1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Merge pull request #1932 from rilian-la-te/proper-teleport

VCMI: teleport redesign
This commit is contained in:
Ivan Savenko
2023-04-16 22:52:01 +03:00
committed by GitHub
19 changed files with 228 additions and 204 deletions

View File

@@ -56,11 +56,6 @@ CStack::CStack(const CStackBasicDescriptor * stack, const PlayerColor & O, int I
health.init(); //???
}
const CCreature * CStack::getCreature() const
{
return type;
}
void CStack::localInit(BattleInfo * battleInfo)
{
battle = battleInfo;
@@ -88,7 +83,7 @@ ui32 CStack::level() const
if(base)
return base->getLevel(); //creature or commander
else
return std::max(1, static_cast<int>(getCreature()->getLevel())); //war machine, clone etc
return std::max(1, static_cast<int>(unitType()->getLevel())); //war machine, clone etc
}
si32 CStack::magicResistance() const
@@ -346,7 +341,7 @@ bool CStack::unitHasAmmoCart(const battle::Unit * unit) const
{
for(const CStack * st : battle->stacks)
{
if(battle->battleMatchOwner(st, unit, true) && st->getCreature()->getId() == CreatureID::AMMO_CART)
if(battle->battleMatchOwner(st, unit, true) && st->unitType()->getId() == CreatureID::AMMO_CART)
{
return st->alive();
}