diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/game/Spell.cpp | 6 | ||||
| -rw-r--r-- | src/game/SpellAuras.cpp | 8 | ||||
| -rw-r--r-- | src/game/SpellEffects.cpp | 16 | ||||
| -rw-r--r-- | src/game/Unit.cpp | 40 | ||||
| -rw-r--r-- | src/game/Unit.h | 3 | 
5 files changed, 55 insertions, 18 deletions
| diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 1f31c3d2d88..8b0014caaae 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -2681,8 +2681,8 @@ void Spell::finish(bool ok)      // Heal caster for all health leech from all targets      if (m_healthLeech)      { -        m_caster->ModifyHealth(m_healthLeech); -        m_caster->SendHealSpellLog(m_caster, m_spellInfo->Id, uint32(m_healthLeech)); +        int32 gain = m_caster->ModifyHealth(m_healthLeech); +        m_caster->SendHealSpellLog(m_caster, m_spellInfo->Id, uint32(m_healthLeech), false, &gain);      }      if (IsMeleeAttackResetSpell()) @@ -2695,7 +2695,7 @@ void Spell::finish(bool ok)      }      // potions disabled by client, send event "not in combat" if need -    if (m_caster->GetTypeId() == TYPEID_PLAYER) +    if (!m_triggeredByAuraSpell && m_caster->GetTypeId() == TYPEID_PLAYER)          ((Player*)m_caster)->UpdatePotionCooldown(this);      // call triggered spell only at successful cast (after clear combo points -> for add some if need) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 37c4600feaf..04521881744 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -1150,7 +1150,7 @@ void Aura::_RemoveAura()                  if(*itr < 0)                      m_target->RemoveAurasDueToSpell(-(*itr));                  else if(Unit* caster = GetCaster()) -                    if (m_removeMode==AURA_REMOVE_BY_EXPIRE) +                    if (m_removeMode!=AURA_REMOVE_BY_DEFAULT)                          m_target->CastSpell(m_target, *itr, true, 0, 0, caster->GetGUID());              }      } @@ -1631,8 +1631,8 @@ void AuraEffect::TriggerSpell()                      case 23493:                      {                          int32 heal = caster->GetMaxHealth() / 10; -                        caster->ModifyHealth( heal ); -                        caster->SendHealSpellLog(caster, 23493, heal); +                        int32 gain = caster->ModifyHealth( heal ); +                        caster->SendHealSpellLog(caster, 23493, heal, false, &gain);                          int32 mana = caster->GetMaxPower(POWER_MANA);                          if (mana) @@ -5854,7 +5854,7 @@ void AuraEffect::PeriodicTick()              int32 gain = pCaster->ModifyHealth(heal);              pCaster->getHostilRefManager().threatAssist(pCaster, gain * 0.5f, spellProto); -            pCaster->SendHealSpellLog(pCaster, spellProto->Id, heal); +            pCaster->SendHealSpellLog(pCaster, spellProto->Id, heal,false, &gain);              break;          }          case SPELL_AURA_PERIODIC_HEAL: diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 604be4ba554..f4f7ae2e78b 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -2601,9 +2601,9 @@ void Spell::EffectHealPct( uint32 /*i*/ )          if(Player* modOwner = m_caster->GetSpellModOwner())              modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DAMAGE, addhealth, this); -        caster->SendHealSpellLog(unitTarget, m_spellInfo->Id, addhealth, false); -          int32 gain = unitTarget->ModifyHealth( int32(addhealth) ); +        caster->SendHealSpellLog(unitTarget, m_spellInfo->Id, addhealth, false, &gain); +          unitTarget->getHostilRefManager().threatAssist(m_caster, float(gain) * 0.5f, m_spellInfo);          if(caster->GetTypeId()==TYPEID_PLAYER) @@ -2625,8 +2625,8 @@ void Spell::EffectHealMechanical( uint32 /*i*/ )              return;          uint32 addhealth = caster->SpellHealingBonus(unitTarget, m_spellInfo, uint32(damage), HEAL); -        caster->SendHealSpellLog(unitTarget, m_spellInfo->Id, addhealth, false); -        unitTarget->ModifyHealth( int32(damage) ); +        int32 Gain = unitTarget->ModifyHealth( int32(damage) ); +        caster->SendHealSpellLog(unitTarget, m_spellInfo->Id, addhealth, false, &Gain);      }  } @@ -2657,10 +2657,10 @@ void Spell::EffectHealthLeech(uint32 i)      {          new_damage = m_caster->SpellHealingBonus(m_caster, m_spellInfo, new_damage, HEAL); -        m_caster->ModifyHealth(new_damage); +        int32 Gain = m_caster->ModifyHealth(new_damage);          if(m_caster->GetTypeId() == TYPEID_PLAYER) -            m_caster->SendHealSpellLog(m_caster, m_spellInfo->Id, uint32(new_damage)); +            m_caster->SendHealSpellLog(m_caster, m_spellInfo->Id, uint32(new_damage), false, &Gain);      }  //    m_healthLeech+=tmpvalue;  //    m_damage+=new_damage; @@ -4322,10 +4322,10 @@ void Spell::EffectHealMaxHealth(uint32 /*i*/)      if(!unitTarget->isAlive())          return; -    uint32 addhealth = unitTarget->GetMaxHealth() - unitTarget->GetHealth(); +    int32 addhealth = unitTarget->GetMaxHealth() - unitTarget->GetHealth();      unitTarget->SetHealth(unitTarget->GetMaxHealth());      if(m_originalCaster) -        m_originalCaster->SendHealSpellLog(unitTarget, m_spellInfo->Id, addhealth, false); +        m_originalCaster->SendHealSpellLog(unitTarget, m_spellInfo->Id, addhealth, false, &addhealth);  }  void Spell::EffectInterruptCast(uint32 i) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index bcc96c972bc..0820e7a2fcd 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -6473,6 +6473,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger          }          case SPELLFAMILY_POTION:          { +            // alchemist's stone              if (dummySpell->Id == 17619)              {                  if (procSpell->SpellFamilyName == SPELLFAMILY_POTION) @@ -8308,15 +8309,21 @@ void Unit::UnsummonAllTotems()      }  } -void Unit::SendHealSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage, bool critical) +void Unit::SendHealSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage, bool critical, int32 * Gain )  {      // we guess size      WorldPacket data(SMSG_SPELLHEALLOG, (8+8+4+4+1));      data.append(pVictim->GetPackGUID());      data.append(GetPackGUID());      data << uint32(SpellID); +    int32 gainAmount; +    if (!Gain) +        gainAmount = pVictim->GetHealthGain(Damage); +    else +        gainAmount = *Gain; +      data << uint32(Damage); -    data << uint32(0);                                      // over healing? +    data << uint32(Damage-gainAmount >0 ? Damage-gainAmount : 0);       // overheal      data << uint8(critical ? 1 : 0);      data << uint8(0);                                       // unused in client?      SendMessageToSet(&data, true); @@ -9776,6 +9783,35 @@ int32 Unit::ModifyHealth(int32 dVal)      return gain;  } +int32 Unit::GetHealthGain(int32 dVal) +{ +    int32 gain = 0; + +    if(dVal==0) +        return 0; + +    int32 curHealth = (int32)GetHealth(); + +    int32 val = dVal + curHealth; +    if(val <= 0) +    { +        return -curHealth; +    } + +    int32 maxHealth = (int32)GetMaxHealth(); + +    if(val < maxHealth) +    { +        gain = dVal; +    } +    else if(curHealth != maxHealth) +    { +        gain = maxHealth - curHealth; +    } + +    return gain; +} +  int32 Unit::ModifyPower(Powers power, int32 dVal)  {      int32 gain = 0; diff --git a/src/game/Unit.h b/src/game/Unit.h index ec400111a35..03331861b9e 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -984,6 +984,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject          void SetHealth(   uint32 val);          void SetMaxHealth(uint32 val);          int32 ModifyHealth(int32 val); +        int32 GetHealthGain(int32 dVal);          Powers getPowerType() const { return Powers(GetByteValue(UNIT_FIELD_BYTES_0, 3)); }          void setPowerType(Powers power); @@ -1150,7 +1151,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject          virtual bool IsUnderWater() const;          bool isInAccessiblePlaceFor(Creature const* c) const; -        void SendHealSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage, bool critical = false); +        void SendHealSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage, bool critical, int32 * Gain = NULL);          void SendEnergizeSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage,Powers powertype);          uint32 SpellNonMeleeDamageLog(Unit *pVictim, uint32 spellID, uint32 damage, bool isTriggeredSpell = false, bool useSpellDamage = true);          void CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item *castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0); | 
