diff options
author | Eugene Sandulenko | 2016-01-16 13:42:32 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2016-02-14 17:12:46 +0100 |
commit | 87698593db098cd906a5b8f7f19eb7f6db5a6e7a (patch) | |
tree | df9983aeecc30aa36908cf084585a6f140608e9c /engines/wage | |
parent | 43df45d610aa2014f07d1f0307365627fc61ef8e (diff) | |
download | scummvm-rg350-87698593db098cd906a5b8f7f19eb7f6db5a6e7a.tar.gz scummvm-rg350-87698593db098cd906a5b8f7f19eb7f6db5a6e7a.tar.bz2 scummvm-rg350-87698593db098cd906a5b8f7f19eb7f6db5a6e7a.zip |
WAGE: Implement printPlayerCondition()
Diffstat (limited to 'engines/wage')
-rw-r--r-- | engines/wage/entities.cpp | 4 | ||||
-rw-r--r-- | engines/wage/entities.h | 1 | ||||
-rw-r--r-- | engines/wage/script.cpp | 33 | ||||
-rw-r--r-- | engines/wage/script.h | 3 |
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 |