aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortkrokli <tkrokli@users.noreply.github.com>2016-10-15 01:46:19 +0200
committerjoschiwald <joschiwald.trinity@gmail.com>2017-10-03 16:56:48 +0200
commitc4ec0d8cfc4dc12fc03a33d20c61c199a1f8d57c (patch)
tree4eee7625c6c36041ba53cc7722b4ff1dd193d8cd
parentb2f9e0c95bfec8657320c8d7b7b086baf9d75785 (diff)
[WIP] Core/Scripts: Gnomish Mind Control Cap and Gnomish Universal Remote (#17374)
(cherry picked from commit b651bf271b047d3c79d7e8fc2c558913d20c9e15) Rename 2016_09_09_20_world.sql to 2016_10_15_00_world.sql (cherry picked from commit d03b3e26438e12bda9069969041d50c36119c24b)
-rw-r--r--sql/updates/world/master/2017_10_03_05_world_2016_10_15_00_world.sql7
-rw-r--r--src/server/scripts/Spells/spell_item.cpp111
2 files changed, 118 insertions, 0 deletions
diff --git a/sql/updates/world/master/2017_10_03_05_world_2016_10_15_00_world.sql b/sql/updates/world/master/2017_10_03_05_world_2016_10_15_00_world.sql
new file mode 100644
index 00000000000..2a2b1ae3e8e
--- /dev/null
+++ b/sql/updates/world/master/2017_10_03_05_world_2016_10_15_00_world.sql
@@ -0,0 +1,7 @@
+-- Gnomish Mind Control Cap and Mind Amplification Dish script
+DELETE FROM `spell_script_names` WHERE ScriptName IN ('spell_item_mind_control_cap','spell_item_universal_remote');
+INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
+(67799, 'spell_item_mind_control_cap'),
+(13180, 'spell_item_mind_control_cap'),
+-- Gnomish Universal Remote script
+(8344, 'spell_item_universal_remote');
diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp
index 2f43fc60256..9370ea8bc7b 100644
--- a/src/server/scripts/Spells/spell_item.cpp
+++ b/src/server/scripts/Spells/spell_item.cpp
@@ -4170,6 +4170,115 @@ 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* /*spellInfo*/) override
+ {
+ return ValidateSpellInfo({ SPELL_GNOMISH_MIND_CONTROL_CAP, SPELL_DULLARD });
+ }
+
+ 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
+ {
+ return ValidateSpellInfo({ SPELL_CONTROL_MACHINE, SPELL_MOBILITY_MALFUNCTION, SPELL_TARGET_LOCK });
+ }
+
+ 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,
@@ -4629,6 +4738,8 @@ void AddSC_item_spell_scripts()
new spell_item_darkmoon_card_greatness();
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);
new spell_item_artifical_stamina();