Relationship between "skill-melee" in game files and "To-hit" on the character screen

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • smileyy90210
    Rookie
    • Dec 2024
    • 2

    Relationship between "skill-melee" in game files and "To-hit" on the character screen

    I'm trying to understand the 4.2.5 melee combat system. What I can't figure out is the relationship between "skill-melee" as defined in the game files (p_race.txt and class.txt). I see that a human warrior will start with skill-melee value of 70 and this is displayed in the character creation screen. However, when I look at the To-hit on the character screen of a newly created warrior the To-hit is 24(+4, I assume that's from STR and DEX). How does the 24 relate to the 70?

    Thank you!
  • backwardsEric
    Knight
    • Aug 2019
    • 531

    #2
    Internally, there is the player's state->skills[SKILL_TO_HIT_MELEE] which is the sum of the "skill-melee" values for the player's class and race from the configuration files. That value will also include an additional 75 if the super-heroism timed effect is active. There is also the player's state->to_h which includes to the to-hit adjustments due to dexterity and strength, to-hit bonuses from equipment that is not the melee-weapon or launcher, adjustments from a variety of timed effects (stunning, fear, hunger, blessing, heroism), and adjustments for blessed melee, too-heavy melee weapons, and too-heavy launchers. Those calculations are in player-calcs.c.

    state->skills[SKILL_TO_HIT_MELEE] and state->to_h are combined with the melee weapon's to-hit bonus to get the base chance to hit. That calculation is in player-attack.c's chance_of_melee_hit_base(): the result is state->skills[SKILL_TO_HIT_MELEE] + 3 * (melee weapon's to-hit bonus + state->to_h). What is displayed on the character sheet is x+y where x is ((10 * state->skills[SKILL_TO_HIT_MELEE]) / 3) / 10 (note that each those divisions will discard the remainder so the result will not always be the same as state->skills[SKILL_TO_HIT_MELEE] / 3) and y is the known component of state->to_h plus the melee weapon's to-hit bonus. The calculation for the character sheet happens in ui-player.c's get_panel_combat().

    Comment

    • smileyy90210
      Rookie
      • Dec 2024
      • 2

      #3
      I'll probably have to read that a few times to get it, but that looks really helpful...thank you.

      Comment

      Working...
      😀
      😂
      🥰
      😘
      🤢
      😎
      😞
      😡
      👍
      👎