1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

Update low level battle stacks accessor for ghost selection support.

This commit is contained in:
AlexVinS
2016-02-28 05:10:20 +03:00
parent 47b619a543
commit 5df8d1cbd0
7 changed files with 55 additions and 40 deletions

View File

@@ -1139,9 +1139,24 @@ std::string CStack::getName() const
return (count > 1) ? type->namePl : type->nameSing; //War machines can't use base
}
bool CStack::isValidTarget(bool allowDead/* = false*/) const /*alive non-turret stacks (can be attacked or be object of magic effect) */
bool CStack::isValidTarget(bool allowDead/* = false*/) const
{
return !isGhost() && (alive() || allowDead) && position.isValid();
return (alive() || (allowDead && isDead())) && position.isValid() && !isTurret();
}
bool CStack::isDead() const
{
return !alive() && !isGhost();
}
bool CStack::isGhost() const
{
return vstd::contains(state,EBattleStackState::GHOST);
}
bool CStack::isTurret() const
{
return type->idNumber == CreatureID::ARROW_TOWERS;
}
bool CStack::canBeHealed() const