mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 09:44:45 +01:00
Core/Spell: Attempt to fix some rare steady shot crashes
ref issue #5689
This commit is contained in:
@@ -666,19 +666,19 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
|
||||
if (found)
|
||||
damage += m_spellInfo->Effects[EFFECT_1].CalcValue();
|
||||
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
if (Player* caster = m_caster->ToPlayer())
|
||||
{
|
||||
// Add Ammo and Weapon damage plus RAP * 0.1
|
||||
Item* item = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK);
|
||||
if (item)
|
||||
if (Item* item = caster->GetWeaponForAttack(RANGED_ATTACK))
|
||||
{
|
||||
float dmg_min = item->GetTemplate()->Damage->DamageMin;
|
||||
float dmg_max = item->GetTemplate()->Damage->DamageMax;
|
||||
ItemTemplate const* weaponTemplate = item->GetTemplate();
|
||||
float dmg_min = weaponTemplate->Damage[0].DamageMin;
|
||||
float dmg_max = weaponTemplate->Damage[0].DamageMax;
|
||||
if (dmg_max == 0.0f && dmg_min > dmg_max)
|
||||
damage += int32(dmg_min);
|
||||
else
|
||||
damage += irand(int32(dmg_min), int32(dmg_max));
|
||||
damage += int32(m_caster->ToPlayer()->GetAmmoDPS()*item->GetTemplate()->Delay*0.001f);
|
||||
damage += int32(caster->GetAmmoDPS() * weaponTemplate->Delay * 0.001f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user