| Caryatis | 
			11-04-2010 10:17 PM | 
		 
		 
		 
		
		
		OK I fixed this effect. The problem was this: 
	Code: 
	
 if (damage > 0 && ((skill_used == BASH || skill_used == KICK && (attacker && attacker->GetLevel() >= 55)) && GetLevel() < 56)) { 
 NPCs can stun off any bash or kick however players kick/bash only stuns after they reach a certain level and it only stuns mobs under 56, so I previously removed the check for the stunee to be under level 56 but since there is no stun % it caused every bash/kick to stun.
 
The new code adds a rule so you can define how often an NPC's bash/kick will stun, also seperates out the client restrictions of only being able to stun under 56 and having to be 55+ so that NPCs arent restricted by it.
 
Keep in mind that atm, any client over 55 is 100% immune to bash/kick stuns so this code will result in more stuns however it is now adjustable so shouldn't be as bad as before(set as 15% default).
 
SQL:
 
	Code: 
	
 INSERT INTO `rule_values` (`ruleset_id`, `rule_name`, `rule_value`, `notes`) VALUES (1, 'Combat:NPCBashKickStunChance', '15', 'Percent chance that a bash/kick will stun'); 
 DIFF:
 
	Code: 
	
 Index: common/ruletypes.h 
=================================================================== 
--- common/ruletypes.h        (revision 1713) 
+++ common/ruletypes.h        (working copy) 
@@ -231,6 +231,7 @@ 
 RULE_REAL ( Combat, WarBerBaseCritChance, 0.03 ) //The base crit chance for warriors and berserkers, only applies to clients 
 RULE_REAL ( Combat, BerserkBaseCritChance, 0.06 ) //The bonus base crit chance you get when you're berserk 
 RULE_INT ( Combat, NPCBashKickLevel, 6 ) //The level that npcs can KICK/BASH 
+RULE_INT ( Combat, NPCBashKickStunChance, 15 ) //Percent chance that a bash/kick will stun 
 RULE_REAL ( Combat, ClientBaseCritChance, 0.0 ) //The base crit chance for all clients, this will stack with warrior's/zerker's crit chance. 
 RULE_BOOL ( Combat, UseIntervalAC, true) 
 RULE_INT ( Combat, PetAttackMagicLevel, 30) 
Index: zone/attack.cpp 
=================================================================== 
--- zone/attack.cpp        (revision 1713) 
+++ zone/attack.cpp        (working copy) 
@@ -3283,16 +3283,38 @@ 
                 } 
              
             //check stun chances if bashing 
-                if (damage > 0 && ((skill_used == BASH || skill_used == KICK && (attacker && attacker->GetLevel() >= 55)) && GetLevel() < 56)) { 
-                        int stun_resist = itembonuses.StunResist+spellbonuses.StunResist; 
-                        if(this->GetBaseRace() == OGRE && this->IsClient() && !attacker->BehindMob(this, attacker->GetX(), attacker->GetY())) { 
-                                mlog(COMBAT__HITS, "Stun Resisted. Ogres are immune to frontal melee stuns."); 
-                        } else { 
-                                if(stun_resist <= 0 || MakeRandomInt(0,99) >= stun_resist) { 
-                                        mlog(COMBAT__HITS, "Stunned. We had %d percent resist chance."); 
-                                        Stun(0); 
-                                } else { 
-                                        mlog(COMBAT__HITS, "Stun Resisted. We had %dpercent resist chance."); 
+                if (damage > 0 && ((skill_used == BASH || skill_used == KICK) && attacker)) 
+                { 
+                        // NPCs can stun with their bash/kick as soon as they recieve it. 
+                        // Clients can stun mobs under level 56 with their bash/kick when they get level 55 or greater. 
+                        if((attacker->IsNPC()) || (attacker->IsClient() && attacker->GetLevel() >= 55 && GetLevel() < 56)) 
+                        { 
+                                if (MakeRandomInt(0,99) < (RuleI(Character, NPCBashKickStunChance)) || attacker->IsClient()) 
+                                { 
+                                        int stun_resist = itembonuses.StunResist+spellbonuses.StunResist; 
+                         
+                                        if(this->IsClient()) 
+                                                stun_resist += aabonuses.StunResist; 
+                         
+                                        if(this->GetBaseRace() == OGRE && this->IsClient() && !attacker->BehindMob(this, attacker->GetX(), attacker->GetY()))  
+                                        { 
+                                                mlog(COMBAT__HITS, "Stun Resisted. Ogres are immune to frontal melee stuns."); 
+                                        } 
+                                        else  
+                                        { 
+                                                if(stun_resist <= 0 || MakeRandomInt(0,99) >= stun_resist)  
+                                                { 
+                                                        mlog(COMBAT__HITS, "Stunned. We had %d percent resist chance."); 
+                                                        Stun(0); 
+                                                }  
+                                                else  
+                                                { 
+                                                        if(this->IsClient()) 
+                                                                Message_StringID(MT_Stun, SHAKE_OFF_STUN); 
+                                                         
+                                                        mlog(COMBAT__HITS, "Stun Resisted. We had %dpercent resist chance."); 
+                                                } 
+                                        } 
                                 } 
                         } 
                 } 
Index: zone/bonuses.cpp 
=================================================================== 
--- zone/bonuses.cpp        (revision 1713) 
+++ zone/bonuses.cpp        (working copy) 
@@ -659,6 +659,9 @@ 
                         case SE_TotalHP: 
                                 newbon->HP += base1; 
                                 break; 
+                        case SE_StunResist: 
+                                newbon->StunResist += base1; 
+                                break; 
                 } 
         } 
  
Index: zone/spell_effects.cpp 
=================================================================== 
--- zone/spell_effects.cpp        (revision 1713) 
+++ zone/spell_effects.cpp        (working copy) 
@@ -652,7 +652,21 @@ 
                                 } 
                                 else 
                                 { 
-                                        Stun(effect_value); 
+                                        int stun_resist = itembonuses.StunResist+spellbonuses.StunResist;  
+                                        if(IsClient())  
+                                                stun_resist += aabonuses.StunResist; 
+ 
+                                        if(stun_resist <= 0 || MakeRandomInt(0,99) >= stun_resist)  
+                                        {  
+                                                mlog(COMBAT__HITS, "Stunned. We had %d percent resist chance.", stun_resist); 
+                                                Stun(effect_value);  
+                                        } 
+                                        else {  
+                                                if(IsClient())  
+                                                        Message_StringID(MT_Stun, SHAKE_OFF_STUN); 
+                                                         
+                                                mlog(COMBAT__HITS, "Stun Resisted. We had %d percent resist chance.", stun_resist); 
+                                        } 
                                 } 
                                 break; 
                         } 
Index: zone/StringIDs.h 
=================================================================== 
--- zone/StringIDs.h        (revision 1713) 
+++ zone/StringIDs.h        (working copy) 
@@ -249,6 +249,7 @@ 
 #define YOU_HEAL                                        9068        //You have healed %1 for %2 points of damage. 
 #define OTHER_HIT_DOT                                9072        //%1 has taken %2 damage from your %3. 
 #define HIT_NON_MELEE                                9073        //%1 hit %2 for %3 points of non-melee damage. 
+#define SHAKE_OFF_STUN                                9077 
 #define STRIKETHROUGH_STRING                9078        //You strike through your opponent's defenses! 
 #define NEW_SPELLS_AVAIL                        9149        //You have new spells available to you.  Check the merchants near your guild master. 
 #define FACE_ACCEPTED                                12028        //Facial features accepted. 
  
	 |