Fix bug: LandMine is not exploding to enemies. (#630)

* The reason is,

the mine has attribute hidden=true;
when enemy unit moves, the code in BattleInfo.cpp MoveUnit() (line 817) will update the revealed to true;
then in the CGameHandler.cpp handleDamageFromObstacle() (line 4846) is checking , and the condition battleIsObstacleVisibleForSide() will return true, so the effect will not be triggerred.

Resolution:
1. Remove the "revealed=true" in moveUnit(), and in handleDamageFromObstacle, remove the "const" restrict for obstacle, and then update revealed to true;
2. After the takeDamage function, add a pack "BattleObstaclesChanged" to update the obstacle to be "revealed=true".
This commit is contained in:
Toney Sui
2020-02-12 20:12:12 +03:00
committed by GitHub
parent 0f7de511be
commit dca5d86e7a
9 changed files with 57 additions and 13 deletions
+1
View File
@@ -47,6 +47,7 @@ public:
MOCK_METHOD2(setWallState, void(int, si8));
MOCK_METHOD1(addObstacle, void(const ObstacleChanges &));
MOCK_METHOD1(removeObstacle, void(uint32_t));
MOCK_METHOD1(updateObstacle, void(const ObstacleChanges &));
};