Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Server Code Submissions

Reply
 
Thread Tools Display Modes
  #1  
Old 08-11-2010, 09:26 PM
Caryatis
Dragon
 
Join Date: May 2009
Location: Milky Way
Posts: 539
Default COMMITTED: Stun Resist

This seemed to be functioning incorrectly, it didnt have a message associated with it and it seemed to restrict players from being stunned by a bash if they are over level 55(which doesnt happen on live, otherwise there would be no point in stun resist on gear on any expansion in last 10 years). Also it now works for the AA stun resist.

attack
Code:
Index: attack.cpp
===================================================================
--- attack.cpp	(revision 1620)
+++ attack.cpp	(working copy)
@@ -3249,8 +3287,10 @@
 		}
     	
     	//check stun chances if bashing
-		if (damage > 0 && ((skill_used == BASH || skill_used == KICK && (attacker && attacker->GetLevel() >= 55)) && GetLevel() < 56)) {
+		if (damage > 0 && ((skill_used == BASH || skill_used == KICK && (attacker && attacker->GetLevel() >= 55)))) {
 			int stun_resist = itembonuses.StunResist+spellbonuses.StunResist;
+			if(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 {
@@ -3258,6 +3298,8 @@
 					mlog(COMBAT__HITS, "Stunned. We had %d percent resist chance.");
 					Stun(0);
 				} else {
+					if(IsClient())
+						this->Message(0,"You shake off the stun effect!");
 					mlog(COMBAT__HITS, "Stun Resisted. We had %dpercent resist chance.");
 				}
 			}
bonuses
Code:
Index: bonuses.cpp
===================================================================
--- bonuses.cpp	(revision 1620)
+++ bonuses.cpp	(working copy)
@@ -659,6 +659,9 @@
 			case SE_TotalHP:
 				newbon->HP += base1;
 				break;
+			case SE_StunResist:
+				newbon->StunResist += base1;
+				break;
 		}
 	}
spell effects
Code:
Index: spell_effects.cpp
===================================================================
--- spell_effects.cpp	(revision 1620)
+++ spell_effects.cpp	(working copy)
@@ -652,7 +652,19 @@
 				}
 				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(effect_value);
+					} 
+					else {
+						if(IsClient())
+							this->Message(0,"You shake off the stun effect!");
+						mlog(COMBAT__HITS, "Stun Resisted. We had %dpercent resist chance.");
+					}
+					
 				}
 				break;
 			}
Reply With Quote
  #2  
Old 09-12-2010, 12:19 PM
Derision
Developer
 
Join Date: Feb 2004
Location: UK
Posts: 1,540
Default

Thanks I have committed this and the Melee Lifetap fix.

EDIT: Reverted the stun changes for now due to http://www.peqtgc.com/phpBB2/viewtop...?p=51025#51025

Last edited by Derision; 09-13-2010 at 04:05 PM..
Reply With Quote
  #3  
Old 11-04-2010, 10:17 PM
Caryatis
Dragon
 
Join Date: May 2009
Location: Milky Way
Posts: 539
Default

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.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 10:07 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3