Merge branch 'master' into Playerbot

This commit is contained in:
Yunfan Li
2023-06-06 00:07:04 +08:00
19 changed files with 269 additions and 138 deletions

View File

@@ -1,6 +1,6 @@
-- DB update 2023_05_28_02 -> 2023_05_28_03
--
DELETE FROM `smart_scripts` WHERE (`entryorguid` IN (-151090,-151091,-151092,-151093)) AND (`source_type` = 0) AND (`id` IN (0));
DELETE FROM `smart_scripts` WHERE (`entryorguid` IN (-151090,-151091,-151092,-151093)) AND (`source_type` = 0) AND (`id` IN (1000));
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
(-151090, 0, 1000, 0, 11, 0, 100, 0, 0, 0, 0, 0, 0, 18, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Hack: Fel Orc Convert - On Respawn - Set Flags Not Attackable'),
(-151091, 0, 1000, 0, 11, 0, 100, 0, 0, 0, 0, 0, 0, 18, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Hack: Fel Orc Convert - On Respawn - Set Flags Not Attackable'),

View File

@@ -0,0 +1,8 @@
-- DB update 2023_06_01_06 -> 2023_06_02_00
--
DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` = 17160);
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
(17160, 0, 0, 0, 23, 0, 100, 0, 12550, 0, 10000, 10000, 0, 11, 12550, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Living Cyclone - On Missing Aura - Cast Lightning Shield'),
(17160, 0, 1, 0, 9, 0, 100, 0, 8, 40, 10000, 15000, 0, 11, 31705, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Living Cyclone - On Range - Cast Magnetic Pull');
DELETE FROM `smart_scripts` WHERE (`entryorguid` = 19996) AND (`source_type` = 0) AND (`id` IN (1));

View File

@@ -0,0 +1,6 @@
-- DB update 2023_06_02_00 -> 2023_06_02_01
-- Tavernkeep Smitts
UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=273;
DELETE FROM `smart_scripts` WHERE `entryorguid`=273 AND `source_type`=0;
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
(273,0,0,0,1,0,100,0,45000,60000,150000,180000,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Tavernkeep Smitts - Out of Combat - Say Line 0');

View File

@@ -0,0 +1,5 @@
-- DB update 2023_06_02_01 -> 2023_06_02_02
UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=346;
DELETE FROM `smart_scripts` WHERE `entryorguid`=346;
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
(346,0,0,0,1,0,100,0,1000,15000,150000,180000,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Barkeep Daniels - Out of Combat - Say Line 0');

View File

@@ -0,0 +1,3 @@
-- DB update 2023_06_02_02 -> 2023_06_02_03
-- guid 96761 is id 25580 aka old man barlo
UPDATE `creature` SET `position_x` = -1460.62, `position_y` = 4992.52, `position_z` = -8.977667, `orientation` = 5.532693862915039062 WHERE `guid` = 96761 AND `id1` = 25580;

View File

@@ -0,0 +1,3 @@
-- DB update 2023_06_02_03 -> 2023_06_02_04
--
UPDATE `creature_template` SET `mingold` = 0, `maxgold` = 0 WHERE `entry` = 16470;

View File

@@ -0,0 +1,4 @@
-- DB update 2023_06_02_04 -> 2023_06_02_05
--
-- remove Sha\'tar reputation gain from Restless Skeletons
DELETE FROM `creature_onkill_reputation` WHERE `creature_id` = 17261;

View File

@@ -0,0 +1,5 @@
-- DB update 2023_06_02_05 -> 2023_06_02_06
--
DELETE FROM `conditions` WHERE (`SourceTypeOrReferenceId` = 17) AND (`SourceGroup` = 0) AND (`SourceEntry` = 38915) AND (`SourceId` = 0) AND (`ElseGroup` = 0) AND (`ConditionTypeOrReference` = 31) AND (`ConditionTarget` = 1) AND (`ConditionValue1` = 3) AND (`ConditionValue2` = 16943) AND (`ConditionValue3` = 0);
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
(17, 0, 38915, 0, 0, 31, 1, 3, 16943, 0, 0, 0, 0, '', 'Controls a Mo\'arg at Forge Base: Gehenna.');

View File

@@ -0,0 +1,4 @@
-- DB update 2023_06_02_06 -> 2023_06_02_07
DELETE FROM `creature_template_movement` WHERE `creatureId` = 20687;
INSERT INTO `creature_template_movement` (`CreatureId`, `Flight`, `Rooted`) VALUES
(20687, 1, 1);

View File

@@ -0,0 +1,2 @@
-- DB update 2023_06_02_07 -> 2023_06_02_08
UPDATE `creature_template` SET `flags_extra` = `flags_extra`|1073741824 WHERE (`entry` IN (20898, 21598));

View File

@@ -0,0 +1,3 @@
-- DB update 2023_06_02_08 -> 2023_06_02_09
--
UPDATE `creature` SET `position_x` = -7195.0405, `position_y` = -2979.6877, `position_z` = 9.052029, `orientation` = 5.340707302093505859 WHERE `guid` = 51829 AND `id1` = 8200;

View File

@@ -0,0 +1,79 @@
-- DB update 2023_06_02_09 -> 2023_06_05_00
--
DELETE FROM `holiday_dates` WHERE `id` IN (374, 375, 376);
INSERT INTO `holiday_dates` (`id`, `date_id`, `date_value`) VALUES
(374, 1 , 391135232),
(374, 2 , 394264576),
(374, 3 , 397410304),
(374, 4 , 404750336),
(374, 5 , 407339008),
(374, 6 , 410468352),
(374, 7 , 413597696),
(374, 8 , 420921344),
(374, 9 , 424099840),
(374, 10, 427884544),
(374, 11, 431030272),
(374, 12, 437682176),
(374, 13, 441516032),
(374, 14, 444645376),
(374, 15, 447791104),
(374, 16, 455147520),
(374, 17, 458276864),
(374, 18, 461406208),
(374, 19, 464551936),
(374, 20, 471891968),
(374, 21, 475021312),
(374, 22, 478150656),
(374, 23, 481296384),
(374, 24, 488652800),
(374, 25, 491782144),
(375, 1 , 391593984),
(375, 2 , 395395072),
(375, 3 , 402718720),
(375, 4 , 405864448),
(375, 5 , 409010176),
(375, 6 , 412139520),
(375, 7 , 419463168),
(375, 8 , 422625280),
(375, 9 , 425771008),
(375, 10, 428900352),
(375, 11, 436224000),
(375, 12, 439386112),
(375, 13, 442531840),
(375, 14, 445661184),
(375, 15, 452984832),
(375, 16, 456146944),
(375, 17, 459292672),
(375, 18, 462422016),
(375, 19, 469778432),
(375, 20, 472924160),
(375, 21, 476069888),
(375, 22, 479199232),
(375, 23, 486604800),
(375, 24, 489111552),
(375, 25, 492240896),
(376, 1 , 393265152),
(376, 2 , 396394496),
(376, 3 , 403718144),
(376, 4 , 406880256),
(376, 5 , 410009600),
(376, 6 , 413138944),
(376, 7 , 419921920),
(376, 8 , 423641088),
(376, 9 , 426770432),
(376, 10, 429359104),
(376, 11, 436682752),
(376, 12, 440401920),
(376, 13, 442990592),
(376, 14, 446119936),
(376, 15, 454098944),
(376, 16, 456605696),
(376, 17, 459751424),
(376, 18, 463536128),
(376, 19, 470859776),
(376, 20, 474021888),
(376, 21, 477151232),
(376, 22, 480280576),
(376, 23, 487604224),
(376, 24, 490782720),
(376, 25, 493912064);

View File

@@ -0,0 +1,34 @@
-- DB update 2023_06_05_00 -> 2023_06_05_01
-- Archaedas (Uldaman) SAI
DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` = 2748);
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
(2748, 0, 0, 0, 25, 0, 100, 0, 0, 0, 0, 0, 0, 11, 10255, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Archaedas - On Reset - Cast Stoned'),
(2748, 0, 1, 2, 38, 0, 100, 0, 1, 1, 0, 0, 0, 11, 10347, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Archaedas - On Data Set - Cast Archaedas Awaken Visual (DND)'),
(2748, 0, 2, 0, 61, 0, 100, 512, 0, 0, 0, 0, 0, 67, 1, 4000, 4000, 0, 0, 100, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Archaedas - On Data Set - Create Timed Event'),
(2748, 0, 3, 4, 59, 0, 100, 512, 1, 0, 0, 0, 0, 28, 10255, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Archaedas - On Timed Event - Remove Aura Stoned'),
(2748, 0, 4, 0, 61, 0, 100, 512, 0, 0, 0, 0, 0, 49, 0, 0, 0, 0, 0, 0, 21, 80, 0, 0, 0, 0, 0, 0, 0, 'Archaedas - On Timed Event - Attack Start'),
(2748, 0, 5, 0, 4, 0, 100, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Archaedas - On Aggro - Say Line 0'),
(2748, 0, 6, 0, 5, 0, 100, 0, 5000, 5000, 0, 0, 0, 1, 3, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Archaedas - On Kill - Say Line 3'),
(2748, 0, 7, 8, 2, 0, 100, 1, 0, 70, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Archaedas - Health Between 0-70% - Say Line 1'),
(2748, 0, 8, 0, 61, 0, 100, 0, 0, 0, 0, 0, 0, 11, 10252, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Archaedas - Health Between 0-70% - Cast Awaken Earthen Guardian'),
(2748, 0, 9, 10, 2, 0, 100, 1, 0, 40, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Archaedas - Health Between 0-40% - Say Line 2'),
(2748, 0, 10, 0, 61, 0, 100, 0, 0, 0, 0, 0, 0, 11, 10258, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Archaedas - Health Between 0-40% - Cast Awaken Vault Warder'),
(2748, 0, 11, 0, 0, 0, 100, 0, 10000, 10000, 10000, 10000, 0, 11, 10259, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Archaedas - In Combat - Awaken Earthen Dwarf'),
(2748, 0, 12, 0, 0, 0, 100, 0, 0, 10000, 14000, 20000, 0, 11, 6524, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Archaedas - In Combat - Cast Ground Tremor'),
(2748, 0, 13, 14, 60, 0, 100, 769, 1000, 1000, 0, 0, 0, 64, 1, 0, 0, 0, 0, 0, 11, 7076, 100, 0, 0, 0, 0, 0, 0, 'Archaedas - On Update - Store Target List (Earthen Guardian)'),
(2748, 0, 14, 15, 61, 0, 100, 512, 0, 0, 0, 0, 0, 64, 2, 0, 0, 0, 0, 0, 11, 10120, 100, 0, 0, 0, 0, 0, 0, 'Archaedas - On Update - Store Target List (Vault Warder)'),
(2748, 0, 15, 16, 61, 0, 100, 512, 0, 0, 0, 0, 0, 64, 3, 0, 0, 0, 0, 0, 11, 7077, 100, 0, 0, 0, 0, 0, 0, 'Archaedas - On Update - Store Target List (Earthen Hellshaper)'),
(2748, 0, 16, 0, 61, 0, 100, 512, 0, 0, 0, 0, 0, 64, 4, 0, 0, 0, 0, 0, 11, 7309, 100, 0, 0, 0, 0, 0, 0, 'Archaedas - On Update - Store Target List (Earthen Custodian)'),
(2748, 0, 17, 18, 25, 0, 100, 512, 0, 0, 0, 0, 0, 70, 0, 0, 0, 0, 0, 0, 12, 1, 0, 0, 0, 0, 0, 0, 0, 'Archaedas - On Reset - Respawn Target'),
(2748, 0, 18, 19, 61, 0, 100, 512, 0, 0, 0, 0, 0, 70, 0, 0, 0, 0, 0, 0, 12, 2, 0, 0, 0, 0, 0, 0, 0, 'Archaedas - On Reset - Respawn Target'),
(2748, 0, 19, 20, 61, 0, 100, 512, 0, 0, 0, 0, 0, 70, 0, 0, 0, 0, 0, 0, 12, 3, 0, 0, 0, 0, 0, 0, 0, 'Archaedas - On Reset - Respawn Target'),
(2748, 0, 20, 0, 61, 0, 100, 512, 0, 0, 0, 0, 0, 70, 0, 0, 0, 0, 0, 0, 12, 4, 0, 0, 0, 0, 0, 0, 0, 'Archaedas - On Reset - Respawn Target'),
(2748, 0, 21, 0, 21, 0, 100, 512, 0, 0, 0, 0, 0, 34, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Archaedas - Just Reached Home - Set Instance Data'),
(2748, 0, 22, 23, 6, 0, 100, 512, 0, 0, 0, 0, 0, 34, 2, 3, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Archaedas - On Death - Set Instance Data'),
(2748, 0, 23, 25, 61, 0, 100, 512, 0, 0, 0, 0, 0, 11, 10604, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Archaedas - On Death - Cast Destroy Earthen Guards'),
(2748, 0, 24, 0, 31, 0, 100, 512, 10604, 0, 0, 0, 0, 41, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 'Archaedas - Spell Hit Target - Despawn'),
(2748, 0, 25, 26, 61, 0, 100, 512, 0, 0, 0, 0, 0, 41, 0, 0, 0, 0, 0, 0, 9, 10120, 0, 100, 0, 0, 0, 0, 0, 'Archaedas - On Just Died - Despawn Vault Warders'),
(2748, 0, 26, 27, 61, 0, 100, 512, 0, 0, 0, 0, 0, 41, 0, 0, 0, 0, 0, 0, 9, 7076, 0, 100, 0, 0, 0, 0, 0, 'Archaedas - On Just Died - Despawn Earthen Guardians'),
(2748, 0, 27, 28, 61, 0, 100, 512, 0, 0, 0, 0, 0, 41, 0, 0, 0, 0, 0, 0, 9, 7077, 0, 100, 0, 0, 0, 0, 0, 'Archaedas - On Just Died - Despawn Earthen Hallshapers'),
(2748, 0, 28, 0, 61, 0, 100, 512, 0, 0, 0, 0, 0, 41, 0, 0, 0, 0, 0, 0, 9, 7309, 0, 100, 0, 0, 0, 0, 0, 'Archaedas - On Just Died - Despawn Earthen Custodians');

View File

@@ -344,6 +344,32 @@ void MotionMaster::MoveBackwards(Unit* target, float dist)
init.Launch();
}
void MotionMaster::MoveForwards(Unit* target, float dist)
{
//like movebackwards, but without the inversion
if (!target)
{
return;
}
Position const& pos = target->GetPosition();
float angle = target->GetAngle(_owner);
G3D::Vector3 point;
point.x = pos.m_positionX + dist * cosf(angle);
point.y = pos.m_positionY + dist * sinf(angle);
point.z = pos.m_positionZ;
if (!_owner->GetMap()->CanReachPositionAndGetValidCoords(_owner, point.x, point.y, point.z, true, true))
{
return;
}
Movement::MoveSplineInit init(_owner);
init.MoveTo(point.x, point.y, point.z, false);
init.SetFacing(target);
init.Launch();
}
void MotionMaster::MoveCircleTarget(Unit* target)
{
if (!target)

View File

@@ -205,6 +205,7 @@ public:
void MoveChase(Unit* target, float dist) { MoveChase(target, ChaseRange(dist)); }
void MoveCircleTarget(Unit* target);
void MoveBackwards(Unit* target, float dist);
void MoveForwards(Unit* target, float dist);
void MoveConfused();
void MoveFleeing(Unit* enemy, uint32 time = 0);
void MovePoint(uint32 id, const Position& pos, bool generatePath = true, bool forceDestination = true)

View File

@@ -28,10 +28,6 @@ enum eBlackStalker
SPELL_TAIL_SWEEP = 34267,
SPELL_ENRAGE = 15716,
EVENT_ACID_BREATH = 1,
EVENT_ACID_SPIT = 2,
EVENT_TAIL_SWEEP = 3,
ACTION_MOVE_TO_PLATFORM = 1
};
@@ -39,6 +35,10 @@ struct boss_ghazan : public BossAI
{
boss_ghazan(Creature* creature) : BossAI(creature, DATA_GHAZAN)
{
scheduler.SetValidator([this]
{
return !me->HasUnitState(UNIT_STATE_CASTING);
});
}
void InitializeAI() override
@@ -50,31 +50,34 @@ struct boss_ghazan : public BossAI
void Reset() override
{
_enraged = false;
_Reset();
if (!_reachedPlatform)
{
_movedToPlatform = false;
}
BossAI::Reset();
}
void JustEngagedWith(Unit* who) override
{
events.ScheduleEvent(EVENT_ACID_BREATH, 3s);
events.ScheduleEvent(EVENT_ACID_SPIT, 1s);
events.ScheduleEvent(EVENT_TAIL_SWEEP, DUNGEON_MODE<Milliseconds>(5900ms, 10s));
BossAI::JustEngagedWith(who);
}
void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*type*/, SpellSchoolMask /*school*/) override
{
if (!_enraged && me->HealthBelowPctDamaged(20, damage))
{
_enraged = true;
ScheduleHealthCheckEvent(20, [&] {
DoCastSelf(SPELL_ENRAGE);
}
});
}
void JustEngagedWith(Unit* /*who*/) override
{
scheduler.Schedule(3s, [this](TaskContext context)
{
DoCastVictim(SPELL_ACID_BREATH);
context.Repeat(7s, 9s);
}).Schedule(1s, [this](TaskContext context)
{
DoCastRandomTarget(SPELL_ACID_SPIT);
context.Repeat(7s, 9s);
}).Schedule(DUNGEON_MODE<Milliseconds>(5900ms, 10s), [this](TaskContext context)
{
DoCastVictim(SPELL_TAIL_SWEEP);
context.Repeat(7s, 9s);
});
_JustEngagedWith();
}
void DoAction(int32 type) override
@@ -110,7 +113,7 @@ struct boss_ghazan : public BossAI
me->GetMotionMaster()->MoveRandom(12.f);
}
BossAI::JustReachedHome();
_JustReachedHome();
}
void UpdateAI(uint32 diff) override
@@ -120,42 +123,12 @@ struct boss_ghazan : public BossAI
return;
}
events.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
{
return;
}
while (uint32 eventId = events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_ACID_BREATH:
DoCastVictim(SPELL_ACID_BREATH);
events.Repeat(7s, 9s);
break;
case EVENT_ACID_SPIT:
if (Unit* target = SelectTarget(SelectTargetMethod::Random))
{
DoCast(target, SPELL_ACID_SPIT);
}
events.Repeat(7s, 9s);
break;
case EVENT_TAIL_SWEEP:
DoCastVictim(SPELL_TAIL_SWEEP);
events.Repeat(7s, 9s);
break;
default:
break;
}
}
scheduler.Update(diff);
DoMeleeAttackIfReady();
}
private:
bool _enraged;
bool _movedToPlatform;
bool _reachedPlatform;
};

View File

@@ -44,35 +44,29 @@ enum Misc
struct boss_hungarfen : public BossAI
{
boss_hungarfen(Creature* creature) : BossAI(creature, DATA_HUNGARFEN), _foul_spores(false) { }
boss_hungarfen(Creature* creature) : BossAI(creature, DATA_HUNGARFEN) { }
void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType, SpellSchoolMask) override
void Reset() override
{
if (me->HealthBelowPctDamaged(20, damage) && !_foul_spores)
{
_foul_spores = true;
_Reset();
_scheduler.CancelAll();
DoCastAOE(SPELL_DESPAWN_MUSHROOMS, true);
ScheduleHealthCheckEvent(20, [&] {
me->AddUnitState(UNIT_STATE_ROOT);
Talk(EMOTE_ROARS);
DoCastSelf(SPELL_FOUL_SPORES);
_scheduler.DelayAll(11s);
_scheduler.Schedule(11s, [this](TaskContext /*context*/)
{
me->ClearUnitState(UNIT_STATE_ROOT);
});
}
{
me->ClearUnitState(UNIT_STATE_ROOT);
});
});
}
void Reset() override
void JustEngagedWith(Unit* /*who*/) override
{
BossAI::Reset();
_foul_spores = false;
_scheduler.CancelAll();
DoCastAOE(SPELL_DESPAWN_MUSHROOMS, true);
}
void JustEngagedWith(Unit* who) override
{
BossAI::JustEngagedWith(who);
_JustEngagedWith();
_scheduler.Schedule(IsHeroic() ? randtime(2400ms, 3600ms) : 10s, [this](TaskContext context)
{
@@ -107,7 +101,6 @@ struct boss_hungarfen : public BossAI
private:
TaskScheduler _scheduler;
bool _foul_spores;
};
struct npc_underbog_mushroom : public ScriptedAI

View File

@@ -17,6 +17,7 @@
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "TaskScheduler.h"
#include "the_underbog.h"
enum Spells
@@ -27,14 +28,14 @@ enum Spells
SPELL_MULTISHOT = 34974,
SPELL_THROW_FREEZING_TRAP = 31946,
SPELL_AIMED_SHOT = 31623,
SPELL_HUNTERS_MARK = 31615
SPELL_HUNTERS_MARK = 31615,
};
enum Text
{
SAY_AGGRO = 1,
SAY_KILL = 2,
SAY_JUST_DIED = 3
SAY_AGGRO = 1,
SAY_KILL = 2,
SAY_JUST_DIED = 3
};
enum Misc
@@ -133,7 +134,7 @@ struct boss_swamplord_muselek : public BossAI
if (me->IsWithinMeleeRange(me->GetVictim()))
{
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveBackwards(me->GetVictim(), 10.0f);
me->GetMotionMaster()->MoveForwards(me->GetVictim(), 10.0f);
}
me->m_Events.AddEventAtOffset([this]()

View File

@@ -47,14 +47,6 @@ enum eBlackStalker
SPELL_SUSPENSION_PRIMER = 31720,
SPELL_SUSPENSION = 31719,
EVENT_LEVITATE = 1,
EVENT_SPELL_CHAIN = 2,
EVENT_SPELL_STATIC = 3,
EVENT_SPELL_SPORES = 4,
EVENT_CHECK = 5,
EVENT_LEVITATE_TARGET_1 = 6,
EVENT_LEVITATE_TARGET_2 = 7,
ENTRY_SPORE_STRIDER = 22299
};
@@ -62,18 +54,47 @@ struct boss_the_black_stalker : public BossAI
{
boss_the_black_stalker(Creature* creature) : BossAI(creature, DATA_BLACK_STALKER)
{
scheduler.SetValidator([this]
{
return !me->HasUnitState(UNIT_STATE_CASTING);
});
}
void JustEngagedWith(Unit* who) override
void JustEngagedWith(Unit* /*who*/) override
{
events.ScheduleEvent(EVENT_LEVITATE, urand(8000, 12000));
events.ScheduleEvent(EVENT_SPELL_CHAIN, 6000);
events.ScheduleEvent(EVENT_SPELL_STATIC, 10000);
events.ScheduleEvent(EVENT_CHECK, 5000);
if (IsHeroic())
events.ScheduleEvent(EVENT_SPELL_SPORES, urand(10000, 15000));
scheduler.Schedule(8s, 12s, [this](TaskContext context)
{
DoCastSelf(SPELL_LEVITATE);
context.Repeat(18s, 24s);
}).Schedule(6s, [this](TaskContext context)
{
DoCastRandomTarget(SPELL_CHAIN_LIGHTNING, false);
context.Repeat(9s);
}).Schedule(10s, [this](TaskContext context)
{
DoCastRandomTarget(SPELL_STATIC_CHARGE, false);
context.Repeat(10s);
}).Schedule(5s, [this](TaskContext /*context*/)
{
float x, y, z, o = 0.f;
me->GetHomePosition(x, y, z, o);
if (!me->IsWithinDist3d(x, y, z, 60.0f))
{
EnterEvadeMode();
return;
}
});
BossAI::JustEngagedWith(who);
if (IsHeroic())
{
scheduler.Schedule(10s, 15s, [this](TaskContext context)
{
DoCastSelf(SPELL_SUMMON_SPORE_STRIDER, false);
context.Repeat(10s, 15s);
});
}
_JustEngagedWith();
}
void JustSummoned(Creature* summon) override
@@ -89,8 +110,6 @@ struct boss_the_black_stalker : public BossAI
void SummonedCreatureDies(Creature* summon, Unit* /*killer*/) override
{
summons.Despawn(summon);
for (uint8 i = 0; i < 3; ++i)
me->CastSpell(me, SPELL_SUMMON_SPORE_STRIDER, false);
}
void UpdateAI(uint32 diff) override
@@ -98,45 +117,7 @@ struct boss_the_black_stalker : public BossAI
if (!UpdateVictim())
return;
events.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
switch (events.ExecuteEvent())
{
case EVENT_CHECK:
float x, y, z, o;
me->GetHomePosition(x, y, z, o);
if (!me->IsWithinDist3d(x, y, z, 60))
{
EnterEvadeMode();
return;
}
events.RepeatEvent(5000);
break;
case EVENT_SPELL_SPORES:
me->CastSpell(me, SPELL_SUMMON_SPORE_STRIDER, false);
events.RepeatEvent(urand(10000, 15000));
break;
case EVENT_SPELL_CHAIN:
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
me->CastSpell(target, SPELL_CHAIN_LIGHTNING, false);
events.RepeatEvent(9000);
break;
case EVENT_SPELL_STATIC:
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 30, true))
me->CastSpell(target, SPELL_STATIC_CHARGE, false);
events.RepeatEvent(10000);
break;
case EVENT_LEVITATE:
DoCastSelf(SPELL_LEVITATE);
events.RepeatEvent(urand(18000, 24000));
break;
}
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
scheduler.Update(diff);
DoMeleeAttackIfReady();
}