Commit Graph
675 Commits
Author SHA1 Message Date
ariel- 3fbbea61bd Core/Spells: rework part 3: spells only handle at most one UnitAura and one DynObjAura during its lifetime
# Conflicts:
#	src/server/game/Spells/Auras/SpellAuras.h
2022-09-12 09:15:13 +02:00
ariel- 98a988a77a 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
2022-09-12 09:15:13 +02:00
ariel- 3bfa32d15b Core/Unit: kill unused parameter from SpellxxxBonusTaken 2022-09-12 09:15:11 +02:00
ariel- 6024b7b4fb Core/Unit: corrected calculation for SPELL_AURA_MOD_DAMAGE_TAKEN/SPELL_AURA_MOD_HEALING auras
- Spell bonus calculation and penalty was done twice, but it's simply flat +SP, which should be taken into account before other bonuses
- Fixed missing code from SpellDamageBonusDone/SpellHealingBonusDone and killed multiplication by stack amount twice for default coefficient spells (already multiplied on level penalty)
2022-09-12 09:15:11 +02:00
ariel- c81f48197d Core/Spells: calculate crit chance only for spells that do damage/healing 2022-09-12 09:15:10 +02:00
Ovahlord 30e219bfa1 Core/Entities: don't allow client control if player is still affected by any lose of control state 2022-09-12 09:15:08 +02:00
ariel- 29fddba8fd Core/Entities: Port some refactors from f1986c6aafdf2457902a7a4cc7acc903cbbdc7bb 2022-09-12 09:15:06 +02:00
ariel- 6fc5bfcd08 Core/Unit: fixed crash 2022-09-12 09:15:05 +02:00
ariel- 1d3fbff332 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
2022-09-12 09:15:04 +02:00
Ovahlord 6506e71a23 Core/Units: added a helper to check if a limited target aura exists without creating an empty element in the container 2022-02-21 13:44:24 +01:00
ariel- d441e864c4 Core/Unit: cleanup and minor fixes of miss and resist calculations
- Removed Unit::GetUnitMeleeSkill as it was basically a copy of GetMaxSkillValueForLevel
- Removed static from GetEffectiveResistChance, as this was passed anyways, changed name to CalculateAverageResistReduction, which better reflects what it does
- Fix melee miss chances calculated from attacker maxskill instead of victim maxskill
- Do actual checks if spell can be resisted/missed in MagicSpellHitResult (ie chances > 0)
- Fixed SPELLMOD_RESIST_MISS_CHANCE calculation in MeleeSpellMissChance
- Minor codestyle and cleanup of diminishing returns calcs

(cherry picked from commit e565b34f6d24411e210151d0d03e524f94cdff85)
2022-02-16 04:49:24 +01:00
ariel- 4ad1d377fe Core/Entities: virtualize CheckAttackFitToAuraRequirement
- Should've been like this to begin with

