Prev: C069 Up: Map Next: C0D1
C083: The update routine for a monster of graphics 112-127
It walks at its speed the way it faces, warbling if it walks into a wall while on the screen (BUMP_SOUND), turning when it is stopped and every so often -- a monster with bit 5 of its flags set turns towards the knight (STEER) -- and takes its frame from its facing (FACING_PICTURE). Three cells or more from the knight it is forgotten: its record is emptied. Touching him it scores 2500 and takes one of his hits, bursting (WANDERING_MONSTER).
Struck by an antibody (ANTIBODY_STRIKE), its fate depends on the two kinds together: a monster's kind is bits 2-3 of its graphic (112, 116, 120 or 124 on), an antibody's the same bits of its (80, 84, 88 or 92 on), and their sum, four apart, picks a routine from MONSTER_HIT_TABLE: destroyed, changed into the next kind, split in two, or turned into a monster of 64-79. A monster's kind is that of the villain nearest where it appeared (APPEARING_UPDATE), so each villain's monsters are destroyed by one kind of antibody.
Input
IX the monster's record
MONSTER112_UPDATE C083 LD A,(IX+$05) its steps, from its speed and facing; is the way clear?
C086 CALL SET_STEP
C089 CALL MOVE_CLIPPED
C08C BIT 0,(IX+$07) a wall: the warble, if it is on the screen
C090 CALL NZ,BUMP_SOUND
C093 RES 1,(IX+$07) not yet drawn this turn
C097 CALL APPLY_STEP move; perhaps turn; its frame
C09A CALL STEER
C09D CALL FACING_PICTURE
C0A0 LD C,$03 three cells or more from the knight: forgotten
C0A2 CALL NEAR_KNIGHT
C0A5 JR NC,MONSTER_TOO_FAR
C0A7 CALL ANTIBODY_STRIKE struck by an antibody?
C0AA JR C,STRIKE_OUTCOME
C0AC CALL TOUCHING_KNIGHT touching the knight: 2500, it bursts, and he loses a hit
C0AF RET NC
C0B0 LD BC,$0025
C0B3 CALL ADD_SCORE
C0B6 JP MONSTER_HITS_KNIGHT
STRIKE_OUTCOME C0B9 LD A,(IX+$00) STRIKE_OUTCOME: the two kinds added, four apart, pick what happens
C0BC SRL A
C0BE SRL A
C0C0 LD C,A
C0C1 LD A,(IY+$00)
C0C4 SRL A
C0C6 SRL A
C0C8 ADD A,C
C0C9 AND $03
C0CB LD BC,MONSTER_HIT_TABLE
C0CE JP DISPATCH
Prev: C069 Up: Map Next: C0D1