fix(Scripts/Spells): Fix Healing & Mana injectors not giving bonus to… (#17348)

* fix(Scripts/Spells): Fix Healing & Mana injectors not giving bonus to engineers

* Update SpellEffects.cpp

* Update spell_item.cpp
This commit is contained in:
Skjalf
2023-09-25 06:10:23 -03:00
committed by GitHub
parent 1328412501
commit cc60bc0c35
3 changed files with 38 additions and 11 deletions

View File

@@ -0,0 +1,7 @@
--
DELETE FROM `spell_script_names` WHERE `spell_id` IN (67486, 67489, 67487, 67490);
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(67486, 'spell_item_healing_injector'),
(67489, 'spell_item_healing_injector'),
(67487, 'spell_item_mana_injector'),
(67490, 'spell_item_mana_injector');

View File

@@ -1930,13 +1930,6 @@ void Spell::EffectEnergize(SpellEffIndex effIndex)
case 48542: // Revitalize
damage = int32(CalculatePct(unitTarget->GetMaxPower(power), damage));
break;
case 67490: // Runic Mana Injector (mana gain increased by 25% for engineers - 3.2.0 patch change)
{
if (Player* player = m_caster->ToPlayer())
if (player->HasSkill(SKILL_ENGINEERING))
AddPct(damage, 25);
break;
}
case 71132: // Glyph of Shadow Word: Pain
damage = int32(CalculatePct(unitTarget->GetCreateMana(), 1)); // set 1 as value, missing in dbc
break;

View File

@@ -3342,9 +3342,9 @@ class spell_item_rocket_boots : public SpellScript
}
};
class spell_item_runic_healing_injector : public SpellScript
class spell_item_healing_injector : public SpellScript
{
PrepareSpellScript(spell_item_runic_healing_injector);
PrepareSpellScript(spell_item_healing_injector);
bool Load() override
{
@@ -3360,7 +3360,33 @@ class spell_item_runic_healing_injector : public SpellScript
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_item_runic_healing_injector::HandleHeal, EFFECT_0, SPELL_EFFECT_HEAL);
OnEffectHitTarget += SpellEffectFn(spell_item_healing_injector::HandleHeal, EFFECT_0, SPELL_EFFECT_HEAL);
}
};
class spell_item_mana_injector : public SpellScript
{
PrepareSpellScript(spell_item_mana_injector);
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
}
void HandleEnergize(SpellEffIndex /*effIndex*/)
{
if (Player* caster = GetCaster()->ToPlayer())
{
if (caster->HasSkill(SKILL_ENGINEERING))
{
SetEffectValue(GetEffectValue() * 1.25f);
}
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_item_mana_injector::HandleEnergize, EFFECT_0, SPELL_EFFECT_ENERGIZE);
}
};
@@ -3959,7 +3985,8 @@ void AddSC_item_spell_scripts()
RegisterSpellScript(spell_item_nitro_boots);
RegisterSpellScript(spell_item_teach_language);
RegisterSpellScript(spell_item_rocket_boots);
RegisterSpellScript(spell_item_runic_healing_injector);
RegisterSpellScript(spell_item_healing_injector);
RegisterSpellScript(spell_item_mana_injector);
RegisterSpellScript(spell_item_pygmy_oil);
RegisterSpellScript(spell_item_unusual_compass);
RegisterSpellScript(spell_item_chicken_cover);