Old school apply poison was allowing multiple poisons at once.

This commit is contained in:
Noudess 2019-10-07 13:16:52 -04:00
parent 2e98de3923
commit c62d9040cb
3 changed files with 21 additions and 2 deletions

View File

@ -22,6 +22,7 @@
#include "skills.h"
#define SPELL_UNKNOWN 0xFFFF
#define POISON_PROC 0xFFFE
#define SPELLBOOK_UNKNOWN 0xFFFFFFFF //player profile spells are 32 bit
//some spell IDs which will prolly change, but are needed

View File

@ -2856,7 +2856,7 @@ void Client::Handle_OP_ApplyPoison(const EQApplicationPacket *app)
if (ChanceRoll < (.75 + poison_skill / 1000)) {
ApplyPoisonSuccessResult = 1;
AddProcToWeapon(poison->Proc.Effect, false, (GetDEX() / 100) + 103);
AddProcToWeapon(poison->Proc.Effect, false, (GetDEX() / 100) + 103, POISON_PROC);
}
}
else {

View File

@ -5360,13 +5360,31 @@ bool Mob::AddProcToWeapon(uint16 spell_id, bool bPerma, uint16 iChance, uint16 b
}
Log(Logs::Detail, Logs::Spells, "Too many perma procs for %s", GetName());
} else {
// If its a poison proc, replace any existing one if present.
if (base_spell_id == POISON_PROC) {
for (i = 0; i < MAX_PROCS; i++) {
// If we already have a poison proc active replace it and return
if (SpellProcs[i].base_spellID == POISON_PROC) {
SpellProcs[i].spellID = spell_id;
SpellProcs[i].chance = iChance;
SpellProcs[i].level_override = level_override;
Log(Logs::Detail, Logs::Spells, "Replaced poison-granted proc spell %d with chance %d to slot %d", spell_id, iChance, i);
return true;
}
}
}
// If we get here it either wasn't poison (which can only use 1 slot)
// or it is poison and no poison procs are currently present.
// Find a slot and use it as normal.
for (i = 0; i < MAX_PROCS; i++) {
if (SpellProcs[i].spellID == SPELL_UNKNOWN) {
SpellProcs[i].spellID = spell_id;
SpellProcs[i].chance = iChance;
SpellProcs[i].base_spellID = base_spell_id;;
SpellProcs[i].level_override = level_override;
Log(Logs::Detail, Logs::Spells, "Added spell-granted proc spell %d with chance %d to slot %d", spell_id, iChance, i);
Log(Logs::Detail, Logs::Spells, "Added %s-granted proc spell %d with chance %d to slot %d", (base_spell_id == POISON_PROC) ? "poison" : "spell", spell_id, iChance, i);
return true;
}
}