Skip to content

Commit

Permalink
Unit/Spell: Refactor existing absorb and death prevention into spell …
Browse files Browse the repository at this point in the history
…scripts
  • Loading branch information
killerwife committed Aug 13, 2023
1 parent 537e677 commit 2191883
Show file tree
Hide file tree
Showing 7 changed files with 156 additions and 156 deletions.
19 changes: 19 additions & 0 deletions sql/scriptdev2/spell.sql
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,10 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
(38760,'spell_void_blast'),
(33558,'spell_draw_shadows_trigger'),
(34662,'spell_bear_command'),
(36815,'spell_shock_barrier'),
(39228,'spell_argussian_compass'),
(41341,'spell_balance_of_power'),
(41475,'spell_reflective_shield_malande'),
(41624,'spell_enfeeble_removal'),
(32264,'spell_shirrak_inhibit_magic'),
(33332,'spell_suppression_blast'),
Expand Down Expand Up @@ -634,6 +638,18 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
(15324,'spell_blackout'),
(15325,'spell_blackout'),
(15326,'spell_blackout'),
(17,'spell_power_word_shield_priest'),
(592,'spell_power_word_shield_priest'),
(600,'spell_power_word_shield_priest'),
(3747,'spell_power_word_shield_priest'),
(6065,'spell_power_word_shield_priest'),
(6066,'spell_power_word_shield_priest'),
(10898,'spell_power_word_shield_priest'),
(10899,'spell_power_word_shield_priest'),
(10900,'spell_power_word_shield_priest'),
(10901,'spell_power_word_shield_priest'),
(25217,'spell_power_word_shield_priest'),
(25218,'spell_power_word_shield_priest'),
(27827,'spell_spirit_of_redemption_heal'),
(32676,'spell_consume_magic'),
(33076,'spell_prayer_of_mending'),
Expand Down Expand Up @@ -817,6 +833,9 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
(6770,'spell_sap'),
(2070,'spell_sap'), -- check ranks before changing
(11297,'spell_sap'),
(31228,'spell_cheat_death_rogue'),
(31229,'spell_cheat_death_rogue'),
(31230,'spell_cheat_death_rogue'),
(14185,'spell_preparation'),
(14082,'spell_dirty_deeds'),
(14083,'spell_dirty_deeds'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,31 @@ struct VerasDeadlyPoisonTick : public AuraScript
}
};

// 41341 - Balance of Power
struct BalanceOfPower : public AuraScript
{
void OnAbsorb(Aura* /*aura*/, int32& currentAbsorb, int32& remainingDamage, uint32& /*reflectedSpellId*/, int32& /*reflectDamage*/, bool& /*preventedDeath*/, bool& dropCharge) const override
{
// unused atm
remainingDamage += currentAbsorb;
currentAbsorb = 0;
dropCharge = false;
}
};

// 41475 - Reflective Shield
struct ReflectiveShieldMalande : public AuraScript
{
void OnAbsorb(Aura* /*aura*/, int32& currentAbsorb, int32& remainingDamage, uint32& reflectedSpellId, int32& reflectDamage, bool& /*preventedDeath*/, bool& /*dropCharge*/) const override
{
if (remainingDamage < currentAbsorb)
reflectDamage = remainingDamage / 2;
else
reflectDamage = currentAbsorb / 2;
reflectedSpellId = 33619;
}
};

void AddSC_boss_illidari_council()
{
Script* pNewScript = new Script;
Expand Down Expand Up @@ -750,4 +775,6 @@ void AddSC_boss_illidari_council()
RegisterSpellScript<VerasVanish>("spell_veras_vanish");
RegisterSpellScript<VerasDeadlyPoison>("spell_veras_deadly_poison");
RegisterSpellScript<VerasDeadlyPoisonTick>("spell_veras_deadly_poison_tick");
RegisterSpellScript<BalanceOfPower>("spell_balance_of_power");
RegisterSpellScript<ReflectiveShieldMalande>("spell_reflective_shield_malande");
}
Original file line number Diff line number Diff line change
Expand Up @@ -1927,6 +1927,19 @@ struct GravityLapseKnockup : public AuraScript
}
};

// 36815 - Shock Barrier
struct ShockBarrier : public AuraScript
{
void OnAbsorb(Aura* /*aura*/, int32& currentAbsorb, int32& remainingDamage, uint32& reflectedSpellId, int32& reflectDamage, bool& /*preventedDeath*/, bool& /*dropCharge*/) const override
{
reflectedSpellId = 36822;
if (remainingDamage < currentAbsorb)
reflectDamage = remainingDamage / 100;
else
reflectDamage = currentAbsorb / 100;
}
};

void AddSC_boss_kaelthas()
{
Script* pNewScript = new Script;
Expand Down Expand Up @@ -1965,4 +1978,5 @@ void AddSC_boss_kaelthas()
RegisterSpellScript<NetherVaporSummonParent>("spell_nether_vapor_summon_parent");
RegisterSpellScript<RemoveWeapons>("spell_remove_weapons");
RegisterSpellScript<GravityLapseKnockup>("spell_gravity_lapse_knockup");
RegisterSpellScript<ShockBarrier>("spell_shock_barrier");
}
13 changes: 13 additions & 0 deletions src/game/AI/ScriptDevAI/scripts/world/item_scripts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,18 @@ struct OrbOfDeception : public AuraScript
}
};

// 39228 - Argussian Compass
struct ArgussianCompass : public AuraScript
{
void OnAbsorb(Aura* aura, int32& currentAbsorb, int32& /*remainingDamage*/, uint32& /*reflectedSpellId*/, int32& /*reflectDamage*/, bool& /*preventedDeath*/, bool& /*dropCharge*/) const override
{
// Max absorb stored in 1 dummy effect
int32 max_absorb = aura->GetSpellProto()->CalculateSimpleValue(EFFECT_INDEX_1);
if (max_absorb < currentAbsorb)
currentAbsorb = max_absorb;
}
};

void AddSC_item_scripts()
{
Script* pNewScript = new Script;
Expand Down Expand Up @@ -354,4 +366,5 @@ void AddSC_item_scripts()
RegisterSpellScript<ReducedProcChancePast60>("spell_reduced_proc_chance_past60");
RegisterSpellScript<BanishExile>("spell_banish_exile");
RegisterSpellScript<OrbOfDeception>("spell_orb_of_deception");
RegisterSpellScript<ArgussianCompass>("spell_argussian_compass");
}
Loading

0 comments on commit 2191883

Please sign in to comment.