Prev: C52F Up: Map Next: C54A
C538: Is the thing at IX struck by an antibody?
Used by the routines at CREATURE_UPDATE, MONSTER112_UPDATE and WANDERING_MONSTER.
Meant to try both antibody records against the thing at IX, returning with carry set and IY on the antibody that touches it. But the loop loads the size of a record into DE and never adds it to IY, so it tries the first record twice and never the second: an antibody thrown while another is still in flight goes through monsters and the creature without harming them. Used by the creature (CREATURE_UPDATE), the monsters of 112-127 (MONSTER112_UPDATE) and those of 64-79 (WANDERING_MONSTER).
Measured: with an antibody on a monster in the first record, carry; the same antibody in the second record, no carry, IY still on the first.
Input
IX the thing
Output
F carry if struck
IY the first antibody record
ANTIBODY_STRIKE C538 LD IY,ANTIBODIES IY = the first antibody record; two tries
C53C LD B,$02
ANTIBODY_STRIKE_0 C53E PUSH BC touching? carry
C53F CALL ANTIBODY_TOUCHING
C542 POP BC
C543 RET C
C544 LD DE,$0010 the step to the next record is loaded, but never added
C547 DJNZ ANTIBODY_STRIKE_0
C549 RET
Prev: C52F Up: Map Next: C54A