[Scummvm-tracker] [ScummVM :: Bugs] #17362: LOL: battleHitSkillTest() reads the target's monster slot when a monster attacks

ScummVM :: Bugs trac at scummvm.org
Tue Oct 13 15:13:12 UTC 2026


#17362: LOL: battleHitSkillTest() reads the target's monster slot when a monster
attacks
--------------------------+--------------------------
Reporter:  circular17     |      Owner:  (none)
    Type:  defect         |     Status:  new
Priority:  normal         |  Component:  Engine: Kyra
 Version:                 |   Keywords:
    Game:  Lands of Lore  |
--------------------------+--------------------------
 In engines/kyra/engine/lol.cpp, LoLEngine::battleHitSkillTest(), the
 branch for a monster attacker uses the target index instead of the
 attacker index:

 {{{
 if (attacker & 0x8000) {
         hitChanceModifier = _monsters[target &
 0x7FFF].properties->fightingStats[0];
         sk = 100 - _monsters[target & 0x7FFF].properties->skillLevel;
 }
 }}}

 When a monster attacks, the target is a party member (0-3), so this reads
 the stats of whatever monsters sit in slots 0-3 of the monster table,
 unrelated to the attacker. The hit chance and skill then depend on which
 monsters happen to be in those slots, not on the monster actually
 attacking.

 It should presumably be:

 {{{
 if (attacker & 0x8000) {
         hitChanceModifier = _monsters[attacker &
 0x7FFF].properties->fightingStats[0];
         sk = 100 - _monsters[attacker & 0x7FFF].properties->skillLevel;
 }
 }}}

 Found while studying the code (current master), not by observing a
 specific in-game symptom. I could not check whether the original
 executable has the same slip; if it does, this may be intended
 faithfulness to the original.
-- 
Ticket URL: <https://bugs.scummvm.org/ticket/17362>
ScummVM :: Bugs <https://bugs.scummvm.org>
ScummVM


More information about the Scummvm-tracker mailing list