mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-27 22:49:25 +02:00
Fix hypnotize spell
- Fix testing for Hypnotized status - Fix handling of three-headed & all-around attack (Cerberi / Hydras) while hypnotized
This commit is contained in:
@@ -325,7 +325,7 @@ BattleHexArray CBattleInfoCallback::battleGetAttackedHexes(const battle::Unit *
|
|||||||
for (const BattleHex & tile : at.hostileCreaturePositions)
|
for (const BattleHex & tile : at.hostileCreaturePositions)
|
||||||
{
|
{
|
||||||
const auto * st = battleGetUnitByPos(tile, true);
|
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);
|
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
|
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);
|
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);
|
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
|
for (const BattleHex & tile : at.hostileCreaturePositions) //all around & three-headed attack
|
||||||
{
|
{
|
||||||
const CStack * st = battleGetStackByPos(tile, true);
|
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);
|
attackedCres.insert(st);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ CCasts::CCasts(const battle::Unit * Owner):
|
|||||||
CRetaliations::CRetaliations(const battle::Unit * Owner)
|
CRetaliations::CRetaliations(const battle::Unit * Owner)
|
||||||
: CAmmo(Owner, Selector::type()(BonusType::ADDITIONAL_RETALIATION)),
|
: CAmmo(Owner, Selector::type()(BonusType::ADDITIONAL_RETALIATION)),
|
||||||
totalCache(0),
|
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))
|
unlimited(Owner, Selector::type()(BonusType::UNLIMITED_RETALIATIONS))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -698,12 +698,12 @@ BattlePhases::Type CUnitState::battleQueuePhase(int turn) const
|
|||||||
|
|
||||||
bool CUnitState::isHypnotized() const
|
bool CUnitState::isHypnotized() const
|
||||||
{
|
{
|
||||||
return bonusCache.getBonusValue(UnitBonusValuesProxy::HYPNOTIZED);
|
return bonusCache.hasBonus(UnitBonusValuesProxy::HYPNOTIZED);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CUnitState::isInvincible() const
|
bool CUnitState::isInvincible() const
|
||||||
{
|
{
|
||||||
return bonusCache.getBonusValue(UnitBonusValuesProxy::INVINCIBLE);
|
return bonusCache.hasBonus(UnitBonusValuesProxy::INVINCIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CUnitState::getTotalAttacks(bool ranged) const
|
int CUnitState::getTotalAttacks(bool ranged) const
|
||||||
|
|||||||
Reference in New Issue
Block a user