aboutsummaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorTrazom62 <none@none>2010-05-31 20:14:21 +0200
committerTrazom62 <none@none>2010-05-31 20:14:21 +0200
commit248782448c91aaa15a918d117a92f4ceaae0d77c (patch)
tree2ade1b1a2b750741723107b969e60cf707e7b25d /src/game
parent427e8be65624c9823667429ef2e6a395a1e8f113 (diff)
Fix hidden CD for HandleDummyAuraProc for random proc spell (put the hidden CD on one of the random spell to avoid multiple proc of different random spell).
Take trigger_spell from dbc in case there is one and not yet handled by custom case. --HG-- branch : trunk
Diffstat (limited to 'src/game')
-rw-r--r--src/game/Unit.cpp62
1 files changed, 31 insertions, 31 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index f493d1bbae5..bd1921169b5 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -5241,7 +5241,7 @@ bool Unit::HandleSpellCritChanceAuraProc(Unit *pVictim, uint32 /*damage*/, AuraE
bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const * procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown)
{
- SpellEntry const *dummySpell = triggeredByAura->GetSpellProto ();
+ SpellEntry const *dummySpell = triggeredByAura->GetSpellProto();
uint32 effIndex = triggeredByAura->GetEffIndex();
int32 triggerAmount = triggeredByAura->GetAmount();
@@ -5249,6 +5249,8 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
? this->ToPlayer()->GetItemByGuid(triggeredByAura->GetBase()->GetCastItemGUID()) : NULL;
uint32 triggered_spell_id = 0;
+ uint32 cooldown_spell_id = 0; // for random trigger, will be one of the triggered spell to avoid repeatable triggers
+ // otherwise, it's the triggered_spell_id by default
Unit* target = pVictim;
int32 basepoints0 = 0;
uint64 originalCaster = 0;
@@ -5434,33 +5436,25 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
{
case CLASS_PALADIN: // 39511,40997,40998,40999,41002,41005,41009,41011,41409
case CLASS_DRUID: // 39511,40997,40998,40999,41002,41005,41009,41011,41409
- {
- uint32 RandomSpell[]={39511,40997,40998,40999,41002,41005,41009,41011,41409};
- triggered_spell_id = RandomSpell[ irand(0, sizeof(RandomSpell)/sizeof(uint32) - 1) ];
+ triggered_spell_id = RAND(39511,40997,40998,40999,41002,41005,41009,41011,41409);
+ cooldown_spell_id = 39511;
break;
- }
case CLASS_ROGUE: // 39511,40997,40998,41002,41005,41011
case CLASS_WARRIOR: // 39511,40997,40998,41002,41005,41011
- {
- uint32 RandomSpell[]={39511,40997,40998,41002,41005,41011};
- triggered_spell_id = RandomSpell[ irand(0, sizeof(RandomSpell)/sizeof(uint32) - 1) ];
+ triggered_spell_id = RAND(39511,40997,40998,41002,41005,41011);
+ cooldown_spell_id = 39511;
break;
- }
case CLASS_PRIEST: // 40999,41002,41005,41009,41011,41406,41409
case CLASS_SHAMAN: // 40999,41002,41005,41009,41011,41406,41409
case CLASS_MAGE: // 40999,41002,41005,41009,41011,41406,41409
case CLASS_WARLOCK: // 40999,41002,41005,41009,41011,41406,41409
- {
- uint32 RandomSpell[]={40999,41002,41005,41009,41011,41406,41409};
- triggered_spell_id = RandomSpell[ irand(0, sizeof(RandomSpell)/sizeof(uint32) - 1) ];
+ triggered_spell_id = RAND(40999,41002,41005,41009,41011,41406,41409);
+ cooldown_spell_id = 40999;
break;
- }
case CLASS_HUNTER: // 40997,40999,41002,41005,41009,41011,41406,41409
- {
- uint32 RandomSpell[]={40997,40999,41002,41005,41009,41011,41406,41409};
- triggered_spell_id = RandomSpell[ irand(0, sizeof(RandomSpell)/sizeof(uint32) - 1) ];
+ triggered_spell_id = RAND(40997,40999,41002,41005,41009,41011,41406,41409);
+ cooldown_spell_id = 40997;
break;
- }
default:
return false;
}
@@ -6986,7 +6980,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
return false;
// custom cooldown processing case
- if (cooldown && this->ToPlayer()->HasSpellCooldown(dummySpell->Id))
+ if (cooldown && ToPlayer()->HasSpellCooldown(dummySpell->Id))
return false;
if (triggeredByAura->GetBase() && castItem->GetGUID() != triggeredByAura->GetBase()->GetCastItemGUID())
@@ -7045,7 +7039,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// apply cooldown before cast to prevent processing itself
if (cooldown)
- this->ToPlayer()->AddSpellCooldown(dummySpell->Id,0,time(NULL) + cooldown);
+ ToPlayer()->AddSpellCooldown(dummySpell->Id,0,time(NULL) + cooldown);
// Attack Twice
for (uint32 i = 0; i<2; ++i)
@@ -7239,7 +7233,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
return false;
// custom cooldown processing case
- if (cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(dummySpell->Id))
+ if (cooldown && GetTypeId() == TYPEID_PLAYER && ToPlayer()->HasSpellCooldown(dummySpell->Id))
return false;
uint32 spellId = 0;
@@ -7287,14 +7281,14 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// Remove cooldown (Chain Lightning - have Category Recovery time)
if (procSpell->SpellFamilyFlags[0] & 0x2)
- this->ToPlayer()->RemoveSpellCooldown(spellId);
+ ToPlayer()->RemoveSpellCooldown(spellId);
CastSpell(pVictim, spellId, true, castItem, triggeredByAura);
this->ToPlayer()->AddSpellMod(mod, false);
if (cooldown && GetTypeId() == TYPEID_PLAYER)
- this->ToPlayer()->AddSpellCooldown(dummySpell->Id,0,time(NULL) + cooldown);
+ ToPlayer()->AddSpellCooldown(dummySpell->Id,0,time(NULL) + cooldown);
return true;
}
@@ -7307,8 +7301,8 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
uint32 spell = spellmgr.GetSpellWithRank(26364, spellmgr.GetSpellRank(aurEff->GetId()));
// custom cooldown processing case
- if (GetTypeId() == TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(spell))
- ((Player*)this)->RemoveSpellCooldown(spell);
+ if (GetTypeId() == TYPEID_PLAYER && ToPlayer()->HasSpellCooldown(spell))
+ ToPlayer()->RemoveSpellCooldown(spell);
CastSpell(target, spell, true, castItem, triggeredByAura);
aurEff->GetBase()->DropCharge();
@@ -7577,14 +7571,17 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
}
default:
break;
- }
+ }
+
+ // if not handled by custom case, get triggered spell from dummySpell proto
+ if (!triggered_spell_id)
+ triggered_spell_id = dummySpell->EffectTriggerSpell[triggeredByAura->GetEffIndex()];
// processed charge only counting case
if (!triggered_spell_id)
return true;
SpellEntry const* triggerEntry = sSpellStore.LookupEntry(triggered_spell_id);
-
if (!triggerEntry)
{
sLog.outError("Unit::HandleDummyAuraProc: Spell %u have not existed triggered spell %u",dummySpell->Id,triggered_spell_id);
@@ -7595,7 +7592,10 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
if ((!target && !spellmgr.IsSrcTargetSpell(triggerEntry)) || (target && target != this && !target->isAlive()))
return false;
- if (cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(triggered_spell_id))
+ if (cooldown_spell_id == 0)
+ cooldown_spell_id = triggered_spell_id;
+
+ if (cooldown && GetTypeId() == TYPEID_PLAYER && ToPlayer()->HasSpellCooldown(cooldown_spell_id))
return false;
if (basepoints0)
@@ -7604,7 +7604,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
CastSpell(target,triggered_spell_id,true,castItem,triggeredByAura, originalCaster);
if (cooldown && GetTypeId() == TYPEID_PLAYER)
- this->ToPlayer()->AddSpellCooldown(triggered_spell_id,0,time(NULL) + cooldown);
+ ToPlayer()->AddSpellCooldown(cooldown_spell_id,0,time(NULL) + cooldown);
return true;
}
@@ -8402,7 +8402,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
if (!target)
return false;
- if (cooldown && GetTypeId() == TYPEID_PLAYER && target->ToPlayer()->HasSpellCooldown(trigger_spell_id))
+ if (cooldown && target->GetTypeId() == TYPEID_PLAYER && target->ToPlayer()->HasSpellCooldown(trigger_spell_id))
return false;
target->CastSpell(target,trigger_spell_id,true,castItem,triggeredByAura);
@@ -8552,7 +8552,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
}
}
- if (cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(trigger_spell_id))
+ if (cooldown && GetTypeId() == TYPEID_PLAYER && ToPlayer()->HasSpellCooldown(trigger_spell_id))
return false;
// try detect target manually if not set
@@ -8569,7 +8569,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
CastSpell(target,trigger_spell_id,true,castItem,triggeredByAura);
if (cooldown && GetTypeId() == TYPEID_PLAYER)
- this->ToPlayer()->AddSpellCooldown(trigger_spell_id,0,time(NULL) + cooldown);
+ ToPlayer()->AddSpellCooldown(trigger_spell_id,0,time(NULL) + cooldown);
return true;
}