MM: MM1: Actually deduct SP when casting spells in enhanced mode

This commit is contained in:
Paul Gilbert 2024-09-02 20:10:16 -07:00
parent 45ea120eb7
commit 409b5809ba
4 changed files with 8 additions and 4 deletions

View File

@ -40,7 +40,7 @@ For a more comprehensive changelog of the latest experimental code, see:
MM:
- Added MT32/LAPC-1 support for Xeen engine.
- Fixed Xeen regression which caused some sound effects to stop abruptly.
- Fixed spell SP/gem requirements
- Fixed spell SP/gem requirements in MM1 enhanced mode, and actually remove spell points & gems when spells are cast.
SCI:
- Added support for Russian fan-translation of QFG3.

View File

@ -115,7 +115,7 @@ void SpellCasting::setSpell(const Character *chr, int lvl, int num) {
if (SPELLS_SP_GEMS[spellIndex] < 0 && chr->_sp._current < chr->_level._current)
_spellState = SS_NOT_ENOUGH_SP;
else if ((lvl - 1) > chr->_sp._current)
else if (requiredSp > chr->_sp._current)
_spellState = SS_NOT_ENOUGH_SP;
int requiredGems = ABS(SPELLS_SP_GEMS[spellIndex]);

View File

@ -206,8 +206,8 @@ void CastSpell::timeout() {
void CastSpell::performSpell(Character *chr) {
Character &c = *g_globals->_currCharacter;
c._sp._current = MAX(c._sp._current - _requiredSp, 0);
c._gems = MAX(c._gems - _requiredGems, 0);
c._sp._current = MAX((int)c._sp._current - _requiredSp, 0);
c._gems = MAX((int)c._gems - _requiredGems, 0);
if (!isMagicAllowed()) {
spellDone(STRING["spells.magic_doesnt_work"], 5);

View File

@ -172,6 +172,10 @@ void CastSpell::castSpell(Character *target) {
if (_spellIndex == -1)
return;
Character &c = *g_globals->_currCharacter;
c._sp._current = MAX((int)c._sp._current - _requiredSp, 0);
c._gems = MAX((int)c._gems - _requiredGems, 0);
if (!isMagicAllowed()) {
g_events->send(InfoMessage(STRING["spells.magic_doesnt_work"]));