Scripts/SmartScripts: Fix charmed behavior for SmartAI. For real this time.

- Core AI logic will no longer issue attack/movement commands while under player control.
- Add new SMART_EVENT_FLAG_WHILE_CHARMED (0x200). Any event without this flag won't run while charmed.
- Add SMART_EVENT_FLAG_WHILE_CHARMED to existing actions, except a select subset (movement, talking, and nontriggered casts, pretty much).
This commit is contained in:
treeston authored and Aokromes committed 2016-09-03 01:21:03 +02:00
1 parent 214602a29d
commit 9da4e304ae
7 files changed
+127 -33

No files matched your search

@@ -130,7 +130,7 @@ enum SMART_EVENT
SMART_EVENT_IC_LOS = 26, // NoHostile, MaxRnage, CooldownMin, CooldownMax
SMART_EVENT_PASSENGER_BOARDED = 27, // CooldownMin, CooldownMax
SMART_EVENT_PASSENGER_REMOVED = 28, // CooldownMin, CooldownMax
SMART_EVENT_CHARMED = 29, // NONE
SMART_EVENT_CHARMED = 29, // onRemove (0 - on apply, 1 - on remove)
SMART_EVENT_CHARMED_TARGET = 30, // NONE
SMART_EVENT_SPELLHIT_TARGET = 31, // SpellID, School, CooldownMin, CooldownMax
SMART_EVENT_DAMAGED = 32, // MinDmg, MaxDmg, CooldownMin, CooldownMax
@@ -293,6 +293,11 @@ struct SmartEvent
uint32 repeatMax;
} aura;
struct
{
uint32 onRemove;
} charm;
struct
{
uint32 spell;
@@ -1369,20 +1374,21 @@ enum SmartEventFlags
SMART_EVENT_FLAG_RESERVED_6 = 0x040,
SMART_EVENT_FLAG_DEBUG_ONLY = 0x080, //Event only occurs in debug build
SMART_EVENT_FLAG_DONT_RESET = 0x100, //Event will not reset in SmartScript::OnReset()
SMART_EVENT_FLAG_WHILE_CHARMED = 0x200, //Event occurs even if AI owner is charmed
SMART_EVENT_FLAG_DIFFICULTY_ALL = (SMART_EVENT_FLAG_DIFFICULTY_0|SMART_EVENT_FLAG_DIFFICULTY_1|SMART_EVENT_FLAG_DIFFICULTY_2|SMART_EVENT_FLAG_DIFFICULTY_3),
SMART_EVENT_FLAGS_ALL = (SMART_EVENT_FLAG_NOT_REPEATABLE|SMART_EVENT_FLAG_DIFFICULTY_ALL|SMART_EVENT_FLAG_RESERVED_5|SMART_EVENT_FLAG_RESERVED_6|SMART_EVENT_FLAG_DEBUG_ONLY|SMART_EVENT_FLAG_DONT_RESET)
SMART_EVENT_FLAGS_ALL = (SMART_EVENT_FLAG_NOT_REPEATABLE|SMART_EVENT_FLAG_DIFFICULTY_ALL|SMART_EVENT_FLAG_RESERVED_5|SMART_EVENT_FLAG_RESERVED_6|SMART_EVENT_FLAG_DEBUG_ONLY|SMART_EVENT_FLAG_DONT_RESET|SMART_EVENT_FLAG_WHILE_CHARMED)
};
enum SmartCastFlags
{
SMARTCAST_INTERRUPT_PREVIOUS = 0x01, //Interrupt any spell casting
SMARTCAST_TRIGGERED = 0x02, //Triggered (this makes spell cost zero mana and have no cast time)
SMARTCAST_INTERRUPT_PREVIOUS = 0x01, // Interrupt any spell casting
SMARTCAST_TRIGGERED = 0x02, // Triggered (this makes spell cost zero mana and have no cast time)
//SMARTCAST_FORCE_CAST = 0x04, //Forces cast even if creature is out of mana or out of range
//SMARTCAST_NO_MELEE_IF_OOM = 0x08, //Prevents creature from entering melee if out of mana or out of range
//SMARTCAST_FORCE_TARGET_SELF = 0x10, //Forces the target to cast this spell on itself
SMARTCAST_AURA_NOT_PRESENT = 0x20, //Only casts the spell if the target does not have an aura from the spell
SMARTCAST_COMBAT_MOVE = 0x40 //Prevents combat movement if cast successful. Allows movement on range, OOM, LOS
SMARTCAST_AURA_NOT_PRESENT = 0x20, // Only casts the spell if the target does not have an aura from the spell
SMARTCAST_COMBAT_MOVE = 0x40 // Prevents combat movement if cast successful. Allows movement on range, OOM, LOS
};
// one line in DB is one event