1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-06-26 15:12:48 +00:00

ru:: stats now can be fractional

This commit is contained in:
Zeno Rogue 2025-05-23 09:17:13 +02:00
parent b001514ccc
commit 9266d2dea2
3 changed files with 8 additions and 4 deletions

View File

@ -261,7 +261,7 @@ struct entity {
}; };
struct statdata { struct statdata {
statarray<int> stats; statarray<ld> stats;
int jump_control, coyote_time, hallucinating; int jump_control, coyote_time, hallucinating;
void reset(); void reset();
}; };

View File

@ -38,7 +38,7 @@ void check_fountains() {
} }
void statdata::reset() { void statdata::reset() {
stats = m.base_stats; for(auto i: allstats) stats[i] = m.base_stats[i];
coyote_time = 0; coyote_time = 0;
jump_control = 0; jump_control = 0;
} }

View File

@ -22,8 +22,12 @@ void draw_stats() {
dialog::addSelItem("free experience", its(m.experience), 'x'); dialog::addSelItem("free experience", its(m.experience), 'x');
for(auto st: allstats) { for(auto st: allstats) {
string s = its(m.base_stats[st]); auto bas = m.base_stats[st];
if(m.current.stats[st] != m.base_stats[st]) s += " (" + its(m.current.stats[st]) + ")"; auto cur = m.current.stats[st];
string s = its(bas);
int curi = cur + 0.01;
if(cur != bas && abs(cur-curi) < 1e-6) s += " (" + its(curi) + ")";
else if(cur != bas) s += " (" + format("%.2f", cur) + ")";
dialog::addSelItem(statdata[st].name, s, statdata[st].key); dialog::addSelItem(statdata[st].name, s, statdata[st].key);
dialog::add_action_push([st] { dialog::add_action_push([st] {
render_the_map(); render_the_map();