aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMachiavelli <none@none>2009-08-21 17:15:35 +0200
committerMachiavelli <none@none>2009-08-21 17:15:35 +0200
commit7e52b1120c41f9ccaf82b2ca67021e97b35e8b9e (patch)
treef2e0bd86499d6d99cc505c0bddf0548ddf7d0714 /src
parent3dda9caedd571fc815adad9616b8d33b3ad91c2b (diff)
*Fix crash in mob_anti_airAI. Remove assert and cast no spell instead, if no spell was found in DB template.
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/the_scarlet_enclave.cpp9
-rw-r--r--src/game/SpellEffects.cpp13
2 files changed, 20 insertions, 2 deletions
diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/the_scarlet_enclave.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/the_scarlet_enclave.cpp
index b13423e850f..3a1f7304688 100644
--- a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/the_scarlet_enclave.cpp
+++ b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/the_scarlet_enclave.cpp
@@ -104,11 +104,16 @@ struct TRINITY_DLL_DECL mob_anti_airAI : public ScriptedAI
{
mob_anti_airAI(Creature *c) : ScriptedAI(c)
{
- assert(me->m_spells[0]);
+ if(!me->m_spells[0])
+ spell = NULL;
+ else
+ spell = me->m_spells[0];
+
range = DoGetSpellMaxRange(me->m_spells[0]);
}
float range;
+ uint32 spell;
void MoveInLineOfSight(Unit *who)
{
@@ -136,7 +141,7 @@ struct TRINITY_DLL_DECL mob_anti_airAI : public ScriptedAI
if(me->getVictim()->IsFlying() || !me->IsWithinMeleeRange(me->getVictim()))
{
- if(!DoSpellAttackIfReady(me->m_spells[0]))
+ if(!DoSpellAttackIfReady(spell))
EnterEvadeMode();
}
else
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 2cadd2262e6..857eb26cc88 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -591,6 +591,19 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
//TODO: should this be put on taken but not done?
if(found)
damage += m_spellInfo->EffectBasePoints[1];
+
+ if (m_caster->GetTypeId() == TYPEID_PLAYER)
+ {
+ // Add Ammo and Weapon damage
+ Item *item = ((Player*)m_caster)->GetWeaponForAttack(RANGED_ATTACK);
+ if(item)
+ {
+ damage += urand(uint32(item->GetProto()->Damage->DamageMin), uint32(item->GetProto()->Damage->DamageMax));
+ damage += ((Player*)m_caster)->GetAmmoDPS()*item->GetProto()->Delay/1000;
+ damage += ((Player*)m_caster)->GetTotalAttackPowerValue(RANGED_ATTACK)*0.1f;
+ }
+ }
+
}
break;
}