projects
/
gbrg
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b0cf8c2
)
actor: Added default hp setter in tact init
author
Lukas Krickl
<lukas@krickl.dev>
Fri, 30 Jan 2026 06:57:11 +0000
(07:57 +0100)
committer
Lukas Krickl
<lukas@krickl.dev>
Fri, 30 Jan 2026 06:57:11 +0000
(07:57 +0100)
src/action.s
patch
|
blob
|
history
src/actor.s
patch
|
blob
|
history
diff --git
a/src/action.s
b/src/action.s
index eb113b5371503540b913de134d7dccd2841157fa..9474f7cef794c1efe295ab356478e8fe67dc387a 100644
(file)
--- a/
src/action.s
+++ b/
src/action.s
@@
-36,12
+36,15
@@
action_attack:
ld h, c
or a, h
ret z ; no actor here...
-
+
+ push hl
; hl = actor
+ call act_attr_get_attack_damage
+ ; a = attack damage (source)
+ ld b, a ; b = damage
; TODO: for now just kill the actor
; later we need actual damage calculations
- push hl
pop de
call act_die
diff --git
a/src/actor.s
b/src/actor.s
index 447966830cb4276fa860f574b48b04ee52e5866f..f347edffebeb2d98ec194d77807d884014381a4c 100644
(file)
--- a/
src/actor.s
+++ b/
src/actor.s
@@
-261,6
+261,19
@@
act_draw:
; inputs:
; de: actor ptr
act_init_set_tact:
+ push de
+ call act_attr_get_max_hp
+ ; bc = max hp
+ pop de
+ ld hl, act_hp
+ add hl, de
+ ; set default hp
+ ld a, b
+ ld [hl+], a
+ ld a, c
+ ld [hl], a
+
+
call act_set_tact
ret