diff --git a/zone/attack.cpp b/zone/attack.cpp index 99682eee5..4592f2fdf 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -1350,7 +1350,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b MeleeLifeTap(damage); if (damage > 0) - CheckNumHitsRemaining(5); + CheckNumHitsRemaining(NUMHIT_OutgoingHitSuccess); //break invis when you attack if(invisible) { @@ -1965,7 +1965,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool MeleeLifeTap(damage); if (damage > 0) - CheckNumHitsRemaining(5); + CheckNumHitsRemaining(NUMHIT_OutgoingHitSuccess); //break invis when you attack if(invisible) { @@ -3421,7 +3421,7 @@ int32 Mob::ReduceAllDamage(int32 damage) TryTriggerOnValueAmount(false, true); } - CheckNumHitsRemaining(8); + CheckNumHitsRemaining(NUMHIT_IncomingDamage); return(damage); } @@ -3527,10 +3527,10 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons } if (spell_id == SPELL_UNKNOWN && skill_used) { - CheckNumHitsRemaining(1); //Incoming Hit Attempts + CheckNumHitsRemaining(NUMHIT_IncomingHitAttempts); if (attacker) - attacker->CheckNumHitsRemaining(2); //Outgoing Hit Attempts + attacker->CheckNumHitsRemaining(NUMHIT_OutgoingHitAttempts); } if(attacker){ @@ -3604,7 +3604,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons } if (skill_used) - CheckNumHitsRemaining(6); //Incomming Hit Success on Defender + CheckNumHitsRemaining(NUMHIT_IncomingHitSuccess); ReduceAllDamage(damage); @@ -4021,7 +4021,7 @@ void Mob::TryDefensiveProc(const ItemInst* weapon, Mob *on, uint16 hand, int dam int chance = ProcChance * (DefensiveProcs[i].chance); if ((MakeRandomInt(0, 100) < chance)) { ExecWeaponProc(nullptr, DefensiveProcs[i].spellID, on); - CheckNumHitsRemaining(10,0,DefensiveProcs[i].base_spellID); + CheckNumHitsRemaining(NUMHIT_DefensiveSpellProcs,0,DefensiveProcs[i].base_spellID); } } } @@ -4208,7 +4208,7 @@ 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(11, 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)", @@ -4224,7 +4224,7 @@ 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(11, 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)", @@ -4594,7 +4594,7 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, float chance) int ProcChance = chance * (float)SkillProcs[i].chance; if ((MakeRandomInt(0, 100) < ProcChance)) { ExecWeaponProc(nullptr, SkillProcs[i].spellID, on); - CheckNumHitsRemaining(11,0, SkillProcs[i].base_spellID); + CheckNumHitsRemaining(NUMHIT_OffensiveSpellProcs,0, SkillProcs[i].base_spellID); } } } diff --git a/zone/bot.cpp b/zone/bot.cpp index 3b996e7a8..5bdf3cb02 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -3389,7 +3389,7 @@ void Bot::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, SkillUseTypes return; if (damage > 0) - CheckNumHitsRemaining(5); + CheckNumHitsRemaining(NUMHIT_OutgoingHitSuccess); if((skillinuse == SkillDragonPunch) && GetAA(aaDragonPunch) && MakeRandomInt(0, 99) < 25){ SpellFinished(904, other, 10, 0, -1, spells[904].ResistDiff); @@ -6632,7 +6632,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b MeleeLifeTap(damage); if (damage > 0) - CheckNumHitsRemaining(5); + CheckNumHitsRemaining(NUMHIT_OutgoingHitSuccess); //break invis when you attack if(invisible) { @@ -8092,7 +8092,7 @@ void Bot::DoSpecialAttackDamage(Mob *who, SkillUseTypes skill, int32 max_damage, if (HasDied()) return; if (max_damage > 0) - CheckNumHitsRemaining(5); + 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 f94962ee1..a8e8a17c9 100644 --- a/zone/common.h +++ b/zone/common.h @@ -150,6 +150,20 @@ 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 +}; + //this is our internal representation of the BUFF struct, can put whatever we want in it struct Buffs_Struct { uint16 spellid; diff --git a/zone/mob.cpp b/zone/mob.cpp index 06dbe4519..138c159cd 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -3155,7 +3155,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(7,0, focus_spell); + CheckNumHitsRemaining(NUMHIT_MatchingSpells,0, focus_spell); } } } @@ -3408,7 +3408,7 @@ int32 Mob::GetVulnerability(Mob* caster, uint32 spell_id, uint32 ticsremaining) value += tmp_focus; if (tmp_buffslot >= 0) - CheckNumHitsRemaining(7, tmp_buffslot); + CheckNumHitsRemaining(NUMHIT_MatchingSpells, tmp_buffslot); } return value; } @@ -3509,7 +3509,7 @@ void Mob::TrySympatheticProc(Mob *target, uint32 spell_id) SpellFinished(focus_trigger, target, 10, 0, -1, spells[focus_trigger].ResistDiff); } - CheckNumHitsRemaining(7, 0, focus_spell); + CheckNumHitsRemaining(NUMHIT_MatchingSpells, 0, focus_spell); } } diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index 4bbd808cc..f9f324b6d 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -156,7 +156,7 @@ void Mob::DoSpecialAttackDamage(Mob *who, SkillUseTypes skill, int32 max_damage, if (HasDied()) return; if (max_damage > 0) - CheckNumHitsRemaining(5); + CheckNumHitsRemaining(NUMHIT_OutgoingHitSuccess); //[AA Dragon Punch] value[0] = 100 for 25%, chance value[1] = skill if(aabonuses.SpecialAttackKBProc[0] && aabonuses.SpecialAttackKBProc[1] == skill){ @@ -951,7 +951,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Item TryCriticalHit(other, SkillArchery, TotalDmg); other->AddToHateList(this, hate, 0, false); - CheckNumHitsRemaining(5); + CheckNumHitsRemaining(NUMHIT_OutgoingHitSuccess); } } else @@ -1056,7 +1056,7 @@ void NPC::RangedAttack(Mob* other) TryCriticalHit(GetTarget(), SkillArchery, TotalDmg); GetTarget()->AddToHateList(this, hate, 0, false); GetTarget()->Damage(this, TotalDmg, SPELL_UNKNOWN, SkillArchery); - CheckNumHitsRemaining(5); + CheckNumHitsRemaining(NUMHIT_OutgoingHitSuccess); } else { @@ -1281,7 +1281,7 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite TryCriticalHit(other, SkillThrowing, TotalDmg); int32 hate = (2*WDmg); other->AddToHateList(this, hate, 0, false); - CheckNumHitsRemaining(5); + CheckNumHitsRemaining(NUMHIT_OutgoingHitSuccess); } } @@ -2196,7 +2196,7 @@ void Mob::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, SkillUseTypes if (HasDied()) return; - CheckNumHitsRemaining(5); + CheckNumHitsRemaining(NUMHIT_OutgoingHitSuccess); if(aabonuses.SpecialAttackKBProc[0] && aabonuses.SpecialAttackKBProc[1] == skillinuse){ int kb_chance = 25; diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index b846e0058..6f71a56eb 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -5275,7 +5275,7 @@ void Mob::CheckNumHitsRemaining(uint8 type, uint32 buff_slot, uint16 spell_id) 1: [Incoming Hit Attempts] (323=SE_DefensiveProc, 172=SE_AvoidMeleeChance, 1=SE_ArmorClass, 40=SE_DivineAura) 2: [Outgoing Hit Attempts] (185=SE_DamageModifer, 184=SE_HitChance) 3: [Incoming Spells] (180=SE_ResistSpellChance, 296=SE_FcSpellVulnerability) //Note: Determinetal spells only unless proven otherwise - 4: NONE + 4: [Outgoing Spells] 5: [Outgoing Hit Successes] (220=SE_SkillDamageAmount, 178=SE_MeleeLifetap, 121=SE_ReverseDS, ?373=SE_CastOnWearoff) 6: [Incoming Hit Successes] (59=SE_DamageShield, 197=SE_SkillDamageTaken, 162=define SE_MitigateMeleeDamage) 7: [Matching Spells] *When focus is triggered (focus effects) @@ -5591,7 +5591,7 @@ int32 Mob::GetFcDamageAmtIncoming(Mob *caster, uint32 spell_id, bool use_skill, } if ((!limit_exists) || (limit_exists && skill_found)){ dmg += temp_dmg; - CheckNumHitsRemaining(7,i); + CheckNumHitsRemaining(NUMHIT_MatchingSpells,i); } } @@ -5599,7 +5599,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(7,i); + CheckNumHitsRemaining(NUMHIT_MatchingSpells,i); } } } @@ -5653,7 +5653,7 @@ int32 Mob::GetFocusIncoming(focusType type, int effect, Mob *caster, uint32 spel value = tmp_focus; if (tmp_buffslot >= 0) - CheckNumHitsRemaining(7, tmp_buffslot); + CheckNumHitsRemaining(NUMHIT_MatchingSpells, tmp_buffslot); } } diff --git a/zone/spells.cpp b/zone/spells.cpp index 21a2fe749..32140849b 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -1250,7 +1250,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, } if(IsClient()) { - CheckNumHitsRemaining(7); + CheckNumHitsRemaining(NUMHIT_MatchingSpells); TrySympatheticProc(target, spell_id); } @@ -3401,7 +3401,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(7,b); + CheckNumHitsRemaining(NUMHIT_MatchingSpells,b); Message_StringID(MT_SpellFailure, SPELL_WOULDNT_HOLD); safe_delete(action_packet); return false; @@ -3450,7 +3450,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(9); + CheckNumHitsRemaining(NUMHIT_ReflectSpell); SpellOnTarget(spell_id, this, true, use_resist_adjust, resist_adjust); safe_delete(action_packet); return false; @@ -3501,7 +3501,8 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r } } - spelltar->CheckNumHitsRemaining(3); + spelltar->CheckNumHitsRemaining(NUMHIT_IncomingSpells); + CheckNumHitsRemaining(NUMHIT_OutgoingSpells); safe_delete(action_packet); return false; @@ -3654,8 +3655,13 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r } - if (spelltar && IsDetrimentalSpell(spell_id)) - spelltar->CheckNumHitsRemaining(3); //Incoming spells + if (IsDetrimentalSpell(spell_id)) { + + CheckNumHitsRemaining(NUMHIT_OutgoingSpells); + + if (spelltar) + spelltar->CheckNumHitsRemaining(NUMHIT_IncomingSpells); + } // send the action packet again now that the spell is successful // NOTE: this is what causes the buff icon to appear on the client, if