aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorEugene Sandulenko2016-01-27 20:49:25 +0100
committerEugene Sandulenko2016-02-14 17:12:54 +0100
commitda0611ec30ad9a28b368ea062903a53bd3aa8d86 (patch)
tree4863fd0dc6920f64e93e4e5843044ca99d8cdfdf /engines
parente22626529489301ecb0298c7dcf06a40c8b36d99 (diff)
downloadscummvm-rg350-da0611ec30ad9a28b368ea062903a53bd3aa8d86.tar.gz
scummvm-rg350-da0611ec30ad9a28b368ea062903a53bd3aa8d86.tar.bz2
scummvm-rg350-da0611ec30ad9a28b368ea062903a53bd3aa8d86.zip
WAGE: Implement handleAttack()
Diffstat (limited to 'engines')
-rw-r--r--engines/wage/combat.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/engines/wage/combat.cpp b/engines/wage/combat.cpp
index 6864805273..50b6e1ddd7 100644
--- a/engines/wage/combat.cpp
+++ b/engines/wage/combat.cpp
@@ -863,7 +863,24 @@ bool WageEngine::tryAttack(Obj *weapon, Common::String &input) {
}
bool WageEngine::handleAttack(Obj *weapon) {
- warning("STUB: handleAttack");
+ Chr *player = _world->_player;
+ Chr *enemy = getMonster();
+
+ if (weapon->_type == Obj::MAGICAL_OBJECT) {
+ switch (weapon->_attackType) {
+ case Obj::HEALS_PHYSICAL_AND_SPIRITUAL_DAMAGE:
+ case Obj::HEALS_PHYSICAL_DAMAGE:
+ case Obj::HEALS_SPIRITUAL_DAMAGE:
+ performMagic(player, enemy, weapon);
+ return true;
+ }
+ }
+ if (enemy != NULL)
+ performAttack(player, enemy, weapon);
+ else if (weapon->_type == Obj::MAGICAL_OBJECT)
+ appendText("There is nobody to cast a spell at.");
+ else
+ appendText("There is no one to fight.");
return true;
}