diff options
-rw-r--r-- | sql/FULL/world_spell_full.sql | 2 | ||||
-rw-r--r-- | sql/updates/5491_world_scripts_ulduar.sql | 4 | ||||
-rw-r--r-- | src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_kologarn.cpp | 84 | ||||
-rw-r--r-- | src/game/CreatureAIImpl.h | 5 | ||||
-rw-r--r-- | src/game/UnitAI.h | 1 | ||||
-rw-r--r-- | src/game/Vehicle.cpp | 7 |
6 files changed, 70 insertions, 33 deletions
diff --git a/sql/FULL/world_spell_full.sql b/sql/FULL/world_spell_full.sql index ebf75e98568..c8328346b60 100644 --- a/sql/FULL/world_spell_full.sql +++ b/sql/FULL/world_spell_full.sql @@ -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 diff --git a/sql/updates/5491_world_scripts_ulduar.sql b/sql/updates/5491_world_scripts_ulduar.sql new file mode 100644 index 00000000000..a3091fafeaf --- /dev/null +++ b/sql/updates/5491_world_scripts_ulduar.sql @@ -0,0 +1,4 @@ +INSERT INTO creature_template (entry, vehicleid) VALUES +(32930, 328) # Kologarn +ON DUPLICATE KEY UPDATE +vehicleid = VALUES(vehicleid);
\ No newline at end of file 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); |