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

Reply
 
Thread Tools Display Modes
  #1  
Old 12-10-2007, 05:35 AM
TheLieka
Developer
 
Join Date: Oct 2004
Location: THE ATL (wut wut)
Posts: 325
Default Ogres Immune to Frontal Melee Stuns

Ogres are immune to stuns from frontal melee damage, such as bash.

in .\zone\attack.cpp change:
Code:
    	//check stun chances if bashing
		if (skill_used == BASH && GetLevel() < 56) {
			int stun_resist = itembonuses.StunResist+spellbonuses.StunResist;
			if(stun_resist <= 0 || MakeRandomInt(0,99) >= stun_resist) {
				mlog(COMBAT__HITS, "Stunned. We had %dpercent resist chance.");
				Stun(0);
			} else {
				mlog(COMBAT__HITS, "Stun Resisted. We had %dpercent resist chance.");
			}
		}
		
		if(spell_id != SPELL_UNKNOWN) {
			//see if root will break
			if (IsRooted()) { // neotoyko: only spells cancel root
				if(GetAA(aaEnhancedRoot))
				{
					if (MakeRandomInt(0, 99) < 10) {
						mlog(COMBAT__HITS, "Spell broke root! 10percent chance");
						BuffFadeByEffect(SE_Root, buffslot); // buff slot is passed through so a root w/ dam doesnt cancel itself
					} else {
						mlog(COMBAT__HITS, "Spell did not break root. 10 percent chance");
					}
				}
				else
				{
					if (MakeRandomInt(0, 99) < 20) {
						mlog(COMBAT__HITS, "Spell broke root! 20percent chance");
						BuffFadeByEffect(SE_Root, buffslot); // buff slot is passed through so a root w/ dam doesnt cancel itself
					} else {
						mlog(COMBAT__HITS, "Spell did not break root. 20 percent chance");
					}
				}			
			}
		}
		else{
			//increment chances of interrupting
			if(IsCasting()) { //shouldnt interrupt on regular spell damage
				attacked_count++;
				mlog(COMBAT__HITS, "Melee attack while casting. Attack count %d", attacked_count);
			}
		}
to

Code:
    	//check stun chances if bashing
		//Lieka Edit:  Making Ogres immune to frontal stun damage
		if (skill_used == BASH && GetLevel() < 56) {
			int stun_resist = itembonuses.StunResist+spellbonuses.StunResist;
			if((stun_resist <= 0 || MakeRandomInt(0,99) >= stun_resist) && ((this->GetBaseRace() != OGRE) || attacker->BehindMob(this, attacker->GetX(), attacker->GetY()))) {
				mlog(COMBAT__HITS, "Stunned. We had %dpercent resist chance.");
				Stun(0);
			} else if (this->GetBaseRace() == OGRE && this->IsClient() && !attacker->BehindMob(this, attacker->GetX(), attacker->GetY())) {
				//Message(15,"Ogres are immune to frontal melee stuns."); //Lieka Edit:  Debug message
				mlog(COMBAT__HITS, "Stun Resisted. Ogres are immune to frontal melee stuns.");
			} else {
				mlog(COMBAT__HITS, "Stun Resisted. We had %dpercent resist chance.");
			}
		}
		
		if(spell_id != SPELL_UNKNOWN) {
			//see if root will break
			if (IsRooted()) { // neotoyko: only spells cancel root
				if(GetAA(aaEnhancedRoot))
				{
					if (MakeRandomInt(0, 99) < 10) {
						mlog(COMBAT__HITS, "Spell broke root! 10percent chance");
						BuffFadeByEffect(SE_Root, buffslot); // buff slot is passed through so a root w/ dam doesnt cancel itself
					} else {
						mlog(COMBAT__HITS, "Spell did not break root. 10 percent chance");
					}
				}
				else
				{
					if (MakeRandomInt(0, 99) < 20) {
						mlog(COMBAT__HITS, "Spell broke root! 20percent chance");
						BuffFadeByEffect(SE_Root, buffslot); // buff slot is passed through so a root w/ dam doesnt cancel itself
					} else {
						mlog(COMBAT__HITS, "Spell did not break root. 20 percent chance");
					}
				}			
			}
		}
		else{
			//increment chances of interrupting
			if(IsCasting()) { //shouldnt interrupt on regular spell damage
				attacked_count++;
				mlog(COMBAT__HITS, "Melee attack while casting. Attack count %d", attacked_count);
			}
		}
__________________
Daxum



