aboutsummaryrefslogtreecommitdiff
path: root/engines/wage/script.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2016-01-16 13:42:32 +0100
committerEugene Sandulenko2016-02-14 17:12:46 +0100
commit87698593db098cd906a5b8f7f19eb7f6db5a6e7a (patch)
treedf9983aeecc30aa36908cf084585a6f140608e9c /engines/wage/script.cpp
parent43df45d610aa2014f07d1f0307365627fc61ef8e (diff)
downloadscummvm-rg350-87698593db098cd906a5b8f7f19eb7f6db5a6e7a.tar.gz
scummvm-rg350-87698593db098cd906a5b8f7f19eb7f6db5a6e7a.tar.bz2
scummvm-rg350-87698593db098cd906a5b8f7f19eb7f6db5a6e7a.zip
WAGE: Implement printPlayerCondition()
Diffstat (limited to 'engines/wage/script.cpp')
-rw-r--r--engines/wage/script.cpp33
1 files changed, 32 insertions, 1 deletions
diff --git a/engines/wage/script.cpp b/engines/wage/script.cpp
index 0b38f37579..c4567a55df 100644
--- a/engines/wage/script.cpp
+++ b/engines/wage/script.cpp
@@ -1039,7 +1039,7 @@ void Script::handleRestCommand() {
_callbacks->_commandWasQuick = true;
} else {
_callbacks->regen();
- _world->_player->printPlayerCondition();
+ printPlayerCondition(_world->_player);
}
}
@@ -1282,4 +1282,35 @@ void Script::convertToText() {
delete scr;
}
+const char *Script::getPercentMessage(double percent) {
+ if (percent < 0.40) {
+ return "very bad";
+ } else if (percent < 0.55) {
+ return "bad";
+ } else if (percent < 0.70) {
+ return "average";
+ } else if (percent < 0.85) {
+ return "good";
+ } else if (percent <= 1.00) {
+ return "very good";
+ } else {
+ return "enhanced";
+ }
+}
+
+void Script::printPlayerCondition(Chr *player) {
+ double physicalPercent = (double)player->_context._statVariables[PHYS_HIT_CUR] / player->_context._statVariables[PHYS_HIT_BAS];
+ double spiritualPercent = (double)player->_context._statVariables[SPIR_HIT_CUR] / player->_context._statVariables[SPIR_HIT_BAS];
+
+ Common::String msg = "Your physical condition is ";
+ msg += getPercentMessage(physicalPercent);
+ msg += ".";
+ appendText(msg);
+
+ msg = "Your spiritual condition is ";
+ msg += getPercentMessage(spiritualPercent);
+ msg += ".";
+ appendText(msg);
+}
+
} // End of namespace Wage