diff options
Diffstat (limited to 'src/server/scripts')
| -rw-r--r-- | src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp | 135 | ||||
| -rw-r--r-- | src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp | 2 | ||||
| -rw-r--r-- | src/server/scripts/Northrend/isle_of_conquest.cpp | 125 | ||||
| -rw-r--r-- | src/server/scripts/Northrend/zone_dalaran.cpp | 6 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_dk.cpp | 30 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_generic.cpp | 122 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_warrior.cpp | 2 | ||||
| -rw-r--r-- | src/server/scripts/World/areatrigger_scripts.cpp | 4 |
8 files changed, 228 insertions, 198 deletions
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp index 04b58af2a4a..90306913534 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp @@ -1,6 +1,5 @@ /* * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> - * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -16,28 +15,34 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* ScriptData -SDName: Boss_Maiden_of_Virtue -SD%Complete: 100 -SDComment: -SDCategory: Karazhan -EndScriptData */ - #include "ScriptMgr.h" #include "ScriptedCreature.h" +#include "karazhan.h" + +enum Spells +{ + SPELL_REPENTANCE = 29511, + SPELL_HOLYFIRE = 29522, + SPELL_HOLYWRATH = 32445, + SPELL_HOLYGROUND = 29512, + SPELL_BERSERK = 26662 +}; -enum MaidenOfVirtue +enum Yells { - SAY_AGGRO = 0, - SAY_SLAY = 1, - SAY_REPENTANCE = 2, - SAY_DEATH = 3, - - SPELL_REPENTANCE = 29511, - SPELL_HOLYFIRE = 29522, - SPELL_HOLYWRATH = 32445, - SPELL_HOLYGROUND = 29512, - SPELL_BERSERK = 26662, + SAY_AGGRO = 0, + SAY_SLAY = 1, + SAY_REPENTANCE = 2, + SAY_DEATH = 3 +}; + +enum Events +{ + EVENT_REPENTANCE = 1, + EVENT_HOLYFIRE = 2, + EVENT_HOLYWRATH = 3, + EVENT_HOLYGROUND = 4, + EVENT_ENRAGE = 5 }; class boss_maiden_of_virtue : public CreatureScript @@ -50,27 +55,13 @@ public: return new boss_maiden_of_virtueAI(creature); } - struct boss_maiden_of_virtueAI : public ScriptedAI + struct boss_maiden_of_virtueAI : public BossAI { - boss_maiden_of_virtueAI(Creature* creature) : ScriptedAI(creature) { } - - uint32 Repentance_Timer; - uint32 Holyfire_Timer; - uint32 Holywrath_Timer; - uint32 Holyground_Timer; - uint32 Enrage_Timer; - - bool Enraged; + boss_maiden_of_virtueAI(Creature* creature) : BossAI(creature, TYPE_MAIDEN) { } void Reset() override { - Repentance_Timer = 25000 + (rand32() % 15000); - Holyfire_Timer = 8000 + (rand32() % 17000); - Holywrath_Timer = 15000 + (rand32() % 10000); - Holyground_Timer = 3000; - Enrage_Timer = 600000; - - Enraged = false; + _Reset(); } void KilledUnit(Unit* /*Victim*/) override @@ -82,11 +73,19 @@ public: void JustDied(Unit* /*killer*/) override { Talk(SAY_DEATH); + _JustDied(); } void EnterCombat(Unit* /*who*/) override { + _EnterCombat(); Talk(SAY_AGGRO); + + events.ScheduleEvent(EVENT_REPENTANCE, urand(33, 45) * IN_MILLISECONDS); + events.ScheduleEvent(EVENT_HOLYFIRE, 12 * IN_MILLISECONDS); + events.ScheduleEvent(EVENT_HOLYWRATH, urand(15, 25) * IN_MILLISECONDS); + events.ScheduleEvent(EVENT_HOLYGROUND, 3 * IN_MILLISECONDS); + events.ScheduleEvent(EVENT_ENRAGE, 600 * IN_MILLISECONDS); } void UpdateAI(uint32 diff) override @@ -94,41 +93,41 @@ public: if (!UpdateVictim()) return; - if (Enrage_Timer < diff && !Enraged) - { - DoCast(me, SPELL_BERSERK, true); - Enraged = true; - } else Enrage_Timer -= diff; - - if (Holyground_Timer <= diff) - { - DoCast(me, SPELL_HOLYGROUND, true); //Triggered so it doesn't interrupt her at all - Holyground_Timer = 3000; - } else Holyground_Timer -= diff; - - if (Repentance_Timer <= diff) - { - DoCastVictim(SPELL_REPENTANCE); - Talk(SAY_REPENTANCE); + events.Update(diff); - Repentance_Timer = urand(25000, 35000); //A little randomness on that spell - } else Repentance_Timer -= diff; - - if (Holyfire_Timer <= diff) - { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(target, SPELL_HOLYFIRE); - - Holyfire_Timer = urand(8000, 23000); //Anywhere from 8 to 23 seconds, good luck having several of those in a row! - } else Holyfire_Timer -= diff; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - if (Holywrath_Timer <= diff) + while (uint32 eventId = events.ExecuteEvent()) { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(target, SPELL_HOLYWRATH); - - Holywrath_Timer = urand(20000, 25000); //20-30 secs sounds nice - } else Holywrath_Timer -= diff; + switch (eventId) + { + case EVENT_REPENTANCE: + DoCastVictim(SPELL_REPENTANCE); + Talk(SAY_REPENTANCE); + events.ScheduleEvent(EVENT_REPENTANCE, urand(33, 45) * IN_MILLISECONDS); + break; + case EVENT_HOLYFIRE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50, true)) + DoCast(target, SPELL_HOLYFIRE); + events.ScheduleEvent(EVENT_HOLYFIRE, 12 * IN_MILLISECONDS); + break; + case EVENT_HOLYWRATH: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 80, true)) + DoCast(target, SPELL_HOLYWRATH); + events.ScheduleEvent(EVENT_HOLYWRATH, urand(15, 25) * IN_MILLISECONDS); + break; + case EVENT_HOLYGROUND: + DoCast(me, SPELL_HOLYGROUND, true); + events.ScheduleEvent(EVENT_HOLYGROUND, 3 * IN_MILLISECONDS); + break; + case EVENT_ENRAGE: + DoCast(me, SPELL_BERSERK, true); + break; + default: + break; + } + } DoMeleeAttackIfReady(); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp index ca478244d2a..9a9e7aa6849 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp @@ -354,7 +354,7 @@ public: if (caster) { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 45.0f)) + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 45.0f, true)) DoCast(target, SPELL_PRIMARY(id)); } else diff --git a/src/server/scripts/Northrend/isle_of_conquest.cpp b/src/server/scripts/Northrend/isle_of_conquest.cpp index 8cdfce90bc9..14763577c66 100644 --- a/src/server/scripts/Northrend/isle_of_conquest.cpp +++ b/src/server/scripts/Northrend/isle_of_conquest.cpp @@ -20,6 +20,9 @@ #include "PassiveAI.h" #include "BattlegroundIC.h" #include "Player.h" +#include "Vehicle.h" +#include "SpellScript.h" +#include "SpellInfo.h" // TO-DO: This should be done with SmartAI, but yet it does not correctly support vehicles's AIs. // Even adding ReactState Passive we still have issues using SmartAI. @@ -70,7 +73,129 @@ class npc_four_car_garage : public CreatureScript } }; +class spell_ioc_gunship_portal : public SpellScriptLoader +{ + public: + spell_ioc_gunship_portal() : SpellScriptLoader("spell_ioc_gunship_portal") { } + + class spell_ioc_gunship_portal_SpellScript : public SpellScript + { + PrepareSpellScript(spell_ioc_gunship_portal_SpellScript); + + bool Load() override + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } + + void HandleScript(SpellEffIndex /*effIndex*/) + { + Player* caster = GetCaster()->ToPlayer(); + if (Battleground* bg = caster->GetBattleground()) + if (bg->GetTypeID(true) == BATTLEGROUND_IC) + bg->DoAction(1, caster->GetGUID()); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_ioc_gunship_portal_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const override + { + return new spell_ioc_gunship_portal_SpellScript(); + } +}; + +enum ParachuteIC +{ + SPELL_PARACHUTE_IC = 66657 +}; + +class spell_ioc_parachute_ic : public SpellScriptLoader +{ + public: + spell_ioc_parachute_ic() : SpellScriptLoader("spell_ioc_parachute_ic") { } + + class spell_ioc_parachute_ic_AuraScript : public AuraScript + { + PrepareAuraScript(spell_ioc_parachute_ic_AuraScript); + + void HandleTriggerSpell(AuraEffect const* /*aurEff*/) + { + if (Player* target = GetTarget()->ToPlayer()) + if (target->m_movementInfo.fallTime > 2000) + target->CastSpell(target, SPELL_PARACHUTE_IC, true); + } + + void Register() override + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_ioc_parachute_ic_AuraScript::HandleTriggerSpell, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } + }; + + AuraScript* GetAuraScript() const override + { + return new spell_ioc_parachute_ic_AuraScript(); + } +}; + +enum Launch +{ + SPELL_LAUNCH_NO_FALLING_DAMAGE = 66251 +}; + +class spell_ioc_launch : public SpellScriptLoader +{ + public: + spell_ioc_launch() : SpellScriptLoader("spell_ioc_launch") { } + + class spell_ioc_launch_SpellScript : public SpellScript + { + PrepareSpellScript(spell_ioc_launch_SpellScript); + + void HandleScript(SpellEffIndex /*effIndex*/) + { + if (Player* player = GetHitPlayer()) + player->AddAura(SPELL_LAUNCH_NO_FALLING_DAMAGE, player); // prevents falling damage + } + + void Launch() + { + WorldLocation const* const position = GetExplTargetDest(); + + if (Player* player = GetHitPlayer()) + { + player->ExitVehicle(); + + // A better research is needed + // There is no spell for this, the following calculation was based on void Spell::CalculateJumpSpeeds + + float speedZ = 10.0f; + float dist = position->GetExactDist2d(player->GetPositionX(), player->GetPositionY()); + float speedXY = dist; + + player->GetMotionMaster()->MoveJump(position->GetPositionX(), position->GetPositionY(), position->GetPositionZ(), speedXY, speedZ); + } + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_ioc_launch_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_FORCE_CAST); + AfterHit += SpellHitFn(spell_ioc_launch_SpellScript::Launch); + } + }; + + SpellScript* GetSpellScript() const override + { + return new spell_ioc_launch_SpellScript(); + } +}; + void AddSC_isle_of_conquest() { new npc_four_car_garage(); + new spell_ioc_gunship_portal(); + new spell_ioc_parachute_ic(); + new spell_ioc_launch(); } diff --git a/src/server/scripts/Northrend/zone_dalaran.cpp b/src/server/scripts/Northrend/zone_dalaran.cpp index 0897131eaf8..27d3e6dadc6 100644 --- a/src/server/scripts/Northrend/zone_dalaran.cpp +++ b/src/server/scripts/Northrend/zone_dalaran.cpp @@ -158,7 +158,7 @@ class npc_minigob_manabonk : public CreatureScript me->setActive(true); } - void Reset() + void Reset() override { me->SetVisible(false); events.ScheduleEvent(EVENT_SELECT_TARGET, IN_MILLISECONDS); @@ -188,7 +188,7 @@ class npc_minigob_manabonk : public CreatureScript CharacterDatabase.CommitTransaction(trans); } - void UpdateAI(uint32 diff) + void UpdateAI(uint32 diff) override { events.Update(diff); @@ -232,7 +232,7 @@ class npc_minigob_manabonk : public CreatureScript EventMap events; }; - CreatureAI* GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const override { return new npc_minigob_manabonkAI(creature); } diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index b75f5091ec2..1aa01d7ac7c 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -40,6 +40,7 @@ enum DeathKnightSpells SPELL_DK_BLOOD_SHIELD_ABSORB = 77535, SPELL_DK_BUTCHERY = 50163, SPELL_DK_CORPSE_EXPLOSION_TRIGGERED = 43999, + SPELL_DK_DEATH_AND_DECAY_DAMAGE = 52212, SPELL_DK_DEATH_COIL_DAMAGE = 47632, SPELL_DK_DEATH_COIL_HEAL = 47633, SPELL_DK_DEATH_STRIKE_HEAL = 45470, @@ -349,7 +350,33 @@ class spell_dk_butchery : public SpellScriptLoader } }; -// 47541, 52375, 59134, -62900 - Death Coil +class spell_dk_death_and_decay : public SpellScriptLoader +{ + public: + spell_dk_death_and_decay() : SpellScriptLoader("spell_dk_death_and_decay") { } + + class spell_dk_death_and_decay_AuraScript : public AuraScript + { + PrepareAuraScript(spell_dk_death_and_decay_AuraScript); + + void HandleDummyTick(AuraEffect const* aurEff) + { + if (Unit* caster = GetCaster()) + caster->CastCustomSpell(SPELL_DK_DEATH_AND_DECAY_DAMAGE, SPELLVALUE_BASE_POINT0, aurEff->GetAmount(), GetTarget(), true, NULL, aurEff); + } + + void Register() override + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_dk_death_and_decay_AuraScript::HandleDummyTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + } + }; + + AuraScript* GetAuraScript() const override + { + return new spell_dk_death_and_decay_AuraScript(); + } +}; + class spell_dk_death_coil : public SpellScriptLoader { public: @@ -1490,6 +1517,7 @@ void AddSC_deathknight_spell_scripts() new spell_dk_blood_boil(); new spell_dk_blood_gorged(); new spell_dk_butchery(); + new spell_dk_death_and_decay(); new spell_dk_death_coil(); new spell_dk_death_gate(); new spell_dk_death_grip(); diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 267a2f3cbf7..22a186b523b 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -1657,40 +1657,6 @@ class spell_gen_gnomish_transporter : public SpellScriptLoader } }; -class spell_gen_gunship_portal : public SpellScriptLoader -{ - public: - spell_gen_gunship_portal() : SpellScriptLoader("spell_gen_gunship_portal") { } - - class spell_gen_gunship_portal_SpellScript : public SpellScript - { - PrepareSpellScript(spell_gen_gunship_portal_SpellScript); - - bool Load() override - { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; - } - - void HandleScript(SpellEffIndex /*effIndex*/) - { - Player* caster = GetCaster()->ToPlayer(); - if (Battleground* bg = caster->GetBattleground()) - if (bg->GetTypeID(true) == BATTLEGROUND_IC) - bg->DoAction(1, caster->GetGUID()); - } - - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_gen_gunship_portal_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; - - SpellScript* GetSpellScript() const override - { - return new spell_gen_gunship_portal_SpellScript(); - } -}; - enum Interrupt { @@ -1733,58 +1699,6 @@ class spell_gen_interrupt : public SpellScriptLoader } }; -enum Launch -{ - SPELL_LAUNCH_NO_FALLING_DAMAGE = 66251 -}; - -class spell_gen_launch : public SpellScriptLoader -{ - public: - spell_gen_launch() : SpellScriptLoader("spell_gen_launch") { } - - class spell_gen_launch_SpellScript : public SpellScript - { - PrepareSpellScript(spell_gen_launch_SpellScript); - - void HandleScript(SpellEffIndex /*effIndex*/) - { - if (Player* player = GetHitPlayer()) - player->AddAura(SPELL_LAUNCH_NO_FALLING_DAMAGE, player); // prevents falling damage - } - - void Launch() - { - WorldLocation const* const position = GetExplTargetDest(); - - if (Player* player = GetHitPlayer()) - { - player->ExitVehicle(); - - // A better research is needed - // There is no spell for this, the following calculation was based on void Spell::CalculateJumpSpeeds - - float speedZ = 10.0f; - float dist = position->GetExactDist2d(player->GetPositionX(), player->GetPositionY()); - float speedXY = dist; - - player->GetMotionMaster()->MoveJump(position->GetPositionX(), position->GetPositionY(), position->GetPositionZ(), speedXY, speedZ); - } - } - - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_gen_launch_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_FORCE_CAST); - AfterHit += SpellHitFn(spell_gen_launch_SpellScript::Launch); - } - }; - - SpellScript* GetSpellScript() const override - { - return new spell_gen_launch_SpellScript(); - } -}; - class spell_gen_increase_stats_buff : public SpellScriptLoader { public: @@ -2616,39 +2530,6 @@ class spell_gen_parachute : public SpellScriptLoader } }; -enum ParachuteIC -{ - SPELL_PARACHUTE_IC = 66657 -}; - -class spell_gen_parachute_ic : public SpellScriptLoader -{ - public: - spell_gen_parachute_ic() : SpellScriptLoader("spell_gen_parachute_ic") { } - - class spell_gen_parachute_ic_AuraScript : public AuraScript - { - PrepareAuraScript(spell_gen_parachute_ic_AuraScript); - - void HandleTriggerSpell(AuraEffect const* /*aurEff*/) - { - if (Player* target = GetTarget()->ToPlayer()) - if (target->m_movementInfo.jump.fallTime > 2000) - target->CastSpell(target, SPELL_PARACHUTE_IC, true); - } - - void Register() override - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_gen_parachute_ic_AuraScript::HandleTriggerSpell, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - } - }; - - AuraScript* GetAuraScript() const override - { - return new spell_gen_parachute_ic_AuraScript(); - } -}; - enum PetSummoned { NPC_DOOMGUARD = 11859, @@ -3753,7 +3634,6 @@ void AddSC_generic_spell_scripts() new spell_gen_gadgetzan_transporter_backfire(); new spell_gen_gift_of_naaru(); new spell_gen_gnomish_transporter(); - new spell_gen_gunship_portal(); new spell_gen_increase_stats_buff("spell_pal_blessing_of_kings"); new spell_gen_increase_stats_buff("spell_pal_blessing_of_might"); new spell_gen_increase_stats_buff("spell_dru_mark_of_the_wild"); @@ -3762,7 +3642,6 @@ void AddSC_generic_spell_scripts() new spell_gen_increase_stats_buff("spell_mage_arcane_brilliance"); new spell_gen_increase_stats_buff("spell_mage_dalaran_brilliance"); new spell_gen_interrupt(); - new spell_gen_launch(); new spell_gen_lifebloom("spell_hexlord_lifebloom", SPELL_HEXLORD_MALACRASS_LIFEBLOOM_FINAL_HEAL); new spell_gen_lifebloom("spell_tur_ragepaw_lifebloom", SPELL_TUR_RAGEPAW_LIFEBLOOM_FINAL_HEAL); new spell_gen_lifebloom("spell_cenarion_scout_lifebloom", SPELL_CENARION_SCOUT_LIFEBLOOM_FINAL_HEAL); @@ -3775,7 +3654,6 @@ void AddSC_generic_spell_scripts() new spell_gen_oracle_wolvar_reputation(); new spell_gen_orc_disguise(); new spell_gen_parachute(); - new spell_gen_parachute_ic(); new spell_gen_pet_summoned(); new spell_gen_profession_research(); new spell_gen_remove_flight_auras(); diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index 8898456c0a6..c65970aed3d 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -506,7 +506,7 @@ class spell_warr_overpower : public SpellScriptLoader return; if (Player* target = GetHitPlayer()) - if (target->HasUnitState(UNIT_STATE_CASTING)) + if (target->IsNonMeleeSpellCast(false, false, true)) // UNIT_STATE_CASTING should not be used here, it's present during a tick for instant casts target->CastSpell(target, spellId, true); } diff --git a/src/server/scripts/World/areatrigger_scripts.cpp b/src/server/scripts/World/areatrigger_scripts.cpp index 4393f72eb1b..dcba4cf9573 100644 --- a/src/server/scripts/World/areatrigger_scripts.cpp +++ b/src/server/scripts/World/areatrigger_scripts.cpp @@ -236,11 +236,11 @@ class AreaTrigger_at_sholazar_waygate : public AreaTriggerScript switch (trigger->id) { case AT_SHOLAZAR: - player->CastSpell(player, SPELL_SHOLAZAR_TO_UNGORO_TELEPORT, false); + player->CastSpell(player, SPELL_SHOLAZAR_TO_UNGORO_TELEPORT, true); break; case AT_UNGORO: - player->CastSpell(player, SPELL_UNGORO_TO_SHOLAZAR_TELEPORT, false); + player->CastSpell(player, SPELL_UNGORO_TO_SHOLAZAR_TELEPORT, true); break; } } |
