Planar Protector
Join Date: Oct 2019
Posts: 4,144
|
|
Quote:
Originally Posted by DeathsSilkyMist
[You must be logged in to view images. Log in or Register.]
If your friend hasn't played Everquest before, it may be a bit difficult for him to navigate the EQEMU code, as it has code for features that go past Velious. He will need to know that he must disregard code for AA's, Bane Damage, etc. The links I will post below go to the EQEMU github repo. Your friend should be familiar with how to use github.
From my understanding of hate generation, the weapon damage is acquired here:
https://github.com/EQEmu/Server/blob...tack.cpp#L1648
And the damage bonus for your main hand (if applicable) is acquired here:
https://github.com/EQEmu/Server/blob...tack.cpp#L1689
Both are basically just added together and applied to the hate value, which gets added to the hate list here:
https://github.com/EQEmu/Server/blob...tack.cpp#L1736
The formulas are built into the functions, and again they often have code that isn't used in P99. You can link your friend to my damage calculator as well, which condenses a lot of the EQEMU code into simpler formulas specific to P99, but I haven't added hate generation or bow formulas yet. Your friend would need to look through the EQEMU code to find the bow stuff.
https://drive.google.com/file/d/114b...ew?usp=sharing
|
I pasted these (10s of thousands lines of code, wow!!) into Chatgpt and asked it what the code does.
Amazing on all accounts.
FWIW i left out the //comments.. so that it could only look at the code and try to parse it, not what you said it is! Wild.
Quote:
Short version: this is the melee-combat core for EQEmu. It decides what swing animation to play, which skill is used, whether the swing connects, how much damage it does after armor and bonuses, how much hate it generates, and what happens on death. It also houses all the class/level softcaps and heroic-stat hooks that shape avoidance, mitigation, and damage bonuses.
A typical swing goes like this. Mob::Attack picks the weapon and the correct animation (AttackAnimation) and figures out the base weapon damage against the target (GetWeaponDamage), including checks for magical/bane requirements, elemental add-damage, recommended level scaling, and hand-to-hand fallbacks. It adds damage bonus when appropriate (main-hand, 2H logic, off-hand with Sinister Strikes) and builds a DamageHitInfo with the used skill, offense value (offense()), and a to-hit value from GetTotalToHit, which layers in raw accuracy from skills, item/AA/spell accuracy mods, archery special handling, and auto-hit overrides.
DoAttack then runs the avoidance gauntlet via AvoidDamage in live order: riposte → block (including from behind if granted) → parry → dodge → shield block/two-hand-blunt block, with heroic strikethrough reducing those chances, AA/spell/item “10000” autoprocs forcing success, and positional checks (must be in front for parry, etc.). If the swing isn’t avoided—or is forced through by Strike Through—it rolls the actual hit chance with CheckHitChance: attacker accuracy vs defender avoidance (both turned into opposed random rolls), with ties coin-flipped.
If it’s a hit, damage is mitigated in MeleeMitigation. That uses the defender’s mitigation AC (GetMitigationAC feeding from ACSum) and the attacker’s offense in a D20-style roll (RollD20) that maps to a 0.1–2.0 multiplier on base damage, with optional armor-penetration and level-difference bonuses. The result is clamped and logged, then applied to the defender. Damage shields and reverse damage shields are applied in DamageShield. Hate is added every swing (AddToHateList) using subtlety/hatemod reductions, pet/owner mirroring, tunnel vision, and initial aggro bonuses, plus guard-assist behavior in PvP.
The big stat math is split out. compute_tohit and GetTotalToHit build attacker accuracy from offense/skill, intoxication/berserk tweaks, item/AA/spell accuracy and hit-chance effects, and archery penalties. compute_defense and GetTotalDefense build defender avoidance from defense skill, AGI (or heroic AGI), item mod2s, AA/spell avoidance, and intoxication. AC is aggregated in ACSum with item AC, shield AC, class/race bonuses (monk weight rules, rogue/beastlord AGI bumps, iksar racial), defense-skill contributions, spell/AA AC, softcap per class/level (GetACSoftcap) and softcap returns (GetSoftcapReturns) so anything over cap has diminished effect. Hand-to-hand damage and delay have both “revamp” and legacy tables. Weapon damage bonus (GetWeaponDamageBonus) follows live-like 1H/2H and delay-based formulas, with an alternate off-hand formula option.
There’s a lot of special-case game feel in here: dual-wield animation chance when delays match, stun chance when an NPC smacks a moving client from behind, PvP damage reductions (archery/throwing vs melee), low-level damage caps by class (DoDamageCaps), and a long list of immunities (melee immunity, magic-only, bane-only). On death (Client:[You must be logged in to view images. Log in or Register.]eath / NPC:[You must be logged in to view images. Log in or Register.]eath) it sends the packets, does exp loss and corpse creation, splits exp to group/raid, fires quest hooks, logs player events, and handles loot/rename logic and adventure counters.
If you want, I can trace a single swing end-to-end with your class, level, stats, weapon, and target to show exactly which numbers and rules fire.
|
__________________
I am a highly open and reflective and conscientious individual with moderate to low agreeableness and a moderate level of emotional reactivity/sensitivity.
|