Add 6th parameter "count" to SMART_ACTION_SUMMON_CREATURE action to summon more than 1 creature. For backward compatibility, a value of 0 will be treated as 1.
(cherry picked from commit 5628ca7f7c)
Change SMART_EVENT_OOC_LOS and SMART_EVENT_IC_LOS first parameter to have 3 values:
- 0 : Hostile
- 1 : Not hostile (not that Friendly and Not hostile have different meanings)
- 2 : Any, as in both Hostile and Not hostile
Close#24789
* Add validation on startup for allowed values.
Code cleanup.
* Fix errors
(cherry picked from commit 9e7cdb02d2)
Add a second parameter to SetCorpseDelay() that specifies if Rate.Corpse.Decay.Looted setting should be ignored, false by default (aka don't ignore by default).
Add a second parameter to SMART_ACTION_SET_CORPSE_DELAY to specify if Rate.Corpse.Decay.Looted should be included, false by default (aka ignore by default).
(cherry picked from commit d5fc86af8b)
* Core/SAI: Add new action SMART_ACTION_SET_HEALTH_PCT
Add new action SMART_ACTION_SET_HEALTH_PCT (142) with one single parameter "percent" to set the Unit health.
Close#25317
* Do not allow 0%
(cherry picked from commit 7d6f7e4d19)
* Core/SAI: Fix SMART_EVENT_FLAG_NOT_REPEATABLE flag being ignored when specifying a chance
Fix SMART_EVENT_FLAG_NOT_REPEATABLE flag being ignored when specifying a chance, always making the action trigger.
* Fix SMART_ACTION_CAST with SMART_EVENT_FLAG_NOT_REPEATABLE not casting the spell at all if rolled chance was successful but creature couldn't cast the spell
* Prevent linked actions if SMART_ACTION_CAST couldn't be completed and will be retried later
(cherry picked from commit 96b289cadb)
* Core/SAI: Add orientation and delay columns to waypoints table
* Rename 2020_99_99_99_world.sql to 2020_09_19_00_world.sql
(cherry picked from commit 4b7d19c91b)
* Core/SAI: Fix SMART_ACTION_WP_PAUSE with 0 delay pausing the path only for 1 world loop update
* Add code comments
* Remove special handling of SMART_ACTION_WP_PAUSE in SMART_EVENT_WAYPOINT_REACHED
(cherry picked from commit 7dd51ae6d9)
* Game/AI: Implement option to move a creature back to Homeposition on Evade.
* If ToHomePosition (action param 1) is 1 > Move to last stored position
* If ToHomePosition (action param 1) is 0 > Move to homeposition
* Ref: https://github.com/TrinityCore/TrinityCore/issues/24226
* Add parameter for walkmode
* Game/AI: SAI SMART_ACTION_EVADE - Rename ToHomePosition to ToRespawnPosition and store point from GetRespawnPosition.
* Game/AI: SAI SMART_ACTION_EVADE - Rename ToHomePosition to ToRespawnPosition
* Remove broken bits, simplify the code
* Update comments
* Code cleanup
Co-authored-by: jackpoz <giacomopoz@gmail.com>
(cherry picked from commit 02fca032e1)
There might be cases where this should be allowed (i.e. if the SMART_TARGET_* is another object) but for now we'll just never allow it.
(cherry picked from commit 28921f191d)
* Core/SAI: Implement SMART_TARGET_ACTION_INVOKER in SMART_EVENT_FRIENDLY_HEALTH_PCT
* Require radius (5th parameter) to be set
(cherry picked from commit cbed1039c4)
* Core/SAI: Spell casts that cannot be executed because the unit is currently casting another spell will be retried asap with priority over other events
* Core/SAI: Re-sort the events only when needed
* Fix some priority reset and wrong mEventSortingRequired handling
* Code cleanup.
Sort only events loaded from db (not stored events, not timed action list).
* Code cleanup.
Raise priority of failed casts so they are retried before other spells
* Keep priority of the action fails and is rescheduled on next update
* Don't try recasting a spell in SMART_ACTION_CAST if there are multiple targets and at least 1 was successful
(cherry picked from commit ca25e8d019)
* Scripts/ScarletMonastery: Fix wrong emote during Headless Horseman encounter
* Scripts/HoR: Fix wrong emote during escape event
* Core/Unit: Make improve type safety of HandleEmoteCommand
Change argument type to the expected enum type Emote
* Scripts/CoS: Use SetUInt32Value to set UNIT_NPC_EMOTESTATE
UNIT_NPC_EMOTESTATE is no flag field
(cherry picked from commit 6c7837f947)
* Core/SAI: Fix creatures casting with flag SMARTCAST_COMBAT_MOVE not switching to melee when the school of the spell they are trying to cast gets silenced (and other cases of spell failure)
* Core/SAI: Retry casting after 500ms if a cast failed
Fixes#24914
(cherry picked from commit 63a6e1e048)
* Core/SmartAI: allow AreaTrigger SAI scripts to use the player triggering it as base object for actions and targeting.
Closes#23669Closes#24791Closes#24792Closes#24793
* Apply suggested changes.
* Initialize atPlayer in the constructor
Co-authored-by: Giacomo Pozzoni <giacomopoz@gmail.com>
(cherry picked from commit e7a714f66c)
Unlike SMART_ACTION_AUTO_ATTACK, this action is actually stopping the entire attack procedure, rather than just hack-disabling auto-attacks. Keep in mind that this action requires a passive react state to prevent a immediate AttackStart ai reaction
(cherry picked from commit 152ea60116)
* Core/AI: refactor SpellHit and SpellHitTarget.
- now caster/target is WorldObject instead of Unit
- remove SpellHitByGameObject / SpellHitTargetGameObject (handled by SpellHit / SpellHitTarget)
- rename parameters in scripts according parent methods
* Restore logic in Algalon script
* Changed check for REMORSELESS_WINTER hit to avoid dublicate call, because it has TARGET_UNIT_CASTER for effects 0/1 and TARGET_GAMEOBJECT_SRC_AREA for effect 2
* Fix build after merge
(cherry picked from commit e3b232fe0e)
* Game/AI: Implement new targettype SMART_TARGET_CLOSEST_UNSPAWNED_GAMEOBJECT which allows to search for closest unspawned gameobjects
* updates: https://github.com/TrinityCore/TrinityCore/issues/24067
* Game/AI: Implement new targettype SMART_TARGET_CLOSEST_UNSPAWNED_GAMEOBJECT which allows to search for closest unspawned gameobjects
(cherry picked from commit 2d948d3366)
* Game/SmartScripts: Reset counter in SAI only on Initialize.
* Game/SmartScripts: Reset counter in SAI only on Initialize.
(cherry picked from commit 4f52f7d7c9)
* Core/SAI: Allow SMART_TARGET_ACTION_INVOKER to target GameObjects
* Include new Coalesce(..) template by @Shauren
(cherry picked from commit 90b00288c2)