Core/Spells: fixed remaing issues with calculation correct numbers for HOTs and DOTs

This commit is contained in:
Ovahlord committed 2019-05-10 21:28:23 +02:00
1 parent 8d58dc87aa
commit ab1d57d21d
5 files changed
+39 -61

No files matched your search

+20 -1
View File
@@ -2951,6 +2951,8 @@ void Unit::_DeleteRemovedAuras()
delete m_removedAuras.front();
m_removedAuras.pop_front();
}
m_removedAurasCount = 0;
}
void Unit::_UpdateSpells(uint32 time)
@@ -3493,7 +3495,6 @@ void Unit::_ApplyAura(AuraApplication * aurApp, uint8 effMask)
if (aurApp->GetRemoveMode())
return;
aura->HandleAuraSpecificPeriodics(aurApp, caster);
aura->HandleAuraSpecificMods(aurApp, caster, true, false);
// apply effects of the aura
@@ -6702,6 +6703,9 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_DAMAGE, tmpDamage);
}
if (spellProto->Id == 8921)
printf("SpellDamageBonusDone called for Moonfire \n");
return uint32(std::max(tmpDamage, 0.0f));
}
@@ -14135,6 +14139,21 @@ void Unit::OutDebugInfo() const
TC_LOG_DEBUG("entities.unit", "On vehicle %u.", GetVehicleBase()->GetEntry());
}
uint32 Unit::GetRemainingPeriodicAmount(ObjectGuid caster, uint32 spellId, AuraType auraType, uint8 effectIndex) const
{
uint32 amount = 0;
AuraEffectList const& periodicAuras = GetAuraEffectsByType(auraType);
for (AuraEffectList::const_iterator i = periodicAuras.begin(); i != periodicAuras.end(); ++i)
{
if ((*i)->GetCasterGUID() != caster || (*i)->GetId() != spellId || (*i)->GetEffIndex() != effectIndex || !(*i)->GetTotalTicks())
continue;
amount += uint32(((*i)->GetAmount() * std::max<int32>((*i)->GetTotalTicks() - int32((*i)->GetTickNumber()), 0)) / (*i)->GetTotalTicks());
break;
}
return amount;
}
void Unit::SendClearTarget()
{
WorldPacket data(SMSG_BREAK_TARGET, GetPackGUID().size());
@@ -557,7 +557,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
if (MountCapabilityEntry const* mountCapability = GetBase()->GetUnitOwner()->GetMountCapability(uint32(GetMiscValueB())))
{
amount = mountCapability->Id;
m_canBeRecalculated = false;
m_canBeRecalculated = true;
}
break;
case SPELL_AURA_MOD_RESISTANCE_EXCLUSIVE:
@@ -591,7 +591,17 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
}
break;
}
break;
}
case SPELL_AURA_PERIODIC_DAMAGE:
case SPELL_AURA_PERIODIC_LEECH:
if (GetBase()->GetType() == UNIT_AURA_TYPE)
amount = caster->SpellDamageBonusDone(GetBase()->GetUnitOwner(), GetSpellInfo(), amount, DOT, GetEffIndex());
break;
case SPELL_AURA_PERIODIC_HEAL:
if (GetBase()->GetType() == UNIT_AURA_TYPE)
amount = caster->SpellHealingBonusDone(GetBase()->GetUnitOwner(), GetSpellInfo(), amount, DOT, GetEffIndex());
break;
default:
break;
}
+8 -57
View File
@@ -881,22 +881,17 @@ void Aura::SetStackAmount(uint8 stackAmount)
std::list<AuraApplication*> applications;
GetApplicationList(applications);
for (std::list<AuraApplication*>::const_iterator apptItr = applications.begin(); apptItr != applications.end(); ++apptItr)
if (!(*apptItr)->GetRemoveMode())
HandleAuraSpecificMods(*apptItr, caster, false, true);
for (AuraApplication* aurApp : applications)
if (!aurApp->GetRemoveMode())
HandleAuraSpecificMods(aurApp, caster, false, true);
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
if (HasEffect(i))
m_effects[i]->ChangeAmount(m_effects[i]->CalculateAmount(caster), false, true);
if (AuraEffect* aurEff = GetEffect(i))
aurEff->ChangeAmount(aurEff->CalculateAmount(caster), false, true);
for (std::list<AuraApplication*>::const_iterator apptItr = applications.begin(); apptItr != applications.end(); ++apptItr)
{
if (!(*apptItr)->GetRemoveMode())
{
HandleAuraSpecificPeriodics(*apptItr, caster);
HandleAuraSpecificMods(*apptItr, caster, true, true);
}
}
for (AuraApplication* aurApp : applications)
if (!aurApp->GetRemoveMode())
HandleAuraSpecificMods(aurApp, caster, true, true);
SetNeedClientUpdateForTargets();
}
@@ -1521,50 +1516,6 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
}
}
void Aura::HandleAuraSpecificPeriodics(AuraApplication const* aurApp, Unit* caster)
{
Unit* target = aurApp->GetTarget();
if (!caster || aurApp->GetRemoveMode())
return;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (!HasEffect(i))
continue;
if (m_spellInfo->Effects[i].IsAreaAuraEffect() || m_spellInfo->Effects[i].IsEffect(SPELL_EFFECT_PERSISTENT_AREA_AURA))
continue;
switch (m_spellInfo->Effects[i].ApplyAuraName)
{
case SPELL_AURA_PERIODIC_DAMAGE:
case SPELL_AURA_PERIODIC_DAMAGE_PERCENT:
case SPELL_AURA_PERIODIC_LEECH:
{
AuraEffect* aurEff = GetEffect(i);
aurEff->SetDonePct(caster->SpellDamagePctDone(target, m_spellInfo, DOT));
aurEff->SetBonusAmount(caster->SpellDamageBonusDone(target, m_spellInfo, 0, DOT, GetStackAmount()));
aurEff->SetCritChance(caster->GetUnitSpellCriticalChance(target, m_spellInfo, m_spellInfo->GetSchoolMask()));
break;
}
case SPELL_AURA_PERIODIC_HEAL:
case SPELL_AURA_OBS_MOD_HEALTH:
{
AuraEffect* aurEff = GetEffect(i);
aurEff->SetDonePct(caster->SpellHealingPctDone(target, m_spellInfo));
aurEff->SetBonusAmount(caster->SpellHealingBonusDone(target, m_spellInfo, 0, DOT, GetStackAmount()));
aurEff->SetCritChance(caster->GetUnitSpellCriticalChance(target, m_spellInfo, m_spellInfo->GetSchoolMask()));
break;
}
default:
break;
}
}
}
bool Aura::CanBeAppliedOn(Unit* target)
{
// unit not in world or during remove from world
@@ -192,7 +192,6 @@ class TC_GAME_API Aura
void SetNeedClientUpdateForTargets() const;
void HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, bool apply, bool onReapply);
void HandleAuraSpecificPeriodics(AuraApplication const* aurApp, Unit* caster);
bool CanBeAppliedOn(Unit* target);
bool CheckAreaTarget(Unit* target);
bool CanStackWith(Aura const* existingAura) const;
-1
View File
@@ -576,7 +576,6 @@ int32 SpellEffectInfo::CalcValue(Unit const* caster, int32 const* bp, Unit const
value *= casterScaler->ratio / spellScaler->ratio;
}
}
// REVIEW - MERGE >>>>>>> master
}
return int32(value);