Prev: DD52 Up: Map Next: DD89
DD6C: Handler: Decrease Energy
Input
IY Monster Pointer
A Damage value
Handler_DecreaseEnergy DD6C EX AF,AF' Exchange the AF register with the shadow AF register.
DD6D LD A,(IY+$00) Return if the monster state (*IY+00) is higher than 21 (includes the "explosion" and "human" states). If this is the case then the monster is already "game over".
DD70 CP $21
DD72 RET NC
DD73 EX AF,AF' Exchange the shadow AF register back to the normal AF register.
Keep decreasing the monsters energy by the number held in A.
Handler_DecreaseEnergy_Loop DD74 DEC (IY+$0C) Decrease monster energy (*IY+0C) by one.
DD77 DEC A Decrease A by one.
DD78 JR NZ,Handler_DecreaseEnergy_Loop Jump to Handler_DecreaseEnergy_Loop until A is zero.
Is the monster still in-play?
DD7A LD A,(IY+$0C) Return if *IY+0C is lower than C8.
DD7D CP $C8
DD7F RET C
If the monsters energy falls to less than 00 - their turn is over.
DD80 LD (IY+$0C),$00 Reset monsters energy to 00 (in *IY+0C).
DD84 LD (IY+$00),$21 Write 21 (explosion state) to the current monster state (*IY+00).
DD88 RET Return.
Prev: DD52 Up: Map Next: DD89