diff --git a/config/creatures/inferno.json b/config/creatures/inferno.json index a53c7dfcc..f4ce7bbff 100644 --- a/config/creatures/inferno.json +++ b/config/creatures/inferno.json @@ -347,7 +347,8 @@ { "type" : "HATE", "subtype" : "creature.angel", - "val" : 50 + "val" : 50, + "description" : "Devil -1" }, "FLYING_ARMY" : { diff --git a/config/creatures/necropolis.json b/config/creatures/necropolis.json index f73084803..ddc39d282 100644 --- a/config/creatures/necropolis.json +++ b/config/creatures/necropolis.json @@ -329,6 +329,12 @@ "dragon" : { "type" : "DRAGON_NATURE" + }, + "descreaseMorale" : + { + "type" : "MORALE", + "effectRange" : "ONLY_ENEMY_ARMY", + "val" : -1 } }, "upgrades": ["ghostDragon"], @@ -354,7 +360,13 @@ { "dragon" : { - "type" : "DRAGON_NATURE" + "type" : "DRAGON_NATURE", + }, + "descreaseMorale" : + { + "type" : "MORALE", + "effectRange" : "ONLY_ENEMY_ARMY", + "val" : -1 }, "age" : { diff --git a/lib/BattleState.cpp b/lib/BattleState.cpp index f42624382..1b17f2db0 100644 --- a/lib/BattleState.cpp +++ b/lib/BattleState.cpp @@ -684,7 +684,7 @@ BattleInfo * BattleInfo::setupBattle( int3 tile, ETerrainType terrain, BFieldTyp curB->tacticDistance = 0; - // workaround — bonuses affecting only enemy + // workaround — bonuses affecting only enemy - DOES NOT WORK for(int i = 0; i < 2; i++) { TNodes nodes; @@ -883,8 +883,6 @@ void CStack::postInit() assert(type); assert(getParentNodes().size()); - //FIXME: the following should take into account ONLY_ENEMY_ARMY bonus range - firstHPleft = MaxHealth(); shots = getCreature()->valOfBonuses(Bonus::SHOTS); counterAttacks = 1 + valOfBonuses(Bonus::ADDITIONAL_RETALIATION); diff --git a/lib/CBattleCallback.cpp b/lib/CBattleCallback.cpp index a9e06a95d..e98777641 100644 --- a/lib/CBattleCallback.cpp +++ b/lib/CBattleCallback.cpp @@ -1175,7 +1175,7 @@ std::set CBattleInfoCallback::getStoppers(BattlePerspective::BattlePe return ret; } -std::pair CBattleInfoCallback::getNearestStack(const CStack * closest, boost::logic::tribool attackerOwned) const +std::pair CBattleInfoCallback::getNearestStack(const CStack * closest, boost::logic::tribool attackerOwned, bool ignoreItself) const { auto reachability = getReachability(closest); @@ -1190,6 +1190,8 @@ std::pair CBattleInfoCallback::getNearestStack(const for(int g=0; gID == closest->ID) //if there is not stack or we are the closest one continue; diff --git a/lib/CBattleCallback.h b/lib/CBattleCallback.h index d339ae517..87a9161c4 100644 --- a/lib/CBattleCallback.h +++ b/lib/CBattleCallback.h @@ -290,7 +290,7 @@ public: AccessibilityInfo getAccesibility() const; AccessibilityInfo getAccesibility(const CStack *stack) const; //Hexes ocupied by stack will be marked as accessible. AccessibilityInfo getAccesibility(const std::vector &accessibleHexes) const; //given hexes will be marked as accessible - std::pair getNearestStack(const CStack * closest, boost::logic::tribool attackerOwned) const; + std::pair getNearestStack(const CStack * closest, boost::logic::tribool attackerOwned, bool ignoreItself = false) const; protected: ReachabilityInfo getFlyingReachability(const ReachabilityInfo::Parameters params) const; ReachabilityInfo makeBFS(const AccessibilityInfo &accessibility, const ReachabilityInfo::Parameters params) const; diff --git a/server/CGameHandler.cpp b/server/CGameHandler.cpp index 7bf7bf3e1..d78efd68f 100644 --- a/server/CGameHandler.cpp +++ b/server/CGameHandler.cpp @@ -5780,8 +5780,8 @@ void CGameHandler::runBattle() } if(next->hasBonusOfType(Bonus::ATTACKS_NEAREST_CREATURE)) //while in berserk - { - std::pair attackInfo = curB.getNearestStack(next, boost::logic::indeterminate); + { //fixme: stack should not attack itself + std::pair attackInfo = curB.getNearestStack(next, boost::logic::indeterminate, true); if(attackInfo.first != NULL) { BattleAction attack;