Commit Graph

1110 Commits

Author SHA1 Message Date
Shauren
8a4e1119ac Core/Spells: Unify spell effect access api in both branches 2021-09-04 15:13:15 +02:00
Shauren
3dd75a49b1 Core/Spells: Removed SpellEffIndex effIndex argument from spell effect handlers, it was commented out in almost every handler 2021-08-28 19:51:29 +02:00
Shauren
bc2c76a5b8 Core/Spells: Refactor building SMSG_SPELL_EXECUTE_LOG to not create 192 empty vectors on every spell cast 2021-08-28 18:30:45 +02:00
ariel-
962f6d7988 Core/Spells: rework part 5: GameObject casting
Closes #21330
Closes #18885
Ref #18752

(cherry picked from commit 45c5e1b9d6)
2021-08-28 15:59:11 +02:00
ariel-
65dca120d3 Core/Spells: rework part 4: iterate over effects first
Ref #18395

Implement far spell queue processing
Closes #7395

(cherry picked from commit 080d2c6cd4)
2021-08-28 15:59:11 +02:00
ariel-
f3548d45d0 Core/Spells: rework part 3: spells only handle at most one UnitAura and one DynObjAura during its lifetime
Closes #15088

(cherry picked from commit e8d5aa56cc)
2021-08-28 15:59:11 +02:00
ariel-
52ae3c89d1 Core/Spells: rework part 2: Split up target selection logic
Target check only determines what kind of entities we can target, spell positivity determines if that entity is valid for attack/assist

Closes #8844

