Scripts/Spells: Use Spell::GetPowerTypeCostAmount where possible instead of iterating Spell::GetPowerCost

This commit is contained in:
Shauren
2025-01-20 22:49:52 +01:00
parent 0e36fd9360
commit 26376d89e1
7 changed files with 14 additions and 29 deletions
+2 -4
View File
@@ -1031,10 +1031,8 @@ class spell_rog_sinister_strike : public SpellScript
damagePerCombo += t5->GetAmount();
int32 finalDamage = damagePerCombo;
std::vector<SpellPowerCost> const& costs = GetSpell()->GetPowerCost();
auto c = std::find_if(costs.begin(), costs.end(), [](SpellPowerCost const& cost) { return cost.Power == POWER_COMBO_POINTS; });
if (c != costs.end())
finalDamage *= c->Amount;
if (Optional<int32> comboPointCost = GetSpell()->GetPowerTypeCostAmount(POWER_COMBO_POINTS))
finalDamage *= *comboPointCost;
SetHitDamage(finalDamage);
}