Routines |
Prev: CEB1 | Up: Map | Next: CF0B |
Used by the routine at CE71.
|
||||
If Maroc tries to trade an item of insufficient value with a warlock (determined at CEB1), the warlock will fire a missile/bolt at him.
Additionally, every 32 game cycles, there's a random chance a warlock will fire a missile/bolt
The 6th byte in the data sets at 6C7C is an 'aggression' stat for the warlock. It affects the likelihood of the warlock firing at Maroc. The higher the number, the higher the frequency of missiles/bolts.
The animated image below shows warlock #7, the warlock with the highest % chance of firing a bolt/missile, flinging frequent bolts at a stationary Maroc.
|
||||
CED4 | LD A,($EB4E) | Item (warlock) properties byte | ||
CED7 | AND $01 | Check bit 0 (set if the warlock is visible on-screen) | ||
CED9 | JR NZ,$CEF4 | |||
Warlock has gone off-screen
|
||||
CEDB | LD A,$00 | |||
CEDD | LD ($EB43),A | Set type of graphic to draw to 0 (nothing to draw) | ||
CEE0 | LD A,$90 | |||
CEE2 | LD ($EBB4),A | Timer indicating how long before a warlock is likely to materialize in the current room - set this to 144 | ||
CEE5 | LD ($EBB5),A | Timer indicating how long before a creature is likely to wander in from an adjacent room - also set this for 144 | ||
CEE8 | JP $CFD2 | Skip out of this routine to deal with changes to the warlock's data, as it's now off-screen | ||
NEXT 4 INSTRUCTIONS DON'T SEEM TO BE USED.
It looks like a similar check to the goblin warrior at CF3E, where Maroc wielding powerful magic has an effect on creature movement/actions. But these instructions are never run.
|
||||
CEEB | LD A,($EAEC) | - | ||
CEEE | CP $04 | - | ||
CEF0 | JR NC,$CF58 | - | ||
CEF2 | JR $CF08 | - | ||
Warlock is visible on screen. Every 32 frames, a decision whether the warlock is going to fire a missile/bolt at Maroc is made.
|
||||
CEF4 | LD A,($EAAA) | Game cycle counter | ||
CEF7 | AND $1F | Check bits 0-4 (1-31) | ||
CEF9 | JR NZ,$CF08 | If any are set, skip over this routine | ||
Generate a random number and compare it with this warlock's 'aggression' stat...
|
||||
CEFB | CALL $DB06 | Generate random number (returned in A register) | ||
CEFE | LD C,A | Store in C register | ||
CEFF | LD A,($EBAD) | Byte 6 from warlock's data set at 6C7C determines the likelihood of them firing a missile | ||
CF02 | RLA | Double the value of this byte | ||
CF03 | CP C | Compare with the (pseudo) random number generated | ||
CF04 | JR C,$CF08 | If it's < the random number, don't fire a missile | ||
CF06 | JR $CF58 | If it's >= random number, set up a missile to fire (CF58) | ||
CF08 | JP $D04B | Jump to creature collision detection routine |
Prev: CEB1 | Up: Map | Next: CF0B |