aboutsummaryrefslogtreecommitdiff
path: root/src/game/Unit.cpp
diff options
context:
space:
mode:
authorQAston <none@none>2009-03-02 23:37:24 +0100
committerQAston <none@none>2009-03-02 23:37:24 +0100
commit1ebade03d51b2f6aa1bde099776f477b93c4e89e (patch)
treeae0e389e0ae2dba970352ff70f44d98051127b6b /src/game/Unit.cpp
parent352df954f6e1a8542118e8108928ea5fe268f431 (diff)
*Fix crash.
*Prevent applying cast time mod for spell twice. --HG-- branch : trunk
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r--src/game/Unit.cpp56
1 files changed, 42 insertions, 14 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index d0bd170b931..8875c3301a7 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -487,7 +487,7 @@ void Unit::RemoveSpellsCausingAuraWithDispel(AuraType auraType, Spell * spell)
if (*iter)
{
- if (!(*iter)->GetDispelChance(spell))
+ if (!(*iter)->GetDispelChance( spell))
continue;
RemoveAurasDueToSpell((*iter)->GetId());
if (!m_modAuras[auraType].empty())
@@ -4197,7 +4197,7 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode)
&& AurSpellInfo->EffectApplyAuraName[Aur->GetEffIndex()]!= SPELL_AURA_DUMMY)
//don't stop channeling of scripted spells (this is actually a hack)
{
- caster->InterruptSpell(CURRENT_CHANNELED_SPELL);
+ caster->m_currentSpells[CURRENT_CHANNELED_SPELL]->cancel();
}
}
}
@@ -5485,14 +5485,14 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
triggered_spell_id = 56160;
break;
}
- // Glyph of Dispel Magic
- case 55677:
- {
- if(!target->IsFriendlyTo(this))
- return false;
-
- basepoints0 = int32(target->GetMaxHealth() * triggerAmount / 100);
- triggered_spell_id = 56131;
+ // Glyph of Dispel Magic
+ case 55677:
+ {
+ if(!target->IsFriendlyTo(this))
+ return false;
+
+ basepoints0 = int32(target->GetMaxHealth() * triggerAmount / 100);
+ triggered_spell_id = 56131;
break;
}
// Oracle Healing Bonus ("Garments of the Oracle" set)
@@ -6330,6 +6330,35 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
}
break;
}
+ case SPELLFAMILY_POTION:
+ {
+ sLog.outError("It Procs!");
+ if (dummySpell->Id == 17619)
+ {
+ if (procSpell->Category==4) //potion category
+ {
+ for (uint8 i=0;i<3;i++)
+ {
+ if (procSpell->Effect[i]==SPELL_EFFECT_HEAL)
+ {
+ basepoints0 = damage * 0.4f;
+ triggered_spell_id = 21399;
+ }
+ else if (procSpell->Effect[i]==SPELL_EFFECT_ENERGIZE)
+ {
+ basepoints0 = CalculateSpellDamage(procSpell,i,procSpell->EffectBasePoints[i],this) * 0.4f;
+ triggered_spell_id = 21400;
+ }
+ else continue;
+
+ CastCustomSpell(this,triggered_spell_id,&basepoints0,NULL,NULL,true,castItem,triggeredByAura);
+ }
+ if (triggered_spell_id)
+ return true;
+ return false;
+ }
+ }
+ }
default:
break;
}
@@ -10272,13 +10301,13 @@ int32 Unit::ModSpellDuration(SpellEntry const* spellProto, uint8 effect_index, U
return duration>0 ? duration : 0;
}
-void Unit::ModSpellCastTime(SpellEntry const* spellProto, int32 & castTime)
+void Unit::ModSpellCastTime(SpellEntry const* spellProto, int32 & castTime, Spell const * spell)
{
if (!spellProto || castTime<0)
return;
//called from caster
if(Player* modOwner = GetSpellModOwner())
- modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CASTING_TIME, castTime);
+ modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CASTING_TIME, castTime, spell);
if( !(spellProto->Attributes & (SPELL_ATTR_UNK4|SPELL_ATTR_UNK5)) )
castTime = int32( float(castTime) * GetFloatValue(UNIT_MOD_CAST_SPEED));
@@ -11244,12 +11273,11 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag
continue;
procTriggered.push_back( ProcTriggeredData(spellProcEvent, itr->second) );
- }
+ }
// Nothing found
if (procTriggered.empty())
return;
-
// Handle effects proceed this time
for(ProcTriggeredList::iterator i = procTriggered.begin(); i != procTriggered.end(); ++i)
{