All types of THAC0 and AC modifiers are listed here along with the to-hit formula, the role of Luck, and all values that are included within the second variable of the combat log's attack report.
This talk page is a bit technical, better understood with some familiarity with Near Infinity and the IESDP.
Legend[]
- MIN(
a
,b
) equals the lowest value of the two - CAP(
x
) IN [-20
,20
] means thatx
cannot go below -20 or above 20 - FLOOR(
x
) equalsx
rounded down to the nearest integer. e.gFLOOR( -5.1 ) = -6
- In blue are status effects, with their eventual configuration mode in {braces}. The naming scheme is that of Near Infinity.
- In red are names used in EE's inventory screen. In formulae below, an element on the same line as a red name will get, in-game, its value listed under that name.
Effective AC[]
From the defender's perspective:
Effective_AC = CAP( MIN(AC_bonus{Base_AC}, 10) + AC_bonus{All_weapons} ) IN [-20, 20] + Dexterity_modifier // In [-6, 5] + Single_weapon_style_bonus // -1 or -2 + EE_Blindness_penalty // +4; EE-only // Actually attacker THAC0 modifiers all the way down // Everything below is included in the 2nd value of the combat log's attack report // The words penalty and bonus are still from the defender's perspective + CAP( AC_bonus{Damage_type} ) IN [-20, 20] + Sword_&_Shield_style_bonus // -2 or -4 vs Missile + Invisibility{Improved}_bonus // -4 if the attacker can't see the invisible + Opcode_219{Attacker_type}_bonus // -2; e.g. Protection From Evil, see IESDP + Unarmed_or_Ranged_penalty_vs_melee_attacker // +4
Effective THAC0[]
From the attacker's perspective:
Effective_THAC0 = // Overwritten by: CAP( Base_THAC0_bonus{Set} ) IN [0, 25] Base_THAC0 // Appears as Base THAC0 in the inventory screen + Base_THAC0_bonus{Increment} // Appears as To Hit + Blindness_penalty // EE: +4, Original BG2: +10, BG1: ?; appears as Blind + Bless_bonus // -1; appears as Bless + Aid_bonus // -1; appears as Aid // Everything below is included in the 2nd value of the combat log's attack report + THAC0_bonus // Appears as Ability Bonuses + THAC0_vs_type_bonus // Does not appear + Melee_THAC0_bonus // Appears as Weapon_name or Fist_name [1] + Missile_THAC0_bonus // Appears as Missile Adjustment + Off-hand_THAC0_bonus // Appears as Off Hand THAC0-Weapon_name + Fist_THAC0_bonus // Appears as Fist_name Ability Bonuses [1] + Weapon_natural_bonus // Appears as Weapon_name or Fist_name [1] + STR_modifier // In [-7, 5]; appears as Strength Modification [1] + DEX_modifier // In [-5, 6]; appears as Dexterity Modification + Proficiency_modifier // In [-3, 5]; appears as Proficiency [2] + Two-weapon_style_penalty // Main [0, 4], Off [2, 8]; appears as Two-Weapon Style + Elf_bonus // -1 with bows and swords; appears as Elf + Halfling_bonus // -1 with slings; appears as Halfling + Invisibility{Normal}_bonus // -4 if attacking with a melee weapon; does not appear + Berserk_bonus // -2; does not appear + Racial_enemy_bonus // -4 against "enemy race" defenders; does not appear + Ranged_attack_in_melee_range_penalty // +8; does not appear
// If the pure roll (1D20) isn't a critical hit or miss, its result is modified by Luck
// The modified roll won't become a critical miss or hit even if Luck makes it a 1 or 20
Attack_roll = CAP( 1D20 + Luck_modifier ) IN [1, 20]
// Pure_roll - Attack_roll is included in the 2nd value of the combat log's attack // report, even when Pure_roll (the 1st value) was an actual critical hit or miss. Luck_modifier = Luck + Luck_bonus + Chant_luck_bonus + Bad_chant_luck_penalty + CAP( 6 - Fatigue ) IN [-94, 0] // Fatigue luck penalty + CAP( // Intoxication luck penalty FLOOR((49 - Intoxication) / 10) * 2 ) IN [-12, 0]
// Successful hit if there was a critical hit or if:
Effective_THAC0 - Attack_roll ≤ Effective_AC
Combat log's attack report[]
This is no good as a to-hit formula; use it to check the pure roll and eventually the state of to-hit calculation instead: A large positive number next to Pure_roll
is advantageous to the attacker, whereas a large negative one is advantageous to the defender.
Attacker name:Pure_roll
-modifiers_listed_here
=intermediate_result
: Hit (or Miss)
Note: Modifiers computed here are bonuses and penalties as seen from the attacker's point of view (negative modifiers are THAC0 bonuses, positive are THAC0 penalties). Keep that in mind when bringing in the modifiers from the Effective AC section.
Notes[]
Critical hit bonus (301)
only increases accuracy when it's so bad that critical hits are the only rolls able to hit- A Monk using their main hand fist but wielding a non-fist weapon in their off-hand will have it benefit from
Fist THAC0 bonus (288)
- Several
THAC0 vs type bonus (178)
do not see their modifiers summed together: The first effect to be evaluated by the game applies. Their "vs" reach does pile up though. - Effects unused in the unmodded EE games:
Main hand THAC0 bonus (306)
Critical miss bonus (362)
- Effects
Aid (129)
andBless (130)
can apparently take a 1-byte value for the THAC0 modifier — 0-255 or -128-127, didn't check which one — but all sources of these effects in all EE games just use a value of 1, i.e. -1 bonus. - Bug: Though no more than one
Aid
and oneBless
can be active at any time, several can appear in the inventory screen
Tooltip notes[]
Remarks, discussions and corrections[]
"+ Invisibility{Normal}_bonus // -4 if defender can't see the invisible"
Small correction here: you still get the -4 bonus (or +4 if you're looking at the log) even when the enemies ignore invisibility. The same is true with hide-in-shadows/hide-in-plain-sight. You can abuse that with a Shadowdancer by spamming the hide button while hasted to get -4 on two attacks per round. Also, it should be mentioned that the bonus only applies to melee, not ranged.
Source: my own extensive testing.
As for the luck bonus, it's probably worth noting somewhere that it can't, say, turn a 19 roll into a critical hit 20, because new players are often confused by that.
- Fixed, thanks, though you can just go ahead and edit the text directly with the rationale in the changelog =) — Haximus Thunderburp (talk), 3 June 2021