aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortkrokli <tkrokli@users.noreply.github.com>2016-10-15 01:46:19 +0200
committerSnapperRy <snapperryen@gmail.com>2016-10-15 01:46:19 +0200
commitb651bf271b047d3c79d7e8fc2c558913d20c9e15 (patch)
tree72624ad1776f85994e790ef360ce809fedb53c04 /src
parent84439ff4d77abbdbdd06f5276d2fe6b17bf9070f (diff)
[WIP] Core/Scripts: Gnomish Mind Control Cap and Gnomish Universal Remote (#17374)
Diffstat (limited to 'src')
-rw-r--r--src/server/scripts/Spells/spell_item.cpp115
1 files changed, 115 insertions, 0 deletions
diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp
index c214874b688..b45df66e0ac 100644
--- a/src/server/scripts/Spells/spell_item.cpp
+++ b/src/server/scripts/Spells/spell_item.cpp
@@ -4345,6 +4345,119 @@ class spell_item_taunt_flag_targeting : public SpellScriptLoader
}
};
+// 13180 - Gnomish Mind Control Cap
+enum MindControlCap
+{
+ ROLL_CHANCE_DULLARD = 32,
+ ROLL_CHANCE_NO_BACKFIRE = 95,
+ SPELL_GNOMISH_MIND_CONTROL_CAP = 13181,
+ SPELL_DULLARD = 67809
+};
+
+class spell_item_mind_control_cap : public SpellScriptLoader
+{
+ public:
+ spell_item_mind_control_cap() : SpellScriptLoader("spell_item_mind_control_cap") { }
+
+ class spell_item_mind_control_cap_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_item_mind_control_cap_SpellScript);
+
+ bool Load() override
+ {
+ if (!GetCastItem())
+ return false;
+ return true;
+ }
+
+ bool Validate(SpellInfo const* /*spell*/) override
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_GNOMISH_MIND_CONTROL_CAP) || !sSpellMgr->GetSpellInfo(SPELL_DULLARD))
+ return false;
+ return true;
+ }
+
+ void HandleDummy(SpellEffIndex /* effIndex */)
+ {
+ Unit* caster = GetCaster();
+ if (Unit* target = GetHitUnit())
+ {
+ if (roll_chance_i(ROLL_CHANCE_NO_BACKFIRE))
+ caster->CastSpell(target, roll_chance_i(ROLL_CHANCE_DULLARD) ? SPELL_DULLARD : SPELL_GNOMISH_MIND_CONTROL_CAP, true, GetCastItem());
+ else
+ target->CastSpell(caster, SPELL_GNOMISH_MIND_CONTROL_CAP, true); // backfire - 5% chance
+ }
+ }
+
+ void Register() override
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_item_mind_control_cap_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ }
+ };
+
+ SpellScript* GetSpellScript() const override
+ {
+ return new spell_item_mind_control_cap_SpellScript();
+ }
+};
+
+// 8344 - Universal Remote (Gnomish Universal Remote)
+enum UniversalRemote
+{
+ SPELL_CONTROL_MACHINE = 8345,
+ SPELL_MOBILITY_MALFUNCTION = 8346,
+ SPELL_TARGET_LOCK = 8347
+};
+
+class spell_item_universal_remote : public SpellScriptLoader
+{
+ public:
+ spell_item_universal_remote() : SpellScriptLoader("spell_item_universal_remote") { }
+
+ class spell_item_universal_remote_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_item_universal_remote_SpellScript);
+
+ bool Load() override
+ {
+ if (!GetCastItem())
+ return false;
+ return true;
+ }
+
+ bool Validate(SpellInfo const* /*spellInfo*/) override
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_CONTROL_MACHINE) || !sSpellMgr->GetSpellInfo(SPELL_MOBILITY_MALFUNCTION) || !sSpellMgr->GetSpellInfo(SPELL_TARGET_LOCK))
+ return false;
+ return true;
+ }
+
+ void HandleDummy(SpellEffIndex /*effIndex*/)
+ {
+ if (Unit* target = GetHitUnit())
+ {
+ uint8 chance = urand(0, 99);
+ if (chance < 15)
+ GetCaster()->CastSpell(target, SPELL_TARGET_LOCK, true, GetCastItem());
+ else if (chance < 25)
+ GetCaster()->CastSpell(target, SPELL_MOBILITY_MALFUNCTION, true, GetCastItem());
+ else
+ GetCaster()->CastSpell(target, SPELL_CONTROL_MACHINE, true, GetCastItem());
+ }
+ }
+
+ void Register() override
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_item_universal_remote_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ }
+ };
+
+ SpellScript* GetSpellScript() const override
+ {
+ return new spell_item_universal_remote_SpellScript();
+ }
+};
+
enum ZandalarianCharms
{
SPELL_UNSTABLE_POWER_AURA_STACK = 24659,
@@ -4517,6 +4630,8 @@ void AddSC_item_spell_scripts()
new spell_item_charm_witch_doctor();
new spell_item_mana_drain();
new spell_item_taunt_flag_targeting();
+ new spell_item_mind_control_cap();
+ new spell_item_universal_remote();
new spell_item_zandalarian_charm("spell_item_unstable_power", SPELL_UNSTABLE_POWER_AURA_STACK);
new spell_item_zandalarian_charm("spell_item_restless_strength", SPELL_RESTLESS_STRENGTH_AURA_STACK);