diff options
author | QAston <none@none> | 2009-02-21 19:58:04 +0100 |
---|---|---|
committer | QAston <none@none> | 2009-02-21 19:58:04 +0100 |
commit | a0c920265d39b799458bb5369dd14a40fbc24c35 (patch) | |
tree | b07b960c43217edc00e5caaf79bf6c4266817533 | |
parent | 316a8ca8d37cf9c9f7e21455d52fd59dc60e7ca8 (diff) |
*Handle aura SPELL_AURA_RAID_PROC_FROM_CHARGE_WITH_VALUE.
*Fix Prayer of Mending tier 7 bonus, Prayer of Mending cast on pet, Prayer of Mending healing bonus from caster.
--HG--
branch : trunk
-rw-r--r-- | src/game/SpellAuraDefines.h | 4 | ||||
-rw-r--r-- | src/game/SpellAuras.cpp | 4 | ||||
-rw-r--r-- | src/game/Unit.cpp | 127 | ||||
-rw-r--r-- | src/game/Unit.h | 3 |
4 files changed, 111 insertions, 27 deletions
diff --git a/src/game/SpellAuraDefines.h b/src/game/SpellAuraDefines.h index 39e8b4b1bd5..7868bb8dcd1 100644 --- a/src/game/SpellAuraDefines.h +++ b/src/game/SpellAuraDefines.h @@ -267,9 +267,9 @@ enum AuraType SPELL_AURA_MOD_RATING_FROM_STAT = 220, SPELL_AURA_221 = 221, SPELL_AURA_222 = 222, - SPELL_AURA_223 = 223, + SPELL_AURA_RAID_PROC_FROM_CHARGE = 223, SPELL_AURA_224 = 224, - SPELL_AURA_PRAYER_OF_MENDING = 225, + SPELL_AURA_RAID_PROC_FROM_CHARGE_WITH_VALUE = 225, SPELL_AURA_PERIODIC_DUMMY = 226, SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE = 227, SPELL_AURA_DETECT_STEALTH = 228, diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 15627df8a2f..68665237500 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -277,9 +277,9 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= &Aura::HandleModRatingFromStat, //220 SPELL_AURA_MOD_RATING_FROM_STAT &Aura::HandleNULL, //221 ignored &Aura::HandleUnused, //222 unused (3.0.8a) only for spell 44586 that not used in real spell cast - &Aura::HandleNULL, //223 Cold Stare + &Aura::HandleNoImmediateEffect, //223 SPELL_AURA_RAID_PROC_FROM_CHARGE &Aura::HandleUnused, //224 unused (3.0.8a) - &Aura::HandleNoImmediateEffect, //225 SPELL_AURA_PRAYER_OF_MENDING + &Aura::HandleNoImmediateEffect, //225 SPELL_AURA_RAID_PROC_FROM_CHARGE_WITH_VALUE &Aura::HandleAuraPeriodicDummy, //226 SPELL_AURA_PERIODIC_DUMMY &Aura::HandlePeriodicTriggerSpellWithValue, //227 SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE &Aura::HandleNoImmediateEffect, //228 stealth detection diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 9227fe47c66..0fb76244bdb 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -10953,7 +10953,8 @@ bool InitTriggerAuraData() isTriggerAura[SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS] = true; isTriggerAura[SPELL_AURA_MOD_HASTE] = true; isTriggerAura[SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE]=true; - isTriggerAura[SPELL_AURA_PRAYER_OF_MENDING] = true; + isTriggerAura[SPELL_AURA_RAID_PROC_FROM_CHARGE] = true; + isTriggerAura[SPELL_AURA_RAID_PROC_FROM_CHARGE_WITH_VALUE] = true; isTriggerAura[SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE] = true; isTriggerAura[SPELL_AURA_MOD_DAMAGE_FROM_CASTER] = true; @@ -11167,12 +11168,20 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag continue; break; } - case SPELL_AURA_PRAYER_OF_MENDING: + case SPELL_AURA_RAID_PROC_FROM_CHARGE_WITH_VALUE: { sLog.outDebug("ProcDamageAndSpell: casting mending (triggered by %s dummy aura of spell %u)", (isVictim?"a victim's":"an attacker's"),triggeredByAura->GetId()); - HandleMeandingAuraProc(triggeredByAura); + HandleAuraRaidProcFromChargeWithValue(triggeredByAura); + break; + } + case SPELL_AURA_RAID_PROC_FROM_CHARGE: + { + sLog.outDebug("ProcDamageAndSpell: casting mending (triggered by %s dummy aura of spell %u)", + (isVictim?"a victim's":"an attacker's"),triggeredByAura->GetId()); + + HandleAuraRaidProcFromCharge(triggeredByAura); break; } case SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE: @@ -11949,7 +11958,7 @@ bool Unit::IsTriggeredAtSpellProcEvent(Unit *pVictim, Aura* aura, SpellEntry con return roll_chance_f(chance); } -bool Unit::HandleMeandingAuraProc( Aura* triggeredByAura ) +bool Unit::HandleAuraRaidProcFromChargeWithValue( Aura* triggeredByAura ) { // aura can be deleted at casts SpellEntry const* spellProto = triggeredByAura->GetSpellProto(); @@ -11957,14 +11966,23 @@ bool Unit::HandleMeandingAuraProc( Aura* triggeredByAura ) int32 heal = triggeredByAura->GetModifier()->m_amount; uint64 caster_guid = triggeredByAura->GetCasterGUID(); + //Currently only Prayer Of Mending + if (!(spellProto->SpellFamilyName==SPELLFAMILY_PRIEST && spellProto->SpellFamilyFlags[1] & 0x20)) + { + sLog.outDebug("Unit::HandleAuraRaidProcFromChargeWithValue, received not handled spell: %u", spellProto->Id); + return false; + } // jumps int32 jumps = triggeredByAura->GetAuraCharges()-1; // current aura expire triggeredByAura->SetAuraCharges(1); // will removed at next charges decrease + //Get max possible jumps for aura to get proper charges amount for target + int32 maxJumps = spellProto->procCharges; + // next target selection - if(jumps > 0 && GetTypeId()==TYPEID_PLAYER && IS_PLAYER_GUID(caster_guid)) + if(jumps > 0 && IS_PLAYER_GUID(caster_guid)) { float radius; if (spellProto->EffectRadiusIndex[effIdx]) @@ -11976,12 +11994,20 @@ bool Unit::HandleMeandingAuraProc( Aura* triggeredByAura ) { caster->ApplySpellMod(spellProto->Id, SPELLMOD_RADIUS, radius,NULL); - if(Player* target = ((Player*)this)->GetNextRandomRaidMember(radius)) + caster->ApplySpellMod(spellProto->Id, SPELLMOD_CHARGES, maxJumps, NULL); + + Player* player = NULL; + if(GetTypeId() == TYPEID_PLAYER) + player = (Player*)this; + else if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isPet()) + player=(Player*)GetOwner(); + + if (Player* target = player->GetNextRandomRaidMember(radius)) { // aura will applied from caster, but spell casted from current aura holder SpellModifier *mod = new SpellModifier; mod->op = SPELLMOD_CHARGES; - mod->value = jumps-5; // negative + mod->value = jumps-maxJumps; // negative mod->type = SPELLMOD_FLAT; mod->spellId = spellProto->Id; mod->mask = spellProto->SpellFamilyFlags; @@ -11989,6 +12015,9 @@ bool Unit::HandleMeandingAuraProc( Aura* triggeredByAura ) caster->AddSpellMod(mod, true); CastCustomSpell(target,spellProto->Id,&heal,NULL,NULL,true,NULL,triggeredByAura,caster->GetGUID()); caster->AddSpellMod(mod, false); + + //bonus must be applied after aura cast on target + heal = caster->SpellHealingBonus(this, spellProto, heal, HEAL); } } } @@ -11997,29 +12026,83 @@ bool Unit::HandleMeandingAuraProc( Aura* triggeredByAura ) CastCustomSpell(this,33110,&heal,NULL,NULL,true,NULL,NULL,caster_guid); return true; } - -void Unit::RemoveAurasAtChanneledTarget(SpellEntry const* spellInfo, Unit * caster) +bool Unit::HandleAuraRaidProcFromCharge( Aura* triggeredByAura ) { -/* uint64 target_guid = GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT); - if(target_guid == GetGUID()) - return; + // aura can be deleted at casts + SpellEntry const* spellProto = triggeredByAura->GetSpellProto(); - if(!IS_UNIT_GUID(target_guid)) - return; + uint32 damageSpellId; + switch(spellProto->Id) + { + case 57949: //shiver + damageSpellId=57952; +// animationSpellId=57951; dummy effects for jump spell have unknown use (see also 41637) + break; + case 59978: //shiver + damageSpellId=59979; + break; + case 43593: //Cold Stare + damageSpellId=43594; + break; + default: + sLog.outDebug("Unit::HandleAuraRaidProcFromCharge, received not handled spell: %u", spellProto->Id); + return false; + } - Unit* target = ObjectAccessor::GetUnit(*this, target_guid);*/ - if(!caster) - return; + uint64 caster_guid = triggeredByAura->GetCasterGUID(); + uint32 effIdx = triggeredByAura->GetEffIndex(); + + // jumps + int32 jumps = triggeredByAura->GetAuraCharges()-1; + + // current aura expire + triggeredByAura->SetAuraCharges(1); // will removed at next charges decrease + + //Get max possible jumps for aura to get proper charges amount for target + int32 maxJumps = spellProto->procCharges; - for (AuraMap::iterator iter = GetAuras().begin(); iter != GetAuras().end(); ) + // next target selection + if(jumps > 0 && IS_PLAYER_GUID(caster_guid)) { - if (iter->second->GetId() == spellInfo->Id && iter->second->GetCasterGUID() == caster->GetGUID()) - RemoveAura(iter); + float radius; + if (spellProto->EffectRadiusIndex[effIdx]) + radius = GetSpellRadiusForTarget(triggeredByAura->GetCaster(), sSpellRadiusStore.LookupEntry(spellProto->EffectRadiusIndex[effIdx])); else - ++iter; + radius = GetSpellMaxRangeForTarget(triggeredByAura->GetCaster() ,sSpellRangeStore.LookupEntry(spellProto->rangeIndex)); + + if(Player* caster = ((Player*)triggeredByAura->GetCaster())) + { + caster->ApplySpellMod(spellProto->Id, SPELLMOD_RADIUS, radius,NULL); + + caster->ApplySpellMod(spellProto->Id, SPELLMOD_CHARGES, maxJumps, NULL); + + Player* player = NULL; + if(GetTypeId() == TYPEID_PLAYER) + player = (Player*)this; + else if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isPet()) + player=(Player*)GetOwner(); + + if (Player* target = player->GetNextRandomRaidMember(radius)) + { + // aura will applied from caster, but spell casted from current aura holder + SpellModifier *mod = new SpellModifier; + mod->op = SPELLMOD_CHARGES; + mod->value = jumps-maxJumps; // negative + mod->type = SPELLMOD_FLAT; + mod->spellId = spellProto->Id; + mod->mask = spellProto->SpellFamilyFlags; + + caster->AddSpellMod(mod, true); + CastSpell(this, spellProto, true,NULL,triggeredByAura,caster_guid); + caster->AddSpellMod(mod, false); + } + } } -} + CastSpell(this, damageSpellId, true,NULL,triggeredByAura,caster_guid); + + return true; +} /*-----------------------TRINITY-----------------------------*/ void Unit::SetToNotify() diff --git a/src/game/Unit.h b/src/game/Unit.h index 0e0bbda6225..d57440c4cd4 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1585,7 +1585,8 @@ class TRINITY_DLL_SPEC Unit : public WorldObject bool HandleHasteAuraProc( Unit *pVictim, uint32 damage, Aura* triggredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); bool HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); bool HandleOverrideClassScriptAuraProc(Unit *pVictim, uint32 damage, Aura* triggredByAura, SpellEntry const *procSpell, uint32 cooldown); - bool HandleMeandingAuraProc(Aura* triggeredByAura); + bool HandleAuraRaidProcFromChargeWithValue(Aura* triggeredByAura); + bool HandleAuraRaidProcFromCharge(Aura* triggeredByAura); void SetFeared(bool apply); void SetConfused(bool apply); |