feat(Core/AI): CU_SAI - Custom Target Options (#2879)

NEW:
* SMART_TARGET_PLAYER_WITH_AURA (spellid, negation?, distMax, distMin) - if target.O is set it will resize the list of targets to target.o
* SMART_TARGET_RANDOM_POINT (range, amount (for summon creature), self (creature is middle else use xyz) (ONLY USED FOR SUMMON CREATURE OR MOVE/JUMP TO POS ACTIONS FOR NOW)

MODIFIED:
* SMART_ACTION_SUMMON_CREATURE now possible to spawn multiple creatures with SMART_TARGET_RANDOM_POINT
* SMART_ACTION_MOVE_TO_POS/JUMP_TO_POS now possible to move to a random point with SMART_TARGET_RANDOM_POINT
* SMART_TARGET_PLAYER_RANGE no longer targets GMs or dead targets and when target.o is >0 it will try all possible targets in max instead of min-maxing


Co-authored-by: Francesco Borzì <borzifrancesco@gmail.com>
This commit is contained in:
P-Kito
2020-04-18 16:59:52 +02:00
committed by GitHub
parent 63c86a9a14
commit 2514f8fc9a
7 changed files with 1033 additions and 677 deletions

View File

@@ -344,6 +344,9 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e)
case SMART_TARGET_CLOSEST_FRIENDLY:
case SMART_TARGET_STORED:
case SMART_TARGET_FARTHEST:
case SMART_TARGET_PLAYER_WITH_AURA:
case SMART_TARGET_RANDOM_POINT:
case SMART_TARGET_ROLE_SELECTION:
break;
default:
sLog->outErrorDb("SmartAIMgr: Not handled target_type(%u), Entry %d SourceType %u Event %u Action %u, skipped.", e.GetTargetType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
@@ -396,7 +399,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
default:
break;
}
if (e.target.type < 0 || e.target.type >= SMART_TARGET_END)
if (e.target.type < 0 || (e.target.type >= SMART_TARGET_TC_END && e.target.type < SMART_TARGET_AC_START) || e.target.type >= SMART_TARGET_AC_END)
{
sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has an invalid target type (%u), skipped.",
e.entryOrGuid, e.event_id, e.GetTargetType());