diff options
| -rw-r--r-- | sql/updates/world/2013_07_20_08_world_spell_script_misc_434.sql | 7 | ||||
| -rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 45 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_generic.cpp | 70 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_priest.cpp | 6 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_warrior.cpp | 8 |
5 files changed, 83 insertions, 53 deletions
diff --git a/sql/updates/world/2013_07_20_08_world_spell_script_misc_434.sql b/sql/updates/world/2013_07_20_08_world_spell_script_misc_434.sql new file mode 100644 index 00000000000..f662b7a1b57 --- /dev/null +++ b/sql/updates/world/2013_07_20_08_world_spell_script_misc_434.sql @@ -0,0 +1,7 @@ +DELETE FROM `spell_proc_event` WHERE `entry`=17619; +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +(17619, 0, 13, 0, 0, 0, 32768, 0, 0, 100, 0); + +DELETE FROM `spell_script_names` WHERE `spell_id`=17619; +INSERT INTO `spell_script_names`(`spell_id`, `ScriptName`) VALUES +(17619,'spell_gen_alchemist_stone'); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index a37630a2b37..3c3c1be3c62 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -5604,16 +5604,6 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere RemoveMovementImpairingAuras(); break; } - // Glyph of Dispel Magic - case 55677: - { - if (!target || !target->IsFriendlyTo(this)) - return false; - - basepoints0 = int32(target->CountPctFromMaxHealth(triggerAmount)); - triggered_spell_id = 56131; - break; - } // Oracle Healing Bonus ("Garments of the Oracle" set) case 26169: { @@ -6522,34 +6512,6 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere } break; } - case SPELLFAMILY_POTION: - { - // alchemist's stone - if (dummySpell->Id == 17619) - { - if (procSpell->SpellFamilyName == SPELLFAMILY_POTION) - { - for (uint8 i = 0; i < MAX_SPELL_EFFECTS; i++) - { - if (procSpell->Effects[i].Effect == SPELL_EFFECT_HEAL) - { - triggered_spell_id = 21399; - } - else if (procSpell->Effects[i].Effect == SPELL_EFFECT_ENERGIZE) - { - triggered_spell_id = 21400; - } - else - continue; - - basepoints0 = int32(CalculateSpellDamage(this, procSpell, i) * 0.4f); - CastCustomSpell(this, triggered_spell_id, &basepoints0, NULL, NULL, true, NULL, triggeredByAura); - } - return true; - } - } - break; - } case SPELLFAMILY_PET: { switch (dummySpell->SpellIconID) @@ -6797,13 +6759,6 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 /*damage*/, Aura* triggeredByAura } return true; } - // Hungering Cold aura drop - case 51209: - *handled = true; - // Drop only in not disease case - if (procSpell && procSpell->Dispel == DISPEL_DISEASE) - return false; - return true; } break; } diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 68951c48350..a9c28159345 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -163,6 +163,75 @@ class spell_gen_adaptive_warding : public SpellScriptLoader } }; +enum AlchemistStone +{ + ALECHEMIST_STONE_HEAL = 21399, + ALECHEMIST_STONE_MANA = 21400, +}; + +// 17619 - Alchemist Stone +class spell_gen_alchemist_stone : public SpellScriptLoader +{ + public: + spell_gen_alchemist_stone() : SpellScriptLoader("spell_gen_alchemist_stone") { } + + class spell_gen_alchemist_stone_AuraScript : public AuraScript + { + PrepareAuraScript(spell_gen_alchemist_stone_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE + { + if (!sSpellMgr->GetSpellInfo(ALECHEMIST_STONE_HEAL) || + !sSpellMgr->GetSpellInfo(ALECHEMIST_STONE_MANA)) + return false; + return true; + } + + bool CheckProc(ProcEventInfo& eventInfo) + { + return eventInfo.GetDamageInfo()->GetSpellInfo()->SpellFamilyName == SPELLFAMILY_POTION; + } + + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + + uint32 spellId = 0; + int32 basepoints0 = 0; + TC_LOG_ERROR(LOG_FILTER_GENERAL, "procSpell: %u", eventInfo.GetDamageInfo()->GetSpellInfo()->Id); + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) + { + if (eventInfo.GetDamageInfo()->GetSpellInfo()->Effects[i].Effect == SPELL_EFFECT_HEAL) + spellId = ALECHEMIST_STONE_HEAL; + else if (eventInfo.GetDamageInfo()->GetSpellInfo()->Effects[i].Effect == SPELL_EFFECT_ENERGIZE) + spellId = ALECHEMIST_STONE_MANA; + else + continue; + + basepoints0 = int32(GetTarget()->CalculateSpellDamage(GetTarget(), eventInfo.GetDamageInfo()->GetSpellInfo(), i) * 0.4f); + } + + if (!spellId) + return; + + + GetTarget()->CastCustomSpell(GetTarget(), spellId, &basepoints0, NULL, NULL, true, NULL, aurEff); + } + + + void Register() OVERRIDE + { + DoCheckProc += AuraCheckProcFn(spell_gen_alchemist_stone_AuraScript::CheckProc); + OnEffectProc += AuraEffectProcFn(spell_gen_alchemist_stone_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); + } + }; + + AuraScript* GetAuraScript() const OVERRIDE + { + return new spell_gen_alchemist_stone_AuraScript(); + } +}; + class spell_gen_allow_cast_from_item_only : public SpellScriptLoader { public: @@ -3616,6 +3685,7 @@ void AddSC_generic_spell_scripts() { new spell_gen_absorb0_hitlimit1(); new spell_gen_adaptive_warding(); + new spell_gen_alchemist_stone(); new spell_gen_allow_cast_from_item_only(); new spell_gen_animal_blood(); new spell_gen_aura_of_anger(); diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index 432b8ae4771..1976a2c05cf 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -101,10 +101,10 @@ public: if (GetHitUnit()->IsFriendlyTo(GetCaster())) { GetCaster()->CastSpell(GetHitUnit(), SPELL_PRIEST_DISPEL_MAGIC_FRIENDLY, true); - if (GetCaster()->HasAura(SPELL_PRIEST_GLYPH_OF_DISPEL_MAGIC)) + if (AuraEffect const* aurEff = GetHitUnit()->GetAuraEffect(SPELL_PRIEST_GLYPH_OF_DISPEL_MAGIC, EFFECT_0)) { - int32 healAmount = CalculatePct(GetHitUnit()->GetMaxHealth(), sSpellMgr->GetSpellInfo(SPELL_PRIEST_GLYPH_OF_DISPEL_MAGIC_HEAL)->Effects[EFFECT_0].CalcValue()); - GetCaster()->CastCustomSpell(SPELL_PRIEST_GLYPH_OF_DISPEL_MAGIC_HEAL, SPELLVALUE_BASE_POINT0, healAmount, GetHitUnit()); + int32 heal = GetHitUnit()->CountPctFromMaxHealth(aurEff->GetAmount()); + GetCaster()->CastCustomSpell(SPELL_PRIEST_GLYPH_OF_DISPEL_MAGIC_HEAL, SPELLVALUE_BASE_POINT0, heal, GetHitUnit()); } } else diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index 9c5b7af76d7..9688554f4f9 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -368,6 +368,7 @@ class spell_warr_intimidating_shout : public SpellScriptLoader }; /// Updated 4.3.4 +// 12975 - Last Stand class spell_warr_last_stand : public SpellScriptLoader { public: @@ -386,11 +387,8 @@ class spell_warr_last_stand : public SpellScriptLoader void HandleDummy(SpellEffIndex /*effIndex*/) { - if (Unit* caster = GetCaster()) - { - int32 healthModSpellBasePoints0 = int32(caster->CountPctFromMaxHealth(GetEffectValue())); - caster->CastCustomSpell(caster, SPELL_WARRIOR_LAST_STAND_TRIGGERED, &healthModSpellBasePoints0, NULL, NULL, true, NULL); - } + int32 healthModSpellBasePoints0 = int32(GetCaster()->CountPctFromMaxHealth(GetEffectValue())); + GetCaster()->CastCustomSpell(GetCaster(), SPELL_WARRIOR_LAST_STAND_TRIGGERED, &healthModSpellBasePoints0, NULL, NULL, true, NULL); } void Register() OVERRIDE |
