mirror of
https://github.com/mangosfour/server.git
synced 2025-12-21 01:37:05 +00:00
[11322] Get rid of redundant CalculateSpellDuration calls, calculate once in Spell::prepare
Also fix despawn time calculation of dynamic objects.
This commit is contained in:
parent
28375e295e
commit
0dfcbf8051
4 changed files with 16 additions and 25 deletions
|
|
@ -388,6 +388,7 @@ Spell::Spell( Unit* caster, SpellEntry const *info, bool triggered, ObjectGuid o
|
|||
m_powerCost = 0; // setup to correct value in Spell::prepare, don't must be used before.
|
||||
m_casttime = 0; // setup to correct value in Spell::prepare, don't must be used before.
|
||||
m_timer = 0; // will set to cast time in prepare
|
||||
m_duration = 0;
|
||||
|
||||
m_needAliveTargetMask = 0;
|
||||
|
||||
|
|
@ -2812,6 +2813,7 @@ void Spell::prepare(SpellCastTargets const* targets, Aura* triggeredByAura)
|
|||
|
||||
// calculate cast time (calculated after first CheckCast check to prevent charge counting for first CheckCast fail)
|
||||
m_casttime = GetSpellCastTime(m_spellInfo, this);
|
||||
m_duration = CalculateSpellDuration(m_spellInfo, m_caster);
|
||||
|
||||
// set timer base at cast time
|
||||
ReSetTimer();
|
||||
|
|
@ -3153,15 +3155,10 @@ void Spell::cast(bool skipCheck)
|
|||
void Spell::handle_immediate()
|
||||
{
|
||||
// start channeling if applicable
|
||||
if(IsChanneledSpell(m_spellInfo))
|
||||
if (IsChanneledSpell(m_spellInfo) && m_duration > 0)
|
||||
{
|
||||
int32 duration = CalculateSpellDuration(m_spellInfo, m_caster);
|
||||
|
||||
if (duration > 0)
|
||||
{
|
||||
m_spellState = SPELL_STATE_CASTING;
|
||||
SendChannelStart(duration);
|
||||
}
|
||||
m_spellState = SPELL_STATE_CASTING;
|
||||
SendChannelStart(m_duration);
|
||||
}
|
||||
|
||||
// process immediate effects (items, ground, etc.) also initialize some variables
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue