Scripts/Icecrown Citadel: Fixed Vengeful Shade despawning after it casts Vengeful Blast (Lady Deathwhisper)
Core/Auras: Implemented SPELL_AURA_SET_VEHICLE_ID (296) Core/Scripts: Moved DefaultTargetSelector class into header file --HG-- branch : trunk
This commit is contained in:
@@ -80,55 +80,6 @@ bool UnitAI::DoSpellAttackIfReady(uint32 spell)
|
||||
return true;
|
||||
}
|
||||
|
||||
// default predicate function to select target based on distance, player and/or aura criteria
|
||||
struct DefaultTargetSelector : public std::unary_function<Unit *, bool>
|
||||
{
|
||||
const Unit *me;
|
||||
float m_dist;
|
||||
bool m_playerOnly;
|
||||
int32 m_aura;
|
||||
|
||||
// pUnit: the reference unit
|
||||
// dist: if 0: ignored, if > 0: maximum distance to the reference unit, if < 0: minimum distance to the reference unit
|
||||
// playerOnly: self explaining
|
||||
// aura: if 0: ignored, if > 0: the target shall have the aura, if < 0, the target shall NOT have the aura
|
||||
DefaultTargetSelector(const Unit *pUnit, float dist, bool playerOnly, int32 aura) : me(pUnit), m_dist(dist), m_playerOnly(playerOnly), m_aura(aura) {}
|
||||
|
||||
bool operator() (const Unit *pTarget)
|
||||
{
|
||||
if (!me)
|
||||
return false;
|
||||
|
||||
if (!pTarget)
|
||||
return false;
|
||||
|
||||
if (m_playerOnly && (pTarget->GetTypeId() != TYPEID_PLAYER))
|
||||
return false;
|
||||
|
||||
if (m_dist > 0.0f && !me->IsWithinCombatRange(pTarget, m_dist))
|
||||
return false;
|
||||
|
||||
if (m_dist < 0.0f && me->IsWithinCombatRange(pTarget, -m_dist))
|
||||
return false;
|
||||
|
||||
if (m_aura)
|
||||
{
|
||||
if (m_aura > 0)
|
||||
{
|
||||
if (!pTarget->HasAura(m_aura))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pTarget->HasAura(-m_aura))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
Unit* UnitAI::SelectTarget(SelectAggroTarget targetType, uint32 position, float dist, bool playerOnly, int32 aura)
|
||||
{
|
||||
return SelectTarget(targetType, position, DefaultTargetSelector(me, dist, playerOnly, aura));
|
||||
|
||||
@@ -48,6 +48,55 @@ enum SelectAggroTarget
|
||||
SELECT_TARGET_FARTHEST,
|
||||
};
|
||||
|
||||
// default predicate function to select target based on distance, player and/or aura criteria
|
||||
struct DefaultTargetSelector : public std::unary_function<Unit *, bool>
|
||||
{
|
||||
const Unit *me;
|
||||
float m_dist;
|
||||
bool m_playerOnly;
|
||||
int32 m_aura;
|
||||
|
||||
// pUnit: the reference unit
|
||||
// dist: if 0: ignored, if > 0: maximum distance to the reference unit, if < 0: minimum distance to the reference unit
|
||||
// playerOnly: self explaining
|
||||
// aura: if 0: ignored, if > 0: the target shall have the aura, if < 0, the target shall NOT have the aura
|
||||
DefaultTargetSelector(const Unit *pUnit, float dist, bool playerOnly, int32 aura) : me(pUnit), m_dist(dist), m_playerOnly(playerOnly), m_aura(aura) {}
|
||||
|
||||
bool operator() (const Unit *pTarget)
|
||||
{
|
||||
if (!me)
|
||||
return false;
|
||||
|
||||
if (!pTarget)
|
||||
return false;
|
||||
|
||||
if (m_playerOnly && (pTarget->GetTypeId() != TYPEID_PLAYER))
|
||||
return false;
|
||||
|
||||
if (m_dist > 0.0f && !me->IsWithinCombatRange(pTarget, m_dist))
|
||||
return false;
|
||||
|
||||
if (m_dist < 0.0f && me->IsWithinCombatRange(pTarget, -m_dist))
|
||||
return false;
|
||||
|
||||
if (m_aura)
|
||||
{
|
||||
if (m_aura > 0)
|
||||
{
|
||||
if (!pTarget->HasAura(m_aura))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pTarget->HasAura(-m_aura))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class UnitAI
|
||||
{
|
||||
protected:
|
||||
|
||||
@@ -6348,3 +6348,35 @@ void AuraEffect::HandleAuraOpenStable(AuraApplication const * aurApp, uint8 mode
|
||||
|
||||
// client auto close stable dialog at !apply aura
|
||||
}
|
||||
|
||||
void AuraEffect::HandleAuraSetVehicle(AuraApplication const * aurApp, uint8 mode, bool apply) const
|
||||
{
|
||||
if (!(mode & AURA_EFFECT_HANDLE_REAL))
|
||||
return;
|
||||
|
||||
Unit * target = aurApp->GetTarget();
|
||||
|
||||
if (target->GetTypeId() != TYPEID_PLAYER || !target->IsInWorld())
|
||||
return;
|
||||
|
||||
uint32 vehicleId = GetMiscValue();
|
||||
|
||||
if (apply)
|
||||
{
|
||||
if (!target->CreateVehicleKit(vehicleId))
|
||||
return;
|
||||
}
|
||||
else if (target->GetVehicleKit())
|
||||
target->RemoveVehicleKit();
|
||||
|
||||
WorldPacket data(SMSG_PLAYER_VEHICLE_DATA, target->GetPackGUID().size()+4);
|
||||
data.appendPackGUID(target->GetGUID());
|
||||
data << uint32(apply ? vehicleId : 0);
|
||||
target->SendMessageToSet(&data, true);
|
||||
|
||||
if (apply)
|
||||
{
|
||||
data.Initialize(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, 0);
|
||||
target->ToPlayer()->GetSession()->SendPacket(&data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -256,6 +256,7 @@ class AuraEffect
|
||||
void HandleAuraConvertRune(AuraApplication const * aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraLinked(AuraApplication const * aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraOpenStable(AuraApplication const * aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraSetVehicle(AuraApplication const * aurApp, uint8 mode, bool apply) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -295,8 +295,8 @@ class boss_lady_deathwhisper : public CreatureScript
|
||||
DoScriptText(SAY_PHASE_2, me);
|
||||
DoScriptText(SAY_PHASE_2_EMOTE, me);
|
||||
DoStartMovement(me->getVictim());
|
||||
me->SetPower(POWER_MANA, 0);
|
||||
uiDamage -= me->GetPower(POWER_MANA);
|
||||
me->SetPower(POWER_MANA, 0);
|
||||
me->RemoveAurasDueToSpell(SPELL_MANA_BARRIER);
|
||||
events.SetPhase(PHASE_TWO);
|
||||
events.ScheduleEvent(EVENT_P2_FROSTBOLT, urand(10000, 12000), 0, PHASE_TWO);
|
||||
@@ -736,8 +736,17 @@ class npc_vengeful_shade : public CreatureScript
|
||||
|
||||
void SpellHitTarget(Unit * /*pTarget*/, const SpellEntry * spell)
|
||||
{
|
||||
if (spell->Id == SPELL_VENGEFUL_BLAST)
|
||||
switch (spell->Id)
|
||||
{
|
||||
case SPELL_VENGEFUL_BLAST:
|
||||
case 72010:
|
||||
case 72011:
|
||||
case 72012:
|
||||
me->Kill(me);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user