108 Commits

Author SHA1 Message Date
Shauren
5de252ae84 Core/Misc: Move large functions out of header files 2025-07-13 13:40:31 +02:00
Ovahlord
24bda9c73d Core/Combat: reset the ThreatManager update interval upon engaging the creature and move ThreatClear packet sending into the update cycle to mimic retail behavior (#29949) 2024-05-02 22:50:20 +02:00
Shauren
1369b87084 Core/Creatures: Implemented CREATURE_STATIC_FLAG_2_IGNORE_SANCTUARY (ignore SPELL_EFFECT_SANCTUARY, used by Vanish) 2024-03-04 00:05:35 +01:00
Shauren
3fd1a2b78c Core/Creatures: Implemented CREATURE_STATIC_FLAG_3_NO_THREAT_FEEDBACK 2024-02-14 12:14:36 +01:00
funjoker
17c69368a3 Dep/Boost: Drop windows boost hacks (#29358) 2023-10-13 21:10:01 +02:00
Shauren
3e3968b63c Core/Units: Fixed possible use after free in ThreatManager
Closes #28830
2023-08-23 11:03:52 +02:00
Shauren
9e1b97900e Core/Auras: Minor optimization for Unit object creation with msvc (not allocating a list end sentinel node for all of the 500 lists stored in Unit for each aura type) 2023-08-18 18:23:29 +02:00
DeadMouse
deac3476b0 Core/Misc Fixed build with boost 1.74 (#28679) 2023-01-09 10:27:16 +01:00
Shauren
e8e330addd Core/Misc: Remove boost::heap::fibonacci_heap from header files 2023-01-06 16:54:16 +01:00
Shauren
8d16a79dea Core/Spells: Rename SpellAttr4 to use official attribute names
* Corrected implementation of SPELL_ATTR4_CLASS_TRIGGER_ONLY_ON_TARGET
* Implemented SPELL_ATTR4_NO_HELPFUL_THREAT
* Implemented SPELL_ATTR4_NO_PARTIAL_IMMUNITY
* Implemented SPELL_ATTR4_ALLOW_PROC_WHILE_SITTING
* Implemented SPELL_ATTR4_USE_FACING_FROM_SPELL
* Implemented SPELL_ATTR4_BOUNCY_CHAIN_MISSILES
* Implemented SPELL_ATTR4_AURA_NEVER_BOUNCES
* Implemented SPELL_ATTR4_AURA_BOUNCE_FAILS_SPELL
* Implemented SPELL_ATTR4_AURA_IS_BUFF
* Implemented SPELL_ATTR5_MELEE_CHAIN_TARGETING

* Implemented SpellEffectAttributes::ChainFromInitialTarget
2022-05-01 20:01:13 +02:00
Shauren
88d7b58a3d Core/Spells: Rename SpellAttr3 to use official attribute names
* Implemented SPELL_ATTR3_NO_AVOIDANCE
* Implemented SPELL_ATTR3_ONLY_PROC_OUTDOORS
* Implemented SPELL_ATTR3_ONLY_PROC_ON_CASTER
* Implemented SPELL_ATTR3_PVP_ENABLING
* Implemented SPELL_ATTR3_SUPPRESS_CASTER_PROCS
* Implemented SPELL_ATTR3_SUPPRESS_TARGET_PROCS
2022-04-30 16:57:32 +02:00
jackpoz
68faf5bc4b Core/Common: Replace ASSERT(false, "...") with ABORT_MSG("...")
(cherry picked from commit 54c701cf0d)
2022-01-19 22:17:42 +01:00
Treeston
a8ceed265a typo fix in comment
(cherry picked from commit 4fcb322010)
2021-12-18 15:47:18 +01:00
Treeston
0e13ed412a Core/Threat: Properly update offline states even if all threat references are offline. Closes #23639.
(cherry picked from commit 55ec3bd73f)
2021-12-17 21:46:33 +01:00
Treeston
a4c2c0fb1d Core/AI: No longer override chase movement with follow movement if the creature engages before JustAppeared has had a chance to fire.
(cherry picked from commit 49b04c0fdd)
2021-12-17 00:25:59 +01:00
Treeston
c13d83796f Core/AI: Finally move the "is creature engaged" flag to be a property of the creature AI, where it honestly always belonged. Fixes #17981 and #23602 for real this time.
(cherry picked from commit 0e7c66cb4c)
2021-12-17 00:23:33 +01:00
Treeston
38d7c1530a Combat/Threat: Split ThreatManager::NotifyDisengaged off from ThreatManager::ClearAllThreat. NotifyDisengaged signifies intent to clear the engagement flag, and should only be called from AI. Fixes #23490.
(cherry picked from commit 1158f267df)
2021-12-12 02:09:15 +01:00
Treeston
35e55f1089 Core/Entities: Kick engagement logic upstairs to Unit (from ThreatManager), since all Units with AI need it (not just those with threat list). Fixes #17981.
(cherry picked from commit dbe3bbefe7)
2021-12-12 00:31:15 +01:00
Treeston
35e5383929 Core/Threat: Properly sequence checking offline state _after_ adding the reference to the threat list. This ensures IsEngagedWith reports consistent values for downstack calls in Creature. Closes #22406.
(cherry picked from commit 9f1755dbf1)
2021-10-26 23:51:34 +02:00
Treeston
c323758631 Core/Threat: Suppressed threat is now re-evaluated on taunt state update, and taunting units can no longer be suppressed.
(cherry picked from commit fdbec8b639)
2021-10-25 14:17:14 +02:00
Treeston
55cb4f9a6d Core/Threat: Fear no longer suppresses threat. All confuse effects now suppress threat, even ones that wouldn't break on damage.
(cherry picked from commit 704870496f)
2021-10-23 16:01:05 +02:00
Treeston
00b9c23e28 Core/Entities: Fixed an issue where creatures would not properly assist formation members in certain scenarios. Tagging #21967.
(cherry picked from commit a001bc63b1)
2021-10-23 14:45:40 +02:00
Treeston
b6f4b53407 Core/Threat: Only send SMSG_THREAT_UPDATE if the threat list actually changed
(cherry picked from commit 4e5d1b7021)
2021-10-23 02:14:04 +02:00
Treeston
7a503ff597 Core/Threat: Further tweak to assist threat, all CC now prevents assist threat splitting (not just damage-breakable CC)
(cherry picked from commit 408ce48732)
2021-10-23 02:14:04 +02:00
Treeston
392a644dc8 Core/Threat: Threat system adjustments:
* Online states are now re-evaluated before victim update instead of continuously. Closes #22226. Tagging #21501.
* Victim update now happens every 1s as opposed to every server tick unless current target goes away.
* Suppressed threat is no longer re-established until the victim gains additional threat (by hitting the target, for instance).
* Assistance threat is now split between non-controlled units threatened by target, as opposed to all units threatened by target.

(cherry picked from commit 5cea572a9a)
2021-10-23 02:14:04 +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 042f5515e4)
2021-10-22 23:47:51 +02:00
jackpoz
3f659ce5ff Core/Thread: Fix crash added in fd33b1cd02
Fix crash caused by dereferencing uninitialized field.

(cherry picked from commit 623bc6483a)
2021-09-26 16:15:52 +02:00
Treeston
9f06cb63d2 Core/Threat: My dictionary informs me that "fixtate" is not, in fact, a word. Corrected to "fixate".
fd33b1c follow-up

(cherry picked from commit 1d27f83bda)
2021-09-26 16:13:15 +02:00
Treeston
16eb5032ad Core/Threat: Re-add fixtate system. I am being told Netherspite needs it.
(cherry picked from commit fd33b1cd02)
2021-09-26 16:12:33 +02:00
Treeston
c926e2fc94 1b7ec4b follow-up
(cherry picked from commit 7fe59c95d8)
2021-09-26 16:11:59 +02:00
Treeston
4634cfaa9f Core/Threat: Fix taunt behavior in some edge cases
(cherry picked from commit 1b7ec4bc84)
2021-09-26 16:07:40 +02:00
Treeston
f1ac141f25 Core/Unit: UNIT_FLAG renames
[UNIT_FLAG_PLAYER_CONTROLLED -> UNIT_FLAG_POSSESSED]
[UNIT_FLAG_PVP_ATTACKABLE -> UNIT_FLAG_PLAYER_CONTROLLED]
Signed off by: Shauren, Warlockbugs.

(cherry picked from commit 081eab3cf5)
2021-09-26 16:07:09 +02:00
Treeston
74cdf260e1 Core/Threat: Fix taunt logic relying on unspecified behavior by unordered boost heap iterators. Use ordered iterators instead, this is cheap for our use case anyway. This will make taunt behave consistently again.
Closes #21499.

(cherry picked from commit 71b5ed6832)
2021-08-08 21:21:34 +02:00
Treeston
fdc1c5b6c9 Combat/Threat: Now set engaged state for all units on offline reference registration (vanished/invis'd units). For non-PASSIVE units, this will immediately cause an evade.
This fixes an exploit where creating the reference as offline (by vanishing while a spell was mid-flight) you could damage a creature further without it ever engaging you.

(cherry picked from commit 2402406228)
2021-06-19 01:35:40 +02:00
ariel-
d0f4310c44 Core/Entities: don't allow client control if player is still affected by any lose of control state
(cherry picked from commit e315e41d36)
2021-06-16 21:26:57 +02:00
Treeston
73bf0e3a0b Core/Threat: Assistance threat (healing, buffs, etc.) is now properly split (instead of copied) between all creatures threatened by the action. Thanks to Foereaper for help with testing, and my apologies to healers everywhere.
(No apologies for charm AI though. You deserve that one.)

(cherry picked from commit 013d4560c7)
2021-06-16 14:29:45 +02:00
Treeston
9f91cf23ab Core/Threat: Passive creatures now properly become engaged when adding an offline threat entry. Fixes RoS and Thaddius, maybe more. Closes #21269.
(cherry picked from commit a373275612)
2021-06-16 14:26:10 +02:00
Treeston
56fcd8ba1d Core/Threat: Fix a potential crash that would occur in specific edge cases of AI being a bit naughty.
(cherry picked from commit 1847555c8c)
2021-06-15 23:22:50 +02:00
ariel-
63f9b52ea1 Core/Misc: kill whitespace
(cherry picked from commit f50a333418)
2021-05-29 21:27:11 +02:00
Treeston
563188fe4b 3dcd49e v2, slightly cheaper
(cherry picked from commit b53cbf467b)
2021-05-17 00:06:52 +02:00
Treeston
7cd61b581c Core/Threat: fix a potential super edge case iterator invalidation
(cherry picked from commit 3dcd49ef90)
2021-05-17 00:05:47 +02:00
Treeston
6344ddd633 Core/Threat: only send periodic threat list updates while unit is engaged
(cherry picked from commit a08ad9aac1)
2021-05-16 21:56:05 +02:00
Treeston
dce39aedc2 Core/Combat: Some more sanity check asserts to try and track down #21187.
Also, some anti-annoyance treatment for dot tele.

(cherry picked from commit fdacf12739)
2021-05-16 21:56:05 +02:00
Treeston
2a7bb9b404 Core/Combat: some more detailed assertions to possibly shed light on #21187.
(cherry picked from commit 5a9fddaa5a)
2021-05-16 21:56:05 +02:00
Treeston
5aee452943 Core/Misc: A variety of clean-up changes, mostly following up on 532ab1c to fix legacy bugs exposed by it:
- Triggers can no longer have a threat list (this may expose some ugliness in old legacy scripts)
- Threat entries are forced to OFFLINE if the AI refuses to attack the target
- Clean up passive creature evade behavior to be more consistent
- Fix a months old issue in spawn group management that would cause "Inactive" to incorrectly show in .list respawns for system groups outside of map 0
- Valithria script cleanups, remove old hacks and make it work with the new system. Closes #21174.
- Some strings cleanup

(cherry picked from commit 9f9507e6a1)
2021-05-16 21:56:05 +02:00
Treeston
34c7810fe5 Core: Combat/threat system rewrite (PR #19930)
- PvE combat is now always mutual. UNIT_FLAG_IN_COMBAT is backed by actual references to the units we're in combat with.
- PvP combat is now also tracked, and almost always mutual; spells like Vanish and Feign Death can break this rule. That means we can easily determine a list of players we're fighting.
- By extension, IsInCombatWith now has sensible behavior when invoked on nonplayers.
- Threat and combat systems are no longer the same.
  - They still have an enforced relationship (threat implies combat - clearing combat clears threat)...
  - ...but we can have combat without threat. A creature (with threat list) isn't considered to be engaged until it has an entry on its threat list...
  - ...which means we can now faithfully replicate retail engage behavior. Combat on projectile launch - engagement start on projectile impact. Yay for progress!
- AI method refactor, as already ported in 6113b9d - `JustEngagedWith`, `JustEnteredCombat` and `JustExitedCombat`.
- Vehicle threat is now properly pooled on the main vehicle body (fixes #16542).
- Various edge case bug fixes for threat redirects (Misdirection "cancelling" Vigilance and similar).
- Target re-selection is now significantly faster.
- Fixed a ton of other smaller edge case bugs, probably.

Closes #7951 and #19998.

(cherry picked from commit 532ab1c7f8)
2021-05-16 21:56:01 +02:00
Shauren
f21270b987 Core/Objects: Refactor private object checks into separate function 2021-03-28 20:22:05 +02:00
Matan Shukry
1082a6645e Core/Objects: Move personal summon handling from TemporarySummon/GameObject to WorldObject and check it using dedicated guid field 2021-03-28 20:22:05 +02:00
Shauren
9b5a46ca2b Core/Auras: Defined and implemented many new interrupt flags 2021-03-21 12:05:32 +01:00
Shauren
6585666e6e Core/Spells: Define all spell modifier types and implement ProcCooldown mod and PeriodicHealingAndDamage for melee periodic damage 2021-03-15 21:03:06 +01:00