Skip to content

Commit

Permalink
Spell: Add SpellScript for Mind Amplification Dish
Browse files Browse the repository at this point in the history
  • Loading branch information
insunaa authored and killerwife committed Aug 16, 2024
1 parent 15588f7 commit 3ccf8f8
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
1 change: 1 addition & 0 deletions sql/scriptdev2/spell.sql
Original file line number Diff line number Diff line change
Expand Up @@ -992,6 +992,7 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
(67547,'spell_clear_valkyr_essence'),
(67590,'spell_powering_up'),
(67630,'spell_leeching_swarm_aura'),
(67799,'spell_mind_amplification_dish'),
(68084,'spell_clear_valkyr_touch'),
(68614,'spell_irresistible_cologne_spill_aura'),
(68644,'spell_valentine_boss_validate_area'),
Expand Down
41 changes: 41 additions & 0 deletions src/game/AI/ScriptDevAI/scripts/world/item_scripts_wotlk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,46 @@ struct BlessingOfAncientKings : public AuraScript
}
};

// 67799 - Mind Amplification Dish
struct MindAmplificationDish : public SpellScript
{
enum
{
MIND_CONTROL = 13181,
FAIL_CONTROL = 26740,
DULLARD = 67809,
MENTAL_BATTLE = 67810,
};

SpellCastResult OnCheckCast(Spell* spell, bool /*strict*/) const override
{
if (spell->GetAffectiveCaster()->HasAura(DULLARD))
return SPELL_FAILED_CASTER_AURASTATE;
return SPELL_CAST_OK;
}

void OnEffectExecute(Spell* spell, SpellEffectIndex effIdx) const override
{
if (effIdx != EFFECT_INDEX_0)
return;
Unit* caster = spell->GetAffectiveCaster();
Unit* target = spell->GetUnitTarget();

if (!caster || !target)
return;

uint32 roll = urand(0, 99);
if (roll < 75)
caster->CastSpell(target, MIND_CONTROL, TRIGGERED_NONE, spell->GetCastItem());
else if (roll < 90)
caster->CastSpell(target, MENTAL_BATTLE, TRIGGERED_NONE, spell->GetCastItem());
else if (roll < 97)
target->CastSpell(caster, FAIL_CONTROL, TRIGGERED_NONE, spell->GetCastItem());
else
caster->CastSpell(nullptr, DULLARD, TRIGGERED_NONE, spell->GetCastItem());
}
};

void AddSC_item_scripts_wotlk()
{
RegisterSpellScript<SwiftHandOfJustice>("spell_swift_hand_of_justice");
Expand All @@ -198,4 +238,5 @@ void AddSC_item_scripts_wotlk()
RegisterSpellScript<Icecrown25MeleeTrinket>("spell_icecrown_25_melee_trinket");
RegisterSpellScript<ValanyrEquipEffect>("spell_valanyr_equip_effect");
RegisterSpellScript<BlessingOfAncientKings>("spell_blessing_of_ancient_kings");
RegisterSpellScript<MindAmplificationDish>("spell_mind_amplification_dish");
}

0 comments on commit 3ccf8f8

Please sign in to comment.