[7183] Updated spell casting pushback system.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
Sarjuuk 2009-01-25 23:24:37 +03:00 committed by VladimirMangos
parent be64293da3
commit 9e52b0f748
6 changed files with 32 additions and 17 deletions

View file

@ -5182,18 +5182,22 @@ void Spell::Delayed()
if (m_spellState == SPELL_STATE_DELAYED)
return; // spell is active and can't be time-backed
if(isDelayableNoMore()) // Spells may only be delayed twice
return;
// spells not loosing casting time ( slam, dynamites, bombs.. )
if(!(m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_DAMAGE))
return;
//check resist chance
int32 resistChance = 100; //must be initialized to 100 for percent modifiers
((Player*)m_caster)->ApplySpellMod(m_spellInfo->Id,SPELLMOD_NOT_LOSE_CASTING_TIME,resistChance, this);
resistChance += m_caster->GetTotalAuraModifier(SPELL_AURA_RESIST_PUSHBACK) - 100;
if (roll_chance_i(resistChance))
//check pushback reduce
int32 delaytime = 500; // spellcasting delay is normally 500ms
int32 delayReduce = 100; // must be initialized to 100 for percent modifiers
((Player*)m_caster)->ApplySpellMod(m_spellInfo->Id,SPELLMOD_NOT_LOSE_CASTING_TIME, delayReduce, this);
delayReduce += m_caster->GetTotalAuraModifier(SPELL_AURA_REDUCE_PUSHBACK) - 100;
if(delayReduce >= 100)
return;
int32 delaytime = GetNextDelayAtDamageMsTime();
delaytime = delaytime * (100 - delayReduce) / 100;
if(int32(m_timer) + delaytime > m_casttime)
{
@ -5217,14 +5221,18 @@ void Spell::DelayedChannel()
if(!m_caster || m_caster->GetTypeId() != TYPEID_PLAYER || getState() != SPELL_STATE_CASTING)
return;
//check resist chance
int32 resistChance = 100; //must be initialized to 100 for percent modifiers
((Player*)m_caster)->ApplySpellMod(m_spellInfo->Id,SPELLMOD_NOT_LOSE_CASTING_TIME,resistChance, this);
resistChance += m_caster->GetTotalAuraModifier(SPELL_AURA_RESIST_PUSHBACK) - 100;
if (roll_chance_i(resistChance))
if(isDelayableNoMore()) // Spells may only be delayed twice
return;
int32 delaytime = GetNextDelayAtDamageMsTime();
//check pushback reduce
int32 delaytime = GetSpellDuration(m_spellInfo) * 25 / 100; // channeling delay is normally 25% of its time per hit
int32 delayReduce = 100; // must be initialized to 100 for percent modifiers
((Player*)m_caster)->ApplySpellMod(m_spellInfo->Id,SPELLMOD_NOT_LOSE_CASTING_TIME,delayReduce, this);
delayReduce += m_caster->GetTotalAuraModifier(SPELL_AURA_REDUCE_PUSHBACK) - 100;
if(delayReduce >= 100)
return;
delaytime = delaytime * (100 - delayReduce) / 100;
if(int32(m_timer) < delaytime)
{