mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Removed CStack::totalHealth()
This commit is contained in:
parent
44fc0cb57b
commit
ea3502ed60
@ -589,11 +589,6 @@ const CGHeroInstance * CStack::getMyHero() const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ui32 CStack::totalHealth() const
|
||||
{
|
||||
return health.available();//do not hide possible invalid firstHPleft for dead stack
|
||||
}
|
||||
|
||||
std::string CStack::nodeName() const
|
||||
{
|
||||
std::ostringstream oss;
|
||||
|
@ -186,7 +186,6 @@ public:
|
||||
si32 magicResistance() const override; //include aura of resistance
|
||||
std::vector<si32> activeSpells() const; //returns vector of active spell IDs sorted by time of cast
|
||||
const CGHeroInstance * getMyHero() const; //if stack belongs to hero (directly or was by him summoned) returns hero, nullptr otherwise
|
||||
ui32 totalHealth() const; // total health for all creatures in stack;
|
||||
|
||||
static bool isMeleeAttackPossible(const CStack * attacker, const CStack * defender, BattleHex attackerPos = BattleHex::INVALID, BattleHex defenderPos = BattleHex::INVALID);
|
||||
|
||||
|
@ -1640,8 +1640,8 @@ DLL_LINKAGE void StacksHealedOrResurrected::applyGs(CGameState *gs)
|
||||
bool resurrected = !changedStack->alive(); //indicates if stack is resurrected or just healed
|
||||
if(resurrected)
|
||||
{
|
||||
if(changedStack->getCount() > 0 || changedStack->getFirstHPleft() > 0)
|
||||
logGlobal->warn("Dead stack %s with positive total HP %d", changedStack->nodeName(), changedStack->totalHealth());
|
||||
if(auto totalHealth = changedStack->health.available())
|
||||
logGlobal->warn("Dead stack %s with positive total HP %d", changedStack->nodeName(), totalHealth);
|
||||
|
||||
changedStack->state.insert(EBattleStackState::ALIVE);
|
||||
}
|
||||
|
@ -442,9 +442,9 @@ ESpellCastProblem::ESpellCastProblem HypnotizeMechanics::isImmuneByStack(const I
|
||||
if(nullptr != caster)
|
||||
{
|
||||
//TODO: what with other creatures casting hypnotize, Faerie Dragons style?
|
||||
ui32 subjectHealth = obj->totalHealth();
|
||||
int64_t subjectHealth = obj->health.available();
|
||||
//apply 'damage' bonus for hypnotize, including hero specialty
|
||||
ui32 maxHealth = caster->getSpellBonus(owner, owner->calculateRawEffectValue(caster->getEffectLevel(owner), caster->getEffectPower(owner)), obj);
|
||||
int64_t maxHealth = caster->getSpellBonus(owner, owner->calculateRawEffectValue(caster->getEffectLevel(owner), caster->getEffectPower(owner)), obj);
|
||||
if(subjectHealth > maxHealth)
|
||||
return ESpellCastProblem::STACK_IMMUNE_TO_SPELL;
|
||||
}
|
||||
|
@ -1014,7 +1014,7 @@ void CGameHandler::applyBattleEffects(BattleAttack &bat, const CStack *att, cons
|
||||
bsa2.flags |= BattleStackAttacked::EFFECT; //FIXME: play animation upon efreet and not attacker
|
||||
bsa2.effect = 11;
|
||||
|
||||
bsa2.damageAmount = (std::min<si32>(def->totalHealth(), bsa.damageAmount) * def->valOfBonuses(Bonus::FIRE_SHIELD)) / 100; //TODO: scale with attack/defense
|
||||
bsa2.damageAmount = (std::min<int64_t>(def->health.available(), bsa.damageAmount) * def->valOfBonuses(Bonus::FIRE_SHIELD)) / 100; //TODO: scale with attack/defense
|
||||
att->prepareAttacked(bsa2, getRandomGenerator());
|
||||
bat.bsa.push_back(bsa2);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user