From 63c26538718482ad1e5d917586bdb99ac76dfc04 Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Wed, 25 Apr 2018 12:14:08 -0400 Subject: [PATCH] Adding health/stamina percent functions to master --- vore.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vore.js b/vore.js index 8395598..ba17dd5 100644 --- a/vore.js +++ b/vore.js @@ -67,6 +67,14 @@ function Creature(name = "Creature", str = 10, dex = 10, con = 10) { this.healthRate = 1 / 86400 * 4; this.staminaRate = 1 / 86400 * 6; + this.healthPercentage = function() { + return this.health / this.maxHealth; + }; + + this.staminaPercentage = function() { + return this.stamina / this.maxStamina; + }; + this.restoreHealth = function(time) { this.health = Math.min(this.maxHealth, this.health + this.maxHealth * time * this.healthRate); };