View Single Post
  #8  
Old 08-27-2014, 05:54 PM
Torven
Sarnak
 
Join Date: Aug 2014
Posts: 52
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