diff options
| author | megamage <none@none> | 2009-08-30 18:38:54 -0500 |
|---|---|---|
| committer | megamage <none@none> | 2009-08-30 18:38:54 -0500 |
| commit | 3ea312cad572bca3bb3c15ad9eea7e54f7f04f07 (patch) | |
| tree | d86c3447ef4da0b35a5b5e7ac943b13f0a6b6abf /src/bindings/scripts | |
| parent | c07707ba47d75b18b84b5602aa5224078e1b40e3 (diff) | |
*Update Kologarn script.
--HG--
branch : trunk
Diffstat (limited to 'src/bindings/scripts')
| -rw-r--r-- | src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_kologarn.cpp | 84 |
1 files changed, 56 insertions, 28 deletions
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(); } }; |
