mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 10:26:28 +01:00
Scripts/Drustvar: Added combat script for Helena Gentle (#30802)
This commit is contained in:
27
sql/updates/world/master/2025_04_01_02_world.sql
Normal file
27
sql/updates/world/master/2025_04_01_02_world.sql
Normal file
@@ -0,0 +1,27 @@
|
||||
SET @CGUID := 7001780;
|
||||
|
||||
-- Creature
|
||||
DELETE FROM `creature` WHERE `guid` = @CGUID+0;
|
||||
INSERT INTO `creature` (`guid`, `id`, `map`, `zoneId`, `areaId`, `spawnDifficulties`, `PhaseId`, `PhaseGroup`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `wander_distance`, `currentwaypoint`, `MovementType`, `npcflag`, `unit_flags`, `unit_flags2`, `unit_flags3`, `VerifiedBuild`) VALUES
|
||||
(@CGUID+0, 124953, 1643, 8721, 9033, '0', 0, 0, 0, 0, 187.4895782470703125, 1987.69970703125, 101.0208892822265625, 3.432718276977539062, 120, 0, 0, 0, NULL, NULL, NULL, NULL, 59888); -- Helena Gentle (Area: Shrouded Foothills - Difficulty: 0) CreateObject2
|
||||
|
||||
-- Template
|
||||
UPDATE `creature_template` SET `AIName` = '', `ScriptName` = 'npc_helena_gentle_witch_hunt' WHERE `entry` = 124953;
|
||||
|
||||
UPDATE `gameobject_template` SET `ContentTuningId`=187, `VerifiedBuild`=59888 WHERE `entry`=272422; -- Gentle's Spellbook
|
||||
|
||||
-- Difficulty
|
||||
UPDATE `creature_template_difficulty` SET `StaticFlags1`=0x10000000, `VerifiedBuild`=59888 WHERE (`Entry`=124953 AND `DifficultyID`=0); -- 124953 (Helena Gentle) - CanSwim
|
||||
UPDATE `creature_template_difficulty` SET `StaticFlags1`=0x10000000, `VerifiedBuild`=59888 WHERE (`Entry`=128347 AND `DifficultyID`=0); -- 128347 (Hexbound Snarler) - CanSwim
|
||||
|
||||
-- Creature Text
|
||||
DELETE FROM `creature_text` WHERE `CreatureID` = 124953;
|
||||
INSERT INTO `creature_text` (`CreatureID`, `GroupID`, `ID`, `Text`, `Type`, `Language`, `Probability`, `Emote`, `Duration`, `Sound`, `BroadcastTextId`, `TextRange`, `comment`) VALUES
|
||||
(124953, 0, 0, 'I will show you the coven\'s power!', 12, 0, 100, 0, 0, 97672, 133717, 0, 'Helena Gentle'),
|
||||
(124953, 1, 0, 'Our power is ancient. You will fall!', 12, 0, 100, 0, 0, 97673, 133718, 0, 'Helena Gentle'),
|
||||
(124953, 2, 0, 'You cannot stop... my curse...', 12, 0, 100, 0, 0, 97674, 133719, 0, 'Helena Gentle to Player');
|
||||
|
||||
-- Target condition
|
||||
DELETE FROM `conditions` WHERE (`SourceTypeOrReferenceId` = 13) AND (`SourceEntry` IN (257877));
|
||||
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `ConditionStringValue1`, `NegativeCondition`, `Comment`) VALUES
|
||||
(13, 1, 257877, 0, 0, 51, 0, 5, 128347, 0, '', 0, 'Potential target of the spell is TYPEID_UNIT, entry is 128347');
|
||||
@@ -15,16 +15,30 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "CreatureAI.h"
|
||||
#include "CreatureAIImpl.h"
|
||||
#include "Player.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "TemporarySummon.h"
|
||||
|
||||
enum WitchHuntData
|
||||
{
|
||||
NPC_HELENA_GENTLE_HUMAN = 124922,
|
||||
NPC_HELENA_GENTLE_HUMAN = 124922,
|
||||
NPC_HEXBOUND_SNARLER = 128347,
|
||||
|
||||
SPELL_TAKE_A_SEAT_CURSED = 248423
|
||||
SAY_HELENA_AGGRO = 0,
|
||||
SAY_HELENA_HALF_LIFE = 1,
|
||||
SAY_HELENA_DEATH = 2,
|
||||
|
||||
EVENT_HELENA_RUINED_BOLT = 1,
|
||||
EVENT_HELENA_SUMMON_ALIVE,
|
||||
EVENT_HELENA_SUMMON_ATTACK,
|
||||
|
||||
SPELL_TAKE_A_SEAT_CURSED = 248423,
|
||||
SPELL_HELENA_EMPOWERING = 257877,
|
||||
SPELL_HELENA_RUINED_BOLT = 256865
|
||||
};
|
||||
|
||||
// EventID: 59332
|
||||
@@ -45,8 +59,140 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
constexpr Position HelenaPetSummonPos = { 181.513885f, 1987.2222f, 101.9137f, 1.667730f };
|
||||
|
||||
// 124953 - Helena Gentle
|
||||
struct npc_helena_gentle_witch_hunt : public ScriptedAI
|
||||
{
|
||||
npc_helena_gentle_witch_hunt(Creature* creature) : ScriptedAI(creature), _halfLifeTriggered(false) { }
|
||||
|
||||
void JustAppeared() override
|
||||
{
|
||||
_oocScheduler.Schedule(0ms, [this](TaskContext context)
|
||||
{
|
||||
if (Creature* hexboundSnarler = me->FindNearestCreatureWithOptions(50.0f, { .CreatureId = NPC_HEXBOUND_SNARLER, .StringId = "HelenaSummon", .IsAlive = FindCreatureAliveState::Alive }))
|
||||
{
|
||||
if (!hexboundSnarler->IsInCombat())
|
||||
_hexboundSnarlerGuid = hexboundSnarler->GetGUID();
|
||||
else
|
||||
context.Repeat(1s);
|
||||
}
|
||||
else
|
||||
SummonHexboundSnarler();
|
||||
});
|
||||
}
|
||||
|
||||
void Reset() override
|
||||
{
|
||||
_halfLifeTriggered = false;
|
||||
_events.Reset();
|
||||
_oocScheduler.CancelAll();
|
||||
}
|
||||
|
||||
void JustEngagedWith(Unit* who) override
|
||||
{
|
||||
Talk(SAY_HELENA_AGGRO);
|
||||
_events.ScheduleEvent(EVENT_HELENA_RUINED_BOLT, 9s);
|
||||
_events.ScheduleEvent(EVENT_HELENA_SUMMON_ALIVE, 1s);
|
||||
|
||||
_oocScheduler.CancelAll();
|
||||
|
||||
if (Creature* hexboundSnarler = ObjectAccessor::GetCreature(*me, _hexboundSnarlerGuid))
|
||||
hexboundSnarler->AI()->AttackStart(who);
|
||||
}
|
||||
|
||||
void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
|
||||
{
|
||||
if (!_halfLifeTriggered && me->HealthBelowPctDamaged(50, damage))
|
||||
{
|
||||
Talk(SAY_HELENA_HALF_LIFE);
|
||||
_halfLifeTriggered = true;
|
||||
}
|
||||
}
|
||||
|
||||
void EnterEvadeMode(EvadeReason /*why*/) override
|
||||
{
|
||||
me->DespawnOrUnsummon(0ms, 1min);
|
||||
|
||||
if (Creature* hexboundSnarler = ObjectAccessor::GetCreature(*me, _hexboundSnarlerGuid))
|
||||
hexboundSnarler->DespawnOrUnsummon();
|
||||
}
|
||||
|
||||
void JustDied(Unit* /*killer*/) override
|
||||
{
|
||||
Talk(SAY_HELENA_DEATH);
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
{
|
||||
_oocScheduler.Update(diff);
|
||||
return;
|
||||
}
|
||||
|
||||
_events.Update(diff);
|
||||
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING))
|
||||
return;
|
||||
|
||||
while (uint32 eventId = _events.ExecuteEvent())
|
||||
{
|
||||
switch (eventId)
|
||||
{
|
||||
case EVENT_HELENA_RUINED_BOLT:
|
||||
DoCastVictim(SPELL_HELENA_RUINED_BOLT);
|
||||
_events.ScheduleEvent(EVENT_HELENA_RUINED_BOLT, 9s);
|
||||
break;
|
||||
case EVENT_HELENA_SUMMON_ALIVE:
|
||||
if (Creature* hexboundSnarler = ObjectAccessor::GetCreature(*me, _hexboundSnarlerGuid))
|
||||
{
|
||||
hexboundSnarler->SetAIAnimKitId(0);
|
||||
hexboundSnarler->PlayOneShotAnimKitId(1099);
|
||||
_events.ScheduleEvent(EVENT_HELENA_SUMMON_ATTACK, 2s);
|
||||
}
|
||||
break;
|
||||
case EVENT_HELENA_SUMMON_ATTACK:
|
||||
if (Creature* hexboundSnarler = ObjectAccessor::GetCreature(*me, _hexboundSnarlerGuid))
|
||||
{
|
||||
hexboundSnarler->SetImmuneToAll(false);
|
||||
hexboundSnarler->SetUninteractible(false);
|
||||
hexboundSnarler->SetReactState(REACT_AGGRESSIVE);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SummonHexboundSnarler()
|
||||
{
|
||||
if (TempSummon* hexboundSnarler = me->SummonCreature(NPC_HEXBOUND_SNARLER, HelenaPetSummonPos))
|
||||
{
|
||||
me->CastSpell(hexboundSnarler, SPELL_HELENA_EMPOWERING);
|
||||
|
||||
_hexboundSnarlerGuid = hexboundSnarler->GetGUID();
|
||||
hexboundSnarler->SetScriptStringId("HelenaSummon");
|
||||
hexboundSnarler->SetAIAnimKitId(730);
|
||||
hexboundSnarler->SetReactState(REACT_PASSIVE);
|
||||
hexboundSnarler->SetImmuneToAll(true);
|
||||
hexboundSnarler->SetUninteractible(true);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
EventMap _events;
|
||||
TaskScheduler _oocScheduler;
|
||||
ObjectGuid _hexboundSnarlerGuid;
|
||||
bool _halfLifeTriggered;
|
||||
};
|
||||
|
||||
void AddSC_drustvar_chapter_1_the_final_effigy()
|
||||
{
|
||||
// Creature
|
||||
RegisterCreatureAI(npc_helena_gentle_witch_hunt);
|
||||
|
||||
// EventScripts
|
||||
new event_listen_to_helenas_story();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user