| The Hobbit (v1.0) | Routines |
| Prev: 90A2 | Up: Map | Next: 90DB |
|
Characters on the same side do not fight each other. The target's side bits (4-6 of byte 4 of its record) are compared with the attacker's; if they have any in common, the attack is quietly ruled out: the 'would work' flag is cleared and the attack routine's caller is abandoned.
But the player is allowed to attack a friend. When Bilbo is the attacker and the target is on his side (bit 4), that bit is cleared in the target's record first - permanently. So hitting Thorin or Gandalf takes them off Bilbo's side for the rest of the game, which is what lets them fight back (and, since no one is on the same side any more, lets other characters attack them too).
|
||||
| 90B4 | LD IX,($B5F8) | IX = the target's record | ||
| 90B8 | LD A,($B5DB) | Is the attacker Bilbo? | ||
| 90BB | AND A | |||
| 90BC | JR NZ,$90C8 | No: just compare sides | ||
| 90BE | BIT 4,(IX+$04) | Is the target on Bilbo's side (bit 4)? | ||
| 90C2 | JR Z,$90C8 | No | ||
| 90C4 | RES 4,(IX+$04) | Yes: it is not any more - for good | ||
| 90C8 | LD A,(IX+$04) | A = the target's side bits... | ||
| 90CB | AND $70 | |||
| 90CD | LD IX,($B5FC) | IX = the attacker's record | ||
| 90D1 | AND (IX+$04) | ...in common with the attacker's? | ||
| 90D4 | RET Z | None: the attack may go ahead | ||
| 90D5 | POP HL | Same side: drop the caller's return address... | ||
| 90D6 | XOR A | ...and record that the attack would not work | ||
| 90D7 | LD ($B5EC),A | |||
| 90DA | RET | |||
| Prev: 90A2 | Up: Map | Next: 90DB |