*Update Kologarn script.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-08-30 18:38:54 -05:00
parent c07707ba47
commit 3ea312cad5
6 changed files with 72 additions and 35 deletions
+1 -1
View File
@@ -2161,7 +2161,7 @@ INSERT INTO `spell_script_target` (`entry`, `type`, `targetEntry`) VALUES
-- ULDUAR
-- --------
INSERT INTO creature_template (entry, vehicleid) VALUES
(32930, 338), # Kologarn
(32930, 328), # Kologarn
(32934, 380), # Right Arm
(33113, 340), # Flame Leviathan
(33114, 341), # Flame Leviathan Seat
@@ -0,0 +1,4 @@
INSERT INTO creature_template (entry, vehicleid) VALUES
(32930, 328) # Kologarn
ON DUPLICATE KEY UPDATE
vehicleid = VALUES(vehicleid);
@@ -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)
{
me->AttackerStateUpdate(me->getVictim(), type);
if(leftArm)
leftArm->AttackerStateUpdate(me->getVictim(), type);
if(rightArm)
rightArm->AttackerStateUpdate(me->getVictim(), type);
}
void PassengerBoarded(Unit *who, int8 seatId, bool apply)
{
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);
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 EnterCombat(Unit *who)
{
_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();
}
};
+5
View File
@@ -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))
+1
View File
@@ -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);
+3 -4
View File
@@ -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);