mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
[WIP] Core/Scripts: Gnomish Mind Control Cap and Gnomish Universal Remote (#17374)
(cherry picked from commitb651bf271b) Rename 2016_09_09_20_world.sql to 2016_10_15_00_world.sql (cherry picked from commitd03b3e2643)
This commit is contained in:
@@ -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');
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user