Scripts/Hellfire Ramparts: Rewrite Omor the Unscarred (#31743)

(cherry picked from commit 73d1ea35b5b2653ab088ab9611b61687ca0540f7)
This commit is contained in:
offl
2026-06-30 19:16:20 +02:00
committed by Shauren
parent 0d9e03bb46
commit 3aedb52e59
2 changed files with 216 additions and 151 deletions
@@ -0,0 +1,19 @@
--
DELETE FROM `creature_text` WHERE `CreatureID` = 17308;
INSERT INTO `creature_text` (`CreatureID`, `GroupID`, `ID`, `Text`, `Type`, `Language`, `Probability`, `Emote`, `Duration`, `Sound`, `BroadcastTextId`, `TextRange`, `comment`) VALUES
(17308,0,0,"Achor she-ki! Feast, my pet! Eat your fill!",14,0,100,0,0,10277,17637,0,"omor SAY_SUMMON"),
(17308,1,0,"A-kreesh!",14,0,100,0,0,10278,17636,0,"omor SAY_KNOCK"),
(17308,2,0,"I will not be defeated!",14,0,100,0,0,10279,17633,0,"omor SAY_AGGRO_1"),
(17308,2,1,"You dare stand against ME?",14,0,100,0,0,10280,17634,0,"omor SAY_AGGRO_2"),
(17308,2,2,"Your insolence will be your death!",14,0,100,0,0,10281,17635,0,"omor SAY_AGGRO_3"),
(17308,3,0,"Die, weakling!",14,0,100,0,0,10282,17631,0,"omor SAY_SLAY_1"),
(17308,3,1,"I am victorious!",14,0,100,0,0,10283,17632,0,"omor SAY_SLAY_2"),
(17308,4,0,"It is... not over.",14,0,100,0,0,10284,17630,0,"omor SAY_DEATH"),
(17308,5,0,"%s grins malevolently.",16,0,100,0,0,0,14756,0,"omor EMOTE_SHIELD");
DELETE FROM `spell_script_names` WHERE `ScriptName` IN (
'spell_omor_the_unscarred_orbital_strike_target',
'spell_omor_the_unscarred_orbital_strike_whip');
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(35642, 'spell_omor_the_unscarred_orbital_strike_target'),
(32185, 'spell_omor_the_unscarred_orbital_strike_whip');
@@ -15,99 +15,122 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* ScriptData
SDName: Boss_Omar_The_Unscarred
SD%Complete: 90
SDComment: Temporary solution for orbital/shadow whip-ability. Needs more core support before making it more proper.
SDCategory: Hellfire Citadel, Hellfire Ramparts
EndScriptData */
/*
* Combat timers requires to be revisited
*/
#include "ScriptMgr.h"
#include "Containers.h"
#include "hellfire_ramparts.h"
#include "ObjectAccessor.h"
#include "Player.h"
#include "ScriptedCreature.h"
#include "SpellAuraEffects.h"
#include "SpellInfo.h"
#include "SpellScript.h"
enum Says
enum OmorTexts
{
SAY_AGGRO = 0,
SAY_SUMMON = 1,
SAY_CURSE = 2,
SAY_KILL_1 = 3,
SAY_DIE = 4,
SAY_WIPE = 5
SAY_SUMMON = 0,
SAY_KNOCK = 1,
SAY_AGGRO = 2,
SAY_SLAY = 3,
SAY_DEATH = 4,
EMOTE_SHIELD = 5
};
enum Spells
enum OmorSpells
{
SPELL_ORBITAL_STRIKE = 30637,
SPELL_SHADOW_WHIP = 30638,
SPELL_TREACHEROUS_AURA = 30695,
H_SPELL_BANE_OF_TREACHERY = 37566,
SPELL_DEMONIC_SHIELD = 31901,
SPELL_SHADOW_BOLT = 30686,
H_SPELL_SHADOW_BOLT = 39297,
SPELL_SUMMON_FIENDISH_HOUND = 30707
// Combat
SPELL_SHADOW_BOLT = 30686,
SPELL_TREACHEROUS_AURA = 30695,
SPELL_SUMMON_FIENDISH_HOUND = 30707,
SPELL_ORBITAL_STRIKE_TARGET = 35642,
SPELL_DEMONIC_SHIELD = 31901,
// Scripts
SPELL_ORBITAL_STRIKE_WHIP = 32185,
SPELL_ORBITAL_STRIKE_KNOCK = 30637
};
enum OmorEvents
{
EVENT_SHADOW_BOLT = 1,
EVENT_TREACHEROUS_AURA,
EVENT_SUMMON_FIENDISH_HOUND,
EVENT_ORBITAL_STRIKE_TARGET,
EVENT_DEMONIC_SHIELD
};
// 17308 - Omor the Unscarred
struct boss_omor_the_unscarred : public BossAI
{
boss_omor_the_unscarred(Creature* creature) : BossAI(creature, DATA_OMOR_THE_UNSCARRED)
{
Initialize();
SetCombatMovement(false);
}
void Initialize()
{
OrbitalStrike_Timer = 25000;
ShadowWhip_Timer = 2000;
Aura_Timer = 10000;
DemonicShield_Timer = 1000;
Shadowbolt_Timer = 2000;
Summon_Timer = 10000;
SummonedCount = 0;
PlayerGUID.Clear();
CanPullBack = false;
}
boss_omor_the_unscarred(Creature* creature) : BossAI(creature, DATA_OMOR_THE_UNSCARRED), _demonicShieldUsed(false) { }
void Reset() override
{
Talk(SAY_WIPE);
Initialize();
_Reset();
_demonicShieldUsed = false;
}
void JustEngagedWith(Unit* who) override
{
BossAI::JustEngagedWith(who);
Talk(SAY_AGGRO);
events.ScheduleEvent(EVENT_SHADOW_BOLT, 0s);
events.ScheduleEvent(EVENT_TREACHEROUS_AURA, 16s, 23s);
events.ScheduleEvent(EVENT_SUMMON_FIENDISH_HOUND, 20s, 23s);
events.ScheduleEvent(EVENT_ORBITAL_STRIKE_TARGET, 25s);
}
void KilledUnit(Unit* /*victim*/) override
void AttackStart(Unit* who) override
{
if (rand32() % 2)
return;
ScriptedAI::AttackStartCaster(who, 100.0f);
}
Talk(SAY_KILL_1);
void OnSpellCast(SpellInfo const* spellInfo) override
{
switch (spellInfo->Id)
{
case SPELL_SUMMON_FIENDISH_HOUND:
if (roll_chance(30))
Talk(SAY_SUMMON);
break;
case SPELL_DEMONIC_SHIELD:
Talk(EMOTE_SHIELD);
break;
default:
break;
}
}
void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
{
if (!_demonicShieldUsed && me->HealthBelowPctDamaged(20, damage))
{
_demonicShieldUsed = true;
events.ScheduleEvent(EVENT_DEMONIC_SHIELD, 0s);
}
}
void JustSummoned(Creature* summoned) override
{
Talk(SAY_SUMMON);
// Engage but don't despawn hounds
if (me->IsEngaged())
DoZoneInCombat(summoned);
}
if (Unit* random = SelectTarget(SelectTargetMethod::Random, 0))
summoned->AI()->AttackStart(random);
++SummonedCount;
void KilledUnit(Unit* /*victim*/) override
{
Talk(SAY_SLAY);
}
void JustDied(Unit* /*killer*/) override
{
Talk(SAY_DIE);
_JustDied();
Talk(SAY_DEATH);
}
void UpdateAI(uint32 diff) override
@@ -115,111 +138,134 @@ struct boss_omor_the_unscarred : public BossAI
if (!UpdateVictim())
return;
//only two may be wrong, perhaps increase timer and spawn periodically instead.
if (SummonedCount < 2)
events.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
while (uint32 eventId = events.ExecuteEvent())
{
if (Summon_Timer <= diff)
switch (eventId)
{
me->InterruptNonMeleeSpells(false);
DoCast(me, SPELL_SUMMON_FIENDISH_HOUND);
Summon_Timer = 15000 + rand32() % 15000;
case EVENT_SHADOW_BOLT:
DoCastVictim(SPELL_SHADOW_BOLT);
if (me->IsWithinMeleeRange(me->GetVictim()))
events.Repeat(6s, 10s);
else
events.Repeat(3s, 4s);
break;
case EVENT_TREACHEROUS_AURA:
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
DoCast(target, SPELL_TREACHEROUS_AURA);
events.Repeat(30s, 40s);
break;
case EVENT_SUMMON_FIENDISH_HOUND:
DoCastSelf(SPELL_SUMMON_FIENDISH_HOUND);
events.Repeat(20s, 26s);
break;
case EVENT_ORBITAL_STRIKE_TARGET:
DoCastSelf(SPELL_ORBITAL_STRIKE_TARGET);
events.Repeat(23s, 30s);
break;
case EVENT_DEMONIC_SHIELD:
DoCastSelf(SPELL_DEMONIC_SHIELD);
break;
default:
break;
}
else
Summon_Timer -= diff;
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
}
if (CanPullBack)
{
if (ShadowWhip_Timer <= diff)
{
if (Player* temp = ObjectAccessor::GetPlayer(*me, PlayerGUID))
{
//if unit dosen't have this flag, then no pulling back (script will attempt cast, even if orbital strike was resisted)
if (temp->HasUnitMovementFlag(MOVEMENTFLAG_FALLING_FAR))
{
me->InterruptNonMeleeSpells(false);
DoCast(temp, SPELL_SHADOW_WHIP);
}
}
PlayerGUID.Clear();
ShadowWhip_Timer = 2000;
CanPullBack = false;
}
else
ShadowWhip_Timer -= diff;
}
else
if (OrbitalStrike_Timer <= diff)
{
Unit* temp = nullptr;
if (me->IsWithinMeleeRange(me->GetVictim()))
temp = me->GetVictim();
else temp = SelectTarget(SelectTargetMethod::Random, 0);
if (temp && temp->GetTypeId() == TYPEID_PLAYER)
{
DoCast(temp, SPELL_ORBITAL_STRIKE);
OrbitalStrike_Timer = 14000 + rand32() % 2000;
PlayerGUID = temp->GetGUID();
if (!PlayerGUID.IsEmpty())
CanPullBack = true;
}
}
else
OrbitalStrike_Timer -= diff;
if (HealthBelowPct(20))
{
if (DemonicShield_Timer <= diff)
{
DoCast(me, SPELL_DEMONIC_SHIELD);
DemonicShield_Timer = 15000;
}
else
DemonicShield_Timer -= diff;
}
if (Aura_Timer <= diff)
{
Talk(SAY_CURSE);
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
{
DoCast(target, SPELL_TREACHEROUS_AURA);
Aura_Timer = 8000 + rand32() % 8000;
}
}
else
Aura_Timer -= diff;
if (Shadowbolt_Timer <= diff)
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
{
target = me->GetVictim();
DoCast(target, SPELL_SHADOW_BOLT);
Shadowbolt_Timer = 4000 + rand32() % 2500;
}
}
else
Shadowbolt_Timer -= diff;
}
private:
uint32 OrbitalStrike_Timer;
uint32 ShadowWhip_Timer;
uint32 Aura_Timer;
uint32 DemonicShield_Timer;
uint32 Shadowbolt_Timer;
uint32 Summon_Timer;
uint32 SummonedCount;
ObjectGuid PlayerGUID;
bool CanPullBack;
private:
bool _demonicShieldUsed;
};
// 35642 - Orbital Strike Target
class spell_omor_the_unscarred_orbital_strike_target : public SpellScript
{
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_ORBITAL_STRIKE_WHIP, SPELL_ORBITAL_STRIKE_KNOCK });
}
void FilterTargets(std::list<WorldObject*>& targets)
{
if (targets.size() <= 1)
return;
Unit* caster = GetCaster();
targets.remove_if([caster](WorldObject const* target)
{
return caster->GetExactDist2d(target) > 20.0f;
});
Trinity::Containers::RandomResize(targets, 1);
_canContinue = true;
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
if (!_canContinue)
return;
Unit* caster = GetCaster();
Unit* target = GetHitUnit();
caster->CastSpell(caster, SPELL_ORBITAL_STRIKE_WHIP, true);
caster->CastSpell(target, SPELL_ORBITAL_STRIKE_KNOCK, true);
if (Creature* creature = caster->ToCreature())
creature->AI()->Talk(SAY_KNOCK, target);
if (caster->CanHaveThreatList())
caster->GetThreatManager().ModifyThreatByPercent(target, -100);
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_omor_the_unscarred_orbital_strike_target::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
OnEffectHitTarget += SpellEffectFn(spell_omor_the_unscarred_orbital_strike_target::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
private:
bool _canContinue = false;
};
// 32185 - Orbital Strike
class spell_omor_the_unscarred_orbital_strike_whip : public AuraScript
{
bool Validate(SpellInfo const* spellInfo) override
{
return ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0).TriggerSpell });
}
void OnPeriodic(AuraEffect const* aurEff)
{
PreventDefaultAction();
if (Creature* creature = GetTarget()->ToCreature())
{
for (ThreatReference const* ref : creature->GetThreatManager().GetUnsortedThreatList())
{
Unit* victim = ref->GetVictim();
if (victim->IsPlayer() && victim->IsFalling())
creature->CastSpell(victim, aurEff->GetSpellEffectInfo().TriggerSpell, aurEff);
}
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_omor_the_unscarred_orbital_strike_whip::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
void AddSC_boss_omor_the_unscarred()
{
RegisterHellfireRampartsCreatureAI(boss_omor_the_unscarred);
RegisterSpellScript(spell_omor_the_unscarred_orbital_strike_target);
RegisterSpellScript(spell_omor_the_unscarred_orbital_strike_whip);
}