1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-06-25 22:52:49 +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 {
statarray<int> stats;
statarray<ld> stats;
int jump_control, coyote_time, hallucinating;
void reset();
};

View File

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

View File

@ -22,8 +22,12 @@ void draw_stats() {
dialog::addSelItem("free experience", its(m.experience), 'x');
for(auto st: allstats) {
string s = its(m.base_stats[st]);
if(m.current.stats[st] != m.base_stats[st]) s += " (" + its(m.current.stats[st]) + ")";
auto bas = m.base_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::add_action_push([st] {
render_the_map();