From 7bf6ab420b27165e8c892f4ecf8eff7e3d990a3e Mon Sep 17 00:00:00 2001 From: realtradam Date: Sun, 22 Nov 2020 06:35:05 -0500 Subject: added 'derived statistics' in stats menu --- run.rb | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/run.rb b/run.rb index 01e2e7b..4b5845c 100644 --- a/run.rb +++ b/run.rb @@ -105,6 +105,18 @@ class Character } sum end + def hitPoints + 10 + (5 * ((@@stats[8][1] + @@stats[5][1])/2.0).ceil) + end + def SWWThreshold + (self.hitPoints.to_f / 2.0).ceil + end + def deathSave + @@stats[8][1] + end + def humanity + @@stats[9][1] * 10 + end def totalSkills sum = 0 @@skills.each do |group| @@ -159,7 +171,7 @@ class Interface Curses.addstr("Points Spent: " + yourStats.totalStats.to_s+ "/62") } end - + #Displaying all stats + the "selector" yourStats.statsVar.each_with_index { |pair,index| Curses.setpos(index + 5, 3) @@ -212,7 +224,29 @@ class Interface } end } + + spacing = 25 + numberSpacing = spacing - 1 + + Curses.setpos(5, spacing) + Curses.addstr(":Hit Points") + Curses.setpos(5, numberSpacing - yourStats.hitPoints.to_s.length) + Curses.addstr(yourStats.hitPoints.to_s) + + Curses.setpos(7, spacing) + Curses.addstr(":Seriously Wounded Wound Threshold") + Curses.setpos(7, numberSpacing - yourStats.SWWThreshold.to_s.length) + Curses.addstr(yourStats.SWWThreshold.to_s) + + Curses.setpos(9, spacing) + Curses.addstr(":Death Save") + Curses.setpos(9, numberSpacing - yourStats.deathSave.to_s.length) + Curses.addstr(yourStats.deathSave.to_s) + Curses.setpos(11, spacing) + Curses.addstr(":Humanity") + Curses.setpos(11, numberSpacing - yourStats.humanity.to_s.length) + Curses.addstr(yourStats.humanity.to_s) Curses.refresh key = Curses.getch #User input -- cgit v1.2.3