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

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-13-2008, 04:06 AM
LordKahel
Fire Beetle
 
Join Date: Sep 2007
Posts: 22
Default Adding a Rule to use Dex and Agi in Hit Chance calculation

Here is a mod that will give the option of making Dex and agi matter in hit probability . Dex is used by the attacker to help hit and agi is used by the defender to avoid the hit. This will give the possibility to world builder to tune mob and make them hard to hit or very good at hitting.

Add the bold line to commons/ruletypes.h

Code:
RULE_CATEGORY( Combat )
RULE_REAL ( Combat, BaseCritChance, 0.0 ) //The base crit chance for non warriors, NOTE: This will apply to NPCs as well
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_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, false)
RULE_INT ( Combat, PetAttackMagicLevel, 30)
RULE_BOOL ( Combat, UseDexAgiForHitChance, false)
RULE_CATEGORY_END()

And add the following Bold code to the Mob::CheckHitChance in attack.cpp

Code:
	AA_mod += 3*GetAA(aaPhysicalEnhancement);
	AA_mod += 2*GetAA(aaLightningReflexes);
	chancetohit -= chancetohit * AA_mod / 100;
	
	if (RuleB(Combat, UseDexAgiForHitChance)) 
	{
		chancetohit += ((attacker->GetDEX() / 200) - (defender->GetAGI() / 200));	
	}

	// Chance to hit;   Max 95%, Min 30%
	if(chancetohit > 1000) {
		//if chance to hit is crazy high, that means a discipline is in use, and let it stay there
	} 
	else if(chancetohit > 99) {
		chancetohit = 99;
	} 
	else if(chancetohit < 5) {
		chancetohit = 5;
	}

By giving high amount of AGI or DEX you can make a npc very hard to hit or give him more chance to hit the player without raising the levels .

I divide the stat by 200 so that the change does not unbalance the current system. A player with 600 dex hitting a mob with 200 agi will only gain a 2% hit chance increase. This value can be adjusted has the dev see fit or put has a rule if they want to .

Thanks,

--
Pyronis/Kahell
Dev Jest 3 server
Reply With Quote
 


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 11:33 PM.


 

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 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3