diff --git a/zone/attack.cpp b/zone/attack.cpp index 8b9196adc..9f6011c52 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -3348,7 +3348,7 @@ int32 Mob::ReduceAllDamage(int32 damage) } } - CheckNumHitsRemaining(NUMHIT_IncomingDamage); + CheckNumHitsRemaining(NumHit::IncomingDamage); return(damage); } @@ -3464,10 +3464,10 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons } if (spell_id == SPELL_UNKNOWN && skill_used) { - CheckNumHitsRemaining(NUMHIT_IncomingHitAttempts); + CheckNumHitsRemaining(NumHit::IncomingHitAttempts); if (attacker) - attacker->CheckNumHitsRemaining(NUMHIT_OutgoingHitAttempts); + attacker->CheckNumHitsRemaining(NumHit::OutgoingHitAttempts); } if(attacker){ @@ -3544,7 +3544,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons } if (skill_used) - CheckNumHitsRemaining(NUMHIT_IncomingHitSuccess); + CheckNumHitsRemaining(NumHit::IncomingHitSuccess); if(IsClient() && CastToClient()->sneaking){ CastToClient()->sneaking = false; @@ -3917,7 +3917,8 @@ void Mob::TryDefensiveProc(const ItemInst* weapon, Mob *on, uint16 hand) { float chance = ProcChance * (static_cast(DefensiveProcs[i].chance)/100.0f); if (zone->random.Roll(chance)) { ExecWeaponProc(nullptr, DefensiveProcs[i].spellID, on); - CheckNumHitsRemaining(NUMHIT_DefensiveSpellProcs,0,DefensiveProcs[i].base_spellID); + CheckNumHitsRemaining(NumHit::DefensiveSpellProcs, 0, + DefensiveProcs[i].base_spellID); } } } @@ -4093,7 +4094,8 @@ void Mob::TrySpellProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on, "Spell proc %d procing spell %d (%.2f percent chance)", i, SpellProcs[i].spellID, chance); ExecWeaponProc(nullptr, SpellProcs[i].spellID, on); - CheckNumHitsRemaining(NUMHIT_OffensiveSpellProcs, 0, SpellProcs[i].base_spellID); + CheckNumHitsRemaining(NumHit::OffensiveSpellProcs, 0, + SpellProcs[i].base_spellID); } else { mlog(COMBAT__PROCS, "Spell proc %d failed to proc %d (%.2f percent chance)", @@ -4109,7 +4111,8 @@ void Mob::TrySpellProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on, "Ranged proc %d procing spell %d (%.2f percent chance)", i, RangedProcs[i].spellID, chance); ExecWeaponProc(nullptr, RangedProcs[i].spellID, on); - CheckNumHitsRemaining(NUMHIT_OffensiveSpellProcs, 0, RangedProcs[i].base_spellID); + CheckNumHitsRemaining(NumHit::OffensiveSpellProcs, 0, + RangedProcs[i].base_spellID); } else { mlog(COMBAT__PROCS, "Ranged proc %d failed to proc %d (%.2f percent chance)", @@ -4526,7 +4529,8 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, ui float final_chance = chance * (ProcMod / 100.0f); if (zone->random.Roll(final_chance)) { ExecWeaponProc(nullptr, proc_spell_id, on); - CheckNumHitsRemaining(NUMHIT_OffensiveSpellProcs,0, base_spell_id); + CheckNumHitsRemaining(NumHit::OffensiveSpellProcs, 0, + base_spell_id); CanProc = false; break; } @@ -4772,7 +4776,7 @@ void Mob::CommonOutgoingHitSuccess(Mob* defender, int32 &damage, SkillUseTypes s ApplyMeleeDamageBonus(skillInUse, damage); damage += (damage * defender->GetSkillDmgTaken(skillInUse) / 100) + (GetSkillDmgAmt(skillInUse) + defender->GetFcDamageAmtIncoming(this, 0, true, skillInUse)); TryCriticalHit(defender, skillInUse, damage); - CheckNumHitsRemaining(NUMHIT_OutgoingHitSuccess); + CheckNumHitsRemaining(NumHit::OutgoingHitSuccess); } void Mob::CommonBreakInvisible() diff --git a/zone/bot.cpp b/zone/bot.cpp index a4780ddc8..eb919272a 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -3184,7 +3184,7 @@ void Bot::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, SkillUseTypes return; if (damage > 0) - CheckNumHitsRemaining(NUMHIT_OutgoingHitSuccess); + CheckNumHitsRemaining(NumHit::OutgoingHitSuccess); if((skillinuse == SkillDragonPunch) && GetAA(aaDragonPunch) && zone->random.Int(0, 99) < 25){ SpellFinished(904, other, 10, 0, -1, spells[904].ResistDiff); @@ -6249,7 +6249,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b MeleeLifeTap(damage); if (damage > 0) - CheckNumHitsRemaining(NUMHIT_OutgoingHitSuccess); + CheckNumHitsRemaining(NumHit::OutgoingHitSuccess); //break invis when you attack if(invisible) { @@ -7707,7 +7707,7 @@ void Bot::DoSpecialAttackDamage(Mob *who, SkillUseTypes skill, int32 max_damage, if (HasDied()) return; if (max_damage > 0) - CheckNumHitsRemaining(NUMHIT_OutgoingHitSuccess); + CheckNumHitsRemaining(NumHit::OutgoingHitSuccess); //[AA Dragon Punch] value[0] = 100 for 25%, chance value[1] = skill if(aabonuses.SpecialAttackKBProc[0] && aabonuses.SpecialAttackKBProc[1] == skill){ diff --git a/zone/common.h b/zone/common.h index 45f3bdb09..3639f74a0 100644 --- a/zone/common.h +++ b/zone/common.h @@ -158,18 +158,18 @@ enum TradeState { TradeCompleting }; -enum { //Numhits type - NUMHIT_IncomingHitAttempts = 1, //Attempted incoming melee attacks (hit or miss) on YOU. - NUMHIT_OutgoingHitAttempts = 2, //Attempted outgoing melee attacks (hit or miss) on YOUR TARGET. - NUMHIT_IncomingSpells = 3, //Incoming detrimental spells - NUMHIT_OutgoingSpells = 4, //Outgoing deterimental spells - NUMHIT_OutgoingHitSuccess = 5, //Successful outgoing melee attack HIT on YOUR TARGET. - NUMHIT_IncomingHitSuccess = 6, //Successful incoming melee attack HIT on YOU. - NUMHIT_MatchingSpells = 7, //Any casted spell matching/triggering a focus effect. - NUMHIT_IncomingDamage = 8, //Successful incoming spell or melee dmg attack on YOU - NUMHIT_ReflectSpell = 9, //Incoming Reflected spells. - NUMHIT_DefensiveSpellProcs = 10, //Defensive buff procs - NUMHIT_OffensiveSpellProcs = 11 //Offensive buff procs +enum class NumHit { // Numhits type + IncomingHitAttempts = 1, // Attempted incoming melee attacks (hit or miss) on YOU. + OutgoingHitAttempts = 2, // Attempted outgoing melee attacks (hit or miss) on YOUR TARGET. + IncomingSpells = 3, // Incoming detrimental spells + OutgoingSpells = 4, // Outgoing detrimental spells + OutgoingHitSuccess = 5, // Successful outgoing melee attack HIT on YOUR TARGET. + IncomingHitSuccess = 6, // Successful incoming melee attack HIT on YOU. + MatchingSpells = 7, // Any casted spell matching/triggering a focus effect. + IncomingDamage = 8, // Successful incoming spell or melee dmg attack on YOU + ReflectSpell = 9, // Incoming Reflected spells. + DefensiveSpellProcs = 10, // Defensive buff procs + OffensiveSpellProcs = 11 // Offensive buff procs }; //this is our internal representation of the BUFF struct, can put whatever we want in it diff --git a/zone/mob.cpp b/zone/mob.cpp index 3ea572eb6..3c7243e03 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -3383,7 +3383,7 @@ void Mob::TriggerOnCast(uint32 focus_spell, uint32 spell_id, bool aa_trigger) if(IsValidSpell(trigger_spell_id) && GetTarget()){ SpellFinished(trigger_spell_id, GetTarget(),10, 0, -1, spells[trigger_spell_id].ResistDiff); - CheckNumHitsRemaining(NUMHIT_MatchingSpells,-1, focus_spell); + CheckNumHitsRemaining(NumHit::MatchingSpells, -1, focus_spell); } } } @@ -3615,7 +3615,7 @@ int32 Mob::GetVulnerability(Mob* caster, uint32 spell_id, uint32 ticsremaining) value += tmp_focus; if (tmp_buffslot >= 0) - CheckNumHitsRemaining(NUMHIT_MatchingSpells, tmp_buffslot); + CheckNumHitsRemaining(NumHit::MatchingSpells, tmp_buffslot); } return value; } @@ -3720,7 +3720,7 @@ void Mob::TrySympatheticProc(Mob *target, uint32 spell_id) SpellFinished(focus_trigger, target, 10, 0, -1, spells[focus_trigger].ResistDiff); } - CheckNumHitsRemaining(NUMHIT_MatchingSpells, -1, focus_spell); + CheckNumHitsRemaining(NumHit::MatchingSpells, -1, focus_spell); } } diff --git a/zone/mob.h b/zone/mob.h index 2fc9a7287..515f484e1 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -282,7 +282,7 @@ public: int16 GetBuffSlotFromType(uint16 type); uint16 GetSpellIDFromSlot(uint8 slot); int CountDispellableBuffs(); - void CheckNumHitsRemaining(uint8 type, int32 buff_slot=-1, uint16 spell_id=SPELL_UNKNOWN); + void CheckNumHitsRemaining(NumHit type, int32 buff_slot = -1, uint16 spell_id = SPELL_UNKNOWN); bool HasNumhits() const { return has_numhits; } inline void Numhits(bool val) { has_numhits = val; } bool HasMGB() const { return has_MGB; } diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index cb21073ca..507c361dd 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -5645,7 +5645,7 @@ int16 NPC::GetFocusEffect(focusType type, uint16 spell_id) { return realTotal + realTotal2; } -void Mob::CheckNumHitsRemaining(uint8 type, int32 buff_slot, uint16 spell_id) +void Mob::CheckNumHitsRemaining(NumHit type, int32 buff_slot, uint16 spell_id) { /* Field 175 = numhits type @@ -5672,7 +5672,7 @@ void Mob::CheckNumHitsRemaining(uint8 type, int32 buff_slot, uint16 spell_id) if (IsValidSpell(spell_id)) { for (int d = 0; d < buff_max; d++) { if (buffs[d].spellid == spell_id && buffs[d].numhits > 0 && - spells[buffs[d].spellid].numhitstype == type) { + spells[buffs[d].spellid].numhitstype == static_cast(type)) { if (--buffs[d].numhits == 0) { CastOnNumHitFade(buffs[d].spellid); if (!TryFadeEffect(d)) @@ -5682,7 +5682,7 @@ void Mob::CheckNumHitsRemaining(uint8 type, int32 buff_slot, uint16 spell_id) } } } - } else if (type == NUMHIT_MatchingSpells) { + } else if (type == NumHit::MatchingSpells) { if (buff_slot >= 0) { if (--buffs[buff_slot].numhits == 0) { CastOnNumHitFade(buffs[buff_slot].spellid); @@ -5711,7 +5711,7 @@ void Mob::CheckNumHitsRemaining(uint8 type, int32 buff_slot, uint16 spell_id) } else { for (int d = 0; d < buff_max; d++) { if (IsValidSpell(buffs[d].spellid) && buffs[d].numhits > 0 && - spells[buffs[d].spellid].numhitstype == type) { + spells[buffs[d].spellid].numhitstype == static_cast(type)) { if (--buffs[d].numhits == 0) { CastOnNumHitFade(buffs[d].spellid); if (!TryFadeEffect(d)) @@ -5975,7 +5975,7 @@ int32 Mob::GetFcDamageAmtIncoming(Mob *caster, uint32 spell_id, bool use_skill, } if ((!limit_exists) || (limit_exists && skill_found)){ dmg += temp_dmg; - CheckNumHitsRemaining(NUMHIT_MatchingSpells,i); + CheckNumHitsRemaining(NumHit::MatchingSpells, i); } } @@ -5983,7 +5983,7 @@ int32 Mob::GetFcDamageAmtIncoming(Mob *caster, uint32 spell_id, bool use_skill, int32 focus = caster->CalcFocusEffect(focusFcDamageAmtIncoming, buffs[i].spellid, spell_id); if(focus){ dmg += focus; - CheckNumHitsRemaining(NUMHIT_MatchingSpells,i); + CheckNumHitsRemaining(NumHit::MatchingSpells, i); } } } @@ -6035,7 +6035,7 @@ int32 Mob::GetFocusIncoming(focusType type, int effect, Mob *caster, uint32 spel value = tmp_focus; if (tmp_buffslot >= 0) - CheckNumHitsRemaining(NUMHIT_MatchingSpells, tmp_buffslot); + CheckNumHitsRemaining(NumHit::MatchingSpells, tmp_buffslot); } diff --git a/zone/spells.cpp b/zone/spells.cpp index f749f062d..ef5dd165a 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -1268,7 +1268,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, } if(IsClient()) { - CheckNumHitsRemaining(NUMHIT_MatchingSpells); + CheckNumHitsRemaining(NumHit::MatchingSpells); TrySympatheticProc(target, spell_id); } @@ -3573,7 +3573,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r if(IsEffectInSpell(buffs[b].spellid, SE_BlockNextSpellFocus)) { focus = CalcFocusEffect(focusBlockNextSpell, buffs[b].spellid, spell_id); if(focus) { - CheckNumHitsRemaining(NUMHIT_MatchingSpells,b); + CheckNumHitsRemaining(NumHit::MatchingSpells, b); Message_StringID(MT_SpellFailure, SPELL_WOULDNT_HOLD); safe_delete(action_packet); return false; @@ -3622,7 +3622,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r } if(reflect_chance) { Message_StringID(MT_Spells, SPELL_REFLECT, GetCleanName(), spelltar->GetCleanName()); - CheckNumHitsRemaining(NUMHIT_ReflectSpell); + CheckNumHitsRemaining(NumHit::ReflectSpell); SpellOnTarget(spell_id, this, true, use_resist_adjust, resist_adjust); safe_delete(action_packet); return false; @@ -3673,8 +3673,8 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r } } - spelltar->CheckNumHitsRemaining(NUMHIT_IncomingSpells); - CheckNumHitsRemaining(NUMHIT_OutgoingSpells); + spelltar->CheckNumHitsRemaining(NumHit::IncomingSpells); + CheckNumHitsRemaining(NumHit::OutgoingSpells); safe_delete(action_packet); return false; @@ -3732,10 +3732,10 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r if (IsDetrimentalSpell(spell_id)) { - CheckNumHitsRemaining(NUMHIT_OutgoingSpells); + CheckNumHitsRemaining(NumHit::OutgoingSpells); if (spelltar) - spelltar->CheckNumHitsRemaining(NUMHIT_IncomingSpells); + spelltar->CheckNumHitsRemaining(NumHit::IncomingSpells); } // send the action packet again now that the spell is successful