aboutsummaryrefslogtreecommitdiff
path: root/engines/xeen/spells.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2015-02-17 21:47:01 -0500
committerPaul Gilbert2015-02-17 21:47:01 -0500
commit7b3c10b09c76c4a8cbd5dbfabb0ceeaeccbbce26 (patch)
treea2de490ac41dcea07ce7cb6c56f00cd2d8b46a30 /engines/xeen/spells.cpp
parentc045adae76e414a8e6b57e48a651ea6c29ed280a (diff)
downloadscummvm-rg350-7b3c10b09c76c4a8cbd5dbfabb0ceeaeccbbce26.tar.gz
scummvm-rg350-7b3c10b09c76c4a8cbd5dbfabb0ceeaeccbbce26.tar.bz2
scummvm-rg350-7b3c10b09c76c4a8cbd5dbfabb0ceeaeccbbce26.zip
XEEN: Implemented Cast Spell dialog
Diffstat (limited to 'engines/xeen/spells.cpp')
-rw-r--r--engines/xeen/spells.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/engines/xeen/spells.cpp b/engines/xeen/spells.cpp
index 4943d95d2a..20ba480a6b 100644
--- a/engines/xeen/spells.cpp
+++ b/engines/xeen/spells.cpp
@@ -104,6 +104,37 @@ void Spells::doSpell(int spellId) {
(this->*SPELL_LIST[spellId])();
}
+void Spells::castSpell(int spellId) {
+ // TODO
+ error("TODO: castSpell");
+}
+
+/**
+ * Subtract the requirements for a given spell if available, returning
+ * true if there was sufficient
+ */
+int Spells::subSpellCost(Character &c, int spellId) {
+ Party &party = *_vm->_party;
+ int gemCost = SPELL_GEM_COST[spellId];
+ int spCost = SPELL_COSTS[spellId];
+
+ // Negative SP costs indicate it's dependent on the character's level
+ if (spCost <= 0) {
+ spCost = c.getCurrentLevel() * (spCost * -1);
+ }
+
+ if (spCost > c._currentSp)
+ // Not enough SP
+ return 1;
+ if (gemCost > party._gems)
+ // Not enough gems
+ return 2;
+
+ c._currentSp -= spCost;
+ party._gems -= gemCost;
+ return 0;
+}
+
void Spells::light() { error("TODO: spell"); }
void Spells::awaken() { error("TODO: spell"); }
void Spells::magicArrow() { error("TODO: spell"); }