mangosArchives / Mangos-One-server-old

This repo has been moved to https://githubs.com/mangosone/server
http://getmangos.eu/
GNU General Public License v2.0
95 stars 54 forks source link

NPCs Spell Crits #47

Closed NoReturn closed 12 years ago

NoReturn commented 12 years ago

Not much to say about this, creatures shouldn't be able to crit with spells.

Suggested fix:

diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 6c83010..2ef38c7 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -5986,6 +5986,10 @@ int32 Unit::SpellBaseDamageBonusTaken(SpellSchoolMask schoolMask)

 bool Unit::IsSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType)
 {
+    // Creatures shouldn't crit with spells
+    if (GetObjectGuid().IsCreature())
+        return false;
+
     // not critting spell
     if (spellProto->HasAttribute(SPELL_ATTR_EX2_CANT_CRIT))
         return false;
Nighoo commented 12 years ago

You are right, but what's up with a players pet?

ghost commented 12 years ago

https://github.com/Danycm/server/commit/103dec7b9f6d62c09bb21b77dc7ce7aa29d034aa https://github.com/Danycm/server/commit/d604501d5449ec437822bb689805e7a5a7ccf4f2

this is based on Tasssadar work, didin't have time to test it

NoReturn commented 12 years ago

What about players' pet? They should be able to crit with spells (e.g. Imp's Firebolt), there are even player talents who proc on pet spell crit. IsCreature() doesn't check for pets, IsCreatureOrPet() does.

Salja commented 12 years ago

https://github.com/mangos-one/server/commit/6c9db9bac39dbb6370b73c22f4e9085fec3e9239