diff options
author | Aqua Deus <95978183+aquadeus@users.noreply.github.com> | 2024-07-30 23:37:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-30 23:37:20 +0200 |
commit | 068d1526e0a3e5489a27341a831faa046ddf32d3 (patch) | |
tree | 7f351935d27fc0c3e8f17bd8798b706ba38cb9d2 | |
parent | 9242eda6c704ab5c10ab07763e662bb2c65b0396 (diff) |
Scripts/WaycrestManor: Implement Soulbound Goliath encounter (all difficulties) (#30074)
7 files changed, 789 insertions, 4 deletions
diff --git a/sql/updates/world/master/2024_07_30_00_world.sql b/sql/updates/world/master/2024_07_30_00_world.sql new file mode 100644 index 00000000000..af8ca89fcc9 --- /dev/null +++ b/sql/updates/world/master/2024_07_30_00_world.sql @@ -0,0 +1,85 @@ +UPDATE `creature_template` SET `faction`=16, `speed_run`=0.285714298486709594, `BaseAttackTime`=2000, `unit_flags`=33554496, `unit_flags2`=2048, `unit_flags3`=524288 WHERE `entry`=136436; -- Burning Soul +UPDATE `creature_template` SET `faction`=14, `BaseAttackTime`=2000, `unit_flags`=768, `unit_flags2`=32800, `unit_flags3`=524288, `AIName`='SmartAI' WHERE `entry`=136330; -- Soul Thorns +UPDATE `creature_template` SET `ScriptName` = 'npc_matron_bryndle' WHERE `entry`=135329; +UPDATE `creature_template` SET `ScriptName` = 'boss_soulbound_goliath' WHERE `entry`=131667; + +DELETE FROM `creature_template_addon` WHERE `entry` = 136436; +INSERT INTO `creature_template_addon` (`entry`, `PathId`, `mount`, `StandState`, `AnimTier`, `VisFlags`, `SheathState`, `PvpFlags`, `emote`, `aiAnimKit`, `movementAnimKit`, `meleeAnimKit`, `visibilityDistanceType`, `auras`) VALUES +(136436, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, '272668 272666'); -- 136436 (Burning Soul) - Burning Fists + +-- SAI +DELETE FROM `smart_scripts` WHERE `entryorguid`=136330 AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `Difficulties`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param_string`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `action_param7`, `action_param_string`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_param_string`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(136330, 0, 0, 0, '', 54, 0, 100, 0, 0, 0, 0, 0, 0, '', 85, 267912, 2, 0, 0, 0, 0, 0, NULL, 1, 0, 0, 0, 0, NULL, 0, 0, 0, 0, 'Soul Thorn - On Just Created - Self: Cast Spell 267912'), +(136330, 0, 1, 0, '', 6, 0, 100, 0, 0, 0, 0, 0, 0, '', 85, 267911, 2, 0, 0, 0, 0, 0, NULL, 1, 0, 0, 0, 0, NULL, 0, 0, 0, 0, 'Soul Thorn - On Died - Self: Cast Spell 267911'); + +-- Conditions +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=265779; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `ConditionStringValue1`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(13, 1, 265779 , 0, 0, 51, 0, 5, 131667, 0, '', 0, 0, 0, '', 'Spell \'Goliath Drain Flavor\' can only hit \'Soulbound Goliath\''); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=265743; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `ConditionStringValue1`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(13, 1, 265743, 0, 0, 51, 0, 5, 131667, 0, '', 0, 0, 0, '', 'Spell \'Goliath Drain Flavor\' can only hit \'Soulbound Goliath\''); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=278792 ; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `ConditionStringValue1`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(13, 1, 278792, 0, 0, 51, 0, 5, 136330, 0, '', 0, 0, 0, '', 'Spell \'Kill Soul Thorn\' can only hit \'Soul Thorn\''); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=265778; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `ConditionStringValue1`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(13, 1, 265778, 0, 0, 51, 0, 5, 135312, 0, '', 0, 0, 0, '', 'Spell \'Goliath Drain Flavor\' can only hit \'Goliath Drain Target Male\''), +(13, 1, 265778, 0, 1, 51, 0, 5, 135313, 0, '', 0, 0, 0, '', 'Spell \'Goliath Drain Flavor\' can only hit \'Goliath Drain Target Heavy\''), +(13, 1, 265778, 0, 2, 51, 0, 5, 135315, 0, '', 0, 0, 0, '', 'Spell \'Goliath Drain Flavor\' can only hit \'Goliath Drain Target Female\''); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=265741 ; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `ConditionStringValue1`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(13, 1, 265741, 0, 0, 51, 0, 5, 135312, 0, '', 0, 0, 0, '', 'Spell \'Goliath Drain Flavor\' can only hit \'Goliath Drain Target Male\''), +(13, 1, 265741, 0, 1, 51, 0, 5, 135313, 0, '', 0, 0, 0, '', 'Spell \'Goliath Drain Flavor\' can only hit \'Goliath Drain Target Heavy\''), +(13, 1, 265741, 0, 2, 51, 0, 5, 135315, 0, '', 0, 0, 0, '', 'Spell \'Goliath Drain Flavor\' can only hit \'Goliath Drain Target Female\''); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=260570; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `ConditionStringValue1`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(13, 2, 260570, 0, 0, 51, 0, 6, 0, 0, '', 0, 0, 0, '', 'Spell 260570 can only hit Player'); + +-- Spells +DELETE FROM `spell_script_names` WHERE `spell_id` IN (265778, 265741, 265759, 260564, 261580, 260551, 267907, 260541, 267911); +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(265778, 'spell_waycrest_manor_goliath_drain_flavor_selector'), +(265741, 'spell_waycrest_manor_drain_goliath_essence'), +(265759, 'spell_waycrest_manor_splinter_spike_selector'), +(260564, 'spell_waycrest_manor_wildfire'), +(261580, 'spell_soulbound_goliath_soul_harvest'), +(260551, 'spell_soulbound_goliath_soul_thorns_selector'), +(267907, 'spell_soulbound_goliath_soul_thorns_damage'), +(260541, 'spell_soulbound_goliath_burning_brush'), +(267911, 'spell_soulbound_goliath_soul_thorns_remove_stun'); + +-- Areatrigger +DELETE FROM `areatrigger_template` WHERE (`IsCustom`=0 AND `Id` = 17041); +INSERT INTO `areatrigger_template` (`Id`, `IsCustom`, `Flags`, `VerifiedBuild`) VALUES +(17041, 0, 0, 55261); + +DELETE FROM `areatrigger_create_properties` WHERE (`IsCustom`=0 AND `Id` = 12353); +INSERT INTO `areatrigger_create_properties` (`Id`, `IsCustom`, `AreaTriggerId`, `IsAreatriggerCustom`, `Flags`, `MoveCurveId`, `ScaleCurveId`, `MorphCurveId`, `FacingCurveId`, `AnimId`, `AnimKitId`, `DecalPropertiesId`, `TimeToTarget`, `TimeToTargetScale`, `Shape`, `ShapeData0`, `ShapeData1`, `ShapeData2`, `ShapeData3`, `ShapeData4`, `ShapeData5`, `ShapeData6`, `ShapeData7`, `ScriptName`, `VerifiedBuild`) VALUES +(12353, 0, 17041, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 15000, 0, 4, 4, 0, 0, 0, 0, 0, 0, 'at_waycrest_manor_wildfire', 55261); -- Spell: 260570 (Wildfire) + +-- Texts +DELETE FROM `creature_text` WHERE `CreatureID`=131667; +INSERT INTO `creature_text` (`CreatureID`, `GroupID`, `ID`, `Text`, `Type`, `Language`, `Probability`, `Emote`, `Duration`, `Sound`, `BroadcastTextId`, `TextRange`, `comment`) VALUES +(131667, 0, 0, 'Flee! There is no hope!', 14, 0, 50, 0, 0, 97529, 145085, 0, 'Soulbound Goliath to Player'), +(131667, 0, 1, 'Beware our torment!', 14, 0, 50, 0, 0, 97527, 145080, 0, 'Soulbound Goliath to Player'), +(131667, 1, 0, 'Together... for eternity.', 14, 0, 33, 0, 0, 97528, 145084, 0, 'Soulbound Goliath'), +(131667, 1, 1, 'There is no escape.', 14, 0, 33, 0, 0, 97530, 145089, 0, 'Soulbound Goliath'), +(131667, 1, 2, 'One of us.', 14, 0, 33, 0, 0, 97531, 145090, 0, 'Soulbound Goliath'), +(131667, 2, 0, 'Beware the thorns!', 14, 0, 50, 0, 0, 97536, 145098, 0, 'Soulbound Goliath'), +(131667, 2, 1, 'The thorns seek your soul!', 14, 0, 50, 0, 0, 97538, 145130, 0, 'Soulbound Goliath'), +(131667, 3, 0, 'Yes! Release us!', 14, 0, 50, 0, 0, 97535, 145094, 0, 'Soulbound Goliath to Soulbound Goliath'), +(131667, 3, 1, 'Fire will be its undoing!', 14, 0, 50, 0, 0, 97535, 145094, 0, 'Soulbound Goliath to Soulbound Goliath'), +(131667, 4, 0, 'Finally... free...', 14, 0, 33, 0, 0, 97533, 145092, 0, 'Soulbound Goliath to Player'), +(131667, 4, 1, 'You have... released us...', 14, 0, 33, 0, 0, 97534, 145093, 0, 'Soulbound Goliath to Player'), +(131667, 4, 2, 'Thank... you...', 14, 0, 33, 0, 0, 97532, 145091, 0, 'Soulbound Goliath to Player'), +(131667, 5, 0, '|TInterface\\Icons\\Ability_Earthen_Pillar.blp:20|t$n is trapped in |cFFF00000|Hspell:260551|h[Soul Thorns]|h|r!', 41, 0, 100, 0, 0, 0, 162151, 0, 'Soulbound Goliath to Player'), +(131667, 6, 0, '|TInterface\\ICONS\\ABILITY_DEATHKNIGHT_SOULREAPER:20|t Soulbound Goliath\'s damage increases with each stack of |cFFFF0404|Hspell:260512|h[Soul Harvest]|h|r!', 42, 0, 100, 0, 0, 0, 156331, 0, 'Soulbound Goliath to Player'); + +UPDATE `creature_template` SET `unit_flags`=`unit_flags` & ~0x00000100 WHERE `entry`=136330; -- remove UNIT_FLAG_IMMUNE_TO_PC diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index b703b228bdc..653fbac677c 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -4836,7 +4836,7 @@ void SpellMgr::LoadSpellInfoCorrections() spellEffectInfo->TargetB = SpellImplicitTargetInfo(TARGET_DEST_DEST); }); }); - // END OF SEPULCHER OF THE FIRST ONES + // ENDOF SEPULCHER OF THE FIRST ONES // // THE AZURE VAULT SPELLS @@ -4870,6 +4870,22 @@ void SpellMgr::LoadSpellInfoCorrections() // // + // WAYCREST MANOR SPELLS + // + + ApplySpellFix({ + 260566, // Wildfire Missile + 260570 // Wildfire Missile Impact + }, [](SpellInfo* spellInfo) + { + spellInfo->AttributesEx2 |= SPELL_ATTR2_IGNORE_LINE_OF_SIGHT; + spellInfo->AttributesEx9 |= SPELL_ATTR9_FORCE_DEST_LOCATION; + }); + + // ENDOF WAYCREST MANOR SPELLS + // + + // // THE WANDERING ISLE SPELLS // @@ -4900,7 +4916,7 @@ void SpellMgr::LoadSpellInfoCorrections() }); }); - // END OF THE WANDERING ISLE SPELLS + // ENDOF THE WANDERING ISLE SPELLS // // Earthquake diff --git a/src/server/scripts/KulTiras/WaycrestManor/boss_soulbound_goliath.cpp b/src/server/scripts/KulTiras/WaycrestManor/boss_soulbound_goliath.cpp new file mode 100644 index 00000000000..d08fe51c8af --- /dev/null +++ b/src/server/scripts/KulTiras/WaycrestManor/boss_soulbound_goliath.cpp @@ -0,0 +1,356 @@ +/* + * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information + * + * 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 + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "Creature.h" +#include "InstanceScript.h" +#include "Map.h" +#include "MotionMaster.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellAuraEffects.h" +#include "SpellScript.h" +#include "TaskScheduler.h" +#include "TemporarySummon.h" +#include "waycrest_manor.h" + +enum SoulboundGoliathSpells +{ + SPELL_BURNING_SOULS = 268045, + SPELL_CRUSH = 260508, + SPELL_KILL_SOUL_THORN = 278792, + SPELL_SOUL_HARVEST_PERIODIC = 261580, + SPELL_SOUL_HARVEST_DAMAGE = 260512, + SPELL_SOUL_THORNS_SELECTOR = 260551, + SPELL_SOUL_THORNS_STUN = 267907 +}; + +enum SoulboundGoliathTexts +{ + SAY_AGGRO = 0, + SAY_SLAY = 1, + SAY_THORNS = 2, + SAY_BURNING_BRUSH = 3, + SAY_DEATH = 4, + SAY_PLAYER_THORNS = 5, + SAY_SOUL_HARVEST = 6 +}; + +enum SoulboundGoliathEvents +{ + EVENT_CRUSH = 1, + EVENT_SOUL_THORNS, + EVENT_SOUL_HARVEST_WARNING +}; + +enum SoulboundGoliathMisc +{ + ANIMKIT_NONE = 0, + ANIMKIT_AWAKE = 6550 +}; + +// 131667 - Soulbound Goliath +struct boss_soulbound_goliath : public BossAI +{ + boss_soulbound_goliath(Creature* creature) : BossAI(creature, DATA_SOULBOUND_GOLIATH) { } + + void JustAppeared() override + { + if (instance->GetData(DATA_SOULBOUND_GOLIATH_INTRO) == DONE) + { + me->SetAIAnimKitId(ANIMKIT_NONE); + me->SetImmuneToPC(false); + me->SetUninteractible(false); + } + } + + void EnterEvadeMode(EvadeReason /*why*/) override + { + instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); + instance->SetBossState(DATA_SOULBOUND_GOLIATH, FAIL); + + _EnterEvadeMode(); + _DespawnAtEvade(); + } + + void JustEngagedWith(Unit* who) override + { + BossAI::JustEngagedWith(who); + + Talk(SAY_AGGRO); + instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, me, 1); + instance->SetBossState(DATA_SOULBOUND_GOLIATH, IN_PROGRESS); + + DoCastSelf(SPELL_SOUL_HARVEST_PERIODIC); + + events.ScheduleEvent(EVENT_CRUSH, 5800ms); + events.ScheduleEvent(EVENT_SOUL_THORNS, 9800ms); + events.ScheduleEvent(EVENT_SOUL_HARVEST_WARNING, 23s); + } + + void JustDied(Unit* /*killer*/) override + { + _JustDied(); + Talk(SAY_DEATH); + instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); + instance->SetBossState(DATA_SOULBOUND_GOLIATH, DONE); + } + + void DoAction(int32 actionId) override + { + switch (actionId) + { + case ACTION_SOULBOUND_GOLIATH_INTRO: + { + _scheduler.Schedule(1s + 500ms, [this](TaskContext /*task*/) + { + me->SetAIAnimKitId(ANIMKIT_NONE); + me->PlayOneShotAnimKitId(ANIMKIT_AWAKE); + me->SetImmuneToPC(false); + me->SetUninteractible(false); + }); + break; + } + default: + break; + } + } + + void KilledUnit(Unit* victim) override + { + if (!victim->IsPlayer()) + return; + + Talk(SAY_SLAY); + } + + void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override + { + if (spellInfo->Id == SPELL_BURNING_BRUSH) + Talk(SAY_BURNING_BRUSH); + } + + void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override + { + if (spellInfo->Id == SPELL_SOUL_THORNS_SELECTOR) + Talk(SAY_PLAYER_THORNS, target); + } + + void UpdateAI(uint32 diff) override + { + _scheduler.Update(diff); + + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_CRUSH: + { + DoCastVictim(SPELL_CRUSH); + events.Repeat(16200ms); + break; + } + case EVENT_SOUL_THORNS: + { + Talk(SAY_THORNS); + DoCast(SPELL_SOUL_THORNS_SELECTOR); + events.Repeat(22500ms); + break; + } + case EVENT_SOUL_HARVEST_WARNING: + { + Talk(SAY_SOUL_HARVEST); + events.Repeat(32s); + break; + } + default: + break; + } + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + } + } + +private: + TaskScheduler _scheduler; +}; + +// 261580 - Soul Harvest +class spell_soulbound_goliath_soul_harvest : public AuraScript +{ + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_SOUL_HARVEST_DAMAGE }); + } + + void HandlePeriodic(AuraEffect const* /*aurEff*/) + { + Unit* target = GetTarget(); + InstanceScript* instance = target->GetInstanceScript(); + if (!instance) + return; + + if (instance->GetBossState(DATA_SOULBOUND_GOLIATH) != IN_PROGRESS) + return; + + target->CastSpell(target, SPELL_SOUL_HARVEST_DAMAGE, true); + } + + void Register() override + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_soulbound_goliath_soul_harvest::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + } +}; + +// 260551 - Soul Thorns +class spell_soulbound_goliath_soul_thorns_selector : public SpellScript +{ + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_SOUL_THORNS_STUN }); + } + + void HandleHitTarget(SpellEffIndex /*effIndex*/) + { + GetHitUnit()->CastSpell(GetHitUnit(), SPELL_SOUL_THORNS_STUN, true); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_soulbound_goliath_soul_thorns_selector::HandleHitTarget, EFFECT_0, SPELL_EFFECT_DUMMY); + } +}; + +// 267907 - Soul Thorns +class spell_soulbound_goliath_soul_thorns_damage : public AuraScript +{ + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_KILL_SOUL_THORN }); + } + + void HandleDamage(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_DEATH) + return; + + GetTarget()->CastSpell(nullptr, SPELL_KILL_SOUL_THORN, TRIGGERED_FULL_MASK); + } + + void Register() override + { + AfterEffectRemove += AuraEffectRemoveFn(spell_soulbound_goliath_soul_thorns_damage::HandleDamage, EFFECT_2, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL); + } +}; + +// 267911 - Soul Thorns +class spell_soulbound_goliath_soul_thorns_remove_stun : public SpellScript +{ + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_SOUL_THORNS_STUN }); + } + + void HandleScript(SpellEffIndex /*effIndex*/) + { + if (TempSummon* target = GetHitUnit()->ToTempSummon()) + { + if (Unit* summoner = target->GetSummonerUnit()) + summoner->RemoveAurasDueToSpell(GetEffectValue()); + } + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_soulbound_goliath_soul_thorns_remove_stun::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + +// 260541 - Burning Brush +class spell_soulbound_goliath_burning_brush : public SpellScript +{ + void HandleScript(SpellEffIndex /*effIndex*/) + { + Creature* target = GetHitCreature(); + if (!target) + return; + + target->AttackStop(); + target->SetReactState(REACT_PASSIVE); + target->GetMotionMaster()->Clear(); + target->GetMotionMaster()->MoveRandom(2.0f); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_soulbound_goliath_burning_brush::HandleScript, EFFECT_1, SPELL_EFFECT_TRIGGER_ACTION_SET); + } +}; + +class spell_soulbound_goliath_burning_brush_aura : public AuraScript +{ + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_SOUL_HARVEST_DAMAGE, SPELL_BURNING_SOULS }); + } + + void HandlePeriodic(AuraEffect const* /*aurEff*/) + { + Unit* target = GetTarget(); + + if (AuraEffect* aurEff = target->GetAuraEffect(SPELL_SOUL_HARVEST_DAMAGE, EFFECT_0)) + aurEff->GetBase()->ModStackAmount(-7); + + if (target->GetMap()->IsHeroicOrHigher()) + target->CastSpell(target, SPELL_BURNING_SOULS, false); + } + + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + Creature* creatureTarget = GetTarget()->ToCreature(); + if (!creatureTarget) + return; + + creatureTarget->GetMotionMaster()->Clear(); + creatureTarget->SetReactState(REACT_AGGRESSIVE); + } + + void Register() override + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_soulbound_goliath_burning_brush_aura::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + AfterEffectRemove += AuraEffectRemoveFn(spell_soulbound_goliath_burning_brush_aura::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); + } +}; + +void AddSC_boss_soulbound_goliath() +{ + RegisterWaycrestManorCreatureAI(boss_soulbound_goliath); + + RegisterSpellScript(spell_soulbound_goliath_soul_harvest); + RegisterSpellScript(spell_soulbound_goliath_soul_thorns_selector); + RegisterSpellScript(spell_soulbound_goliath_soul_thorns_damage); + RegisterSpellScript(spell_soulbound_goliath_soul_thorns_remove_stun); + RegisterSpellAndAuraScriptPair(spell_soulbound_goliath_burning_brush, spell_soulbound_goliath_burning_brush_aura); +} diff --git a/src/server/scripts/KulTiras/WaycrestManor/instance_waycrest_manor.cpp b/src/server/scripts/KulTiras/WaycrestManor/instance_waycrest_manor.cpp index e322591d1e1..68d8408a039 100644 --- a/src/server/scripts/KulTiras/WaycrestManor/instance_waycrest_manor.cpp +++ b/src/server/scripts/KulTiras/WaycrestManor/instance_waycrest_manor.cpp @@ -22,7 +22,8 @@ static BossBoundaryData const boundaries = { - { DATA_HEARTSBANE_TRIAD, new BoundaryIntersectionBoundary(new ZRangeBoundary(235.0f, 243.0f), new RectangleBoundary(-618.580f, -524.305f, -188.971f, -137.363f)) }, + { DATA_HEARTSBANE_TRIAD, new BoundaryIntersectionBoundary(new ZRangeBoundary(235.0f, 243.0f), new RectangleBoundary(-618.580f, -524.305f, -188.971f, -137.363f)) }, + { DATA_SOULBOUND_GOLIATH, new BoundaryUnionBoundary(new CircleBoundary(Position(-422.13f, -258.28f), 32.0f), new RectangleBoundary(-530.650f, -446.580f, -293.130f, -227.150f)) }, { DATA_LORD_AND_LADY_WAYCREST, new ZRangeBoundary(182.5f, 192.2f) } }; @@ -31,6 +32,7 @@ ObjectData const creatureData[] = { BOSS_SISTER_BRIAR, DATA_SISTER_BRIAR }, { BOSS_SISTER_MALADY, DATA_SISTER_MALADY }, { BOSS_SISTER_SOLENA, DATA_SISTER_SOLENA }, + { BOSS_SOULBOUND_GOLIATH, DATA_SOULBOUND_GOLIATH }, { BOSS_LADY_WAYCREST, DATA_LADY_WAYCREST }, { BOSS_LORD_WAYCREST, DATA_LORD_WAYCREST }, { 0, 0 } // END @@ -67,7 +69,36 @@ public: LoadDoorData(doorData); LoadBossBoundaries(boundaries); LoadDungeonEncounterData(encounters); + + _soulboundGoliathIntroState = NOT_STARTED; + } + + uint32 GetData(uint32 dataId) const override + { + switch (dataId) + { + case DATA_SOULBOUND_GOLIATH_INTRO: + return _soulboundGoliathIntroState; + default: + break; + } + return 0; } + + void SetData(uint32 dataId, uint32 value) override + { + switch (dataId) + { + case DATA_SOULBOUND_GOLIATH_INTRO: + _soulboundGoliathIntroState = value; + break; + default: + break; + } + } + + private: + uint8 _soulboundGoliathIntroState; }; InstanceScript* GetInstanceScript(InstanceMap* map) const override diff --git a/src/server/scripts/KulTiras/WaycrestManor/waycrest_manor.cpp b/src/server/scripts/KulTiras/WaycrestManor/waycrest_manor.cpp new file mode 100644 index 00000000000..d220f0d25c5 --- /dev/null +++ b/src/server/scripts/KulTiras/WaycrestManor/waycrest_manor.cpp @@ -0,0 +1,281 @@ +/* + * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information + * + * 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 + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "AreaTrigger.h" +#include "AreaTriggerAI.h" +#include "Creature.h" +#include "InstanceScript.h" +#include "ObjectAccessor.h" +#include "Player.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellAuraEffects.h" +#include "SpellScript.h" +#include "waycrest_manor.h" + +enum WaycrestManorSpells +{ + // Matron Bryndle + SPELL_GOLIATH_DRAIN_FLAVOR_PERIODIC = 265777, + SPELL_GOLIATH_DRAIN_FLAVOR = 265779, + SPELL_DRAIN_GOLIATH_ESSENCE = 265741, + SPELL_DRAIN_GOLIATH_ESSENCE_AREA = 265743, + SPELL_SPLINTER_SPIKE_MISSILE = 265758, + SPELL_SPLINTER_SPIKE_SELECTOR = 265759, + SPELL_THORNED_BARRAGE = 265760, + SPELL_WILDFIRE_MISSILE = 260566, + SPELL_WILDFIRE_DAMAGE = 260569, + SPELL_WILDFIRE_DAMAGE_NPC = 273294 +}; + +enum WaycrestManorEvents +{ + // Matron Bryndle + EVENT_SPLINTER_SPIKE = 1, + EVENT_THORNED_BARRAGE +}; + +// 135329 - Matron Bryndle +struct npc_matron_bryndle : public ScriptedAI +{ + npc_matron_bryndle(Creature* creature) : ScriptedAI(creature) { } + + void JustAppeared() override + { + DoCast(SPELL_GOLIATH_DRAIN_FLAVOR_PERIODIC); + } + + void JustReachedHome() override + { + DoCast(SPELL_GOLIATH_DRAIN_FLAVOR_PERIODIC); + } + + void JustEngagedWith(Unit* /*who*/) override + { + InstanceScript* instance = me->GetInstanceScript(); + if (instance->GetData(DATA_SOULBOUND_GOLIATH_INTRO) != DONE) + { + me->RemoveAurasDueToSpell(SPELL_GOLIATH_DRAIN_FLAVOR_PERIODIC); + DoCast(SPELL_DRAIN_GOLIATH_ESSENCE); + + if (Creature* soulboundGoliath = instance->GetCreature(DATA_SOULBOUND_GOLIATH)) + soulboundGoliath->AI()->DoAction(ACTION_SOULBOUND_GOLIATH_INTRO); + + instance->SetData(DATA_SOULBOUND_GOLIATH_INTRO, DONE); + } + + _events.ScheduleEvent(EVENT_SPLINTER_SPIKE, 4500ms); + _events.ScheduleEvent(EVENT_THORNED_BARRAGE, 8200ms); + } + + void UpdateAI(uint32 diff) override + { + if (!UpdateVictim()) + return; + + _events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + switch (_events.ExecuteEvent()) + { + case EVENT_SPLINTER_SPIKE: + { + DoCast(SPELL_SPLINTER_SPIKE_SELECTOR); + _events.Repeat(24300ms); + break; + } + case EVENT_THORNED_BARRAGE: + { + DoCast(SPELL_THORNED_BARRAGE); + _events.Repeat(12100ms); + break; + } + default: + break; + } + } + +private: + EventMap _events; +}; + +// 265778 - Goliath Drain Flavor +class spell_waycrest_manor_goliath_drain_flavor_selector : public SpellScript +{ + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_GOLIATH_DRAIN_FLAVOR }); + } + + void HandleHitTarget(SpellEffIndex /*effIndex*/) + { + GetHitUnit()->CastSpell(GetHitUnit(), SPELL_GOLIATH_DRAIN_FLAVOR, true); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_waycrest_manor_goliath_drain_flavor_selector::HandleHitTarget, EFFECT_0, SPELL_EFFECT_DUMMY); + } +}; + +// 265741 - Drain Goliath Essence +class spell_waycrest_manor_drain_goliath_essence : public SpellScript +{ + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_DRAIN_GOLIATH_ESSENCE_AREA }); + } + + void HandleHitTarget(SpellEffIndex /*effIndex*/) + { + GetHitUnit()->CastSpell(GetHitUnit(), SPELL_DRAIN_GOLIATH_ESSENCE_AREA, true); + + if (Creature* hitCreature = GetHitCreature()) + hitCreature->DespawnOrUnsummon(); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_waycrest_manor_drain_goliath_essence::HandleHitTarget, EFFECT_0, SPELL_EFFECT_DUMMY); + } +}; + +// 265759 - Splinter Spike +class spell_waycrest_manor_splinter_spike_selector : public SpellScript +{ + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_SPLINTER_SPIKE_MISSILE }); + } + + void HandleHitTarget(SpellEffIndex /*effIndex*/) + { + GetCaster()->CastSpell(GetHitUnit(), SPELL_SPLINTER_SPIKE_MISSILE, true); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_waycrest_manor_splinter_spike_selector::HandleHitTarget, EFFECT_0, SPELL_EFFECT_DUMMY); + } +}; + +// 260564 - Wildfire +class spell_waycrest_manor_wildfire : public AuraScript +{ + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_WILDFIRE_MISSILE }); + } + + Position GetRandomPositionInCircle() + { + static constexpr Position CircleCenterPos = { -422.13f, -258.28f, 233.8286f, 0.0f }; + + Position randomPos = CircleCenterPos; + GetTarget()->MovePosition(randomPos, 30.0f * rand_norm(), rand_norm() * static_cast<float>(2 * M_PI)); + + return randomPos; + } + + Position GetRandomPositionInRectangle() + { + static constexpr Position RectTopRight = { -452.514f, -244.098f }; + static constexpr Position RectBottomLeft = { -529.758f, -277.167f }; + + float x = frand(RectBottomLeft.GetPositionX(), RectTopRight.GetPositionX()); + float y = frand(RectBottomLeft.GetPositionY(), RectTopRight.GetPositionY()); + float z = GetTarget()->GetPositionZ(); + + GetTarget()->UpdateGroundPositionZ(x, y, z); + + return Position(x, y, z); + } + + void HandlePeriodic(AuraEffect const* aurEff) + { + if (aurEff->GetTickNumber() % 6 == 0) + GetTarget()->CastSpell(roll_chance_i(50) ? GetRandomPositionInCircle() : GetRandomPositionInRectangle(), SPELL_WILDFIRE_MISSILE, TRIGGERED_FULL_MASK); + } + + void Register() override + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_waycrest_manor_wildfire::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + } +}; + +// 17041 - Wildfire (260570) +struct at_waycrest_manor_wildfire : AreaTriggerAI +{ + at_waycrest_manor_wildfire(AreaTrigger* areatrigger) : AreaTriggerAI(areatrigger) { } + + void OnUnitEnter(Unit* unit) override + { + if (Player* player = unit->ToPlayer()) + { + if (!player->IsGameMaster()) + unit->CastSpell(unit, SPELL_WILDFIRE_DAMAGE, true); + } + else + { + if (!unit->IsInCombat()) + return; + + if (unit->GetEntry() == BOSS_SOULBOUND_GOLIATH) + { + if (unit->HasAura(SPELL_BURNING_BRUSH)) + return; + + unit->CastSpell(unit, SPELL_BURNING_BRUSH, true); + } + else + unit->CastSpell(unit, SPELL_WILDFIRE_DAMAGE_NPC, true); + } + } + + void OnUnitExit(Unit* unit) override + { + unit->RemoveAurasDueToSpell(SPELL_WILDFIRE_DAMAGE); + unit->RemoveAurasDueToSpell(SPELL_WILDFIRE_DAMAGE_NPC); + } + + void OnRemove() override + { + for (ObjectGuid const& guid : at->GetInsideUnits()) + { + Unit* unit = ObjectAccessor::GetUnit(*at, guid); + if (!unit) + continue; + + OnUnitExit(unit); + } + } +}; + +void AddSC_waycrest_manor() +{ + // Matron Bryndle + RegisterWaycrestManorCreatureAI(npc_matron_bryndle); + + RegisterSpellScript(spell_waycrest_manor_goliath_drain_flavor_selector); + RegisterSpellScript(spell_waycrest_manor_drain_goliath_essence); + RegisterSpellScript(spell_waycrest_manor_splinter_spike_selector); + RegisterSpellScript(spell_waycrest_manor_wildfire); + + RegisterAreaTriggerAI(at_waycrest_manor_wildfire); +} diff --git a/src/server/scripts/KulTiras/WaycrestManor/waycrest_manor.h b/src/server/scripts/KulTiras/WaycrestManor/waycrest_manor.h index 549ed881f43..15b5925fe1a 100644 --- a/src/server/scripts/KulTiras/WaycrestManor/waycrest_manor.h +++ b/src/server/scripts/KulTiras/WaycrestManor/waycrest_manor.h @@ -39,7 +39,9 @@ enum WaycrestManorDataTypes DATA_SISTER_SOLENA, DATA_LADY_WAYCREST, - DATA_LORD_WAYCREST + DATA_LORD_WAYCREST, + + DATA_SOULBOUND_GOLIATH_INTRO }; enum WaycrestManorCreatureIds @@ -63,6 +65,16 @@ enum WaycrestManorGameObjectIds GO_WAYCREST_ORGAN_BARRIER = 297809 }; +enum WaycrestManorSharedActions +{ + ACTION_SOULBOUND_GOLIATH_INTRO = 1 +}; + +enum WaycrestManorSharedSpells +{ + SPELL_BURNING_BRUSH = 260541 +}; + template <class AI, class T> inline AI* GetWaycrestManorAI(T* obj) { diff --git a/src/server/scripts/KulTiras/kultiras_script_loader.cpp b/src/server/scripts/KulTiras/kultiras_script_loader.cpp index c83ba5a781a..78f622da060 100644 --- a/src/server/scripts/KulTiras/kultiras_script_loader.cpp +++ b/src/server/scripts/KulTiras/kultiras_script_loader.cpp @@ -21,8 +21,10 @@ void AddSC_zone_boralus(); // Waycrest Manor void AddSC_boss_heartsbane_triad(); +void AddSC_boss_soulbound_goliath(); void AddSC_boss_lord_and_lady_waycrest(); void AddSC_instance_waycrest_manor(); +void AddSC_waycrest_manor(); // The name of this function should match: // void Add${NameOfDirectory}Scripts() @@ -32,6 +34,8 @@ void AddKulTirasScripts() // Waycrest Manor AddSC_boss_heartsbane_triad(); + AddSC_boss_soulbound_goliath(); AddSC_boss_lord_and_lady_waycrest(); AddSC_instance_waycrest_manor(); + AddSC_waycrest_manor(); } |