(cherry picked from commit 21d95a1d767c95910d4508e0e83f34b4f89f587a)
2022-02-16 04:49:24 +01:00
xinef1 f431459063 Core/Creatures: Various fixes for creatures, regarding combat conditions, despawning, and few others (#18998)
* Made some changes to kiting mechanics, simplified code and made taunt auras prolong combat no matter the distance from the spawn
Unified some creature despawning code, removed some brutal direct calls in scripts
Don't play death anim on forced despawn
Removed some redundant visibility changes on creature despawn
Fixed possible problem with pet initializing template info from difficulty greater than normal
Properly keep UNIT_FLAG_IN_COMBAT on UpdateEntry call
Moved RegenerateMana function to general Regenerate(Power) function
Fixed increased health regeneration from polymorph for pets
Implemented CREATURE_TYPE_FLAG_GHOST_VISIBLE, those creatures will be properly seen when player is dead also
Removed hackfix from Gaeriyan and Franclorn Forgewright, fixed properly
Simplified ForcedRespawnTime code in ForcedDespawn
Do not allow to assist unit while evading or when enemy is evading
Do not allow to attack other units when evading or when the unit is evading
Corrected distance checking code before creature is allowed to evade, should fix some common problems
Properly return summon position for summoned creatures as their respawn position
Properly stop all moving units on gossip hello, no matter their npc flags

(cherry picked from commit e1f14215d86fc9f0cd041f0e87bf0a689c086329)
2022-02-16 04:49:24 +01:00
Shauren f2b4f2208e Core/Objects: ported master branch handling for properly destroying objects via out of range and destroy object opcode
# Conflicts:
#	src/server/game/Entities/Creature/Creature.cpp
2022-02-02 16:24:42 +01:00
Shauren 8acf90d115 Core/Units: Sync ProcessTerrainStatusUpdate code with master branch 2022-01-01 16:49:48 +01:00
Ovahlord 8202480a93 Core/Units: corrected calculations for dodge, parry and spell hit chances 2021-12-29 19:37:47 +01:00
Ovahlord efc94b46f4 Core/Units: corrected melee miss chance calculation 2021-12-29 19:12:37 +01:00
Giacomo Pozzoni adde43e965 Core/AI: Fix crashes caused by charmed Creatures having null AI for 1 map update tick (#27434)
Implement using ScheduledChangeAI instead of nullptr to signal a required AI change
# Conflicts:
#	src/server/game/Entities/Unit/Unit.cpp
#	src/server/game/Entities/Unit/Unit.h
2021-12-27 22:25:11 +01:00
Ovahlord a8301ba5f6 Core/Units: fixed a crash when creatures are having their attack speed increased via aura 2021-11-28 15:11:23 +01:00
ariel- af98e8516c Core/Auras: reworked multiplicative AuraEffects calculation 2021-11-28 12:14:05 +01:00
Ovahlord 373a296b8d Core/Units: removed deprecated fake attacker state update from the core 2021-11-17 17:18:05 +01:00
Ovahlord 4b56a7b9a3 Core/Movement: converted SMSG_MOVE_SET_CAN_TRANSITION_BETWEEN_SWIM_AND_FLY and SMSG_MOVE_UNSET_CAN_TRANSITION_BETWEEN_SWIM_AND_FLY to new ack handling 2021-11-12 19:29:00 +01:00
Ovahlord 56813fd186 Core/Movement: refactored pending movement change queue to be a unordered map instead so we no longer ARE overzealous with kicks when counters or ack receiving order mismatches 2021-11-10 12:19:00 +01:00
Ovahlord 0a7dfc15e2 Core/Movement: ported mount capability updating from master branch and replaced old implementation with it 2021-11-09 18:13:23 +01:00
Ovahlord 3d8762297c Core/Movement: converted CanFly and DisableGravity ack handling to new system 2021-11-08 22:23:54 +01:00
Ovahlord 9faf867f34 Core/Movement: ported movement speed change acknowledge packet handling from 335 branch 2021-11-08 12:44:49 +01:00
Ovahlord edbbeba5a2 Core/Movement: ported client control logic updates from 335 branch 2021-11-06 23:41:34 +01:00
Ovahlord 069684ffa5 Core/Spells: SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK will no longer affect spell haste when its amount is too extreme to fix several exploits with instant cast auras causing haste affected dots and hots dealing insane amounts of damage 2021-09-19 14:33:02 +02:00
Ovahlord 949f92e0a1 Core/AI: ported charm updates from 335 2021-09-16 16:48:07 +02:00
Ovahlord a5caf1af95 Core/Units: removed now unused attacker argument from Unit::GetUnitCriticalChanceTaken 2021-08-29 02:13:16 +02:00
Ovahlord 8011d2de29 Core/Spells: ported resistance and immunity updates from 3.3.5 branch 2021-06-12 14:10:44 +02:00
Ovahlord 4430863a1e Core/Spells: Implement spell queue
As of patch 4.1 spell casts can now be queued up 400ms before a ongoing cast finishes or the global cooldown expires to deliver a smooth transitions between casts though emulators do not really benefit from it.

closes #224
2021-05-24 17:14:55 +02:00
Ovahlord b5994ec6c5 Core/Units: improved logic for determining when a power update shall happen 2021-04-30 16:48:26 +02:00
Ovahlord 4faabd8e18 Core/Units: refactor MeleeSpellMissChance to use a SpellInfo argument instead of using spell IDs 2021-04-07 14:20:35 +02:00
Ovahlord 71356d7971 Core/Spells: added missing SPELL_ATTR10_IGNORE_POSITIVE_DAMAGE_TAKEN_MODS check to SpellBaseDamageBonusTaken 2021-04-07 12:40:05 +02:00
Shauren fed82c1002 Core/Auras: Defined and implemented many new interrupt flags 2021-03-24 14:53:30 +01:00
Ovahlord c1cb11c19f Core/PacketIO: implement and enable SMSG_PLAY_SPELL_VISUAL 2021-03-12 21:56:15 +01:00
Ovahlord 6e3539df30 Core/Spells:
* corrected implementation of SPELL_AURA_MOD_SPELL_POWER_PCT
* ported implementation of SPELL_AURA_OVERRIDE_SPELL_POWER_BY_AP_PCT from master branch
* dropped some deprecated class script handlings and moved Nourish 20% healing bonus to spell script
2021-02-27 12:37:14 +01:00
Ovahlord 43d76be2fd fixed a warning 2021-02-20 23:30:46 +01:00
Ovahlord 0299fa4fe1 Core/Misc: replace boost::optional with std::optional 2021-02-19 14:07:43 +01:00
Ovahlord c3e9861723 Core/Movement: implement creature movement info table to override movement speeds based on movement IDs
thx to @xvwyh for providing initial table data for the most common entries
2021-02-16 16:56:10 +01:00
Giacomo Pozzoni 5e3b57bae7 Core/Unit: Fix movement hiccups in water
* Core/Unit: Allow to define Units which can enter water but cannot swim

Allow to define Units which can enter water but cannot swim, i.e. crabs walking at the bottom of a sea.

* Add UNIT_FLAG_SWIMMING to creatures when entering combat

* Fix charmed creatures not entering water

* Always allow Creatures controlled by players to enter water

* Add swimming flag when possessing a unit and remove it properly at the end, even if the creature engaged combat before and after.
When adding/removing UNIT_FLAG_SWIMMING manually calling Creature::RefreshSwimmingFlag(true) might be required.
2021-01-11 12:33:54 +01:00
Ovahlord 754c138f89 Core/Spells: ported CastSpell unclusterfucking from 3.3.5 branch 2020-11-04 22:37:11 +01:00
Ovahlord a08ab06d36 Core/Units: converted SMSG_SPELL_ENERGIZE_LOG to packet class and no longer send PowerUpdate packets when gaining power via energize spell effects 2020-10-22 23:32:45 +02:00
Ovahlord 90e5e85afd Core/Misc: updated a bunch of packets to packet class 2020-10-21 12:04:13 +02:00
Ovahlord c9afa1a6ed Core/Units: renamed SetInFront to SetOrientationTowards to clarify its actual functionality and added comments to SetOrientationTowards, SetFacingTo and SetFacingToObject 2020-09-23 20:48:44 +02:00
Ovahlord 677990a1b8 Core/Spells: removed more unused parameters for 4.x since SPELL_AURA_MOD_CRIT_PERCENT_VERSUS is not used at all 2020-08-28 12:20:35 +02:00
Ovahlord 74b44c91a7 fixed warnings 2020-08-28 11:54:53 +02:00
Ovahlord 25c980c390 Core/Units: ported spell crit chance updates from 335 branch 2020-08-28 11:46:07 +02:00
Shauren 0c08285932 Core/Spells Fixed scroll stacking check when not targeting self
* Reuse code that removes non-stackable auras at apply to check before casting the spell to keep reagents/cast item
2020-08-23 20:18:52 +02:00