Commit Graph
239 Commits
Author SHA1 Message Date
Giacomo Pozzoni 60519e947f Core/SAI: Fix SMART_ACTION_WP_PAUSE with 0 delay pausing the path only for 1 world loop update (#25471)
* 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 7dd51ae6d98cf6dd8ac71412aa689f888c7bf369)
2022-02-27 20:08:41 +01:00
Maks Szokalski bc04acb726 Add "On" to some gossip methods in AI (#25415)
* Add "On" to some methods

* Update npc_innkeeper.cpp

* Update zone_borean_tundra.cpp

(cherry picked from commit 41188eb535e445b73909659980257da2939e4be4)
2022-02-05 22:18:19 +01:00
Treeston fc094509e9 Core/Scripts: Remove now-unused WaypointPathStarted hook. WaypointStarted does everything it used to do, anyway. b3694bf follow-up.
(cherry picked from commit c9356190b7891deb7878bc30064eaf1c81857c2c)
2022-02-05 13:31:50 +01:00
jackpoz c2d2df96db Core/SAI: Fix SMART_EVENT_WAYPOINT_START not being called at every waypoint checking wrong path id parameter
Remove multiple calls to SMART_EVENT_WAYPOINT_START for the 1st waypoint.
Closes #24760

(cherry picked from commit b3694bf47bfdab8ee9c074ac4a22d8f389e1cfc1)
2022-02-05 13:31:00 +01:00
jackpoz b3545479bf Core/SAI: Fix creatures casting spells while moving with flag SMARTCAST_COMBAT_MOVE
Fixes #24019

(cherry picked from commit 2910d0fb2436d9865d792ef92cb415f831a0af93)
2022-01-26 16:23:15 +01:00
akrom23 77d76ecc1d Creature/AI: Remove SetVisible from SmartAI::InitializeAI
Closes #24184

(cherry picked from commit f99a79cb4301f1d76d95b9c953918216947a2b94)
2022-01-22 00:34:25 +01:00
Seyden f383c0ea21 Core/SAI: Add SMART_ACTION_BECOME_PERSONAL_CLONE_FOR_PLAYER (#27581) 2022-01-18 20:51:23 +01:00
Rothend 381333690b Core/SAI: do not allow the waypoint pause timer to update while in combat. (#24877)
(cherry picked from commit 37cb39179629c90afb09324864bd31bddb9bd07c)
2022-01-18 00:17:44 +01:00
Rothend d4a1a7a040 Core/SAI: implement SMART_EVENT_SUMMONED_UNIT_DIES (82), useable by creatures and gameobjects (#24874)
* Core/SAI: implement SMART_EVENT_SUMMONED_UNIT_DIES (82), useable by creatures and gameobjects.

Closes #24831

* Update SmartScriptMgr.h

(cherry picked from commit 5339d1d3b835fcc8f635d34457ceb6e653e70a1c)
2022-01-18 00:17:28 +01:00
Rothend 1ddde5ca3c Core/SmartAI: allow AreaTrigger SAI scripts to use the player triggering it as base object for actions and targeting (#24817)
* Core/SmartAI: allow AreaTrigger SAI scripts to use the player triggering it as base object for actions and targeting.

Closes #23669
Closes #24791
Closes #24792
Closes #24793

* Apply suggested changes.

* Initialize atPlayer in the constructor

Co-authored-by: Giacomo Pozzoni <[email protected]>
(cherry picked from commit e7a714f66c371cdeb6585846ddedb1bc445e695f)
2022-01-06 22:05:03 +01:00
ForesterDev 3171cd3fa9 Core/AI: refactor SpellHit and SpellHitTarget. (#24691)
* 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 e3b232fe0e5c21a87d3fe71813e9d750259823f1)
2022-01-06 20:46:25 +01:00
jackpoz c75d75b9fa Core/AI: Fix charmed Creatures with SAI scripts not starting waypoint paths
(cherry picked from commit 49e77d7c9e4c39296536cd0b2d427d047e762f46)
2021-12-22 22:36:39 +01:00
jackpoz dab7e5688c Core/AI: Fix remaining charming issue
Make creatures evade when a charming expires and they cannot attack the charmer (i.e. charmer with .gm on)

(cherry picked from commit 69809d12031d055d8d0cffb5a187d9af09dd0efe)
2021-12-22 21:00:14 +01:00
Giacomo Pozzoni 144cfc2bce Core/AI: Make charmed creatures follow their owner (#24195)
* Core/AI: Make charmed creatures follow their owner

* Follow the charmer only when applying the charm

* Make SmartAI follow the charmer

(cherry picked from commit ddf2f60c1317f0ce728d5894064f51251cf71c72)
2021-12-22 20:46:17 +01:00
Ujp8LfXBJ6wCPR ee5384a15d Modernize codebase with Clang-Tidy range based loops (#24165)
Manual expansion of auto types into "typed types"

(cherry picked from commit a933ba60151f478c7bae23dddbba315a448ffe3e)
2021-12-22 16:42:54 +01:00
Killyana d946d74ff9 Core/AI: Fix creatures not updating their target properly once engaged
Closes  #21562

(cherry picked from commit 7fb74326205acbc5c0fa6b2aa9731d891e788d64)
2021-12-19 15:54:20 +01:00
Treeston 3db58c4d96 Core/SmartAI: SmartAI creatures no longer process health-based hooks after death.
(cherry picked from commit 1faa54fe8b2690507e4177a9a7373c0b24855291)
2021-12-18 00:03:55 +01:00
ccrs e94dca132b Core/SmartAI: add missing movement generator type check on SmartAI::SetCombatMove
ref #21562

(cherry picked from commit 0e3e4353a1824dd6e40ca10a01c4465aa1b1fbad)
2021-12-16 22:10:54 +01:00
ccrs f1ef2f73a4 Core/SmartAI: allow more Unit::ResumeMovement calls on JustReachedHome()
Since ResumeMovement also works on other MOTION_SLOT_DEFAULT generators (like RandomMG)

(cherry picked from commit c8cb866db088837cd7c771059e66d98a46de4fdd)
2021-12-16 22:08:01 +01:00
Wyrserth 83a9222c39 Core/SAI: allow creatures to handle gameobject spellhit SAI events. (#23492)
(cherry picked from commit 7a71127da92bd833caf4188aee2d5e88c61ae772)
2021-12-13 00:42:17 +01:00
ccrs f4a71ea9aa Core/AI: remove extra empty line
(cherry picked from commit 3c77c04b052f721efb96bdaaceeca8de09926f12)
2021-12-12 02:15:10 +01:00
Treeston 743d022cee AI/SmartAI: Properly forward to inherited CreatureAI::JustAppeared in SmartAI::JustAppeared. Fixes #23491.
(cherry picked from commit 854a113fc7b6610873b77355aed88900ce3b5bc0)
2021-12-12 02:11:15 +01:00
Treeston e398bb1664 AI/SmartAI: Move SMART_EVENT_RESPAWN invocation from ::InitializeAI() to ::JustAppeared(). Closes #23313.
(cherry picked from commit 37fc38b91701c3e699b20f3ed8de8da3b5c42063)
2021-12-12 01:27:04 +01:00
Wyrserth 5331656785 Core/SAI: allow to start waypoint movement for a creature that is in combat. (#23426)
(cherry picked from commit d6e36601151046d5e99f97fa9594ac2d86fa698c)
2021-12-11 15:29:32 +01:00
jackpoz 6034992dff Core/SmartAI: Implement SMART_EVENT_SUMMONED_UNIT and SMART_EVENT_SUMMON_DESPAWNED for GameObject owners
(cherry picked from commit 507a56d62764f63113d35dfcca9273b8d0b16cc5)
2021-12-07 00:31:26 +01:00
Giacomo Pozzoni 5f545f5402 3.3.5 gameobject summoner (#23289)
* Scripts/Misc: Change IsSummonedBy(Unit*) to IsSummonedBy(WorldObject*)

* Scripts/Misc: Fix build

* Core/TempSummons: Rename GetSummoner() to GetSummonerUnit()

* Core/TempSummons: Add support to TempSummons::GetSummoner() to return GameObject too

* Fix build

* Core/TempSummons: Allow GameObject to be owner of TempSummon

* Core/TempSummons: Add support to SAI for GameObject owner of TempSummon

* Scripts/Misc: Fix no-pch build

* Core/TempSummons: Implement PR comments

(cherry picked from commit 797fba98e95da1236465a15061ec4122d7ec33fe)
2021-12-07 00:02:03 +01:00
jackpoz 54044bda82 Core/SmartAI: Fix SMART_EVENT_SUMMON_DESPAWNED
Fix SMART_EVENT_SUMMON_DESPAWNED not working when event_param1 was set to any value other than 0

(cherry picked from commit 457fc224733cc78cedc5e956442a9f5d7bd2f049)
2021-12-06 23:27:45 +01:00
ccrs 844f969ed7 Core/AI: logs, codestyle & cosmetics standarization
(cherry picked from commit fdb71ce19e02b44323fbb9dfa5f07dae2a35f8ba)
2021-12-05 16:48:58 +01:00
ccrs dd11603150 Core/AI: variable naming standarization
plus minimum codestyle changes

(cherry picked from commit 179c7da1fc264b1444aa50632317e16dca02f78b)
2021-12-05 16:17:02 +01:00
ccrs 356358ee15 Core/Misc: standarize a couple logs
(cherry picked from commit aee26eb46727171593ef7cc1d2652a7847dc88fc)
2021-12-02 00:39:28 +01:00
Killyana e5eff88282 Core/SAI: Fix Move to position and Set run if used after a waypoint
Closes #22976

(cherry picked from commit 9ab05e2b6dee2008aac512e98bc477c4ed637cfc)
2021-11-24 22:16:02 +01:00
Killyana da1166db98 Core/SAI: Fix the respawn event for GameObjects (#23112)
Closes #22612

(cherry picked from commit 75a8639242c9d28deaa0565aba138d2e05b12db9)
2021-11-24 22:15:52 +01:00
Aokromes 2682bf0fca Core/Misc: Add categories to 3 logs
(cherry picked from commit 2d22c027fe0df505ddc63d4faaad032cddd5e258)
2021-11-23 22:29:21 +01:00
Shauren f2456ff319 Scripts/Areatriggers: Fixed all areatrigger scripts triggering both on enter and exit instead of only on enter 2021-11-10 00:01:50 +01:00
Treeston 34f9666f20 Core/Unit: Some charm fixes:
* Properly restore react state after possession expires. Closes #20769.
* Possessed creatures now don't override player control with random/waypoint motion
* SmartAI creatures now properly re-aggress charmer after charm expires

(cherry picked from commit da21ca80fc35a325df0fb0ef2f687a91121d42de)
2021-10-23 14:44:05 +02:00
Treeston e4e8c1c59c Core/AI: Clean up charm AI handling, we now have two unique_ptr instead of a crapton of booleans
(cherry picked from commit 042f5515e4f3e52b0d2e23d9b9e147041849ce12)
2021-10-22 23:47:51 +02:00
Seyden 8f097e4425 Core/Scripts: Implement script name reloading
* Authored by Seyden
* Co-authored by Naios
* We thank Shauren for your helpful feedback
2021-10-22 12:52:37 +02:00
Treeston 0c3690db91 Core/SmartAI: SetRun fix for SAI, because for some reason it has like 95% of escortai code duplicated??? shitshow zz
closes #21463

(cherry picked from commit f95a383293e32eeae514899c132e901174f4207e)
2021-10-22 00:41:41 +02:00
ccrs 426f9f2f92 Core/Movement: MotionMaster reimplementation (#21888)
Internal structure and handling changes, nothing behavioural (or thats the intention at least).

(cherry picked from commit 982643cd96790ffc54e7a3e507469649f3b074d2)
2021-09-28 00:15:13 +02:00
Killyana e7f93ca96d Core/SmartAI: Remove PauseMovement on AttackStart
Closes #21144

(cherry picked from commit e27a745c582f1c45a5d8a1b72c1d61fe3cecf2f1)
2021-09-25 20:43:39 +02:00
ariel- 962f6d7988 Core/Spells: rework part 5: GameObject casting
Closes #21330
Closes #18885
Ref #18752

(cherry picked from commit 45c5e1b9d63796d168339a44f63418f220cf2403)
2021-08-28 15:59:11 +02:00
ariel- a1a00f823e Core/Entities: kill unused return value from Unit::HandleSpellClick
- AI hook will now receive the result by copy, as modifying it had no effect
- Some renaming: result->spellClickHandled, clickPair is actually clickBounds, the clickPair is the pair <creatureID, SpellClickInfo>

(cherry picked from commit 98d6258efdc07b53808ba6177e5427c65163bc0d)
2021-08-08 21:21:34 +02:00
Treeston 37298ca99c Scripts/SmartAI: SetData now has an invoker (if the setting is done by something using SmartAI).
Also, some refactors. SMARTAI IS SUCH A FUCKING CLUSTERFUCK I SWEAR.

(cherry picked from commit cfc77fd84355d28737f3f85f2ba318be5caacdea)
2021-06-21 00:06:41 +02:00
Treeston 168be492f5 Entities/GO: Add forceRespawnTimer support to DespawnOrUnsummon. Use it in SAI.
(cherry picked from commit 264d4e1d30debcf6feacee3d29982875672a7bbe)
2021-06-20 22:10:08 +02:00
Treeston bd158f6c29 oops, now it builds (and a bonus refactor that annoyed me)
(cherry picked from commit 2cd5992f37fe386786ddd906cd4dd691125ad2b6)
2021-06-20 21:42:35 +02:00
Treeston 1f26122528 Scripts/SmartAI: Forward invoker to invoked action list actions. Also JustAppeared -> InitializeAI.
(cherry picked from commit 6fb0bc10387b73836cea9a3c0eaaafcf58794b7d)
2021-06-20 21:42:35 +02:00
Treeston 06b5b8d8b7 Scripts/SmartAI: SMART_TARGET_INVOKER cleanup step 1. The core will now log errors on start-up if SMART_TARGET_INVOKER abuse is found, but will continue to load the scripts as deprecated for now.
Note that a lot of these scripts may either not currently work, not work reliably, or may be prone to breaking unexpectedly when core internals change. SMART_TARGET_INVOKER is undefined behavior on any event that doesn't directly specify its invoker.

(We are considering options for allowing INVOKER to make sense in timed action lists in a reliable fashion, so they are exempted at this time.)

(cherry picked from commit 482328bddf1c5fcd367268525d2f904793239bc9)
2021-06-20 21:42:33 +02:00
Treeston 7695784fd2 AI/SmartAI: Remove a silly incorrect piece of code that was breaking react state swaps on SAI creatures. Fixes #21353.
(cherry picked from commit 6e0df9fce1e1f4de3ffa97bf9ef711f13f2b9a55)
2021-06-19 01:55:18 +02:00
ariel- 861cf261c5 Core/Formations: update codestyle and fix crash
Closes #21288

(cherry picked from commit 73cc613dc86d7d72d78f22affe2faba6786bccc5)
2021-06-16 19:26:32 +02:00
Shauren b9d63c2009 Core/Scripts: Remove deprecated overload of QuestReward without LootItemType argument 2021-05-16 21:56:06 +02:00