Prev: DB7E Up: Map Next: DBD9
DBB4: Character Picker
Used by the routine at TargetMonster.
Input
A Number between 0-3
Output
A Monster state
B Monster number
DE Pointer to Monster X Position
The monster IDs are the following:
ID Monster
01 George
02 Lizzy
03 Ralph
CharacterPicker DBB4 INC A Make the number 1-4 instead of 0-3.
DBB5 CP $04 Jump to GetCharacter if A is not equal to 04.
DBB7 JR NZ,GetCharacter
There aren't four monsters so make 04 into 01. This means George has 50% chance of being chosen, Lizzy and Ralph are 25% each.
DBB9 LD A,$01 A=01.
This entry point is used by the routine at DBD9.
GetCharacter DBBB LD B,A B=A.
Test if it's George.
CharacterPicker_George DBBC CP $01 Jump to CharacterPicker_Lizzy if A is not equal to 01.
DBBE JR NZ,CharacterPicker_Lizzy
DBC0 LD A,($CFD2) A=*George_State.
DBC3 LD DE,$CFDB DE=George_X_Position.
DBC6 RET Return.
Test if it's Lizzy.
CharacterPicker_Lizzy DBC7 CP $02 Jump to CharacterPicker_Ralph if A is not equal to 02.
DBC9 JR NZ,CharacterPicker_Ralph
DBCB LD A,($D001) A=*Lizzy_State.
DBCE LD DE,$D00A DE=Lizzy_X_Position.
DBD1 RET Return.
If it's neither of the above then it can only be Ralph.
CharacterPicker_Ralph DBD2 LD A,($D030) A=*Ralph_State.
DBD5 LD DE,$D039 DE=Ralph_X_Position.
DBD8 RET Return.
Prev: DB7E Up: Map Next: DBD9