Skip to content

Commit

Permalink
Spell/Unit: Fix default for coefficient being 0 and fix coeff for npc…
Browse files Browse the repository at this point in the history
… pets

Closes cmangos/issues#3685

again
  • Loading branch information
killerwife committed May 5, 2024
1 parent b76d38c commit dfff597
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/game/Entities/Unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6899,11 +6899,9 @@ void Unit::EnergizeBySpell(Unit* victim, SpellEntry const* spellInfo, uint32 dam
*/
int32 Unit::SpellBonusWithCoeffs(SpellEntry const* spellProto, SpellEffectIndex effectIndex, int32 total, int32 benefit, int32 ap_benefit, DamageEffectType damagetype, bool donePart)
{
// Distribute Damage over multiple effects, reduce by AoE
float coeff = 1.0f;

// Not apply this to creature casted spells
if (GetTypeId() == TYPEID_UNIT && !((Creature*)this)->IsPet())
float coeff = 0.f; // no coefficient by default
// does not apply to creatures
if (IsCreature() && !IsPlayerControlled())
coeff = 1.0f;
// Check for table values
if (spellProto->effectBonusCoefficient[effectIndex] > 0 || spellProto->effectBonusCoefficientFromAP[effectIndex] > 0)
Expand Down

0 comments on commit dfff597

Please sign in to comment.