lorom

;Health and damage blocks MP2 style
;BY Black Falcon
;Credit goes to Crys for the idea
;and to DSO for helping him


!variavalue = #$0F00	;value for varia suit
!value = #$5000		;the normal damage value (1/65536th)
!subvalue = #$0700	;subhealth-value (healing per frame)
!damage = $0A4E	
!maxhealth = $09C4
!health = $09C2		
!subhealth = $0A4c	;needed for healing frame per frame



;v__v___________BTS 03 Air-Fool X-Ray____________v__v

org $9498B2 	;Hijack point of Air-Fool X-Ray with a BTS 03

DW $B300	;this points to free space in the ROM

org $94B300 

LDA $09A2	;checks, if gravity suit is equipped
AND #$0020
CMP #$0020
BEQ gotgrav	;goto 'gotgrav' if true
LDA $09A2	;checks, if varia suit is equipped
AND #$0001
CMP #$0001	
BEQ gotvaria	;goto 'gotvaria' if true
LDA !value 
STA !damage

gotgrav:	;if gravity is equipped, do nothing
RTS

gotvaria:	;if varia suit is equipped, then load 'variavalue',
LDA !variavalue	;which takes less damage
STA !damage
RTS
;____________________________________________________





;v__v___________BTS 04 Air-Fool X-Ray____________v__v



org $9498B4 	;Hijack point of Air-Fool X-Ray with a BTS value 04

	DW $B400 

org $94B400	;again free space


LDA !value	;normal damage for free use (phazon or something like that)
STA !damage
RTS

;____________________________________________________





;v__v___________BTS 05 Air-Fool X-Ray____________v__v

org $9498B6	

	DW $B500

org $94B500	; -_-°


LDA !subhealth 
ADC !subvalue  	;this adds value to current subhealth
STA !subhealth


LDA !health 
ADC #$0000 
CMP $09C4 	; check that it's <= to max health
BCC OK 		; skips to OK: if true
LDA $09c4	; go with the limit instead of going over it
OK:
STA !health
RTS

;____________________________________________________
;____________________________________________________


