Prev: 52913 Up: Map Next: 53003
52948: Decide whether a warlock will fire a missile/bolt at Maroc
Used by the routine at 52849.
If Maroc tries to trade an item of insufficient value with a warlock (determined at 52913), 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 27772 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.
warlock firing bolts at Maroc
52948 LD A,(60238) Item (warlock) properties byte
52951 AND 1 Check bit 0 (set if the warlock is visible on-screen)
52953 JR NZ,52980
Warlock has gone off-screen
52955 LD A,0
52957 LD (60227),A Set type of graphic to draw to 0 (nothing to draw)
52960 LD A,144
52962 LD (60340),A Timer indicating how long before a warlock is likely to materialize in the current room - set this to 144
52965 LD (60341),A Timer indicating how long before a creature is likely to wander in from an adjacent room - also set this for 144
52968 JP 53202 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 53054, where Maroc wielding powerful magic has an effect on creature movement/actions. But these instructions are never run.
52971 LD A,(60140) -
52974 CP 4 -
52976 JR NC,53080 -
52978 JR 53000 -
Warlock is visible on screen. Every 32 frames, a decision whether the warlock is going to fire a missile/bolt at Maroc is made.
52980 LD A,(60074) Game cycle counter
52983 AND 31 Check bits 0-4 (1-31)
52985 JR NZ,53000 If any are set, skip over this routine
Generate a random number and compare it with this warlock's 'aggression' stat...
52987 CALL 56070 Generate random number (returned in A register)
52990 LD C,A Store in C register
52991 LD A,(60333) Byte 6 from warlock's data set at 27772 determines the likelihood of them firing a missile
52994 RLA Double the value of this byte
52995 CP C Compare with the (pseudo) random number generated
52996 JR C,53000 If it's < the random number, don't fire a missile
52998 JR 53080 If it's >= random number, set up a missile to fire (53080)
53000 JP 53323 Jump to creature collision detection routine
Prev: 52913 Up: Map Next: 53003