92F9: Calculate the casting chance of the current spell.
CHAN_C |
92F9 |
LD A,(CURSP) |
|
92FC |
LD IX,spells_table |
|
9300 |
LD D,$00 |
|
9302 |
DEC A |
|
9303 |
LD E,A |
|
9304 |
LD B,$07 |
spell_add_loop |
9306 |
ADD IX,DE |
|
9308 |
DJNZ spell_add_loop |
|
930A |
LD (current_spell_pointer),IX |
|
930E |
LD A,(IX+$03) |
|
9311 |
LD (spell_chaos_law),A |
|
9314 |
LD A,(CH_LAW) |
|
9317 |
OR A |
|
9318 |
JR NZ,not_neutral |
not_aligned |
931A |
LD HL,(current_spell_pointer) |
|
931D |
INC HL |
|
931E |
LD A,(HL) |
|
931F |
LD (casting_chance),A |
|
9322 |
JR add_ability |
not_neutral |
9324 |
JP M,chaotic |
|
9327 |
LD E,A |
|
9328 |
LD A,(spell_chaos_law) |
|
932B |
OR A |
|
932C |
JR Z,not_aligned |
|
932E |
JP M,not_aligned |
|
9331 |
LD A,(IX+$01) |
|
9334 |
SRL E |
|
9336 |
SRL E |
|
9338 |
ADD A,E |
|
9339 |
LD (casting_chance),A |
|
933C |
JR add_ability |
chaotic |
933E |
NEG |
|
9340 |
LD E,A |
|
9341 |
LD A,(spell_chaos_law) |
|
9344 |
OR A |
|
9345 |
JP P,not_aligned |
|
9348 |
LD A,(IX+$01) |
|
934B |
SRL E |
|
934D |
SRL E |
|
934F |
ADD A,E |
|
9350 |
LD (casting_chance),A |
add_ability |
9353 |
LD A,(current_player) |
|
9356 |
ADD A,$29 |
|
9358 |
LD D,A |
|
9359 |
LD E,$15 |
|
935B |
CALL GETCHR |
|
935E |
LD HL,casting_chance |
|
9361 |
ADD A,(HL) |
|
9362 |
LD (casting_chance),A |
|
9365 |
LD A,(casting_chance) |
|
9368 |
OR A |
|
9369 |
CP $0A |
|
936B |
JP M,less_than_ten |
|
936E |
LD A,$09 |
less_than_ten |
9370 |
CP $00 |
|
9372 |
JP P,greater_equal_zero |
|
9375 |
LD A,$00 |
greater_equal_zero |
9377 |
LD (casting_chance),A |
|
937A |
RET |