Skip to content

Commit 147d239

Browse files
authored
Scripts/Hellfire Ramparts: Update scripts (TrinityCore#31014)
1 parent 8e9b8f6 commit 147d239

File tree

6 files changed

+616
-691
lines changed

6 files changed

+616
-691
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
--
2+
DELETE FROM `creature_text` WHERE `CreatureID` = 17306 AND `GroupID` = 5;

src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp

Lines changed: 145 additions & 157 deletions
Original file line numberDiff line numberDiff line change
@@ -50,190 +50,178 @@ enum Spells
5050
SPELL_SUMMON_FIENDISH_HOUND = 30707
5151
};
5252

53-
class boss_omor_the_unscarred : public CreatureScript
53+
struct boss_omor_the_unscarred : public BossAI
5454
{
55-
public:
56-
57-
boss_omor_the_unscarred() : CreatureScript("boss_omor_the_unscarred") { }
58-
59-
struct boss_omor_the_unscarredAI : public BossAI
55+
boss_omor_the_unscarred(Creature* creature) : BossAI(creature, DATA_OMOR_THE_UNSCARRED)
56+
{
57+
Initialize();
58+
SetCombatMovement(false);
59+
}
60+
61+
void Initialize()
62+
{
63+
OrbitalStrike_Timer = 25000;
64+
ShadowWhip_Timer = 2000;
65+
Aura_Timer = 10000;
66+
DemonicShield_Timer = 1000;
67+
Shadowbolt_Timer = 2000;
68+
Summon_Timer = 10000;
69+
SummonedCount = 0;
70+
PlayerGUID.Clear();
71+
CanPullBack = false;
72+
}
73+
74+
void Reset() override
75+
{
76+
Talk(SAY_WIPE);
77+
78+
Initialize();
79+
80+
_Reset();
81+
}
82+
83+
void JustEngagedWith(Unit* who) override
84+
{
85+
BossAI::JustEngagedWith(who);
86+
Talk(SAY_AGGRO);
87+
}
88+
89+
void KilledUnit(Unit* /*victim*/) override
90+
{
91+
if (rand32() % 2)
92+
return;
93+
94+
Talk(SAY_KILL_1);
95+
}
96+
97+
void JustSummoned(Creature* summoned) override
98+
{
99+
Talk(SAY_SUMMON);
100+
101+
if (Unit* random = SelectTarget(SelectTargetMethod::Random, 0))
102+
summoned->AI()->AttackStart(random);
103+
104+
++SummonedCount;
105+
}
106+
107+
void JustDied(Unit* /*killer*/) override
108+
{
109+
Talk(SAY_DIE);
110+
_JustDied();
111+
}
112+
113+
void UpdateAI(uint32 diff) override
114+
{
115+
if (!UpdateVictim())
116+
return;
117+
118+
//only two may be wrong, perhaps increase timer and spawn periodically instead.
119+
if (SummonedCount < 2)
60120
{
61-
boss_omor_the_unscarredAI(Creature* creature) : BossAI(creature, DATA_OMOR_THE_UNSCARRED)
121+
if (Summon_Timer <= diff)
62122
{
63-
Initialize();
64-
SetCombatMovement(false);
123+
me->InterruptNonMeleeSpells(false);
124+
DoCast(me, SPELL_SUMMON_FIENDISH_HOUND);
125+
Summon_Timer = 15000 + rand32() % 15000;
65126
}
127+
else
128+
Summon_Timer -= diff;
129+
}
66130

67-
void Initialize()
131+
if (CanPullBack)
132+
{
133+
if (ShadowWhip_Timer <= diff)
68134
{
69-
OrbitalStrike_Timer = 25000;
70-
ShadowWhip_Timer = 2000;
71-
Aura_Timer = 10000;
72-
DemonicShield_Timer = 1000;
73-
Shadowbolt_Timer = 2000;
74-
Summon_Timer = 10000;
75-
SummonedCount = 0;
135+
if (Player* temp = ObjectAccessor::GetPlayer(*me, PlayerGUID))
136+
{
137+
//if unit dosen't have this flag, then no pulling back (script will attempt cast, even if orbital strike was resisted)
138+
if (temp->HasUnitMovementFlag(MOVEMENTFLAG_FALLING_FAR))
139+
{
140+
me->InterruptNonMeleeSpells(false);
141+
DoCast(temp, SPELL_SHADOW_WHIP);
142+
}
143+
}
76144
PlayerGUID.Clear();
145+
ShadowWhip_Timer = 2000;
77146
CanPullBack = false;
78147
}
79-
80-
void Reset() override
148+
else
149+
ShadowWhip_Timer -= diff;
150+
}
151+
else
152+
if (OrbitalStrike_Timer <= diff)
81153
{
82-
Talk(SAY_WIPE);
83-
84-
Initialize();
154+
Unit* temp = nullptr;
155+
if (me->IsWithinMeleeRange(me->GetVictim()))
156+
temp = me->GetVictim();
157+
else temp = SelectTarget(SelectTargetMethod::Random, 0);
85158

86-
_Reset();
87-
}
159+
if (temp && temp->GetTypeId() == TYPEID_PLAYER)
160+
{
161+
DoCast(temp, SPELL_ORBITAL_STRIKE);
162+
OrbitalStrike_Timer = 14000 + rand32() % 2000;
163+
PlayerGUID = temp->GetGUID();
88164

89-
void JustEngagedWith(Unit* who) override
90-
{
91-
BossAI::JustEngagedWith(who);
92-
Talk(SAY_AGGRO);
165+
if (PlayerGUID)
166+
CanPullBack = true;
167+
}
93168
}
169+
else
170+
OrbitalStrike_Timer -= diff;
94171

95-
void KilledUnit(Unit* /*victim*/) override
172+
if (HealthBelowPct(20))
173+
{
174+
if (DemonicShield_Timer <= diff)
96175
{
97-
if (rand32() % 2)
98-
return;
99-
100-
Talk(SAY_KILL_1);
176+
DoCast(me, SPELL_DEMONIC_SHIELD);
177+
DemonicShield_Timer = 15000;
101178
}
179+
else
180+
DemonicShield_Timer -= diff;
181+
}
102182

103-
void JustSummoned(Creature* summoned) override
104-
{
105-
Talk(SAY_SUMMON);
106-
107-
if (Unit* random = SelectTarget(SelectTargetMethod::Random, 0))
108-
summoned->AI()->AttackStart(random);
109-
110-
++SummonedCount;
111-
}
183+
if (Aura_Timer <= diff)
184+
{
185+
Talk(SAY_CURSE);
112186

113-
void JustDied(Unit* /*killer*/) override
187+
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
114188
{
115-
Talk(SAY_DIE);
116-
_JustDied();
189+
DoCast(target, SPELL_TREACHEROUS_AURA);
190+
Aura_Timer = 8000 + rand32() % 8000;
117191
}
192+
}
193+
else
194+
Aura_Timer -= diff;
118195

119-
void UpdateAI(uint32 diff) override
196+
if (Shadowbolt_Timer <= diff)
197+
{
198+
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
120199
{
121-
if (!UpdateVictim())
122-
return;
123-
124-
//only two may be wrong, perhaps increase timer and spawn periodically instead.
125-
if (SummonedCount < 2)
126-
{
127-
if (Summon_Timer <= diff)
128-
{
129-
me->InterruptNonMeleeSpells(false);
130-
DoCast(me, SPELL_SUMMON_FIENDISH_HOUND);
131-
Summon_Timer = 15000 + rand32() % 15000;
132-
}
133-
else
134-
Summon_Timer -= diff;
135-
}
136-
137-
if (CanPullBack)
138-
{
139-
if (ShadowWhip_Timer <= diff)
140-
{
141-
if (Player* temp = ObjectAccessor::GetPlayer(*me, PlayerGUID))
142-
{
143-
//if unit dosen't have this flag, then no pulling back (script will attempt cast, even if orbital strike was resisted)
144-
if (temp->HasUnitMovementFlag(MOVEMENTFLAG_FALLING_FAR))
145-
{
146-
me->InterruptNonMeleeSpells(false);
147-
DoCast(temp, SPELL_SHADOW_WHIP);
148-
}
149-
}
150-
PlayerGUID.Clear();
151-
ShadowWhip_Timer = 2000;
152-
CanPullBack = false;
153-
}
154-
else
155-
ShadowWhip_Timer -= diff;
156-
}
157-
else
158-
if (OrbitalStrike_Timer <= diff)
159-
{
160-
Unit* temp = nullptr;
161-
if (me->IsWithinMeleeRange(me->GetVictim()))
162-
temp = me->GetVictim();
163-
else temp = SelectTarget(SelectTargetMethod::Random, 0);
164-
165-
if (temp && temp->GetTypeId() == TYPEID_PLAYER)
166-
{
167-
DoCast(temp, SPELL_ORBITAL_STRIKE);
168-
OrbitalStrike_Timer = 14000 + rand32() % 2000;
169-
PlayerGUID = temp->GetGUID();
170-
171-
if (PlayerGUID)
172-
CanPullBack = true;
173-
}
174-
}
175-
else
176-
OrbitalStrike_Timer -= diff;
177-
178-
if (HealthBelowPct(20))
179-
{
180-
if (DemonicShield_Timer <= diff)
181-
{
182-
DoCast(me, SPELL_DEMONIC_SHIELD);
183-
DemonicShield_Timer = 15000;
184-
}
185-
else
186-
DemonicShield_Timer -= diff;
187-
}
188-
189-
if (Aura_Timer <= diff)
190-
{
191-
Talk(SAY_CURSE);
192-
193-
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
194-
{
195-
DoCast(target, SPELL_TREACHEROUS_AURA);
196-
Aura_Timer = 8000 + rand32() % 8000;
197-
}
198-
}
199-
else
200-
Aura_Timer -= diff;
200+
target = me->GetVictim();
201201

202-
if (Shadowbolt_Timer <= diff)
203-
{
204-
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
205-
{
206-
target = me->GetVictim();
207-
208-
DoCast(target, SPELL_SHADOW_BOLT);
209-
Shadowbolt_Timer = 4000 + rand32() % 2500;
210-
}
211-
}
212-
else
213-
Shadowbolt_Timer -= diff;
214-
215-
DoMeleeAttackIfReady();
202+
DoCast(target, SPELL_SHADOW_BOLT);
203+
Shadowbolt_Timer = 4000 + rand32() % 2500;
216204
}
217-
218-
private:
219-
uint32 OrbitalStrike_Timer;
220-
uint32 ShadowWhip_Timer;
221-
uint32 Aura_Timer;
222-
uint32 DemonicShield_Timer;
223-
uint32 Shadowbolt_Timer;
224-
uint32 Summon_Timer;
225-
uint32 SummonedCount;
226-
ObjectGuid PlayerGUID;
227-
bool CanPullBack;
228-
};
229-
230-
CreatureAI* GetAI(Creature* creature) const override
231-
{
232-
return GetHellfireRampartsAI<boss_omor_the_unscarredAI>(creature);
233205
}
206+
else
207+
Shadowbolt_Timer -= diff;
208+
209+
DoMeleeAttackIfReady();
210+
}
211+
212+
private:
213+
uint32 OrbitalStrike_Timer;
214+
uint32 ShadowWhip_Timer;
215+
uint32 Aura_Timer;
216+
uint32 DemonicShield_Timer;
217+
uint32 Shadowbolt_Timer;
218+
uint32 Summon_Timer;
219+
uint32 SummonedCount;
220+
ObjectGuid PlayerGUID;
221+
bool CanPullBack;
234222
};
235223

236224
void AddSC_boss_omor_the_unscarred()
237225
{
238-
new boss_omor_the_unscarred();
226+
RegisterHellfireRampartsCreatureAI(boss_omor_the_unscarred);
239227
}

0 commit comments

Comments
 (0)