*Remove function passengerleft
--HG-- branch : trunk
This commit is contained in:
@@ -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))
|
if(Creature *miner = Unit::GetCreature(*me, minerGUID))
|
||||||
miner->DisappearAndDie();
|
miner->DisappearAndDie();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -218,13 +218,16 @@ struct TRINITY_DLL_DECL boss_flame_leviathan_seatAI : public PassiveAI
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void PassengerBoarded(Unit *who, int8 seatId)
|
void PassengerBoarded(Unit *who, int8 seatId, bool apply)
|
||||||
{
|
{
|
||||||
if(!me->GetVehicle())
|
if(!me->GetVehicle())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(seatId == SEAT_PLAYER)
|
if(seatId == SEAT_PLAYER)
|
||||||
{
|
{
|
||||||
|
if(!apply)
|
||||||
|
return;
|
||||||
|
|
||||||
if(Creature *turret = CAST_CRE(vehicle->GetPassenger(SEAT_TURRET)))
|
if(Creature *turret = CAST_CRE(vehicle->GetPassenger(SEAT_TURRET)))
|
||||||
{
|
{
|
||||||
turret->setFaction(me->GetVehicleBase()->getFaction());
|
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);
|
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))
|
if(Unit *device = vehicle->GetPassenger(SEAT_DEVICE))
|
||||||
{
|
{
|
||||||
device->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
|
device->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
|
||||||
|
|||||||
@@ -31,16 +31,33 @@
|
|||||||
|
|
||||||
struct TRINITY_DLL_DECL boss_kologarnAI : public BossAI
|
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);
|
assert(vehicle);
|
||||||
|
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Reset()
|
||||||
|
{
|
||||||
|
_Reset();
|
||||||
|
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vehicle *vehicle;
|
Vehicle *vehicle;
|
||||||
|
Creature *leftArm, *rightArm;
|
||||||
|
|
||||||
void AttackStart(Unit *who)
|
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)
|
void UpdateAI(const uint32 diff)
|
||||||
@@ -48,7 +65,18 @@ struct TRINITY_DLL_DECL boss_kologarnAI : public BossAI
|
|||||||
if(!UpdateVictim())
|
if(!UpdateVictim())
|
||||||
return;
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -160,8 +160,7 @@ class TRINITY_DLL_SPEC CreatureAI : public UnitAI
|
|||||||
|
|
||||||
void SetGazeOn(Unit *target);
|
void SetGazeOn(Unit *target);
|
||||||
|
|
||||||
virtual void PassengerBoarded(Unit *who, int8 seatId) {}
|
virtual void PassengerBoarded(Unit *who, int8 seatId, bool apply) {}
|
||||||
virtual void PassengerLeft(Unit *who, int8 seatId) {}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool _EnterEvadeMode();
|
bool _EnterEvadeMode();
|
||||||
|
|||||||
@@ -275,7 +275,7 @@ bool Vehicle::AddPassenger(Unit *unit, int8 seatId)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(((Creature*)me)->IsAIEnabled)
|
if(((Creature*)me)->IsAIEnabled)
|
||||||
((Creature*)me)->AI()->PassengerBoarded(unit, seat->first);
|
((Creature*)me)->AI()->PassengerBoarded(unit, seat->first, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//if(unit->GetTypeId() == TYPEID_PLAYER)
|
//if(unit->GetTypeId() == TYPEID_PLAYER)
|
||||||
@@ -316,7 +316,7 @@ void Vehicle::RemovePassenger(Unit *unit)
|
|||||||
me->RemoveCharmedBy(unit);
|
me->RemoveCharmedBy(unit);
|
||||||
|
|
||||||
if(me->GetTypeId() == TYPEID_UNIT && ((Creature*)me)->IsAIEnabled)
|
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?
|
// only for flyable vehicles?
|
||||||
//CastSpell(this, 45472, true); // Parachute
|
//CastSpell(this, 45472, true); // Parachute
|
||||||
|
|||||||
Reference in New Issue
Block a user