Go Back   EQEmulator Home > EQEmulator Forums > Support > Spell Support

Spell Support Broken Spells? Want them Fixed? Request it here.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 06-03-2009, 04:06 PM
AndMetal
Developer
 
Join Date: Mar 2007
Location: Ohio
Posts: 648
Default

From what I can gather after looking through the source, we didn't used to take into account the chance the spell had to proc, which I believe is what Wolftousen was trying to correct (and for the most part did). That's what iChance is for in Mob:AddProcToWeapon():
Code:
bool Mob::AddProcToWeapon(int16 spell_id, bool bPerma, int16 iChance) {
	if(spell_id == SPELL_UNKNOWN)
		return(false);

	int i;
	if (bPerma) {
 		for (i = 0; i < MAX_PROCS; i++) {
			if (PermaProcs[i].spellID == SPELL_UNKNOWN) {
				PermaProcs[i].spellID = spell_id;
				PermaProcs[i].chance = iChance;
				PermaProcs[i].pTimer = NULL;
				mlog(SPELLS__PROCS, "Added permanent proc spell %d with chance %d to slot %d", spell_id, iChance, i);

				return true;
			}
		}
		mlog(SPELLS__PROCS, "Too many perma procs for %s", GetName());
    } else {
		for (i = 0; i < MAX_PROCS; i++) {
			if (SpellProcs[i].spellID == SPELL_UNKNOWN) {
				SpellProcs[i].spellID = spell_id;
				SpellProcs[i].chance = iChance;
				SpellProcs[i].pTimer = NULL;
				mlog(SPELLS__PROCS, "Added spell-granted proc spell %d with chance %d to slot %d", spell_id, iChance, i);
				return true;
			}
		}
		mlog(SPELLS__PROCS, "Too many procs for %s", GetName());
	}
    return false;
}
However, I don't think there's any need to change the calculation for the chance to proc, just make sure we're taking it into account:
zone/attack.cpp
Code:
		if (SpellProcs[i].spellID != SPELL_UNKNOWN) {
			int chance = ProcChance * (SpellProcs[i].chance);
			if(MakeRandomInt(0, 100) < chance) {
				mlog(COMBAT__PROCS, "Spell proc %d procing spell %d (%d percent chance)", i, SpellProcs[i].spellID, chance);
				ExecWeaponProc(SpellProcs[i].spellID, on);
			} else {
				mlog(COMBAT__PROCS, "Spell proc %d failed to proc %d (%d percent chance)", i, SpellProcs[i].spellID, chance);
			}
		}
The biggest problem we're running into now is the default for SpellProcs[i].chance for several spells is 0, so we're multiplying by 0. What we should probably be doing is adding a percentage if it's not zero.

From the PEQ Forums:
Quote:
This will fix any proc that comes from a buff/spell. CD has the new fix for it that will make these procs account for the PROC_RATE_MOD you find in a lot of their discriptions (this was previously not being taken into account). So for BL pets, they will proc 1.5x as much as a normal character with their stats would with that proc (BL pet buffs have a mod of 150...), spirit of puma willl proc 4x more, etc...
If that's the case, we should be able to change this in zone/attack.cpp:
Code:
		int16 spid = SpellProcs[i].spellID;
		if (spid != SPELL_UNKNOWN) {
			int8 spc = SpellProcs[i].chance;
			int chance = ProcChance;
			if (spc > 0) {
				chance = ProcChance * spc / 100;
				mlog(COMBAT__PROCS, "Proc mod on spell proc %d (spell %d): adjusting chance from %d to %d (%d mod)", i, spid, ProcChance, chance, spc);
			}
			if(MakeRandomInt(0, 100) < chance) {
				mlog(COMBAT__PROCS, "Spell proc %d procing spell %d (%d percent chance)", i, spid, chance);
				ExecWeaponProc(spid, on);
			} else {
				mlog(COMBAT__PROCS, "Spell proc %d failed to proc %d (%d percent chance)", i, spid, chance);
			}
		}
That way if it's 0 or negative, we don't mess with it, and if it's 400, we're multiplying by 4.

On a side note, there's a potential issue that could break this when zoning. From zone/client_packet.cpp:
Code:
                case SE_WeaponProc:
					{
					AddProcToWeapon(GetProcID(buffs[j1].spellid, x1), false, 100+spells[buffs[j1].spellid].base2[x1]);
					break;
					}
We should just be able to remove the 100+, and it should be good to go:
Code:
                case SE_WeaponProc:
					{
					AddProcToWeapon(GetProcID(buffs[j1].spellid, x1), false, spells[buffs[j1].spellid].base2[x1]);
					break;
					}
I don't have a server up right now to compile & test, so if someone wants to give this a shot, feel free.
__________________
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
 


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