diff --git a/zone/attack.cpp b/zone/attack.cpp index a7a03127e..5a5077dce 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -5095,7 +5095,6 @@ void Mob::ApplyDamageTable(DamageHitInfo &hit) void Mob::TrySkillProc(Mob *on, EQ::skills::SkillType skill, uint16 ReuseTime, bool Success, uint16 hand, bool IsDefensive) { - if (!on) { SetTarget(nullptr); LogError("A null Mob object was passed to Mob::TrySkillProc for evaluation!"); @@ -5122,10 +5121,12 @@ void Mob::TrySkillProc(Mob *on, EQ::skills::SkillType skill, uint16 ReuseTime, b float ProcMod = 0; float chance = 0; - if (IsDefensive) + if (IsDefensive) { chance = on->GetSkillProcChances(ReuseTime, hand); - else + } + else { chance = GetSkillProcChances(ReuseTime, hand); + } if (spellbonuses.LimitToSkill[skill]) { @@ -5150,9 +5151,8 @@ void Mob::TrySkillProc(Mob *on, EQ::skills::SkillType skill, uint16 ReuseTime, b proc_spell_id = spells[base_spell_id].base_value[i]; ProcMod = static_cast(spells[base_spell_id].limit_value[i]); } - + else if (spells[base_spell_id].effect_id[i] == SE_LimitToSkill && spells[base_spell_id].base_value[i] <= EQ::skills::HIGHEST_SKILL) { - if (CanProc && spells[base_spell_id].base_value[i] == skill && IsValidSpell(proc_spell_id)) { float final_chance = chance * (ProcMod / 100.0f); if (zone->random.Roll(final_chance)) { diff --git a/zone/bonuses.cpp b/zone/bonuses.cpp index e799271aa..951e2b562 100644 --- a/zone/bonuses.cpp +++ b/zone/bonuses.cpp @@ -1476,7 +1476,7 @@ void Mob::ApplyAABonuses(const AA::Rank &rank, StatBonuses *newbon) } if (base_value <= EQ::skills::HIGHEST_SKILL) { newbon->LimitToSkill[base_value] = true; - newbon->LimitToSkill[EQ::skills::HIGHEST_SKILL + 3] = true; //Used as a general exists check + newbon->LimitToSkill[EQ::skills::HIGHEST_SKILL + 2] = true; //Used as a general exists check } break; } @@ -3553,15 +3553,15 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses *ne new_bonus->IllusionPersistence = effect_value; break; - case SE_LimitToSkill:{ + case SE_LimitToSkill: { // Bad data or unsupported new skill if (effect_value > EQ::skills::HIGHEST_SKILL) { break; } if (effect_value <= EQ::skills::HIGHEST_SKILL){ new_bonus->LimitToSkill[effect_value] = true; - new_bonus->LimitToSkill[EQ::skills::HIGHEST_SKILL + 3] = true; //Used as a general exists check - } + new_bonus->LimitToSkill[EQ::skills::HIGHEST_SKILL + 2] = true; //Used as a general exists check + } break; } @@ -3569,11 +3569,12 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses *ne for(int e = 0; e < MAX_SKILL_PROCS; e++) { - if(new_bonus->SkillProc[e] && new_bonus->SkillProc[e] == spell_id) + if (new_bonus->SkillProc[e] && new_bonus->SkillProc[e] == spell_id) { break; //Do not use the same spell id more than once. - + } else if(!new_bonus->SkillProc[e]){ new_bonus->SkillProc[e] = spell_id; + HasSkillProcs();//This returns it correctly as debug break; } } @@ -5568,6 +5569,7 @@ void Mob::NegateSpellEffectBonuses(uint16 spell_id) case SE_SkillProcAttempt: { for (int e = 0; e < MAX_SKILL_PROCS; e++) { + Shout("Fail NEGATE"); if (negate_spellbonus) { spellbonuses.SkillProc[e] = effect_value; } if (negate_itembonus) { itembonuses.SkillProc[e] = effect_value; } if (negate_aabonus) { aabonuses.SkillProc[e] = effect_value; } diff --git a/zone/common.h b/zone/common.h index 31299d3b4..bb32856d0 100644 --- a/zone/common.h +++ b/zone/common.h @@ -535,8 +535,8 @@ struct StatBonuses { bool Sanctuary; // Sanctuary effect, lowers place on hate list until cast on others. int32 FactionModPct; // Modifies amount of faction gained. bool LimitToSkill[EQ::skills::HIGHEST_SKILL + 3]; // Determines if we need to search for a skill proc. - uint32 SkillProc[MAX_SKILL_PROCS]; // Max number of spells containing skill_procs. - uint32 SkillProcSuccess[MAX_SKILL_PROCS]; // Max number of spells containing skill_procs_success. + int32 SkillProc[MAX_SKILL_PROCS]; // Max number of spells containing skill_procs. + int32 SkillProcSuccess[MAX_SKILL_PROCS]; // Max number of spells containing skill_procs_success. int32 SpellProc[MAX_AA_PROCS]; // Max number of spells containing melee spell procs. int32 RangedProc[MAX_AA_PROCS]; // Max number of spells containing ranged spell procs. int32 DefensiveProc[MAX_AA_PROCS]; // Max number of spells containing defensive spell procs. diff --git a/zone/mob.cpp b/zone/mob.cpp index 514a3cdc0..05e93dd3a 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -4261,7 +4261,7 @@ void Mob::TriggerDefensiveProcs(Mob *on, uint16 hand, bool FromSkillProc, int da TryCastOnSkillUse(on, skillinuse); - if (on->HasSkillProcs()) { + if (on && on->HasSkillProcs()) { on->TrySkillProc(this, skillinuse, 0, false, hand, true); } diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 1a6f11692..1d68f1ec6 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -9702,7 +9702,7 @@ bool Mob::PassLimitToSkill(EQ::skills::SkillType skill, int32 spell_id, int proc bool match_proc_type = false; bool has_limit_check = false; - if (!aa_id && spellbonuses.LimitToSkill[EQ::skills::HIGHEST_SKILL + 3]) { + if (!aa_id && spellbonuses.LimitToSkill[EQ::skills::HIGHEST_SKILL + 2]) { if (spell_id == SPELL_UNKNOWN) { return false; @@ -9721,7 +9721,7 @@ bool Mob::PassLimitToSkill(EQ::skills::SkillType skill, int32 spell_id, int proc } } } - else if (aabonuses.LimitToSkill[EQ::skills::HIGHEST_SKILL + 3]) { + else if (aabonuses.LimitToSkill[EQ::skills::HIGHEST_SKILL + 2]) { int rank_id = 1; AA::Rank *rank = zone->GetAlternateAdvancementRank(aa_id);