Gestion_arme2: ; degré 1 ld a,(arme2num) ; using an auxiliary weapon ? or a ret z ld a,(arme2loc+1) bit 7,a jr z,Gestionarme2_suite add a,30 bit 7,a jr nz,Supp_arme2_2 Gestionarme2_suite: ld a,(arme2num) call IA_arme2 ld a,(arme2num) cp 5 ret nc ld hl,(arme2img) ld de,$0105 ld bc,(arme2loc) call gba_drawsprite ret IA_arme2: ; degré 2 ld hl,arme2IA_table-6 ; find the AI of the weapon add a,a ld d,0 ld e,a add hl,de ld e,(hl) inc hl ld d,(hl) ex de,hl jp (hl) Supp_arme2: ; don't use a weapon anymore pop hl ; degré-1 Supp_arme2_2: ld hl,arme2num ld (hl),0 ret DagueIA: ; degré 2 ld b,2 ; dagger AI DagueIA_boucle: push bc ld bc,(arme2loc) ld a,(arme2stat) add a,b ld b,a call gba_collision call Bloc_type1 jr z,Supp_arme2 ld hl,arme2loc+1 ld a,(arme2stat) sra a sra a sra a add a,(hl) ld (hl),a pop bc djnz DagueIA_boucle ret EaubeniteIA: ; holy water AI ld b,2 EaubeniteIA_boucle2: push bc ld bc,(arme2loc) ld a,(arme2stat) add a,b ld b,a call gba_collision call Bloc_type4 jr z,Supp_arme2 cp 13 jr z,Casser_blocdepierre ld hl,arme2loc+1 ld a,(arme2stat) sra a sra a add a,(hl) ld (hl),a pop bc djnz EaubeniteIA_boucle2 ld a,(arme2stat2) cp 20 jr z,EaubeniteIA_suite inc a EaubeniteIA_suite: ld (arme2stat2),a ld d,0 ld e,a ld hl,table_saut add hl,de ld a,(hl) or a ret z ld hl,arme2loc add a,(hl) ld (hl),a ld bc,(arme2loc) push bc call gba_collision call Bloc_type4 pop bc jp z,Supp_arme2 cp 13 jr z,Casser_blocdepierre ld a,5 add a,c ld c,a ld a,5 add a,b ld b,a call gba_collision call Bloc_type4 jp z,Supp_arme2 cp 13 ret nz Casser_blocdepierre: ; break stone inc (hl) ld hl,Table_sprite ld de,GRAPH_MEM ld bc,8*spritemax ldir ld bc,(mask_y) ld a,(mask_x2) ld b,a push bc call gba_initmap pop bc ld a,b or a jr z,Casser_blocdepierre_suite Casser_blocdepierre_boucle1: push bc call gba_scroll_right pop bc djnz Casser_blocdepierre_boucle1 Casser_blocdepierre_suite: ld a,c or a jr z,Casser_blocdepierre_suite2 Casser_blocdepierre_boucle2: push bc call gba_scroll_down pop bc dec c jr nz,Casser_blocdepierre_boucle2 Casser_blocdepierre_suite2: ld hl,GRAPH_MEM ld de,Table_sprite ld bc,8*spritemax ldir call copier_APDGM jp Supp_arme2 Eaubenite_init: ld hl,arme2stat2 ld (hl),9 ld hl,arme2dommages ld (hl),1 ld hl,arme2largeur ld (hl),5 ld hl,arme2stat ld (hl),5 ld a,(persostat) bit 1,a ret z ld (hl),-1 ret Dague_init: ; degré 1 ld a,(coeur) or a jp z,Supp_arme2_2 dec a ld (coeur),a call Actualiser_nbrecoeur ld hl,arme2largeur ld (hl),4 ld hl,arme2dommages ld (hl),3 ld hl,arme2stat ld (hl),8 ld a,(persostat) bit 1,a ret z ld (hl),-1 ret MedecineIA: ld a,(energiemax) ld (energie),a call Afficher_barredevie ld hl,equipement res 2,(hl) xor a ld (num_arme2),a ld (arme2num),a pop hl ret InvincibleIA: ld hl,persostat ld a,%11110000 or (hl) ld (hl),a xor a ld (arme2loc+1),a ld a,(timer) and %111111 ret nz ld a,(num_arme2) cp 7 jp nz,Supp_arme2 ld a,(coeur) or a jp z,Supp_arme2 dec a ld (coeur),a call Actualiser_nbrecoeur ret Eclair_init: ld a,(coeur) cp 5 jp c,Supp_arme2_2 sub 5 ld (coeur),a call Actualiser_nbrecoeur ld hl,arme2largeur ld (hl),96 inc hl ld (hl),3 ld hl,arme2stat ld (hl),0 xor a ld (EclairIA+1),a ld (arme2loc+1),a ld (arme2loc),a ret EclairIA: ; lightning AI ld a,$00 add a,5 ld (EclairIA+1),a ld (arme2loc),a cp 70 jp z,Supp_arme2 ld a,(timer) and %1 ret nz ld hl,GRAPH_MEM ld de,GRAPH_MEM+1 ld bc,671 ld (hl),255 ldir call CR_GRBCopy ret