Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Development

Development::Development Forum for development topics and for those interested in EQEMu development. (Not a support forum)

Reply
 
Thread Tools Display Modes
  #1  
Old 08-27-2014, 05:54 PM
Torven
Sarnak
 
Join Date: Aug 2014
Posts: 76
Default

I have a proposed fix. I suppose I should have done this before posting, but I'm trying to keep my tasks narrowed to data collection.

Change the end of Mob::ResistSpell() to this:

Code:
	//Finally our roll
	int roll = MakeRandomInt(0, 200);
	if(roll >= resist_chance)
	{
		return 100;
	}
	else
	{
		if(!IsPartialCapableSpell(spell_id))
		{
			return 0;
		}
		else
		{
			if (resist_chance < 1)
			{
				resist_chance = 1;
			}

			int partial_modifier = ((150 * (resist_chance - roll)) / resist_chance);

			if(IsNPC())
			{
				if(GetLevel() > caster->GetLevel() && GetLevel() >= 17 && caster->GetLevel() <= 50)
				{
					partial_modifier += 5;
				}

				if(GetLevel() >= 30 && caster->GetLevel() < 50)
				{
					partial_modifier += (caster->GetLevel() - 25);
				}

				if(GetLevel() < 15)
				{
					partial_modifier -= 5;
				}
			}

			if(caster->IsNPC())
			{
				if((GetLevel() - caster->GetLevel()) >= 20)
				{
					partial_modifier += (GetLevel() - caster->GetLevel()) * 1.5;
				}
			}
			
			if(partial_modifier < 0)
			{
				return 100;
			}

			if(partial_modifier > 100)
			{
				return 0;
			}

			return 100 - partial_modifier;
		}
	}
and edit Mob::SpellEffect() in spell_effects.cpp to prevent 0 damage spells, like so:

Code:
				// take partial damage into account
					dmg = (int32) (dmg * partial / 100);

					if (dmg == 0)
						dmg = -1;

					//handles AAs and what not...
					if(caster)
						dmg = caster->GetActSpellDamage(spell_id, dmg, this);
					
					dmg = -dmg;
					
					Damage(caster, dmg, spell_id, spell.skill, false, buffslot, false);
This is actually closer to Prathum's pseudocode. Whoever wrote EQEmu's version did a couple of strange things, which are substracting the roll from resist value before calculating the partial damage percent and switching around a couple of variables in the partial_modifer equation.

EQ Emu's curve currently looks like this: http://i.imgur.com/h9Xdixr.png

In Prathun's psuedocode, partial_modifer is actually the percent of RESISTED damage, but ResistSpell() returns a value that is the percent of the NON-RESISTED damage, which is why partials on EQ Emu tend to always be nearly full damage at high resist values. At high resist values, spells should actually never do near full damage.

Lastly I changed roll > resist_chance to roll >= resist_chance because a NPC with 0 resist value should never resist, and I have a log at 200 resist value that included full damage hits.

I tested and parsed this code on my local server and it seems more or less identical to live.
Reply With Quote
  #2  
Old 09-08-2014, 06:05 AM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

I didn't even see this last post but yeah I went through tonight and double checked things and basically came out with that code (doh duplication of effort).

I've tested it and it seems to work right which is encouraging. It's on master now.
Reply With Quote
Reply

Thread Tools
Display Modes

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:51 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