Core/Spells: Fix warlock "Healthstone" for 4.3.4
This commit is contained in:
1 parent
a468563904
commit
a651092489
3 files changed
+39
-124
No files matched your search
@@ -29,8 +29,9 @@
|
||||
|
||||
enum WarlockSpells
|
||||
{
|
||||
SPELL_WARLOCK_AFTERMATH_STUN = 85387,
|
||||
SPELL_WARLOCK_AFTERMATH_STUN = 85387,
|
||||
SPELL_WARLOCK_BANE_OF_DOOM_EFFECT = 18662,
|
||||
SPELL_WARLOCK_CREATE_HEALTHSTONE = 34130,
|
||||
SPELL_WARLOCK_CURSE_OF_DOOM_EFFECT = 18662,
|
||||
SPELL_WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST = 62388,
|
||||
SPELL_WARLOCK_DEMONIC_CIRCLE_SUMMON = 48018,
|
||||
@@ -52,8 +53,6 @@ enum WarlockSpells
|
||||
SPELL_WARLOCK_HAUNT = 48181,
|
||||
SPELL_WARLOCK_HAUNT_HEAL = 48210,
|
||||
SPELL_WARLOCK_IMMOLATE = 348,
|
||||
SPELL_WARLOCK_IMPROVED_HEALTHSTONE_R1 = 18692,
|
||||
SPELL_WARLOCK_IMPROVED_HEALTHSTONE_R2 = 18693,
|
||||
SPELL_WARLOCK_IMPROVED_HEALTH_FUNNEL_BUFF_R1 = 60955,
|
||||
SPELL_WARLOCK_IMPROVED_HEALTH_FUNNEL_BUFF_R2 = 60956,
|
||||
SPELL_WARLOCK_IMPROVED_HEALTH_FUNNEL_R1 = 18703,
|
||||
@@ -220,59 +219,26 @@ class spell_warl_create_healthstone : public SpellScriptLoader
|
||||
{
|
||||
PrepareSpellScript(spell_warl_create_healthstone_SpellScript);
|
||||
|
||||
static uint32 const iTypes[8][3];
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_IMPROVED_HEALTHSTONE_R1) || !sSpellMgr->GetSpellInfo(SPELL_WARLOCK_IMPROVED_HEALTHSTONE_R2))
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_CREATE_HEALTHSTONE))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
SpellCastResult CheckCast()
|
||||
bool Load() OVERRIDE
|
||||
{
|
||||
if (Player* caster = GetCaster()->ToPlayer())
|
||||
{
|
||||
uint8 spellRank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id);
|
||||
ItemPosCountVec dest;
|
||||
InventoryResult msg = caster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, iTypes[spellRank - 1][0], 1, NULL);
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
return SPELL_FAILED_TOO_MANY_OF_ITEM;
|
||||
}
|
||||
return SPELL_CAST_OK;
|
||||
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
void HandleScriptEffect(SpellEffIndex effIndex)
|
||||
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Unit* unitTarget = GetHitUnit())
|
||||
{
|
||||
uint32 rank = 0;
|
||||
// Improved Healthstone
|
||||
if (AuraEffect const* aurEff = unitTarget->GetDummyAuraEffect(SPELLFAMILY_WARLOCK, 284, 0))
|
||||
{
|
||||
switch (aurEff->GetId())
|
||||
{
|
||||
case SPELL_WARLOCK_IMPROVED_HEALTHSTONE_R1:
|
||||
rank = 1;
|
||||
break;
|
||||
case SPELL_WARLOCK_IMPROVED_HEALTHSTONE_R2:
|
||||
rank = 2;
|
||||
break;
|
||||
default:
|
||||
TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Unknown rank of Improved Healthstone id: %d", aurEff->GetId());
|
||||
break;
|
||||
}
|
||||
}
|
||||
uint8 spellRank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id);
|
||||
if (spellRank > 0 && spellRank <= 8)
|
||||
CreateItem(effIndex, iTypes[spellRank - 1][rank]);
|
||||
}
|
||||
GetCaster()->CastSpell(GetCaster(), SPELL_WARLOCK_CREATE_HEALTHSTONE, true);
|
||||
}
|
||||
|
||||
void Register() OVERRIDE
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_warl_create_healthstone_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
OnCheckCast += SpellCheckCastFn(spell_warl_create_healthstone_SpellScript::CheckCast);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -282,18 +248,6 @@ class spell_warl_create_healthstone : public SpellScriptLoader
|
||||
}
|
||||
};
|
||||
|
||||
uint32 const spell_warl_create_healthstone::spell_warl_create_healthstone_SpellScript::iTypes[8][3] =
|
||||
{
|
||||
{ 5512, 19004, 19005}, // Minor Healthstone
|
||||
{ 5511, 19006, 19007}, // Lesser Healthstone
|
||||
{ 5509, 19008, 19009}, // Healthstone
|
||||
{ 5510, 19010, 19011}, // Greater Healthstone
|
||||
{ 9421, 19012, 19013}, // Major Healthstone
|
||||
{22103, 22104, 22105}, // Master Healthstone
|
||||
{36889, 36890, 36891}, // Demonic Healthstone
|
||||
{36892, 36893, 36894} // Fel Healthstone
|
||||
};
|
||||
|
||||
// 603 - Bane of Doom
|
||||
/// Updated 4.3.4
|
||||
class spell_warl_bane_of_doom : public SpellScriptLoader
|
||||
@@ -811,6 +765,34 @@ class spell_warl_health_funnel : public SpellScriptLoader
|
||||
}
|
||||
};
|
||||
|
||||
// 6262 - Healthstone
|
||||
class spell_warl_healthstone_heal : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_warl_healthstone_heal() : SpellScriptLoader("spell_warl_healthstone_heal") { }
|
||||
|
||||
class spell_warl_healthstone_heal_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_warl_healthstone_heal_SpellScript);
|
||||
|
||||
void HandleOnHit()
|
||||
{
|
||||
int32 heal = int32(CalculatePct(GetCaster()->GetCreateHealth(), GetHitHeal()));
|
||||
SetHitHeal(heal);
|
||||
}
|
||||
|
||||
void Register() OVERRIDE
|
||||
{
|
||||
OnHit += SpellHitFn(spell_warl_healthstone_heal_SpellScript::HandleOnHit);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const OVERRIDE
|
||||
{
|
||||
return new spell_warl_healthstone_heal_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
// 1454 - Life Tap
|
||||
/// Updated 4.3.4
|
||||
class spell_warl_life_tap : public SpellScriptLoader
|
||||
@@ -1234,6 +1216,7 @@ void AddSC_warlock_spell_scripts()
|
||||
new spell_warl_glyph_of_shadowflame();
|
||||
new spell_warl_haunt();
|
||||
new spell_warl_health_funnel();
|
||||
new spell_warl_healthstone_heal();
|
||||
new spell_warl_life_tap();
|
||||
new spell_warl_ritual_of_doom_effect();
|
||||
new spell_warl_seduction();
|
||||
|
||||
Reference in new issue
Block a user