aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/wage/entities.cpp4
-rw-r--r--engines/wage/entities.h1
-rw-r--r--engines/wage/script.cpp33
-rw-r--r--engines/wage/script.h3
4 files changed, 35 insertions, 6 deletions
diff --git a/engines/wage/entities.cpp b/engines/wage/entities.cpp
index e229daf2fb..7f40353ba8 100644
--- a/engines/wage/entities.cpp
+++ b/engines/wage/entities.cpp
@@ -439,8 +439,4 @@ const char *Chr::getDefiniteArticle(bool capitalize) {
return "";
}
-void Chr::printPlayerCondition() {
- warning("STUB: printPlayerCondition()");
-}
-
} // End of namespace Wage
diff --git a/engines/wage/entities.h b/engines/wage/entities.h
index 0a3fa28e9f..6a97abf39e 100644
--- a/engines/wage/entities.h
+++ b/engines/wage/entities.h
@@ -222,7 +222,6 @@ public:
WeaponArray *getWeapons(bool includeMagic);
ObjArray *getMagicalObjects();
const char *getDefiniteArticle(bool capitalize);
- void printPlayerCondition();
public:
bool hasNativeWeapon1() {
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
diff --git a/engines/wage/script.h b/engines/wage/script.h
index 529efa8bf4..ed2772568f 100644
--- a/engines/wage/script.h
+++ b/engines/wage/script.h
@@ -191,6 +191,9 @@ private:
Common::Array<ScriptText *> _scriptText;
void convertToText();
+
+ void printPlayerCondition(Chr *player);
+ const char *getPercentMessage(double percent);
};
} // End of namespace Wage