aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormegamage <none@none>2009-08-23 01:08:09 -0500
committermegamage <none@none>2009-08-23 01:08:09 -0500
commitdee4a9fd872c28587efe18f6859b91ce3d5ae805 (patch)
treee1839645709ee3e693a22bdb489c41499b98504f /src
parentb35fe879ad812947a50666ccc41d3603227291f9 (diff)
*Update flame leviathan script.
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_flame_leviathan.cpp147
-rw-r--r--src/game/Player.cpp6
-rw-r--r--src/game/SharedDefines.h5
-rw-r--r--src/game/SpellAuras.cpp18
-rw-r--r--src/game/SpellEffects.cpp44
-rw-r--r--src/game/SpellHandler.cpp3
-rw-r--r--src/game/SpellMgr.cpp4
-rw-r--r--src/game/Unit.cpp5
-rw-r--r--src/game/Vehicle.cpp12
9 files changed, 198 insertions, 46 deletions
diff --git a/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_flame_leviathan.cpp b/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_flame_leviathan.cpp
index 20ad85351a9..61d9519d9b0 100644
--- a/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_flame_leviathan.cpp
+++ b/src/bindings/scripts/scripts/northrend/ulduar/ulduar/boss_flame_leviathan.cpp
@@ -20,6 +20,7 @@
#include "def_ulduar.h"
#include "Vehicle.h"
+
#define SPELL_PURSUED 62374
#define SPELL_GATHERING_SPEED 62375
#define SPELL_BATTERING_RAM 62376
@@ -27,12 +28,15 @@
#define SPELL_MISSILE_BARRAGE 62400
#define SPELL_SYSTEMS_SHUTDOWN 62475
-#define SPELL_CANNON 62397
+#define SPELL_FLAME_CANNON 62395
+//#define SPELL_FLAME_CANNON 64692 trigger the same spell
#define SPELL_OVERLOAD_CIRCUIT 62399
#define SPELL_SEARING_FLAME 62402
+#define SPELL_BLAZE 62292
+
enum Events
{
EVENT_PURSUE = 1,
@@ -40,15 +44,21 @@ enum Events
EVENT_VENT,
};
+enum Seats
+{
+ SEAT_PLAYER = 0,
+ SEAT_TURRET = 1,
+ SEAT_DEVICE = 2,
+};
+
struct TRINITY_DLL_DECL boss_flame_leviathanAI : public BossAI
{
boss_flame_leviathanAI(Creature *c) : BossAI(c, BOSS_LEVIATHAN)
{
assert(c->isVehicle());
+ me->SetReactState(REACT_DEFENSIVE);
}
- void MoveInLineOfSight(Unit* who) {}
-
void EnterCombat(Unit *who)
{
_EnterCombat();
@@ -66,6 +76,12 @@ struct TRINITY_DLL_DECL boss_flame_leviathanAI : public BossAI
AttackStart(target);
}
+ void SpellHit(Unit *caster, const SpellEntry *spell)
+ {
+ if(spell->Id == 62472)
+ CAST_VEH(me)->InstallAllAccessories();
+ }
+
void UpdateAI(const uint32 diff)
{
if (!me->isInCombat())
@@ -133,6 +149,12 @@ struct TRINITY_DLL_DECL boss_flame_leviathan_turretAI : public ScriptedAI
events.ScheduleEvent(1, 5000);
}
+ void AttackStart(Unit *who)
+ {
+ if(who)
+ me->Attack(who, false);
+ }
+
void UpdateAI(const uint32 diff)
{
if (!UpdateCombatState())
@@ -148,8 +170,9 @@ struct TRINITY_DLL_DECL boss_flame_leviathan_turretAI : public ScriptedAI
switch(eventId)
{
case 1:
- DoCast(SelectTarget(SELECT_TARGET_RANDOM), SPELL_CANNON);
- events.RepeatEvent(10000);
+ DoCast(me->getVictim(), SPELL_FLAME_CANNON);
+ AttackStart(SelectTarget(SELECT_TARGET_RANDOM));
+ events.RepeatEvent(3000);
return;
default:
events.PopEvent();
@@ -160,44 +183,63 @@ struct TRINITY_DLL_DECL boss_flame_leviathan_turretAI : public ScriptedAI
};
-struct TRINITY_DLL_DECL boss_flame_leviathan_seatAI : public ScriptedAI
+struct TRINITY_DLL_DECL boss_flame_leviathan_seatAI : public PassiveAI
{
- boss_flame_leviathan_seatAI(Creature *c) : ScriptedAI(c)
+ boss_flame_leviathan_seatAI(Creature *c) : PassiveAI(c)
{
assert(c->isVehicle());
if (const CreatureInfo *cInfo = me->GetCreatureInfo())
me->SetDisplayId(cInfo->DisplayID_A[0]); // 0 invisible, 1 visible
+ //me->SetReactState(REACT_AGGRESSIVE);
}
- void Reset()
+ /*
+ void MoveInLineOfSight(Unit *who)
{
- me->SetReactState(REACT_AGGRESSIVE);
+ if(who->GetTypeId() == TYPEID_PLAYER && CAST_PLR(who)->isGameMaster()
+ && !who->m_Vehicle && CAST_VEH(me)->GetPassenger(SEAT_TURRET))
+ who->EnterVehicle((Vehicle*)me, 0);
}
+ */
- void MoveInLineOfSight(Unit *who) // for test
+ void PassengerBoarded(Unit *who, int8 seatId)
{
- if (who->GetTypeId() == TYPEID_PLAYER && !who->m_Vehicle
- && !CAST_VEH(me)->GetPassenger(0) && CAST_VEH(me)->GetPassenger(2))
- who->EnterVehicle(CAST_VEH(me), 0);
+ if(!me->m_Vehicle)
+ return;
+
+ if(seatId == SEAT_PLAYER)
+ {
+ if(Unit *turret = CAST_VEH(me)->GetPassenger(SEAT_TURRET))
+ {
+ turret->setFaction(me->m_Vehicle->getFaction());
+ turret->SetUInt32Value(UNIT_FIELD_FLAGS, 0); // unselectable
+ }
+ if(Unit *device = CAST_VEH(me)->GetPassenger(SEAT_DEVICE))
+ {
+ device->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
+ device->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ }
+ }
}
- void UpdateAI(const uint32 diff)
+ void PassengerLeft(Unit *who, int8 seatId)
{
- if (!CAST_VEH(me)->GetPassenger(2))
- if (Unit *who = CAST_VEH(me)->GetPassenger(0))
- who->ExitVehicle();
+ if(seatId == SEAT_TURRET)
+ {
+ if(Unit *device = CAST_VEH(me)->GetPassenger(SEAT_DEVICE))
+ {
+ device->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
+ device->SetUInt32Value(UNIT_FIELD_FLAGS, 0); // unselectable
+ }
+ }
}
};
struct TRINITY_DLL_DECL boss_flame_leviathan_defense_turretAI : public ScriptedAI
{
- boss_flame_leviathan_defense_turretAI(Creature *c) : ScriptedAI(c)
- {
- }
+ boss_flame_leviathan_defense_turretAI(Creature *c) : ScriptedAI(c), timer(2000) {}
- void Reset()
- {
- }
+ uint32 timer;
void DamageTaken(Unit *who, uint32 &damage)
{
@@ -216,6 +258,12 @@ struct TRINITY_DLL_DECL boss_flame_leviathan_defense_turretAI : public ScriptedA
AttackStart(who);
}
+ void AttackStart(Unit *who)
+ {
+ if(who)
+ me->Attack(who, false);
+ }
+
void UpdateAI(const uint32 diff)
{
if (!UpdateVictim())
@@ -224,30 +272,53 @@ struct TRINITY_DLL_DECL boss_flame_leviathan_defense_turretAI : public ScriptedA
if (me->hasUnitState(UNIT_STAT_CASTING))
return;
- DoCast(me->getVictim(), SPELL_SEARING_FLAME);
+ if(timer > diff)
+ timer -= diff;
+ else
+ {
+ timer = 2000;
+ DoCast(me->getVictim(), SPELL_SEARING_FLAME);
+ }
}
};
-struct TRINITY_DLL_DECL boss_flame_leviathan_overload_deviceAI : public ScriptedAI
+struct TRINITY_DLL_DECL boss_flame_leviathan_overload_deviceAI : public PassiveAI
{
- boss_flame_leviathan_overload_deviceAI(Creature *c) : ScriptedAI(c)
+ boss_flame_leviathan_overload_deviceAI(Creature *c) : PassiveAI(c)
{
if (const CreatureInfo *cInfo = me->GetCreatureInfo())
me->SetDisplayId(cInfo->DisplayID_H[0]); // A0 gm, H0 device
}
- void Reset()
+ void DoAction(const int32 param)
+ {
+ if(param == EVENT_SPELLCLICK)
+ {
+ me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ if(me->m_Vehicle)
+ if(Unit *player = me->m_Vehicle->GetPassenger(SEAT_PLAYER))
+ player->ExitVehicle();
+ }
+ }
+};
+
+struct TRINITY_DLL_DECL spell_pool_of_tarAI : public TriggerAI
+{
+ spell_pool_of_tarAI(Creature *c) : TriggerAI(c)
{
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
}
void DamageTaken(Unit *who, uint32 &damage)
{
- if (damage >= me->GetHealth())
- {
- damage = 0;
- if (!me->hasUnitState(UNIT_STAT_CASTING))
- DoCastAOE(SPELL_OVERLOAD_CIRCUIT);
- }
+ damage = 0;
+ }
+
+ void SpellHit(Unit* caster, const SpellEntry *spell)
+ {
+ if(spell->SchoolMask & SPELL_SCHOOL_MASK_FIRE && !me->HasAura(SPELL_BLAZE))
+ me->CastSpell(me, SPELL_BLAZE, true);
}
};
@@ -276,6 +347,11 @@ CreatureAI* GetAI_boss_flame_leviathan_overload_device(Creature* pCreature)
return new boss_flame_leviathan_overload_deviceAI (pCreature);
}
+CreatureAI* GetAI_spell_pool_of_tar(Creature* pCreature)
+{
+ return new spell_pool_of_tarAI (pCreature);
+}
+
void AddSC_boss_flame_leviathan()
{
Script *newscript;
@@ -303,4 +379,9 @@ void AddSC_boss_flame_leviathan()
newscript->Name="boss_flame_leviathan_overload_device";
newscript->GetAI = &GetAI_boss_flame_leviathan_overload_device;
newscript->RegisterSelf();
+
+ newscript = new Script;
+ newscript->Name="spell_pool_of_tar";
+ newscript->GetAI = &GetAI_spell_pool_of_tar;
+ newscript->RegisterSelf();
}
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index e849311d79c..35cfe584199 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -19075,6 +19075,9 @@ void Player::UpdateVisibilityOf(WorldObject* target)
{
if(target->isVisibleForInState(this,false))
{
+ //if(target->isType(TYPEMASK_UNIT) && ((Unit*)target)->m_Vehicle)
+ // UpdateVisibilityOf(((Unit*)target)->m_Vehicle);
+
target->SendUpdateToPlayer(this);
UpdateVisibilityOf_helper(m_clientGUIDs, target);
@@ -19123,6 +19126,9 @@ void Player::UpdateVisibilityOf(T* target, UpdateData& data, std::set<WorldObjec
{
if(target->isVisibleForInState(this,false))
{
+ //if(target->isType(TYPEMASK_UNIT) && ((Unit*)target)->m_Vehicle)
+ // UpdateVisibilityOf(((Unit*)target)->m_Vehicle, data, visibleNow);
+
visibleNow.insert(target);
target->BuildCreateUpdateBlockForPlayer(&data, this);
UpdateVisibilityOf_helper(m_clientGUIDs,target);
diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h
index f7085b1b5f3..fdd4f6401fe 100644
--- a/src/game/SharedDefines.h
+++ b/src/game/SharedDefines.h
@@ -2497,6 +2497,11 @@ enum SummonType
SUMMON_TYPE_OBJECT = 11,
};
+enum EventId
+{
+ EVENT_SPELLCLICK = 1001,
+};
+
enum ResponseCodes
{
RESPONSE_SUCCESS = 0x00,
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index a415dfbcbd7..27e2c2a9e3a 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -4480,6 +4480,20 @@ void AuraEffect::HandleAuraPeriodicDummy(bool apply, bool Real, bool changeAmoun
SpellEntry const*spell = GetSpellProto();
switch( spell->SpellFamilyName)
{
+ case SPELLFAMILY_GENERIC:
+ {
+ if(spell->Id == 62399) // Overload Circuit
+ {
+ if(m_target->GetMap()->IsDungeon())
+ if(m_target->GetAuras().count(62399) >= (m_target->GetMap()->IsHeroic() ? 4 : 2))
+ {
+ m_target->CastSpell(m_target, 62475, true); // System Shutdown
+ if(m_target->m_Vehicle)
+ m_target->m_Vehicle->CastSpell(m_target, 62475, true);
+ }
+ }
+ break;
+ }
case SPELLFAMILY_WARLOCK:
{
switch (spell->Id)
@@ -6344,6 +6358,10 @@ void AuraEffect::PeriodicDummyTick()
case 59911: // Tenacity (vehicle)
GetParentAura()->RefreshAura();
break;
+ case 62292: // Blaze (Pool of Tar)
+ // should we use custom damage?
+ m_target->CastSpell((Unit*)NULL, m_spellProto->EffectTriggerSpell[m_effIndex], true);
+ break;
default:
break;
}
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 997417c158c..41ef6094855 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -1216,6 +1216,42 @@ void Spell::EffectDummy(uint32 i)
m_caster->CastSpell(m_caster,spell_id,true,NULL);
return;
}
+ case 62324: // Throw Passenger
+ if(m_targets.HasTraj())
+ {
+ if(Vehicle *vehicle = dynamic_cast<Vehicle*>(m_caster))
+ if(Unit *passenger = vehicle->GetPassenger(damage - 1))
+ {
+ std::list<Unit*> unitList;
+ // use 99 because it is 3d search
+ SearchAreaTarget(unitList, 99, PUSH_DST_CENTER, SPELL_TARGETS_ENTRY, 33114);
+ float minDist = 99 * 99;
+ Vehicle *target = NULL;
+ for(std::list<Unit*>::iterator itr = unitList.begin(); itr != unitList.end(); ++itr)
+ {
+ if(Vehicle *seat = dynamic_cast<Vehicle*>(*itr))
+ if(!seat->GetPassenger(0))
+ if(Unit *device = seat->GetPassenger(2))
+ if(!device->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
+ {
+ float dist = seat->GetExactDistSq(m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ);
+ if(dist < minDist)
+ {
+ minDist = dist;
+ target = seat;
+ }
+ }
+ }
+ if(target && target->IsWithinDist2d(m_targets.m_destX, m_targets.m_destY, GetSpellRadius(m_spellInfo, i, false) * 2)) // now we use *2 because the location of the seat is not correct
+ passenger->EnterVehicle(target, 0);
+ else
+ {
+ passenger->ExitVehicle();
+ passenger->GetMotionMaster()->MoveJump(m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ, m_targets.GetSpeedXY(), m_targets.GetSpeedZ());
+ }
+ }
+ }
+ return;
}
//All IconID Check in there
@@ -5195,9 +5231,10 @@ void Spell::EffectScriptEffect(uint32 effIndex)
return;
}
case 62428: // Load into Catapult
- if(m_caster->m_Vehicle && m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->isVehicle())
- if(Unit *passenger = ((Vehicle*)m_caster)->GetPassenger(0))
- passenger->CastSpell(m_caster->m_Vehicle, damage, true);
+ if(Vehicle *demolisher = m_caster->m_Vehicle)
+ if(Vehicle *seat = dynamic_cast<Vehicle*>(m_caster))
+ if(Unit *passenger = seat->GetPassenger(0))
+ passenger->CastSpell(demolisher, damage, true);
return;
case 60123: // Lightwell
{
@@ -5227,6 +5264,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
}
else
((TempSummon*)m_caster)->UnSummon();
+ return;
}
}
break;
diff --git a/src/game/SpellHandler.cpp b/src/game/SpellHandler.cpp
index b41a2a0bf46..500947a321c 100644
--- a/src/game/SpellHandler.cpp
+++ b/src/game/SpellHandler.cpp
@@ -31,6 +31,7 @@
#include "Totem.h"
#include "TemporarySummon.h"
#include "SpellAuras.h"
+#include "CreatureAI.h"
void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket)
{
@@ -516,6 +517,8 @@ void WorldSession::HandleSpellClick( WorldPacket & recv_data )
if(unit->isVehicle())
_player->EnterVehicle((Vehicle*)unit);
+
+ unit->AI()->DoAction(EVENT_SPELLCLICK);
}
void WorldSession::HandleMirrrorImageDataRequest( WorldPacket & recv_data )
diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp
index f8fa301341e..9f21fd442d4 100644
--- a/src/game/SpellMgr.cpp
+++ b/src/game/SpellMgr.cpp
@@ -3729,6 +3729,10 @@ void SpellMgr::LoadSpellCustomAttr()
case 30421: // Nether Portal - Perseverence
spellInfo->EffectBasePoints[2] += 30000;
break;
+ // some dummy spell only has dest, should push caster in this case
+ case 62324: // Throw Passenger
+ spellInfo->Targets |= TARGET_FLAG_CASTER;
+ break;
default:
break;
}
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 294f1cd9168..58e4037b5c0 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -10524,8 +10524,9 @@ bool Unit::canAttack(Unit const* target, bool force) const
if(target->GetVisibility() == VISIBILITY_GROUP_STEALTH && !canDetectStealthOf(target, GetDistance(target)))
return false;
- if(target == m_Vehicle)
- return false;
+ if(m_Vehicle)
+ if(target == m_Vehicle || m_Vehicle->m_Vehicle && target == m_Vehicle->m_Vehicle)
+ return false;
return true;
}
diff --git a/src/game/Vehicle.cpp b/src/game/Vehicle.cpp
index 7dcff65fe06..2b49df166ef 100644
--- a/src/game/Vehicle.cpp
+++ b/src/game/Vehicle.cpp
@@ -90,11 +90,8 @@ void Vehicle::InstallAllAccessories()
InstallAccessory(33139,7);
break;
case 33114:
- InstallAccessory(33142,0);
- //InstallAccessory(33143,1);
- //InstallAccessory(33142,2);
- InstallAccessory(33143,2);
- InstallAccessory(33142,1);
+ InstallAccessory(33143,2); // Overload Control Device
+ InstallAccessory(33142,1); // Leviathan Defense Turret
break;
}
}
@@ -122,7 +119,8 @@ void Vehicle::setDeathState(DeathState s) // overwrite vir
if(passenger->GetOwnerGUID() == GetGUID())
{
passenger->ExitVehicle();
- ((Vehicle*)passenger)->setDeathState(s);
+ passenger->setDeathState(s);
+ passenger->AddObjectToRemoveList();
}
}
RemoveAllPassengers();
@@ -266,7 +264,6 @@ void Vehicle::InstallAccessory(uint32 entry, int8 seatId)
const CreatureInfo *cInfo = objmgr.GetCreatureTemplate(entry);
if(!cInfo)
return;
-
Creature *accessory;
if(cInfo->VehicleId)
accessory = SummonVehicle(entry, GetPositionX(), GetPositionY(), GetPositionZ());
@@ -274,7 +271,6 @@ void Vehicle::InstallAccessory(uint32 entry, int8 seatId)
accessory = SummonCreature(entry, GetPositionX(), GetPositionY(), GetPositionZ());
if(!accessory)
return;
-
accessory->EnterVehicle(this, seatId);
// This is not good, we have to send update twice
accessory->SendMovementFlagUpdate();