mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Scripts: Move some spells to scripts (#22332)
This commit is contained in:
12
sql/updates/world/3.3.5/2019_01_05_01_world.sql
Normal file
12
sql/updates/world/3.3.5/2019_01_05_01_world.sql
Normal file
@@ -0,0 +1,12 @@
|
||||
DELETE FROM `spell_script_names` WHERE `ScriptName` IN
|
||||
('spell_four_horsemen_consumption',
|
||||
'spell_rajaxx_thundercrash',
|
||||
'spell_gen_arcane_charge',
|
||||
'spell_pet_dk_gargoyle_strike');
|
||||
|
||||
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
|
||||
(28865, 'spell_four_horsemen_consumption'),
|
||||
(25599, 'spell_rajaxx_thundercrash'),
|
||||
(45072, 'spell_gen_arcane_charge'),
|
||||
(51963, 'spell_pet_dk_gargoyle_strike');
|
||||
|
||||
@@ -342,40 +342,6 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
|
||||
damage /= count;
|
||||
}
|
||||
|
||||
///@todo: move those to scripts
|
||||
switch (m_spellInfo->Id) // better way to check unknown
|
||||
{
|
||||
// Consumption
|
||||
case 28865:
|
||||
damage = 2750;
|
||||
if (m_caster->GetMap()->IsHeroic())
|
||||
damage = 4250;
|
||||
break;
|
||||
// percent from health with min
|
||||
case 25599: // Thundercrash
|
||||
{
|
||||
damage = unitTarget->GetHealth() / 2;
|
||||
if (damage < 200)
|
||||
damage = 200;
|
||||
break;
|
||||
}
|
||||
// arcane charge. must only affect demons (also undead?)
|
||||
case 45072:
|
||||
{
|
||||
if (!(unitTarget->GetCreatureTypeMask() & CREATURE_TYPEMASK_DEMON_OR_UNDEAD))
|
||||
return;
|
||||
break;
|
||||
}
|
||||
// Gargoyle Strike
|
||||
case 51963:
|
||||
{
|
||||
damage = 60;
|
||||
// about +4 base spell dmg per level
|
||||
if (unitCaster && unitCaster->getLevel() >= 60)
|
||||
damage += (unitCaster->getLevel() - 60) * 4;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SPELLFAMILY_WARRIOR:
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "ruins_of_ahnqiraj.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "SpellScript.h"
|
||||
|
||||
enum Yells
|
||||
{
|
||||
@@ -134,7 +135,27 @@ class boss_rajaxx : public CreatureScript
|
||||
}
|
||||
};
|
||||
|
||||
class spell_rajaxx_thundercrash : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_rajaxx_thundercrash);
|
||||
|
||||
void HandleDamageCalc(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
int32 damage = GetHitUnit()->GetHealth() / 2;
|
||||
if (damage < 200)
|
||||
damage = 200;
|
||||
|
||||
SetHitDamage(damage);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_rajaxx_thundercrash::HandleDamageCalc, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_boss_rajaxx()
|
||||
{
|
||||
new boss_rajaxx();
|
||||
RegisterSpellScript(spell_rajaxx_thundercrash);
|
||||
}
|
||||
|
||||
@@ -690,70 +690,76 @@ class boss_four_horsemen_sir : public CreatureScript
|
||||
}
|
||||
};
|
||||
|
||||
class spell_four_horsemen_mark : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_four_horsemen_mark() : SpellScriptLoader("spell_four_horsemen_mark") { }
|
||||
class spell_four_horsemen_mark : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_four_horsemen_mark);
|
||||
|
||||
class spell_four_horsemen_mark_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_four_horsemen_mark_AuraScript);
|
||||
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
{
|
||||
int32 damage;
|
||||
switch (GetStackAmount())
|
||||
{
|
||||
case 1:
|
||||
damage = 0;
|
||||
break;
|
||||
case 2:
|
||||
damage = 500;
|
||||
break;
|
||||
case 3:
|
||||
damage = 1000;
|
||||
break;
|
||||
case 4:
|
||||
damage = 1500;
|
||||
break;
|
||||
case 5:
|
||||
damage = 4000;
|
||||
break;
|
||||
case 6:
|
||||
damage = 12000;
|
||||
break;
|
||||
default:
|
||||
damage = 20000 + 1000 * (GetStackAmount() - 7);
|
||||
break;
|
||||
}
|
||||
if (damage)
|
||||
{
|
||||
CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
|
||||
args.AddSpellBP0(damage);
|
||||
caster->CastSpell(GetTarget(), SPELL_MARK_DAMAGE, args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
{
|
||||
int32 damage;
|
||||
switch (GetStackAmount())
|
||||
{
|
||||
case 1:
|
||||
damage = 0;
|
||||
break;
|
||||
case 2:
|
||||
damage = 500;
|
||||
break;
|
||||
case 3:
|
||||
damage = 1000;
|
||||
break;
|
||||
case 4:
|
||||
damage = 1500;
|
||||
break;
|
||||
case 5:
|
||||
damage = 4000;
|
||||
break;
|
||||
case 6:
|
||||
damage = 12000;
|
||||
break;
|
||||
default:
|
||||
damage = 20000 + 1000 * (GetStackAmount() - 7);
|
||||
break;
|
||||
}
|
||||
if (damage)
|
||||
{
|
||||
CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
|
||||
args.AddSpellBP0(damage);
|
||||
caster->CastSpell(GetTarget(), SPELL_MARK_DAMAGE, args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
AfterEffectApply += AuraEffectApplyFn(spell_four_horsemen_mark_AuraScript::OnApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const override
|
||||
{
|
||||
return new spell_four_horsemen_mark_AuraScript();
|
||||
}
|
||||
void Register() override
|
||||
{
|
||||
AfterEffectApply += AuraEffectApplyFn(spell_four_horsemen_mark::OnApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
|
||||
}
|
||||
};
|
||||
|
||||
class spell_four_horsemen_consumption : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_four_horsemen_consumption);
|
||||
|
||||
void HandleDamageCalc(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
uint32 damage = GetCaster()->GetMap()->IsHeroic() ? 4250 : 2750;
|
||||
SetHitDamage(damage);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_four_horsemen_consumption::HandleDamageCalc, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_boss_four_horsemen()
|
||||
{
|
||||
new boss_four_horsemen_baron();
|
||||
new boss_four_horsemen_thane();
|
||||
new boss_four_horsemen_lady();
|
||||
new boss_four_horsemen_sir();
|
||||
new spell_four_horsemen_mark();
|
||||
RegisterAuraScript(spell_four_horsemen_mark);
|
||||
RegisterSpellScript(spell_four_horsemen_consumption);
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "MotionMaster.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "SpellScript.h"
|
||||
|
||||
enum DeathKnightSpells
|
||||
{
|
||||
@@ -136,8 +137,31 @@ class npc_pet_dk_guardian : public CreatureScript
|
||||
}
|
||||
};
|
||||
|
||||
class spell_pet_dk_gargoyle_strike : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_pet_dk_gargoyle_strike);
|
||||
|
||||
void HandleDamageCalc(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
int32 damage = 60;
|
||||
if (Unit* caster = GetCaster())
|
||||
{
|
||||
if (caster->getLevel() >= 60)
|
||||
damage += (caster->getLevel() - 60) * 4;
|
||||
}
|
||||
|
||||
SetHitDamage(damage);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_pet_dk_gargoyle_strike::HandleDamageCalc, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_deathknight_pet_scripts()
|
||||
{
|
||||
new npc_pet_dk_ebon_gargoyle();
|
||||
new npc_pet_dk_guardian();
|
||||
RegisterSpellScript(spell_pet_dk_gargoyle_strike);
|
||||
}
|
||||
|
||||
@@ -201,6 +201,27 @@ class spell_gen_animal_blood : public AuraScript
|
||||
}
|
||||
};
|
||||
|
||||
class spell_gen_arcane_charge : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_gen_arcane_charge);
|
||||
|
||||
SpellCastResult CheckRequirement()
|
||||
{
|
||||
if (Unit* target = GetExplTargetUnit())
|
||||
{
|
||||
if (!(target->GetCreatureTypeMask() & CREATURE_TYPEMASK_DEMON_OR_UNDEAD))
|
||||
return SPELL_FAILED_DONT_REPORT;
|
||||
}
|
||||
|
||||
return SPELL_CAST_OK;
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnCheckCast += SpellCheckCastFn(spell_gen_arcane_charge::CheckRequirement);
|
||||
}
|
||||
};
|
||||
|
||||
// 430 Drink
|
||||
// 431 Drink
|
||||
// 432 Drink
|
||||
@@ -4052,6 +4073,7 @@ void AddSC_generic_spell_scripts()
|
||||
RegisterAuraScript(spell_gen_adaptive_warding);
|
||||
RegisterSpellScript(spell_gen_allow_cast_from_item_only);
|
||||
RegisterAuraScript(spell_gen_animal_blood);
|
||||
RegisterSpellScript(spell_gen_arcane_charge);
|
||||
RegisterAuraScript(spell_gen_arena_drink);
|
||||
RegisterAuraScript(spell_gen_aura_of_anger);
|
||||
RegisterAuraScript(spell_gen_aura_of_fear);
|
||||
|
||||
Reference in New Issue
Block a user