mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
Fix for arrow cart at bank fights
This commit is contained in:
parent
8b6316c8ee
commit
9e5abeec35
@ -304,17 +304,30 @@ int32_t CStack::unitBaseAmount() const
|
|||||||
|
|
||||||
bool CStack::unitHasAmmoCart(const battle::Unit * unit) const
|
bool CStack::unitHasAmmoCart(const battle::Unit * unit) const
|
||||||
{
|
{
|
||||||
bool hasAmmoCart = false;
|
|
||||||
|
|
||||||
for(const CStack * st : battle->stacks)
|
for(const CStack * st : battle->stacks)
|
||||||
{
|
{
|
||||||
if(battle->battleMatchOwner(st, unit, true) && st->getCreature()->idNumber == CreatureID::AMMO_CART && st->alive())
|
if(battle->battleMatchOwner(st, unit, true) && st->getCreature()->idNumber == CreatureID::AMMO_CART)
|
||||||
{
|
{
|
||||||
hasAmmoCart = true;
|
if(st->alive())
|
||||||
break;
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return hasAmmoCart;
|
//ammo cart works during creature bank battle while not on battlefield
|
||||||
|
auto ownerHero = battle->battleGetOwnerHero(unit);
|
||||||
|
if(ownerHero && ownerHero->artifactsWorn.find(ArtifactPosition::MACH2) != ownerHero->artifactsWorn.end())
|
||||||
|
{
|
||||||
|
if(battle->battleGetOwnerHero(unit)->artifactsWorn.at(ArtifactPosition::MACH2).artifact->artType->id == ArtifactID::AMMO_CART)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false; //will be always false if trying to examine enemy hero in "special battle"
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerColor CStack::unitEffectiveOwner(const battle::Unit * unit) const
|
PlayerColor CStack::unitEffectiveOwner(const battle::Unit * unit) const
|
||||||
|
Loading…
Reference in New Issue
Block a user