All pastes #637607 Raw Edit

Etwas

public text v1 · immutable
#637607 ·published 2007-07-29 01:40 UTC
rendered paste body
Index: Unit.cpp
===================================================================
--- Unit.cpp	(revision 4182)
+++ Unit.cpp	(working copy)
@@ -419,6 +419,17 @@
 
     if(pVictim->GetTypeId() != TYPEID_PLAYER)
     {
+        if( (!((Creature*)this)->isPet()) && (!((Creature*)this)->isTotem()))
+			if(damageSchool == SPELL_SCHOOL_NORMAL && (!pVictim->isInFront(this,((Creature*)this)->GetCreatureInfo()->combat_reach)))
+			{
+                float CreatureAttackSkill = ((Creature*)this)->getLevel()*5;
+                float PlayerDefenseRate = pVictim->GetDefenseSkillValue();
+                float PlayerCreatureDiff = getLevel()/(float)((Player*)pVictim)->getLevel();
+                uint32 Probability = CreatureAttackSkill/PlayerDefenseRate * 20;
+                Probability = (Probability>40) ? 40 : Probability;
+                if(rand32(1,100)<=Probability)
+                    CastSpell(getVictim(), 1604, false);
+			}
         //pVictim->SetInFront(this);
         // no loot,xp,health if type 8 /critters/
         if ( ((Creature*)pVictim)->GetCreatureInfo()->type == CREATURE_TYPE_CRITTER)