chessmasterhong / WaterEmblem

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

Intermediate work on fixing issue #50 #106

Closed DrkSephy closed 9 years ago

DrkSephy commented 9 years ago

This pull request has a partial implementation to fix issue #50. Upon death, the unit in question is correctly removed from the game world. However, there are two cases where this fails:

  1. Enemy attacks player, and enemy dies in counter-attack. If there are any other enemies on the map, the enemy turn will end. This is probably because the main loop in main.js doesn't recognize there are more enemies?
  2. The same thing happens on the other end. If a player attacks an enemy and dies in the counter-attack, if there are more players, then the player turn will end.

I opened this pull request in the hopes that @chessmasterhong could see how these edge cases can be fixed?

Another way I contemplated fixing this is that if that unit is dead, put a dead flag on them. Allow any units to be able to move on top of a dead unit and occupy their space. This works in all cases, a player can then move on that space and things will work fine. At least, I think so because it seems that dead enemies are removed once the turn ends. I'm not sure yet, but we'd preferably want to do the first implementation.

DrkSephy commented 9 years ago

Closing this due to this attempt not going any further.