Former ServerOp - Vallon Zek / Tallon Zek Emu Server - Legit / Guild PvP - (2007 - 2011 RIP)
Reply With Quote
  #2  
Old 12-10-2007, 07:16 AM
soulshot
Hill Giant
 
Join Date: Jun 2006
Posts: 142
Default nice

Very nice. Hope to see this in game soon =)

-Mard
Reply With Quote
  #3  
Old 12-31-2007, 10:16 PM
Knightly
Accomplished Programmer
 
Join Date: Nov 2006
Location: Honolulu, HI
Posts: 91
Default

Awesome. I just started playing around with an Ogre today and noticed this needed to be fixed. You saved me a lot of time.

One thing I did differently though is to make the Ogre check first. Six of one, half dozen of the other though.
Code:
    	//check stun chances if bashing
	if (skill_used == BASH && 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 %dpercent resist chance.");
				Stun(0);
			} else {
				mlog(COMBAT__HITS, "Stun Resisted. We had %dpercent resist chance.");
			}
		}
	}
Reply With Quote
  #4  
Old 01-02-2008, 04:49 PM
fathernitwit
Developer
 
Join Date: Jul 2004
Posts: 773
Default

Quote:
Originally Posted by Knightly View Post
One thing I did differently though is to make the Ogre check first. Six of one, half dozen of the other though.
Actually, I dont think it works unless you switch it around. Knightly's fix is correct. You only reach the else cases if it is already resisted.
Reply With Quote
  #5  
Old 01-03-2008, 04:00 AM
TheLieka
Developer
 
Join Date: Oct 2004
Location: THE ATL (wut wut)
Posts: 325
Default

Maybe I'm misunderstanding my own code, but I'm reading it as this:
Code:
	if (skill_used == BASH && GetLevel() < 56) {
			int stun_resist = itembonuses.StunResist+spellbonuses.StunResist;
			if((stun_resist <= 0 || MakeRandomInt(0,99) >= stun_resist) && ((this->GetBaseRace() != OGRE) || attacker->BehindMob(this, attacker->GetX(), attacker->GetY()))) {
				mlog(COMBAT__HITS, "Stunned. We had %dpercent resist chance.");
				Stun(0);
The stun roll lands. If the target is not an Ogre (not immune to stuns), or if the attacker is behind the target (no race is immune to stuns from melee attacks to the back), then proceed with the stun.

Code:
			} else if (this->GetBaseRace() == OGRE && this->IsClient() && !attacker->BehindMob(this, attacker->GetX(), attacker->GetY())) {
				//Message(15,"Ogres are immune to frontal melee stuns."); //Lieka Edit:  Debug message
				mlog(COMBAT__HITS, "Stun Resisted. Ogres are immune to frontal melee stuns.");
One of the following has happened to get us here:
The stun roll failed or the target is an Ogre.
If the target is an ogre, and the attacker is not behind the ogre (we checked this already in the previous step, but checking it again), then log that the stun was resisted because it was a an attempt at a frontal melee stun on an ogre.

Code:
	} else {
				mlog(COMBAT__HITS, "Stun Resisted. We had %dpercent resist chance.");
			}
		}
This is the catch all, but we should only get here if the stun roll failed, so log that it failed.


Maybe I'm missing something, but I've had the code live on my server for quite a while without any further complaints about Ogres getting stunned.

Dax
__________________
Daxum



Former ServerOp - Vallon Zek / Tallon Zek Emu Server - Legit / Guild PvP - (2007 - 2011 RIP)
Reply With Quote
  #6  
Old 01-03-2008, 06:25 PM
fathernitwit
Developer
 
Join Date: Jul 2004
Posts: 773
Default

ah. Didnt realize that you duplicated the ogre logic on the end of the first contidional (line too long). So yours gets the same job done, but I think the readability is lower and it will do twice as much work in the ogre case.
Reply With Quote
  #7  
Old 02-13-2008, 12:06 PM
WildcardX
Developer
 
Join Date: Apr 2003
Posts: 589
Default

FNW asked me to commit this fix for him. I'll add it in tonight or tomorrow.

Thank you for your contribution to the eqemu server code!
__________________
Read my developer notes at my blog.

Quote:
If it's not on IRC, it ain't l33t!
Reply With Quote
  #8  
Old 02-13-2008, 12:15 PM
WildcardX
Developer
 
Join Date: Apr 2003
Posts: 589
Default

Actually, KLS already committed this in build 1071, so never mind (/bonk FNW).
__________________
Read my developer notes at my blog.

Quote:
If it's not on IRC, it ain't l33t!
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 05:37 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