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

Development::Bug Reports Post detailed bug reports and what you would like to see next in the emu here.

Reply
 
Thread Tools Display Modes
  #1  
Old 06-26-2009, 06:42 PM
ChaosSlayerZ's Avatar
ChaosSlayerZ
Demi-God
 
Join Date: Mar 2009
Location: Umm
Posts: 1,492
Default Reverse Procs fire of attackers dex?

I have doen extensive testing of Proc Buff and Reverse Proc buffs (those which fire when you get hit), and it seems that Reverse Procs ALSO fire more when hiting side has more DEX, which is UMM kind of illogical.

Basicly what happens if you cast reverse proc buff on yourself as means of DEFENCE and an enemy has very low DEX - it simply not gona proc, making buff rather useless. On other hand, if attacker have a lot of dex, the buff procs like MAD.

Is this how it suppose to be?

I belive that the reverse proc buff are NOT supose to be based of attacker DEX and thats why they come with 400% modifiers (or sometimes more) - so they proc equaly for everyone
Reply With Quote
  #2  
Old 06-28-2009, 12:45 PM
AndMetal
Developer
 
Join Date: Mar 2007
Location: Ohio
Posts: 648
Default

Here's the code:

zone/attack.cpp
Code:
	if (damage > 0)
	{
		// Give the opportunity to throw back a defensive proc, if we are successful in affecting damage on our target
		other->TriggerDefensiveProcs(this);
		
        return true;
	}
	else
		return false;
zone/mob.cpp
Code:
void Mob::TriggerDefensiveProcs(Mob *on)
{
	if (this->HasDefensiveProcs()) {
		this->TryDefensiveProc(on);
	}

	return;
}
zone/attack.cpp
Code:
bool Mob::HasDefensiveProcs() const
{
	for (int i = 0; i < MAX_PROCS; i++)
        if (DefensiveProcs[i].spellID != SPELL_UNKNOWN)
            return true;
    return false;
}
zone/attack.cpp
Code:
void Mob::TryDefensiveProc(Mob *on) {
	// this should have already been checked, but just in case...
	if (!this->HasDefensiveProcs())
		return;

	if (!on) {
		SetTarget(NULL);
		LogFile->write(EQEMuLog::Error, "A null Mob object was passed to Mob::TryDefensiveProc for evaluation!");
		return;
	}

	// iterate through our defensive procs and try each of them
	for (int i = 0; i < MAX_PROCS; i++) {
		if (DefensiveProcs[i].spellID != SPELL_UNKNOWN &&
			IsValidSpell(DefensiveProcs[i].spellID)) {
				if (MakeRandomInt(0, 100) < MakeRandomInt(0, 20)) {
					ExecWeaponProc(DefensiveProcs[i].spellID, on);
				}
		}
	}

	return;
}
zone/mob.cpp
Code:
void Mob::ExecWeaponProc(uint16 spell_id, Mob *on) {
	// Trumpcard: Changed proc targets to look up based on the spells goodEffect flag.
	// This should work for the majority of weapons.
	if(spell_id == SPELL_UNKNOWN)
		return;
	if ( IsBeneficialSpell(spell_id) )
		SpellFinished(spell_id, this, 10, 0);
	else if(!(on->IsClient() && on->CastToClient()->dead))	//dont proc on dead clients
		SpellFinished(spell_id, on, 10, 0);
}
From what I can see, it looks like the only thing that affects the probability of a reverse proc proccing (and maybe a woodchuck chucking?) is the random number generator. I must say though, creating 2 random numbers could create some funny odds of proccing, which may be the issue. I had to create a little program to calculate the probability, but using a sample size of 100,000,000 tries consistently gives a probability to proc of about 9.91% (specifically 9912469/100000000), at least on Windows:
Code:
#include <iostream>
using namespace std;

int MakeRandomInt(int low, int high) {
	if(low >= high)
		return(low);
	return (rand()%(high-low+1) + (low));
}

int main() {
	int l1 = 0;
	int h1 = 100;
	int l2 = 0;
	int h2 = 20;
	cout << "MakeRandomInt(" << l1 << ", " << h1 << ") < MakeRandomInt(" << l2 << ", " << h2 << ")" << endl;
	int tries = 100000000;	//100,000,000
	int count_true = 0;
	cout << "Running";
	for (int i = 0; i < tries; i++) {
		if ((i % 1000000) == 0)
			cout << ".";
		if (MakeRandomInt(l1, h1) < MakeRandomInt(l2, h2))
			count_true++;
	}
	cout << endl;
	int count_false = tries - count_true;
	float percent_true = ((float)count_true / (float)tries) * 100;
	float percent_false = ((float)count_false / (float)tries) * 100;
	cout << "After " << tries << " tries, " << count_true << " (" << percent_true << "%) were true & " << count_false << " (" << percent_false << "%) were false." << endl;
__________________
GM-Impossible of 'A work in progress'
A non-legit PEQ DB server
How to create your own non-legit server

My Contributions to the Wiki
Reply With Quote
  #3  
Old 06-28-2009, 01:07 PM
ChaosSlayerZ's Avatar
ChaosSlayerZ
Demi-God
 
Join Date: Mar 2009
Location: Umm
Posts: 1,492
Default

yeah 9% sounds about right - with 3% default chance +300% modifier- that should get to 9%

but does it works the same way for PCs and NPCs?

cuase spell is expected to be a PC buff, but technicly even NPC can have it, and from my testing it seem like, when npc was beating on me it would proc once in in 3-4 Dozens of hits. (I have specificly choosen hasted quading npc for the test)
When I casted this buff on npc and started beating on him myself, it procced back on to me like every 8-10 hits (which is about 3-4 times as often). Considering my DEX was much higher (and DEX is abse for normal procs), this is where I turned for the posible problem.
Reply With Quote
  #4  
Old 06-28-2009, 01:17 PM
AndMetal
Developer
 
Join Date: Mar 2007
Location: Ohio
Posts: 648
Default

If I remember correctly, the info above is for a PC attacking an NPC that has a Reverse Proc Buff.
__________________
GM-Impossible of 'A work in progress'
A non-legit PEQ DB server
How to create your own non-legit server

My Contributions to the Wiki
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 04:53 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