chessmasterhong / WaterEmblem

https://chessmasterhong.bitbucket.io/projects/WaterEmblem/
118 stars 27 forks source link

Weapon broke mid-battle, freezing game #195

Closed DrkSephy closed 9 years ago

DrkSephy commented 9 years ago

I believe my weapon broke mid-battle, causing the errors below:

screen shot 2015-02-20 at 12 42 49 pm

chessmasterhong commented 9 years ago

What should the intended scenario be if a weapon breaks in mid-battle animation?

DrkSephy commented 9 years ago

If a weapon breaks mid-battle animation, the following should happen:

  1. Since the game will freeze mid-animation if a weapon breaks, perhaps we should hold off on breaking the weapon until after the animations are finished? Or perhaps instead of checking for null, we check for our weapon having > 0 uses? At the end of battle animation, we then make the weapon null (or perhaps on the fadeOut).
  2. We might need extra checks on queueing up attacks. If the player would attack twice, but only has one weapon usage, we'd need a way to make sure we only queue up one attack (or likewise, dequeue an attack). I think ideally at each stage of the battle animation, we only queue an attack if the unit has a weapon equipped (which I believe we have), so this would be the ideal route (check if the attacking unit's weapon has more than 0 uses, instead of checking for null).

I believe this covers the cases for weapon breaking.