Core/Db/Conditions:
-Drop condition CONDITION_SPELL_SCRIPT_TARGET, use other condition types instead -Change CONDITION_SOURCE_TYPE_SPELL_SCRIPT_TARGET to CONDITION_SOURCE_TYPE_SPELL_IMPLICIT_TARGET: --allow using this condition for more spell implicit target types (not just ENTRY) --SourceGroup value for this src type is now effMask and it's now required Core/Spells: Unify the way implicit targets are handled, fully implement some partially implemented target types, fix some minor bugs found on the way, general improvements and cleanup.
This commit is contained in:
1 parent
6155fdd103
commit
f09b5a6bea
23 files changed
+5721
-1823
No files matched your search
+1
-1
@@ -62,7 +62,7 @@ class OrientationCheck : public std::unary_function<Unit*, bool>
|
||||
explicit OrientationCheck(Unit* _caster) : caster(_caster) { }
|
||||
bool operator() (Unit* unit)
|
||||
{
|
||||
return !unit->isInFront(caster, 40.0f, 2.5f);
|
||||
return !unit->isInFront(caster, 2.5f) || !unit->IsWithinDist(caster, 40.0f);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -1736,25 +1736,29 @@ class spell_vehicle_throw_passenger : public SpellScriptLoader
|
||||
if (Vehicle* vehicle = GetCaster()->GetVehicleKit())
|
||||
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, NPC_SEAT);
|
||||
std::list<WorldObject*> targetList;
|
||||
Trinity::WorldObjectSpellAreaTargetCheck check(99, GetTargetDest(), GetCaster(), GetCaster(), GetSpellInfo(), TARGET_CHECK_DEFAULT, NULL);
|
||||
Trinity::WorldObjectListSearcher<Trinity::WorldObjectSpellAreaTargetCheck> searcher(GetCaster(), targetList, check);
|
||||
GetCaster()->GetMap()->VisitAll(GetCaster()->m_positionX, GetCaster()->m_positionY, 99, searcher);
|
||||
float minDist = 99 * 99;
|
||||
Unit* target = NULL;
|
||||
for (std::list<Unit*>::iterator itr = unitList.begin(); itr != unitList.end(); ++itr)
|
||||
for (std::list<WorldObject*>::iterator itr = targetList.begin(); itr != targetList.end(); ++itr)
|
||||
{
|
||||
if (Vehicle* seat = (*itr)->GetVehicleKit())
|
||||
if (!seat->GetPassenger(0))
|
||||
if (Unit* device = seat->GetPassenger(2))
|
||||
if (!device->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
|
||||
{
|
||||
float dist = (*itr)->GetExactDistSq(targets.GetDst());
|
||||
if (dist < minDist)
|
||||
{
|
||||
minDist = dist;
|
||||
target = (*itr);
|
||||
}
|
||||
}
|
||||
if (Unit* unit = (*itr)->ToUnit())
|
||||
if (unit->GetEntry() == NPC_SEAT)
|
||||
if (Vehicle* seat = unit->GetVehicleKit())
|
||||
if (!seat->GetPassenger(0))
|
||||
if (Unit* device = seat->GetPassenger(2))
|
||||
if (!device->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
|
||||
{
|
||||
float dist = unit->GetExactDistSq(targets.GetDst());
|
||||
if (dist < minDist)
|
||||
{
|
||||
minDist = dist;
|
||||
target = unit;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (target && target->IsWithinDist2d(targets.GetDst(), GetSpellInfo()->Effects[effIndex].CalcRadius() * 2)) // now we use *2 because the location of the seat is not correct
|
||||
passenger->EnterVehicle(target, 0);
|
||||
|
||||
@@ -196,7 +196,7 @@ class spell_gen_cannibalize : public SpellScriptLoader
|
||||
float max_range = GetSpellInfo()->GetMaxRange(false);
|
||||
WorldObject* result = NULL;
|
||||
// search for nearby enemy corpse in range
|
||||
Trinity::AnyDeadUnitSpellTargetInRangeCheck check(caster, max_range, GetSpellInfo(), TARGET_SELECT_CHECK_ENEMY);
|
||||
Trinity::AnyDeadUnitSpellTargetInRangeCheck check(caster, max_range, GetSpellInfo(), TARGET_CHECK_ENEMY);
|
||||
Trinity::WorldObjectSearcher<Trinity::AnyDeadUnitSpellTargetInRangeCheck> searcher(caster, result, check);
|
||||
caster->GetMap()->VisitFirstFound(caster->m_positionX, caster->m_positionY, max_range, searcher);
|
||||
if (!result)
|
||||
|
||||
@@ -532,7 +532,7 @@ class spell_hun_pet_carrion_feeder : public SpellScriptLoader
|
||||
float max_range = GetSpellInfo()->GetMaxRange(false);
|
||||
WorldObject* result = NULL;
|
||||
// search for nearby enemy corpse in range
|
||||
Trinity::AnyDeadUnitSpellTargetInRangeCheck check(caster, max_range, GetSpellInfo(), TARGET_SELECT_CHECK_ENEMY);
|
||||
Trinity::AnyDeadUnitSpellTargetInRangeCheck check(caster, max_range, GetSpellInfo(), TARGET_CHECK_ENEMY);
|
||||
Trinity::WorldObjectSearcher<Trinity::AnyDeadUnitSpellTargetInRangeCheck> searcher(caster, result, check);
|
||||
caster->GetMap()->VisitFirstFound(caster->m_positionX, caster->m_positionY, max_range, searcher);
|
||||
if (!result)
|
||||
|
||||
Reference in new issue
Block a user