(cherry picked from commit 9b38a6352c)
2021-08-28 15:59:11 +02:00
ariel-
1e1415a491 Core/Spells: rework part 1: Improved positive detection logic
(cherry picked from commit efeae33495)
2021-08-28 15:59:11 +02:00
Traesh
fb6761c273 Core/Spells Implement targets 133, 134, 135 : TARGET_UNIT_LINE_CASTER_TO_DEST_*** (#26786) 2021-08-15 11:09:46 +02:00
Treeston
e47e95b6dc Core/VMap: Add outdoor state to Map::GetFullTerrainStatusForPosition. Add WorldObject::IsOutdoors, basic member access.
Ref #21479.

(cherry picked from commit e79c595b69)
2021-08-08 21:21:34 +02:00
Cannix
64234b35ed Core/Spells: Execute item casts immediately instead (#21396)
(cherry picked from commit 7e71b4535a)
2021-08-08 21:21:34 +02:00
Jeremy
69edf282fa Partial: Core/Entities: Reduce the probability of units dropping under the map (#21322)
Reduce the probabilty of going under the map

(cherry picked from commit 9e0faace9a)

Revert "Core/Entities: Reduce the probability of units dropping under the map (#21322)"

(cherry picked from commit 2dadbda24a)
2021-08-08 21:21:34 +02:00
ariel-
d91e099b10 Core/Spells: prevent creatures to focus channeled spells without SPELL_ATTR1_CHANNEL_TRACK_TARGET
- Creatures stuck here wouldn't try attacking because of this
- Remove one workaround in halion script, now it's unneeded

Ref #11311

(cherry picked from commit 29f7258dc8)
2021-06-21 12:47:03 +02:00
ariel-
5323a7d386 Core/Spells: fixed server being too overzealous with autoshot
- Interrupting it when casting another spell and switching targets

Ref #21390

(cherry picked from commit 93cbe815cb)
2021-06-21 00:06:41 +02:00
ariel-
13be704cb4 Core/Spells: implement SPELLVALUE_CRIT_CHANCE
(cherry picked from commit 546a605bd0)
2021-06-19 23:33:44 +02:00
ariel-
85e5509e91 Core/Spells: calculate crit chance only for spells that do damage/healing
Refs #18813

(cherry picked from commit 52873a7072)
2021-06-19 23:33:38 +02:00
ariel-
800d92bec3 Core/Spells: remove duplicated LowerPlayerDamageReq call on reflected spells
- It is already called at Unit::DealDamage

(cherry picked from commit e979a58d17)
2021-06-19 23:33:24 +02:00
ariel-
01d9306854 Core/Spells: kill unused parameter from Spell constructor
Added in 1f2292af79

(cherry picked from commit 9fc732eb97)
2021-06-19 23:33:23 +02:00
ariel-
c43f61df3d Core/Spell: killed deprecated code which randomly changed powercost for missed spells
Added in 80d3cd43f6

Closes #5954

(cherry picked from commit b1072faa50)
2021-06-16 21:40:33 +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
ariel-
84a29d8077 Core/Unit: fixed crash
Closes #21231

(cherry picked from commit 22b24d8dae)
2021-06-14 01:19:38 +02:00
ariel-
fccf1a8c62 Core/Auras: removed caster dependency from core
- Decoupled Unit logic: split of spell critical chance into done (caster bonuses) and taken (target bonuses), this allows to precalculate caster bonuses on aura apply and then check victim's auras on damage/healing calc
- Made static a bunch of methods (they no longer have this pointer because they are now called from periodic handlers which may or may not have an active caster in world)
- Simplified all AuraEffect bonuses into AuraEffect::_amount, no more duplicated code
- Critical chance and whether or not caster is player owned unit (for resilience calcs) is now saved one level upper, on Aura itself (it's impossible as of 3.3.5 to have different effects with different critical chances)
- Minor cleanup of SPELL_DAMAGE_CLASS_NONE and Arcane Potency (#18813) crit handling

Closes #19876

(cherry picked from commit cb9e72e521)
2021-06-13 00:59:13 +02:00
Shauren
0b2087ae41 Core/Criteria: Add all values of CriteriaStartEvent 2021-06-01 21:16:41 +02:00
Shauren
6ecfe58cae Core/Maps & Extractors: Move copypasted map file headers into a single shared file and replace #defines with enums 2021-05-29 21:21:37 +02:00
xinef1
1912999b9e Core/Spells: Defined and implemented some new spell attributes (#18950)
(cherry picked from commit 23823f5147)
2021-05-16 21:56:07 +02:00
ariel-
83159544b5 Core/Spells: fix casting NO_TARGET event spells
Closes #19978

(cherry picked from commit e245113660)
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
5a9a3b3938 Core/Spells: Load SpellEffectInfo::ChainTargets as signed (there are negative values found in db2) 2021-05-15 02:13:45 +02:00
Shauren
1a7779a6e6 Core/Spells: Expose number of targets selected for each spell effect to scripts to allow implementing spells that do something depending on number of targets hit 2021-05-13 00:38:09 +02:00
ariel-
b426e64c39 Core/Entities: fix crash
- m_currentSpells and spell would be different in case cancelation of a channeled spell would remove the aura, and aura scripted to cast another channeled spell on remove
- In the above situation, we would lose reference of currentSpell and remove reference from wrong one, this was fixed by clearing the pointer before spell cancelation.

Closes #20172

(cherry picked from commit 5e284d4b38)
2021-04-27 23:56:35 +02:00
Matan Shukry
60df74933f Core/Spells: Removed extra health from feed pet (#26305) 2021-04-22 22:02:19 +02:00
Matan Shukry
2e2dc1afc9 Core/Spells: Added spell value duration to modify aura duration of a specific spell cast 2021-04-21 23:14:02 +02:00
Shauren
8eb3c61f1a Core/Misc: Fix cherry-pick errors 2021-04-16 15:23:04 +02:00
Treeston
9b141207d1 [3.3.5] CastSpell unclusterfucking (that's a word now) (#21123)
Core/Spell: The giant CastSpell unclusterfucking (that's a word now) of this generation.

- CastSpell now always takes three arguments - target, spellId, and a struct containing extra arguments
- This struct (CastSpellExtraArgs, see SpellDefines.h) serves as a conglomerate of every previous combination of the 20 billion different CastSpell overloads, all merged into one
  - It has some great utility constructors - check them out! All of these can be used to implicitly construct the ExtraArgs object.
- A gajillion refactors to make everything behave the way it always has

(cherry picked from commit d507a7e338)
2021-04-16 15:22:42 +02:00
Jeremy
446fc391f0 Core/Entities: Fix some weird movement due to los issues (#21125)
* Core/Entities: Fix some weird movement due to los issues
- Made LoS check use collisionHeight instead of midsection. Value was too low.
- Gnomes will now have a breath bar more quickly than for example a tauren.
- Changes have been made to checking for ground z as well, some tweeking might be needed but removed most of the scattered +2.0f/+0.5f/we
* Add 0.05f to isInAir check in Creature::UpdateMovementFlags

(cherry picked from commit e42903ec16)
2021-04-15 05:53:27 +02:00
ariel-
bebc20b4de Core/Spell: implement SPELL_FAILED_AURA_BOUNCED on DR spells
Closes #13695

(cherry picked from commit 5e2c5a52cd)
2021-04-15 05:53:27 +02:00
Shauren
9619f7c283 Core/Spells: Fixed spell channel object selection
Closes #21227
2021-04-14 00:01:35 +02:00
Robingad
f8255b1541 Core/Script: Implement CalcCritChance hooks for spell and aura scripts (#26116)
(cherry picked from commit AshamaneProject/AshamaneCore@4e0a3f4343)
2021-03-25 21:28:22 +01:00
Shauren
07a47947e2 Core/Spells: Defined and implemented new spell interrupt flags 2021-03-24 23:36:53 +01:00
Shauren
29169181cd Core/Spells: Defined more spell attributes 2021-03-21 17:51:23 +01: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
Shauren
16135b5096 Core/Spells: Changed channel triggered spells to inherit positive/negative status from main spells
Closes #18259
Closes #21041

(cherry picked from commit 6122006b0c)
2021-03-15 20:17:31 +01:00
Shauren
efdca47aff Core/Auras: Remove m_effIndex member of AuraEffect and always take it from SpellEffectInfo 2021-03-11 10:32:03 +01:00
Shauren
0960308cfc Core/Spells: Add Spell::HasPowerTypeCost to check which power types a spell uses 2021-03-04 22:46:44 +01:00
Shauren
a05fc3ded5 Core/Spells: Updated spell effect type definitions to match latest client version 2021-03-04 20:30:50 +01:00
Shauren
624881bef5 Core/Spells: Refactor Player::ApplySpellMod to take SpellInfo argument instead of just spell id 2021-03-02 21:32:48 +01:00
Ovah
b77c9d7a8c Core/Spells: Gathering no longer fails after patch 3.1.0 (#21039)
* Core/Skills: gathering items with orange skill level will no longer fail as it has been removed with patch 3.1.0

Closes #21038

(cherry picked from commit 51bcd1a918)
2021-02-25 18:50:55 +01:00
Matan Shukry
23aa13257a Core/Spells: Fixed spells using SPELL_EFFECT_POWER_BURN not working when combined with other effect types that hit other units and power burn hits caster (#26097) 2021-02-23 00:16:02 +01:00
Shauren
51a9d2a9c2 Core/Auras: Implemented new spell modifier type to change aura stack size on apply 2021-02-21 18:36:18 +01:00