aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormegamage <none@none>2009-08-30 18:38:54 -0500
committermegamage <none@none>2009-08-30 18:38:54 -0500
commit3ea312cad572bca3bb3c15ad9eea7e54f7f04f07 (patch)
treed86c3447ef4da0b35a5b5e7ac943b13f0a6b6abf /src
parentc07707ba47d75b18b84b5602aa5224078e1b40e3 (diff)
*Update Kologarn script.
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_kologarn.cpp84
-rw-r--r--src/game/CreatureAIImpl.h5
-rw-r--r--src/game/UnitAI.h1
-rw-r--r--src/game/Vehicle.cpp7
4 files changed, 65 insertions, 32 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();
}
};
diff --git a/src/game/CreatureAIImpl.h b/src/game/CreatureAIImpl.h
index 569c0fad9da..2ed0219ad6a 100644
--- a/src/game/CreatureAIImpl.h
+++ b/src/game/CreatureAIImpl.h
@@ -319,6 +319,11 @@ inline void UnitAI::DoCast(Unit* victim, uint32 spellId, bool triggered)
me->CastSpell(victim, spellId, triggered);
}
+inline void UnitAI::DoCastVictim(uint32 spellId, bool triggered)
+{
+ me->CastSpell(me->getVictim(), spellId, triggered);
+}
+
inline void UnitAI::DoCastAOE(uint32 spellId, bool triggered)
{
if(!triggered && me->hasUnitState(UNIT_STAT_CASTING))
diff --git a/src/game/UnitAI.h b/src/game/UnitAI.h
index ba6704d897f..c5e02b07d1b 100644
--- a/src/game/UnitAI.h
+++ b/src/game/UnitAI.h
@@ -70,6 +70,7 @@ class TRINITY_DLL_SPEC UnitAI
void DoCast(uint32 spellId);
void DoCast(Unit* victim, uint32 spellId, bool triggered = false);
+ void DoCastVictim(uint32 spellId, bool triggered = false);
void DoCastAOE(uint32 spellId, bool triggered = false);
float DoGetSpellMaxRange(uint32 spellId, bool positive = false);
diff --git a/src/game/Vehicle.cpp b/src/game/Vehicle.cpp
index 853440169eb..8f6399227f4 100644
--- a/src/game/Vehicle.cpp
+++ b/src/game/Vehicle.cpp
@@ -98,7 +98,7 @@ void Vehicle::InstallAllAccessories()
case 28312:InstallAccessory(28319,7);break;
case 32627:InstallAccessory(32629,7);break;
case 32930:
- InstallAccessory(32933,2);
+ InstallAccessory(32933,0);
InstallAccessory(32934,1);
break;
case 33109:InstallAccessory(33167,1);break;
@@ -268,7 +268,7 @@ bool Vehicle::AddPassenger(Unit *unit, int8 seatId)
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
}
- if(!(seat->second.seatInfo->m_flags & 0x4000))
+ if(seat->second.seatInfo->m_flags && !(seat->second.seatInfo->m_flags & 0x4000))
unit->addUnitState(UNIT_STAT_ONVEHICLE);
//SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_24);
@@ -328,8 +328,7 @@ void Vehicle::RemovePassenger(Unit *unit)
++m_usableSeatNum;
}
- if(!(seat->second.seatInfo->m_flags & 0x4000))
- unit->clearUnitState(UNIT_STAT_ONVEHICLE);
+ unit->clearUnitState(UNIT_STAT_ONVEHICLE);
//SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);