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

vcmi: modernize lib/spells/effects

This commit is contained in:
Konstantin
2023-02-07 01:40:01 +03:00
parent cb3723b54c
commit e82cc56ddb
34 changed files with 154 additions and 355 deletions

View File

@@ -31,14 +31,6 @@ namespace effects
VCMI_REGISTER_SPELL_EFFECT(Sacrifice, EFFECT_NAME);
Sacrifice::Sacrifice()
: Heal()
{
}
Sacrifice::~Sacrifice() = default;
void Sacrifice::adjustTargetTypes(std::vector<TargetType> & types) const
{
if(!types.empty())
@@ -109,7 +101,7 @@ bool Sacrifice::applicable(Problem & problem, const Mechanics * m, const EffectT
if(target.size() == 2)
{
auto victim = target.at(1).unitValue;
const auto *victim = target.at(1).unitValue;
if(!victim)
return false;
@@ -160,7 +152,7 @@ EffectTarget Sacrifice::transformTarget(const Mechanics * m, const Target & aimP
//add victim
if(aimPoint.size() >= 2)
{
auto victim = aimPoint.at(1).unitValue;
const auto *victim = aimPoint.at(1).unitValue;
if(victim && getStackFilter(m, false, victim) && isReceptive(m, victim))
res.emplace_back(victim);
}
@@ -168,7 +160,7 @@ EffectTarget Sacrifice::transformTarget(const Mechanics * m, const Target & aimP
return res;
}
int64_t Sacrifice::calculateHealEffectValue(const Mechanics * m, const battle::Unit * victim) const
int64_t Sacrifice::calculateHealEffectValue(const Mechanics * m, const battle::Unit * victim)
{
return (m->getEffectPower() + victim->MaxHealth() + m->calculateRawEffectValue(0, 1)) * victim->getCount();
}