Prev: 56658 Up: Map Next: 56713
56684: Handler: Decrease Energy
Input
IY Monster Pointer
A Damage value
Handler_DecreaseEnergy 56684 EX AF,AF' Exchange the AF register with the shadow AF register.
56685 LD A,(IY+0) Return if the monster state (*IY+0) is higher than 33 (includes the "explosion" and "human" states). If this is the case then the monster is already "game over".
56688 CP 33
56690 RET NC
56691 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 56692 DEC (IY+12) Decrease monster energy (*IY+12) by one.
56695 DEC A Decrease A by one.
56696 JR NZ,Handler_DecreaseEnergy_Loop Jump to Handler_DecreaseEnergy_Loop until A is zero.
Is the monster still in-play?
56698 LD A,(IY+12) Return if *IY+12 is lower than 200.
56701 CP 200
56703 RET C
If the monsters energy falls to less than 0 - their turn is over.
56704 LD (IY+12),0 Reset monsters energy to 0 (in *IY+12).
56708 LD (IY+0),33 Write 33 (explosion state) to the current monster state (*IY+0).
56712 RET Return.
Prev: 56658 Up: Map Next: 56713