Prev: 54996 Up: Map Next: 55218
55077: Update all characters' stats (deteriorate or regenerate) and wake up / send to sleep if required
Used by the routine at 54996.
55077 LD DE,8 Load DE with 8 (as data is 8 bytes long)
55080 LD HL,55490 Point HL at Gimbal's stat regeneration data
55083 LD IX,25323 Point IX to Gimbal's current stats
55087 LD B,7 Load B with 7 (as there are 7 characters to which this routine applies - Banshee is excluded)
55089 LD A,(23468) If Gimbal-is-free flag is set...
55092 AND 1 ...
55094 JR NZ,55104 ...then jump ahead to 55104
55096 LD HL,55498 Else point HL at Thor's stat regeneration data
55099 LD IX,25331 Point IX to Thor's current stats
55103 DEC B Decrease B to 6 as, since Gimbal is not free, he is not included in this routine's function
55104 BIT 7,(IX+6) If current character is awake...
55108 JR Z,55114 ...then skip ahead to 55114
55110 INC HL Advance HL by four bytes to stat deterioration data...
55111 INC HL ...
55112 INC HL ...
55113 INC HL ...
55114 LD C,(HL) Load stat change value into C
55115 LD A,(IX+0) Load current character's strength into A
55118 CALL 55219 Update character's strength as they tire (awake) or regenerate (asleep)...
55121 LD (IX+0),A ...
55124 INC HL Advance HL to next (happiness) data
55125 LD C,(HL) Load stat change value into C
55126 LD A,(IX+1) Load current character's happiness into A
55129 CALL 55219 Update character's happiness as they tire (awake) or regenerate (asleep)...
55132 LD (IX+1),A ...
55135 INC HL Advance HL to next (stamina) data
55136 LD C,(HL) Load stat change value into C
55137 LD A,(IX+2) Load current character's stamina into A
55140 CALL 55219 Update character's stamina as they tire (awake) or regenerate (asleep)...
55143 LD (IX+2),A ...
55146 INC HL Advance HL to next (spell power) data
55147 LD C,(HL) Load stat change value into C
55148 LD A,(IX+3) Load current character's spell power into A
55151 CALL 55219 Update character's spell power as they tire (awake) or regenerate (asleep)...
55154 LD (IX+3),A ...
55157 INC HL Advance HL to next block of data
55158 BIT 7,(IX+6) If current character is asleep...
55162 JR NZ,55168 ...then we have already moved into data for next character, so skip ahead to 55168
55164 INC HL Else, we are now in same character's "asleep" data, so need to advance HL by four bytes to get to next character's data...
55165 INC HL ...
55166 INC HL ...
55167 INC HL ...
55168 ADD IX,DE Advance IX by eight bytes to next character's stats
55170 DJNZ 55104 Loop back to 55104
55172 LD DE,8 Load DE with 8
55175 LD IX,25323 Point IX to Gimbal's current stats
55179 LD B,7 Load B with 7 (as there are 7 characters to which this routine applies - Banshee is excluded)
55181 LD C,0 Load C with zero (to denote first character, Gimbal)
55183 LD A,(IX+2) Load current character's stamina into A
55186 OR A If stamina is not zero...
55187 JP NZ,55196 ...then skip ahead to 55196
55190 SET 7,(IX+6) Else send character to sleep
55194 JR 55205 Skip ahead to 55205
55196 CP 100 If stamina is not 100...
55198 JP NZ,55205 ...then skip ahead to 55205
55201 RES 7,(IX+6) Else wake character up
55205 LD A,(IX+0) Load character's strength into A
55208 OR A If strength is zero...
55209 JP Z,55461 ...then the character has starved to death, so jump to 55461
55212 ADD IX,DE Advance IX to next character's stats
55214 INC C Increase C for next character
55215 DJNZ 55183 Loop back to 55183 for next character
55217 RET Return
Prev: 54996 Up: Map Next: 55218