From 37d66c60cc7eb1544f1f3200f3c2941d6fa1d1eb Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Fri, 23 May 2025 09:45:10 +0200 Subject: [PATCH] ru:: changes to toughness now affect current HP --- rogueviz/ru/geometry.cpp | 4 ++++ rogueviz/ru/man.cpp | 3 +++ 2 files changed, 7 insertions(+) diff --git a/rogueviz/ru/geometry.cpp b/rogueviz/ru/geometry.cpp index 3d9855ab..47d73d1b 100644 --- a/rogueviz/ru/geometry.cpp +++ b/rogueviz/ru/geometry.cpp @@ -1,5 +1,9 @@ namespace rogue_unlike { +int randround(ld x) { + return x + randd(); + } + hyperpoint to_hyper(ld x, ld y) { if(non_hyperbolic) return hyperpoint(x, y, 1, 1); y -= t_margin_at; diff --git a/rogueviz/ru/man.cpp b/rogueviz/ru/man.cpp index 652b3f67..d149fe97 100644 --- a/rogueviz/ru/man.cpp +++ b/rogueviz/ru/man.cpp @@ -52,8 +52,11 @@ void man::act() { stable_where = where; } + auto h = max_hp(); current = next; next.reset(); + if(h != max_hp()) + hp = randround(1. * hp * max_hp() / h); auto dat = get_dat(); if(on_floor) on_floor_when = gframeid;