diff options
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartScript.cpp | 12 | ||||
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartScriptMgr.h | 4 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 7de5b2c8ef2..1c80fd111e2 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -2726,6 +2726,9 @@ void SmartScript::GetTargets(ObjectVector& targets, SmartScriptHolder const& e, if ((!e.target.unitRange.creature || unit->ToCreature()->GetEntry() == e.target.unitRange.creature) && baseObject->IsInRange(unit, float(e.target.unitRange.minDist), float(e.target.unitRange.maxDist))) targets.push_back(unit); } + + if (e.target.unitRange.maxSize) + Trinity::Containers::RandomResize(targets, e.target.unitRange.maxSize); break; } case SMART_TARGET_CREATURE_DISTANCE: @@ -2744,6 +2747,9 @@ void SmartScript::GetTargets(ObjectVector& targets, SmartScriptHolder const& e, if (!e.target.unitDistance.creature || unit->ToCreature()->GetEntry() == e.target.unitDistance.creature) targets.push_back(unit); } + + if (e.target.unitDistance.maxSize) + Trinity::Containers::RandomResize(targets, e.target.unitDistance.maxSize); break; } case SMART_TARGET_GAMEOBJECT_DISTANCE: @@ -2762,6 +2768,9 @@ void SmartScript::GetTargets(ObjectVector& targets, SmartScriptHolder const& e, if (!e.target.goDistance.entry || unit->ToGameObject()->GetEntry() == e.target.goDistance.entry) targets.push_back(unit); } + + if (e.target.goDistance.maxSize) + Trinity::Containers::RandomResize(targets, e.target.goDistance.maxSize); break; } case SMART_TARGET_GAMEOBJECT_RANGE: @@ -2780,6 +2789,9 @@ void SmartScript::GetTargets(ObjectVector& targets, SmartScriptHolder const& e, if ((!e.target.goRange.entry && unit->ToGameObject()->GetEntry() == e.target.goRange.entry) && baseObject->IsInRange(unit, float(e.target.goRange.minDist), float(e.target.goRange.maxDist))) targets.push_back(unit); } + + if (e.target.goRange.maxSize) + Trinity::Containers::RandomResize(targets, e.target.goRange.maxSize); break; } case SMART_TARGET_CREATURE_GUID: diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index 0aa007ddb3d..b4587a0aaca 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -1309,6 +1309,7 @@ struct SmartTarget uint32 creature; uint32 minDist; uint32 maxDist; + uint32 maxSize; } unitRange; struct @@ -1321,6 +1322,7 @@ struct SmartTarget { uint32 creature; uint32 dist; + uint32 maxSize; } unitDistance; struct @@ -1344,6 +1346,7 @@ struct SmartTarget uint32 entry; uint32 minDist; uint32 maxDist; + uint32 maxSize; } goRange; struct @@ -1356,6 +1359,7 @@ struct SmartTarget { uint32 entry; uint32 dist; + uint32 maxSize; } goDistance; struct |