Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add const(data.fall.defence_up) trigger #1149

Merged
merged 4 commits into from
Apr 8, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/bytecode.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ const (
OC_const_data_dizzypoints
OC_const_data_attack
OC_const_data_defence
OC_const_data_fall_defence_up
OC_const_data_fall_defence_mul
OC_const_data_liedown_time
OC_const_data_airjuggle
Expand Down Expand Up @@ -1440,6 +1441,8 @@ func (be BytecodeExp) run_const(c *Char, i *int, oc *Char) {
sys.bcStack.PushI(c.gi().data.attack)
case OC_const_data_defence:
sys.bcStack.PushI(c.gi().data.defence)
case OC_const_data_fall_defence_up:
sys.bcStack.PushI(c.gi().data.fall.defence_up)
case OC_const_data_fall_defence_mul:
sys.bcStack.PushF(1.0 / c.gi().data.fall.defence_mul)
case OC_const_data_liedown_time:
Expand Down
7 changes: 4 additions & 3 deletions src/char.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ type CharData struct {
attack int32
defence int32
fall struct {
defence_up int32
defence_mul float32
}
liedown struct {
Expand All @@ -221,6 +222,7 @@ func (cd *CharData) init() {
cd.guardpoints = 1000
cd.attack = 100
cd.defence = 100
cd.fall.defence_up = 50
cd.fall.defence_mul = 1.5
cd.liedown.time = 60
cd.airjuggle = 15
Expand Down Expand Up @@ -2164,10 +2166,9 @@ func (c *Char) load(def string) error {
c.guardPointsMax = gi.data.guardpoints
is.ReadI32("attack", &gi.data.attack)
is.ReadI32("defence", &gi.data.defence)
is.ReadI32("fall.defence_up", &gi.data.fall.defence_up)
gi.data.fall.defence_mul = (float32(gi.data.fall.defence_up) + 100) / 100
var i32 int32
if is.ReadI32("fall.defence_up", &i32) {
gi.data.fall.defence_mul = (float32(i32) + 100) / 100
}
if is.ReadI32("liedown.time", &i32) {
gi.data.liedown.time = Max(1, i32)
}
Expand Down
2 changes: 2 additions & 0 deletions src/compiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -1461,6 +1461,8 @@ func (c *Compiler) expValue(out *BytecodeExp, in *string,
out.append(OC_const_data_attack)
case "data.defence":
out.append(OC_const_data_defence)
case "data.fall.defence_up":
out.append(OC_const_data_fall_defence_up)
case "data.fall.defence_mul":
out.append(OC_const_data_fall_defence_mul)
case "data.liedown.time":
Expand Down