Core/Spells: Convert/Update "Alchemist Stone" for 4.3.4

This commit is contained in:
Vincent-Michael
2013-07-20 23:40:32 +02:00
parent c05633946e
commit b3e9ca7a6a
5 changed files with 83 additions and 53 deletions
@@ -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');
-45
View File
@@ -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;
}
@@ -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();
+3 -3
View File
@@ -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
+3 -5
View File
@@ -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