Skip to content

Commit

Permalink
Merge pull request #1076 from ikemen-engine/fix
Browse files Browse the repository at this point in the history
fix: fix redirectId in afterImage and destroySelf
  • Loading branch information
K4thos authored Mar 20, 2023
2 parents 25620cf + c892243 commit 2633709
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/bytecode.go
Original file line number Diff line number Diff line change
Expand Up @@ -2827,6 +2827,7 @@ const (
func (sc destroySelf) Run(c *Char, _ []int32) bool {
crun := c
rec, rem := false, false
self := true
StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
switch id {
case destroySelf_recursive:
Expand All @@ -2835,14 +2836,15 @@ func (sc destroySelf) Run(c *Char, _ []int32) bool {
rem = exp[0].evalB(c)
case destroySelf_redirectid:
if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
self = rid.id == c.id
crun = rid
} else {
return false
}
}
return true
})
return crun.destroySelf(rec, rem)
return crun.destroySelf(rec, rem) && self
}

type changeAnim StateControllerBase
Expand Down Expand Up @@ -3982,18 +3984,20 @@ func (sc afterImage) runSub(c *Char, ai *AfterImage,
}
func (sc afterImage) Run(c *Char, _ []int32) bool {
crun := c
crun.aimg.clear()
crun.aimg.time = 1
doOce := false
StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool {
if id == afterImage_redirectid {
if rid := sys.playerID(exp[0].evalI(c)); rid != nil {
crun = rid
crun.aimg.clear()
crun.aimg.time = 1
} else {
return false
}
}
if !doOce {
crun.aimg.clear()
crun.aimg.time = 1
doOce = true
}
sc.runSub(c, &crun.aimg, id, exp)
return true
})
Expand Down

0 comments on commit 2633709

Please sign in to comment.