1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-10 22:31:40 +02:00

Merge pull request #5622 from IvanSavenko/hypno_fix

Fix hypnotize spell
This commit is contained in:
Ivan Savenko
2025-04-13 16:21:14 +03:00
committed by GitHub
2 changed files with 6 additions and 6 deletions

View File

@@ -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);
}

View File

@@ -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