Floating point error coming back from posessing

Where bugs go to lie down and rest

Moderator: Moderator

Post Reply
Message
Author
Dracos
Archmage
Posts: 405
Joined: Sun Jul 13, 2014 4:09 pm

Floating point error coming back from posessing

#1 Post by Dracos »

Got a bug on an addon, and while I am fixing, I think something is wrong upstream too.

From @notinferno

As Posessor, it's possible to get a bug where the game rests infinitely for mana while you have 0 regen.

Repro steps:
1. Start up a game as a posessor.
2. Acquire a mana-using talent from an escort or through the Lua Console with e.g.
Code:
game.player:learnTalent(game.player.T_PHASE_DOOR, true, 1)

3. At this point, no regen is displayed in the mana bar and resting still works normally even if you are missing mana.
4. Assume a form with some base mana regen (All your starting corpses have this, and maybe all monsters do? Not sure. )
5. Return to your normal form. Now, instead of not displaying regen, your mana bar shows your regen as "0.00".
---

After following these steps using the stone giant possessor form, mana regen is: 9.497e-17. I went ahead and put a guard for that in the add-on but it seemed likely that it was in core so I turned off my addon and repeated the steps and had the same result, instead of zero I end up with a regen of extremely tiny floating point value.
ToME Tips - auto-generated spoilers for ToME. - someone else made. I find super awesome, so spreading as well.

Post Reply