1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-23 00:28:08 +02:00

Prevents first aid tents from melee attacking;

Moves attack possibility checks to battle callback (for consistency with shooting checks);
This commit is contained in:
Fay
2015-04-09 21:49:11 +02:00
parent d32461d9d1
commit 1cb54689cf
3 changed files with 27 additions and 2 deletions

View File

@ -775,6 +775,29 @@ std::vector<BattleHex> CBattleInfoCallback::battleGetAvailableHexes(const CStack
return ret;
}
bool CBattleInfoCallback::battleCanAttack(const CStack * stack, const CStack * target, BattleHex dest) const
{
RETURN_IF_NOT_BATTLE(false);
if(battleTacticDist())
return false;
if (!stack || !target)
return false;
if (stack->owner == target->owner)
return false;
auto &id = stack->getCreature()->idNumber;
if (id == CreatureID::FIRST_AID_TENT || id == CreatureID::CATAPULT)
return false;
if (!target->alive())
return false;
return true;
}
bool CBattleInfoCallback::battleCanShoot(const CStack * stack, BattleHex dest) const
{
RETURN_IF_NOT_BATTLE(false);