Ya, I am sure we could use more effect types working properly or at all. But the idea of this would be to just use any existing effect types and have a check to proc when being hit. I will look into seeing how hard it would be to code and maybe write something up. I am pretty sure we could just copy the current proc code from There could always be a rule put in place to allow admins to enable or disable this extra check after chancetohit.
attack.cpp
Maybe add something like this to where incoming damage is calculated:
Code:
TryNonWeaponProc(nonweapon, other);
And then the function would be a modified version of this:
Code:
void Mob::TryWeaponProc(const Item_Struct* weapon, Mob *on) {
int ourlevel = GetLevel();
float ProcChance, ProcBonus;
if(weapon!=NULL)
GetProcChances(ProcBonus, ProcChance, weapon->Delay);
else
GetProcChances(ProcBonus, ProcChance);
//give weapon a chance to proc first.
if(weapon != NULL) {
if (IsValidSpell(weapon->Proc.Effect) && (weapon->Proc.Type == ET_CombatProc)) {
float WPC = ProcChance*(100.0f+(float)weapon->ProcRate)/100.0f;
if (MakeRandomFloat(0, 1) <= WPC) { // 255 dex = 0.084 chance of proc. No idea what this number should be really.
if(weapon->Proc.Level > ourlevel) {
mlog(COMBAT__PROCS, "Tried to proc (%s), but our level (%d) is lower than required (%d)", weapon->Name, ourlevel, weapon->Proc.Level);
Mob * own = GetOwner();
if(own != NULL) {
own->Message_StringID(13,PROC_PETTOOLOW);
} else {
Message_StringID(13,PROC_TOOLOW);
}
} else {
mlog(COMBAT__PROCS, "Attacking weapon (%s) successfully procing spell %d (%.2f percent chance)", weapon->Name, weapon->Proc.Effect, ProcChance*100);
ExecWeaponProc(weapon->Proc.Effect, on);
}
} else {
mlog(COMBAT__PROCS, "Attacking weapon (%s) did no proc (%.2f percent chance).", weapon->Name, ProcChance*100);
}
}
}
if(ProcBonus == -1) {
LogFile->write(EQEMuLog::Error, "ProcBonus was -1 value!");
return;
}
//now try our proc arrays
float procmod = float(GetDEX()) / 100.0f + ProcBonus*100.0; //did somebody think about this???
//AndMetal: aren't we doing this in GetProcChances?
uint32 i;
for(i = 0; i < MAX_PROCS; i++) {
if (PermaProcs[i].spellID != SPELL_UNKNOWN) {
if(MakeRandomInt(0, 100) < PermaProcs[i].chance) {
mlog(COMBAT__PROCS, "Permanent proc %d procing spell %d (%d percent chance)", i, PermaProcs[i].spellID, PermaProcs[i].chance);
ExecWeaponProc(PermaProcs[i].spellID, on);
} else {
mlog(COMBAT__PROCS, "Permanent proc %d failed to proc %d (%d percent chance)", i, PermaProcs[i].spellID, PermaProcs[i].chance);
}
}
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);
}
}
}
}
I will see if I can figure out the best way to do it later if I get the time.