Explorar el Código

Merge pull request #5622 from IvanSavenko/hypno_fix

Fix hypnotize spell
Ivan Savenko hace 6 meses
padre
commit
439c9a7888
Se han modificado 2 ficheros con 6 adiciones y 6 borrados
  1. 3 3
      lib/battle/CBattleInfoCallback.cpp
  2. 3 3
      lib/battle/CUnitState.cpp

+ 3 - 3
lib/battle/CBattleInfoCallback.cpp

@@ -325,7 +325,7 @@ BattleHexArray CBattleInfoCallback::battleGetAttackedHexes(const battle::Unit *
 	for (const BattleHex & tile : at.hostileCreaturePositions)
 	{
 		const auto * st = battleGetUnitByPos(tile, true);
-		if(st && st->unitOwner() != attacker->unitOwner()) //only hostile stacks - does it work well with Berserk?
+		if(st && battleGetOwner(st) != battleGetOwner(attacker)) //only hostile stacks - does it work well with Berserk?
 		{
 			attackedHexes.insert(tile);
 		}
@@ -1347,7 +1347,7 @@ AttackableTiles CBattleInfoCallback::getPotentiallyAttackableHexes(
 			if((BattleHex::mutualPosition(tile, destinationTile) > -1 && BattleHex::mutualPosition(tile, attackOriginHex) > -1)) //adjacent both to attacker's head and attacked tile
 			{
 				const auto * st = battleGetUnitByPos(tile, true);
-				if(st && battleMatchOwner(st, attacker)) //only hostile stacks - does it work well with Berserk?
+				if(st && battleGetOwner(st) != battleGetOwner(attacker)) //only hostile stacks - does it work well with Berserk?
 					at.hostileCreaturePositions.insert(tile);
 			}
 		}
@@ -1488,7 +1488,7 @@ std::set<const CStack*> CBattleInfoCallback::getAttackedCreatures(const CStack*
 	for (const BattleHex & tile : at.hostileCreaturePositions) //all around & three-headed attack
 	{
 		const CStack * st = battleGetStackByPos(tile, true);
-		if(st && st->unitOwner() != attacker->unitOwner()) //only hostile stacks - does it work well with Berserk?
+		if(st && battleGetOwner(st) != battleGetOwner(attacker)) //only hostile stacks - does it work well with Berserk?
 		{
 			attackedCres.insert(st);
 		}

+ 3 - 3
lib/battle/CUnitState.cpp

@@ -116,7 +116,7 @@ CCasts::CCasts(const battle::Unit * Owner):
 CRetaliations::CRetaliations(const battle::Unit * Owner)
 	: CAmmo(Owner, Selector::type()(BonusType::ADDITIONAL_RETALIATION)),
 	totalCache(0),
-	noRetaliation(Owner, Selector::type()(BonusType::SIEGE_WEAPON).Or(Selector::type()(BonusType::HYPNOTIZED)).Or(Selector::type()(BonusType::NO_RETALIATION))),
+	noRetaliation(Owner, Selector::type()(BonusType::SIEGE_WEAPON).Or(Selector::type()(BonusType::NO_RETALIATION))),
 	unlimited(Owner, Selector::type()(BonusType::UNLIMITED_RETALIATIONS))
 {
 }
@@ -698,12 +698,12 @@ BattlePhases::Type CUnitState::battleQueuePhase(int turn) const
 
 bool CUnitState::isHypnotized() const
 {
-	return bonusCache.getBonusValue(UnitBonusValuesProxy::HYPNOTIZED);
+	return bonusCache.hasBonus(UnitBonusValuesProxy::HYPNOTIZED);
 }
 
 bool CUnitState::isInvincible() const
 {
-	return bonusCache.getBonusValue(UnitBonusValuesProxy::INVINCIBLE);
+	return bonusCache.hasBonus(UnitBonusValuesProxy::INVINCIBLE);
 }
 
 int CUnitState::getTotalAttacks(bool ranged) const