*Remove function passengerleft

--HG--
branch : trunk
This commit is contained in:
megamage
2009-08-27 19:26:18 -05:00
parent 5ce0b50fc6
commit a795df9cca
5 changed files with 46 additions and 16 deletions
@@ -739,8 +739,9 @@ struct TRINITY_DLL_DECL npc_scarlet_miner_cartAI : public PassiveAI
}
}
void PassengerLeft(Unit *who, int8 seatId)
void PassengerBoarded(Unit *who, int8 seatId, bool apply)
{
if(!apply)
if(Creature *miner = Unit::GetCreature(*me, minerGUID))
miner->DisappearAndDie();
}
@@ -218,13 +218,16 @@ struct TRINITY_DLL_DECL boss_flame_leviathan_seatAI : public PassiveAI
}
#endif
void PassengerBoarded(Unit *who, int8 seatId)
void PassengerBoarded(Unit *who, int8 seatId, bool apply)
{
if(!me->GetVehicle())
return;
if(seatId == SEAT_PLAYER)
{
if(!apply)
return;
if(Creature *turret = CAST_CRE(vehicle->GetPassenger(SEAT_TURRET)))
{
turret->setFaction(me->GetVehicleBase()->getFaction());
@@ -237,12 +240,11 @@ struct TRINITY_DLL_DECL boss_flame_leviathan_seatAI : public PassiveAI
device->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
}
}
}
else if(seatId == SEAT_TURRET)
{
if(apply)
return;
void PassengerLeft(Unit *who, int8 seatId)
{
if(seatId == SEAT_TURRET)
{
if(Unit *device = vehicle->GetPassenger(SEAT_DEVICE))
{
device->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
@@ -31,16 +31,33 @@
struct TRINITY_DLL_DECL boss_kologarnAI : public BossAI
{
boss_kologarnAI(Creature *c) : BossAI(c, BOSS_KOLOGARN), vehicle(me->GetVehicleKit())
boss_kologarnAI(Creature *c) : BossAI(c, BOSS_KOLOGARN), vehicle(me->GetVehicleKit()),
leftArm(NULL), rightArm(NULL)
{
assert(vehicle);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
}
void Reset()
{
_Reset();
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
}
Vehicle *vehicle;
Creature *leftArm, *rightArm;
void AttackStart(Unit *who)
{
me->Attack(who, true);
me->Attack(who, false);
}
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;
}
void UpdateAI(const uint32 diff)
@@ -48,7 +65,18 @@ struct TRINITY_DLL_DECL boss_kologarnAI : public BossAI
if(!UpdateVictim())
return;
DoMeleeAttackIfReady();
if (me->isAttackReady())
{
//If we are within range melee the target
if (me->IsWithinMeleeRange(me->getVictim()))
{
Unit *attacker = me;
if(leftArm) attacker = leftArm;
if(rightArm && rand()%2) attacker = rightArm;
attacker->AttackerStateUpdate(me->getVictim());
me->resetAttackTimer();
}
}
}
};
+1 -2
View File
@@ -160,8 +160,7 @@ class TRINITY_DLL_SPEC CreatureAI : public UnitAI
void SetGazeOn(Unit *target);
virtual void PassengerBoarded(Unit *who, int8 seatId) {}
virtual void PassengerLeft(Unit *who, int8 seatId) {}
virtual void PassengerBoarded(Unit *who, int8 seatId, bool apply) {}
protected:
bool _EnterEvadeMode();
+2 -2
View File
@@ -275,7 +275,7 @@ bool Vehicle::AddPassenger(Unit *unit, int8 seatId)
}
if(((Creature*)me)->IsAIEnabled)
((Creature*)me)->AI()->PassengerBoarded(unit, seat->first);
((Creature*)me)->AI()->PassengerBoarded(unit, seat->first, true);
}
//if(unit->GetTypeId() == TYPEID_PLAYER)
@@ -316,7 +316,7 @@ void Vehicle::RemovePassenger(Unit *unit)
me->RemoveCharmedBy(unit);
if(me->GetTypeId() == TYPEID_UNIT && ((Creature*)me)->IsAIEnabled)
((Creature*)me)->AI()->PassengerLeft(unit, seat->first);
((Creature*)me)->AI()->PassengerBoarded(unit, seat->first, false);
// only for flyable vehicles?
//CastSpell(this, 45472, true); // Parachute