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 Sep 28, 2023
1 parent c25ddd8 commit 2d805e0
Show file tree
Hide file tree
Showing 17 changed files with 339 additions and 322 deletions.
53 changes: 52 additions & 1 deletion sql/scriptdev2/spell.sql
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,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 @@ -1004,11 +1008,17 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
(52285,'spell_will_of_the_necropolis'),
(52286,'spell_will_of_the_necropolis'),
(50452,'spell_bloodworm'),
(49145,'spell_spell_deflection'),
(49495,'spell_spell_deflection'),
(49497,'spell_spell_deflection'),
(50453,'spell_health_leech_passive'),
(55078,'spell_death_knight_disease'),
(55095,'spell_death_knight_disease'),
(65142,'spell_crypt_fever_serverside'),
(51052,'spell_anti_magic_zone'),
(48707,'spell_anti_magic_shell_absorb_self'),
(50462,'spell_anti_magic_shell_zone'),
(50461,'spell_anti_zone_absorb'),
(55090,'spell_scourge_strike'),
(55265,'spell_scourge_strike'),
(55270,'spell_scourge_strike'),
Expand Down Expand Up @@ -1046,6 +1056,20 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
-- Priest
INSERT INTO spell_scripts(Id, ScriptName) VALUES
(10060,'spell_power_infusion'),
(17,'spell_power_word_shield_priest'),

This comment has been minimized.

Copy link
@kelbren

kelbren Sep 28, 2023

SQL "duplicate entry error" during database update, the power word shield priest items.

This comment has been minimized.

Copy link
@cpevors

cpevors Sep 28, 2023

Had literally just rooted around and found this too. Thank you!

This comment has been minimized.

Copy link
@Muehe

Muehe Sep 28, 2023

Contributor

@cpevors I was looking at the wrong spell.sql file. 🤦

This comment has been minimized.

Copy link
@cpevors

cpevors Sep 28, 2023

@Muehe Initially I was too, so no harm, friend. Seems we have some consensus on the offending line, fortunately, and should be an easy enough fix for our Lord and Saviour, @killerwife.

This comment has been minimized.

Copy link
@Muehe

Muehe Sep 28, 2023

Contributor

Fixed in 6c7edc5

(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'),
(48065,'spell_power_word_shield_priest'),
(48066,'spell_power_word_shield_priest'),
(27827,'spell_spirit_of_redemption_heal'),
(33076,'spell_prayer_of_mending'),
(33206,'spell_pain_suppression'),
Expand Down Expand Up @@ -1074,6 +1098,7 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
(48085,'spell_lightwell_renew'),
(55673,'spell_glyph_of_lightwell'),
(60123,'spell_lightwell_relay'),
(47788,'spell_guardian_spirit_priest'),
(34861,'spell_circle_of_healing'),
(34863,'spell_circle_of_healing'),
(34864,'spell_circle_of_healing'),
Expand Down Expand Up @@ -1286,6 +1311,20 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
(12824,'spell_polymorph'),
(12825,'spell_polymorph'),
(12826,'spell_polymorph'),
(543,'spell_frost_warding'),
(8457,'spell_frost_warding'),
(8458,'spell_frost_warding'),
(10223,'spell_frost_warding'),
(10225,'spell_frost_warding'),
(27128,'spell_frost_warding'),
(43010,'spell_frost_warding'),
(6143,'spell_frost_warding'),
(8461,'spell_frost_warding'),
(8462,'spell_frost_warding'),
(10177,'spell_frost_warding'),
(28609,'spell_frost_warding'),
(32796,'spell_frost_warding'),
(43012,'spell_frost_warding'),
(58838,'spell_inherit_masters_threat_list'),
(59638,'spell_mirror_image_frostbolt');

Expand Down Expand Up @@ -1324,6 +1363,10 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
(27002,'spell_shred_druid'),
(48571,'spell_shred_druid'),
(48572,'spell_shred_druid'),
(33851,'spell_primal_tenacity'),
(33852,'spell_primal_tenacity'),
(33957,'spell_primal_tenacity'),
(69366,'spell_moonkin_form_passive'),
(40121,'spell_swift_flight_form_passive');

-- Rogue
Expand All @@ -1339,6 +1382,9 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
(2070,'spell_sap'), -- check ranks before changing
(11297,'spell_sap'),
(51724,'spell_sap'),
(31228,'spell_cheat_death_rogue'),
(31229,'spell_cheat_death_rogue'),
(31230,'spell_cheat_death_rogue'),
(14082,'spell_dirty_deeds'),
(14083,'spell_dirty_deeds'),
(13983,'spell_setup_rogue'),
Expand All @@ -1350,7 +1396,9 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
(51686,'spell_prey_on_the_weak'),
(51687,'spell_prey_on_the_weak'),
(51688,'spell_prey_on_the_weak'),
(51689,'spell_prey_on_the_weak');
(51689,'spell_prey_on_the_weak'),
(31130,'spell_nerves_of_steel'),
(31131,'spell_nerves_of_steel');

-- Shaman
INSERT INTO spell_scripts(Id, ScriptName) VALUES
Expand Down Expand Up @@ -1396,6 +1444,9 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
(58590,'spell_stoneclaw_totem_absorb'),
(58591,'spell_stoneclaw_totem_absorb'),
(70811,'spell_item_shaman_t10_elemental_2p_bonus'),
(51474,'spell_astral_shift_shaman'),
(51478,'spell_astral_shift_shaman'),
(51479,'spell_astral_shift_shaman'),
(2825,'spell_heroism_bloodlust'),
(32182,'spell_heroism_bloodlust');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1652,7 +1652,7 @@ UnitAI* GetAI_npc_keeper_thorim(Creature* pCreature)

struct HodirsProtectiveGaze : AuraScript
{
void OnAbsorb(Aura* aura, int32& currentAbsorb, int32& remainingDamage, uint32& /*reflectedSpellId*/, int32& /*reflectDamage*/, bool& preventedDeath, bool& dropCharge) const override
void OnAbsorb(Aura* aura, int32& currentAbsorb, int32& remainingDamage, uint32& /*reflectedSpellId*/, int32& /*reflectDamage*/, bool& preventedDeath, bool& dropCharge, DamageEffectType /*damageType*/) const override
{
currentAbsorb = 0;
dropCharge = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ bool AreaTrigger_at_teron_gorefiend(Player* player, AreaTriggerEntry const* /*at

struct ShadowOfDeath : public AuraScript
{
void OnAbsorb(Aura* aura, int32& currentAbsorb, int32& /*remainingDamage*/, uint32& /*reflectedSpellId*/, int32& /*reflectDamage*/, bool& preventedDeath, bool& /*dropCharge*/) const override
void OnAbsorb(Aura* aura, int32& currentAbsorb, int32& /*remainingDamage*/, uint32& /*reflectedSpellId*/, int32& /*reflectDamage*/, bool& preventedDeath, bool& /*dropCharge*/, DamageEffectType /*damageType*/) const override
{
preventedDeath = true;
currentAbsorb = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,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, DamageEffectType /*damageType*/) 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*/, DamageEffectType /*damageType*/) 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 @@ -749,4 +774,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 @@ -1928,6 +1928,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*/, DamageEffectType /*damageType*/) 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 @@ -1966,4 +1979,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 @@ -352,6 +352,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*/, DamageEffectType /*damageType*/) 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 @@ -389,4 +401,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 2d805e0

Please sign in to comment.