Core/Spells: Fix Ram Racing mechanic

To/Do: Fix Quests and your lazy ass :/
This commit is contained in:
Vincent-Michael committed 2014-09-23 21:30:47 +02:00
1 parent eae8437b0e
commit 44bcfb86f5
2 files changed
+241

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
DELETE FROM `spell_script_names` WHERE `spell_id` IN (
42924,
43310,
42992,
42993,
42994,
43052,
43450
);
INSERT INTO `spell_script_names` (`spell_id` ,`ScriptName`) VALUES
(42924, 'spell_brewfest_giddyup'),
(43310, 'spell_brewfest_ram'),
(42992, 'spell_brewfest_ram'),
(42993, 'spell_brewfest_ram'),
(42994, 'spell_brewfest_ram'),
(43052, 'spell_brewfest_ram_fatigue'),
(43450, 'spell_brewfest_apple_trap');
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=17 AND `SourceEntry`=42924;
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=43450;
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
(17, 0, 42924, 0, 0, 1, 0, 43332, 0, 0, 1, 172, 0, '', 'Cast Gore Bladder only if Cosmetic - Underwater Blood (no sound) aura is active'),
(13, 1, 43450, 0, 0, 1, 0, 43052, 0, 0, 0, 0, 0, '', 'Brewfest - apple trap - friendly DND targets only if does have aura Ram Fatigue');
DELETE FROM `spell_linked_spell` WHERE `spell_trigger`=-43883 AND `spell_effect`=-43052;
DELETE FROM `spell_linked_spell` WHERE `spell_trigger`=43450 AND `spell_effect`=-43052;
INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES
(-43883, -43052, 0, 'Rental racing ram removed removes Ram Fatigue');
+213
View File
@@ -444,6 +444,214 @@ class spell_winter_veil_px_238_winter_wondervolt : public SpellScriptLoader
}
};
enum RamBlaBla
{
SPELL_RENTAL_RACING_RAM = 43883,
SPELL_RENTAL_RACING_RAM_AURA = 42146,
SPELL_RAM_LEVEL_NEUTRAL = 43310,
SPELL_RAM_TROT = 42992,
SPELL_RAM_CANTER = 42993,
SPELL_RAM_GALLOP = 42994,
SPELL_RAM_FATIGUE = 43052,
SPELL_EXHAUSTED_RAM = 43332,
// Quest
SPELL_BREWFEST_QUEST_SPEED_BUNNY_GREEN = 43345,
SPELL_BREWFEST_QUEST_SPEED_BUNNY_YELLOW = 43346,
SPELL_BREWFEST_QUEST_SPEED_BUNNY_RED = 43347
};
// 42924 - Giddyup!
class spell_brewfest_giddyup : public SpellScriptLoader
{
public:
spell_brewfest_giddyup() : SpellScriptLoader("spell_brewfest_giddyup") { }
class spell_brewfest_giddyup_AuraScript : public AuraScript
{
PrepareAuraScript(spell_brewfest_giddyup_AuraScript);
void OnChange(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
if (!target->HasAura(SPELL_RENTAL_RACING_RAM))
{
target->RemoveAura(GetId());
return;
}
if (target->HasAura(SPELL_EXHAUSTED_RAM))
return;
switch (GetStackAmount())
{
case 1: // green
target->RemoveAura(SPELL_RAM_LEVEL_NEUTRAL);
target->RemoveAura(SPELL_RAM_CANTER);
target->CastSpell(target, SPELL_RAM_TROT, true);
break;
case 6: // yellow
target->RemoveAura(SPELL_RAM_TROT);
target->RemoveAura(SPELL_RAM_GALLOP);
target->CastSpell(target, SPELL_RAM_CANTER, true);
break;
case 11: // red
target->RemoveAura(SPELL_RAM_CANTER);
target->CastSpell(target, SPELL_RAM_GALLOP, true);
break;
default:
break;
}
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEFAULT)
{
target->RemoveAura(SPELL_RAM_TROT);
target->CastSpell(target, SPELL_RAM_LEVEL_NEUTRAL, true);
}
}
void OnPeriodic(AuraEffect const* /*aurEff*/)
{
GetTarget()->RemoveAuraFromStack(GetId());
}
void Register() override
{
AfterEffectApply += AuraEffectApplyFn(spell_brewfest_giddyup_AuraScript::OnChange, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
OnEffectRemove += AuraEffectRemoveFn(spell_brewfest_giddyup_AuraScript::OnChange, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_brewfest_giddyup_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_brewfest_giddyup_AuraScript();
}
};
// 43310 - Ram Level - Neutral
// 42992 - Ram - Trot
// 42993 - Ram - Canter
// 42994 - Ram - Gallop
class spell_brewfest_ram : public SpellScriptLoader
{
public:
spell_brewfest_ram() : SpellScriptLoader("spell_brewfest_ram") { }
class spell_brewfest_ram_AuraScript : public AuraScript
{
PrepareAuraScript(spell_brewfest_ram_AuraScript);
void OnPeriodic(AuraEffect const* aurEff)
{
Unit* target = GetTarget();
if (target->HasAura(SPELL_EXHAUSTED_RAM))
return;
switch (GetId())
{
case SPELL_RAM_LEVEL_NEUTRAL:
if (Aura* aura = target->GetAura(SPELL_RAM_FATIGUE))
aura->ModStackAmount(-4);
break;
case SPELL_RAM_TROT: // green
if (Aura* aura = target->GetAura(SPELL_RAM_FATIGUE))
aura->ModStackAmount(-2);
if (aurEff->GetTickNumber() == 4)
target->CastSpell(target, SPELL_BREWFEST_QUEST_SPEED_BUNNY_GREEN, true);
break;
case SPELL_RAM_CANTER:
target->CastCustomSpell(SPELL_RAM_FATIGUE, SPELLVALUE_AURA_STACK, 1, target, TRIGGERED_FULL_MASK);
if (aurEff->GetTickNumber() == 4)
target->CastSpell(target, SPELL_BREWFEST_QUEST_SPEED_BUNNY_YELLOW, true);
break;
case SPELL_RAM_GALLOP:
target->CastCustomSpell(SPELL_RAM_FATIGUE, SPELLVALUE_AURA_STACK, target->HasAura(SPELL_RAM_FATIGUE) ? 4 : 5 /*Hack*/, target, TRIGGERED_FULL_MASK);
if (aurEff->GetTickNumber() == 4)
target->CastSpell(target, SPELL_BREWFEST_QUEST_SPEED_BUNNY_RED, true);
break;
default:
break;
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_brewfest_ram_AuraScript::OnPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_brewfest_ram_AuraScript();
}
};
// 43052 - Ram Fatigue
class spell_brewfest_ram_fatigue : public SpellScriptLoader
{
public:
spell_brewfest_ram_fatigue() : SpellScriptLoader("spell_brewfest_ram_fatigue") { }
class spell_brewfest_ram_fatigue_AuraScript : public AuraScript
{
PrepareAuraScript(spell_brewfest_ram_fatigue_AuraScript);
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
if (GetStackAmount() == 101)
{
target->RemoveAura(SPELL_RAM_LEVEL_NEUTRAL);
target->RemoveAura(SPELL_RAM_TROT);
target->RemoveAura(SPELL_RAM_CANTER);
target->RemoveAura(SPELL_RAM_GALLOP);
target->CastSpell(target, SPELL_EXHAUSTED_RAM, true);
}
}
void Register() override
{
AfterEffectApply += AuraEffectApplyFn(spell_brewfest_ram_fatigue_AuraScript::OnApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_brewfest_ram_fatigue_AuraScript();
}
};
// 43450 - Brewfest - apple trap - friendly DND
class spell_brewfest_apple_trap : public SpellScriptLoader
{
public:
spell_brewfest_apple_trap() : SpellScriptLoader("spell_brewfest_apple_trap") { }
class spell_brewfest_apple_trap_AuraScript : public AuraScript
{
PrepareAuraScript(spell_brewfest_apple_trap_AuraScript);
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
GetTarget()->RemoveAura(SPELL_RAM_FATIGUE);
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_brewfest_apple_trap_AuraScript::OnApply, EFFECT_0, SPELL_AURA_FORCE_REACTION, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_brewfest_apple_trap_AuraScript();
}
};
void AddSC_holiday_spell_scripts()
{
// Love is in the Air
@@ -461,4 +669,9 @@ void AddSC_holiday_spell_scripts()
// Winter Veil
new spell_winter_veil_mistletoe();
new spell_winter_veil_px_238_winter_wondervolt();
// Brewfest
new spell_brewfest_giddyup();
new spell_brewfest_ram();
new spell_brewfest_ram_fatigue();
new spell_brewfest_apple_trap();
}