-
Notifications
You must be signed in to change notification settings - Fork 0
/
game_enemy.asm
72 lines (68 loc) · 1.46 KB
/
game_enemy.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
;Airaki! - FSE 2014
;Released under the GPL V3, see LICENSE.TXT
prepareatk:
ld a,(GAME_MODE)
bit 0,a
ret nz
;Make random attack interval value between min and min+amp
call get_random
ld h,a
ld a,(ENEMYATK_LVLAMP)
ld e,a
call mul8_8
ld a,h
ld hl,ENEMYATK_LVLMIN
add (hl)
ld (ENEMYATK_TIMER),a
ret
warnattackplayer:
ld hl,ENEMYGFX_ATK
call loadenemy
ld a,(ENEMYATK_LVLWARN)
ld (ENEMYATK_WARNTIMER),a
ld hl,sfxdata_warn
call sfx_play
ret
attackplayer:
ld hl,ENEMYGFX_IDLE
call loadenemy
call prepareatk ;Prepare next attack
ld de,aap_slash
call aa_init_enemy
ld a,(GAME_MODE)
bit 0,a
ret z
ld hl,sfxdata_warn
call sfx_play
ret
getdamage:
ld a,(GAME_MODE)
bit 0,a
jp nz,useshield ;Don't cause damage in link mode (auto-updated from other player)
getbombdamage:
ld a,(ENEMYATK_FORCE)
ld c,a
ld a,(SHIELD_UP) ;Is shield up ?
or a
jr z,+
ld a,(PLAYER_SH1)
-:
srl c ;Divide damage by shield strength
dec a
jr nz,-
push bc
call useshield
pop bc
+:
ld a,(PLAYER_HP)
cp c
jr nc,+ ;FORCE >= HP : Player survives
jp declives
+:
sub c
ld (PLAYER_HP),a
ld a,BLINK_TIME
ld (PLAYER_BLINK),a
ld hl,HPBAR_REFRESH
set 1,(hl)
ret