From 3ea312cad572bca3bb3c15ad9eea7e54f7f04f07 Mon Sep 17 00:00:00 2001 From: megamage Date: Sun, 30 Aug 2009 18:38:54 -0500 Subject: *Update Kologarn script. --HG-- branch : trunk --- .../northrend/ulduar/ulduar/boss_kologarn.cpp | 84 ++++++++++++++-------- 1 file changed, 56 insertions(+), 28 deletions(-) (limited to 'src/bindings/scripts') diff --git a/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_kologarn.cpp b/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_kologarn.cpp index 9242f5184e5..e1113c67448 100644 --- a/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_kologarn.cpp +++ b/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_kologarn.cpp @@ -29,44 +29,51 @@ #define SPELL_STONE_GRIP HEROIC(62166,63981) #define SPELL_ARM_SWEEP HEROIC(63766,63983) +enum Events +{ + EVENT_NONE = 0, + EVENT_SMASH, + EVENT_GRIP, + EVENT_SWEEP, +}; + struct TRINITY_DLL_DECL boss_kologarnAI : public BossAI { boss_kologarnAI(Creature *c) : BossAI(c, BOSS_KOLOGARN), vehicle(me->GetVehicleKit()), - leftArm(NULL), rightArm(NULL) + left(false), right(false) { assert(vehicle); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); // i think this is a hack, but there is no other way to disable his rotation } Vehicle *vehicle; - Creature *leftArm, *rightArm; + bool left, right; void AttackStart(Unit *who) { me->Attack(who, true); - if(leftArm) - leftArm->Attack(who, true); - if(rightArm) - rightArm->Attack(who, true); } - void MeleeSwing(WeaponAttackType type) + void PassengerBoarded(Unit *who, int8 seatId, bool apply) { - me->AttackerStateUpdate(me->getVictim(), type); - if(leftArm) - leftArm->AttackerStateUpdate(me->getVictim(), type); - if(rightArm) - rightArm->AttackerStateUpdate(me->getVictim(), type); + if(who->GetTypeId() == TYPEID_UNIT) + { + if(who->GetEntry() == 32933) + left = apply; + else if(who->GetEntry() == 32934) + right = apply; + who->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); + ((Creature*)who)->SetReactState(REACT_PASSIVE); + } } - void PassengerBoarded(Unit *who, int8 seatId, bool apply) + void EnterCombat(Unit *who) { - if(who->GetEntry() == 32933) - leftArm = apply ? CAST_CRE(who) : NULL; - else if(who->GetEntry() == 32934) - rightArm = apply ? CAST_CRE(who) : NULL; - who->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); + _EnterCombat(); + events.ScheduleEvent(EVENT_SMASH, 5000); + events.ScheduleEvent(EVENT_SWEEP, 10000); + events.ScheduleEvent(EVENT_GRIP, 15000); } void UpdateAI(const uint32 diff) @@ -74,17 +81,38 @@ struct TRINITY_DLL_DECL boss_kologarnAI : public BossAI if(!UpdateVictim()) return; - if (me->isAttackReady()) + events.Update(diff); + + if(me->hasUnitState(UNIT_STAT_CASTING)) + return; + + // TODO: because we are using hack, he is stunned and cannot cast, so we use triggered for every spell + switch(events.GetEvent()) { - //If we are within range melee the target - if (me->IsWithinMeleeRange(me->getVictim())) - { - WeaponAttackType type = BASE_ATTACK; - if(leftArm && (!rightArm || rand()%2)) type = OFF_ATTACK; - MeleeSwing(type); - me->resetAttackTimer(); - } + case EVENT_NONE: break; + case EVENT_SMASH: + if(left && right) + DoCastVictim(SPELL_TWO_ARM_SMASH, true); + else if(left || right) + DoCastVictim(SPELL_ONE_ARM_SMASH, true); + events.RepeatEvent(15000); + break; + case EVENT_SWEEP: + if(left) + DoCastAOE(SPELL_ARM_SWEEP, true); + events.RepeatEvent(15000); + break; + case EVENT_GRIP: + if(right) + DoCastAOE(SPELL_STONE_GRIP, true); + events.RepeatEvent(15000); + break; + default: + events.PopEvent(); + break; } + + DoMeleeAttackIfReady(); } }; -- cgit v1.2.3