Author Topic: [FIXED] Armor reverts to Veteran difficulty value  (Read 3268 times)

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1512
    • View Profile
[FIXED] Armor reverts to Veteran difficulty value
« on: January 22, 2018, 08:35:37 am »
When I shoot a target in Genius or Superhuman difficulty, their armor value reverts to the Veteran-difficulty amount even if they didn't take any damage. My guess is they already have Veteran armor but are displaying the amount they should have until a hit triggers an update which reveals the true amount. If the difficulty gives them less armor, it seems to work correctly. They take the right amount of damage and their armor stays where it should.

This does not happen in OXC. I cannot test if it happens in unmodded OXCE+ because all difficulties other than Beginner have the same armor values for aliens.


To reproduce this bug, equip pistols or some other weak weapon to soldiers and have them shoot a sectopod. Use mind probe to check armor before and after shooting it. Make sure you have higher armor setting in difficulty.rul, example:
Code: [Select]
aimAndArmorMultipliers: [0.5, 0.8, 1.0, 1.2, 1.5]

P.S.: I'm also getting a small calculation error in armor value. On Genius difficulty, the Sectopod is showing its armor at 173/155/119 when it should be exactly 174/156/120 (20% increase over 145/130/115). My guess: some kind of floating point error rounding down instead of rounding to nearest.
« Last Edit: February 11, 2023, 04:42:16 pm by Meridian »

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9087
    • View Profile
Re: Armor reverts to Veteran difficulty value
« Reply #1 on: January 22, 2018, 09:35:33 am »
thanks for the report, I will investigate later today

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9087
    • View Profile
Re: Armor reverts to Veteran difficulty value
« Reply #2 on: January 22, 2018, 05:21:55 pm »
The issue is here: https://github.com/Yankes/OpenXcom/blob/OpenXcomExtended/src/Savegame/BattleUnit.cpp#L1241

I'll report to Yankes.

PS: I'm not getting any rounding errors (when debugging in visual studio), but maybe other compilers treat it differently. There's definitely a integer * float converted into integer... so if there would be any rounding, it would round down (cut off non-integer part). Here: https://github.com/Yankes/OpenXcom/blob/OpenXcomExtended/src/Savegame/BattleUnit.cpp#L3405

Maybe worth reporting to Warboy, if someone can reproduce.