Core/Spells: Refactor CastSpellExtraArgs

* Allow C++20 designated initializers
* Allow precise float values for SPELLVALUE_RADIUS_MOD, SPELLVALUE_CRIT_CHANCE and SPELLVALUE_DURATION_PCT

(cherry picked from commit 975e7cc072)
This commit is contained in:
Shauren
2024-09-12 21:57:16 +02:00
committed by Ovahlord
parent 1a00001eb0
commit 5a495d8e02
9 changed files with 92 additions and 61 deletions
+7 -2
View File
@@ -2970,8 +2970,13 @@ SpellCastResult WorldObject::CastSpell(CastSpellTargetArg const& targets, uint32
}
Spell* spell = new Spell(this, info, args.TriggerFlags, args.OriginalCaster, args.OriginalCastId);
for (auto const& pair : args.SpellValueOverrides)
spell->SetSpellValue(pair.first, pair.second);
for (auto const& [Type, Value] : args.SpellValueOverrides)
{
if (Type < SPELLVALUE_INT_END)
spell->SetSpellValue(SpellValueMod(Type), Value.I);
else
spell->SetSpellValue(SpellValueModFloat(Type), Value.F);
}
spell->m_CastItem = args.CastItem;
if (args.OriginalCastItemLevel)