Skip to content

Commit

Permalink
Add attack, defence triggers
Browse files Browse the repository at this point in the history
  • Loading branch information
K4thos committed Feb 5, 2023
1 parent f19b444 commit f706bff
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
6 changes: 6 additions & 0 deletions src/bytecode.go
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,10 @@ const (
OC_ex_ailevelf
OC_ex_animelemlength
OC_ex_animlength
OC_ex_attack
OC_ex_combocount
OC_ex_consecutivewins
OC_ex_defence
OC_ex_dizzy
OC_ex_dizzypoints
OC_ex_dizzypointsmax
Expand Down Expand Up @@ -1877,10 +1879,14 @@ func (be BytecodeExp) run_ex(c *Char, i *int, oc *Char) {
}
case OC_ex_animlength:
sys.bcStack.PushI(c.anim.totaltime)
case OC_ex_attack:
sys.bcStack.PushF(c.attackMul * 100)
case OC_ex_combocount:
sys.bcStack.PushI(c.comboCount())
case OC_ex_consecutivewins:
sys.bcStack.PushI(c.consecutiveWins())
case OC_ex_defence:
sys.bcStack.PushF(float32(c.finalDefense * 100))
case OC_ex_dizzy:
sys.bcStack.PushB(c.scf(SCF_dizzy))
case OC_ex_dizzypoints:
Expand Down
6 changes: 6 additions & 0 deletions src/compiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,11 @@ var triggerMap = map[string]int{
//new triggers
"animelemlength": 1,
"animlength": 1,
"attack": 1,
"combocount": 1,
"consecutivewins": 1,
"jugglepoints": 1,
"defence": 1,
"dizzy": 1,
"dizzypoints": 1,
"dizzypointsmax": 1,
Expand Down Expand Up @@ -2533,12 +2535,16 @@ func (c *Compiler) expValue(out *BytecodeExp, in *string,
out.append(OC_ex_, OC_ex_animelemlength)
case "animlength":
out.append(OC_ex_, OC_ex_animlength)
case "attack":
out.append(OC_ex_, OC_ex_attack)
case "combocount":
out.append(OC_ex_, OC_ex_combocount)
case "consecutivewins":
out.append(OC_ex_, OC_ex_consecutivewins)
case "jugglepoints":
out.append(OC_ex_, OC_ex_jugglepoints)
case "defence":
out.append(OC_ex_, OC_ex_defence)
case "dizzy":
out.append(OC_ex_, OC_ex_dizzy)
case "dizzypoints":
Expand Down
16 changes: 8 additions & 8 deletions src/script.go
Original file line number Diff line number Diff line change
Expand Up @@ -3711,6 +3711,10 @@ func triggerFunctions(l *lua.LState) {
l.Push(lua.LNumber(sys.debugWC.anim.totaltime))
return 1
})
luaRegister(l, "attack", func(*lua.LState) int {
l.Push(lua.LNumber(sys.debugWC.attackMul * 100))
return 1
})
luaRegister(l, "combocount", func(*lua.LState) int {
l.Push(lua.LNumber(sys.debugWC.comboCount()))
return 1
Expand All @@ -3719,6 +3723,10 @@ func triggerFunctions(l *lua.LState) {
l.Push(lua.LNumber(sys.consecutiveWins[sys.debugWC.teamside]))
return 1
})
luaRegister(l, "defence", func(*lua.LState) int {
l.Push(lua.LNumber(sys.debugWC.finalDefense * 100))
return 1
})
luaRegister(l, "dizzy", func(*lua.LState) int {
l.Push(lua.LBool(sys.debugWC.scf(SCF_dizzy)))
return 1
Expand Down Expand Up @@ -4027,18 +4035,10 @@ func triggerFunctions(l *lua.LState) {
l.Push(lua.LNumber(sys.debugWC.animPN) + 1)
return 1
})
luaRegister(l, "attack", func(*lua.LState) int {
l.Push(lua.LNumber(sys.debugWC.attackMul * 100))
return 1
})
luaRegister(l, "continue", func(*lua.LState) int {
l.Push(lua.LBool(sys.continueFlg))
return 1
})
luaRegister(l, "defence", func(*lua.LState) int {
l.Push(lua.LNumber(sys.debugWC.finalDefense * 100))
return 1
})
luaRegister(l, "displayname", func(*lua.LState) int {
l.Push(lua.LString(sys.debugWC.gi().displayname))
return 1
Expand Down

0 comments on commit f706bff

Please sign in to comment.