Skip to content

Commit 4523af3

Browse files
committed
Accommodate possibility that High Jump may be canceled before NS Transmission blessing is added
1 parent a12a430 commit 4523af3

File tree

3 files changed

+27
-20
lines changed

3 files changed

+27
-20
lines changed

internal/characters/ororon/jump.go

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,26 @@ const jumpNsStatusTag = nightsoul.NightsoulTransmissionStatus
1616
// Consume stamina.
1717
// Hold defines when fall action will automatically be called.
1818
func (c *char) highJump(hold int) (action.Info, error) {
19-
if (hold > maxJumpFrames-minCancelFrames) || (hold < 0) {
20-
hold = maxJumpFrames - minCancelFrames
19+
if (hold > maxJumpFrames-fallCancelFrames) || (hold < 0) {
20+
hold = maxJumpFrames - fallCancelFrames
2121
}
2222

23-
jumpDur := minCancelFrames + hold
23+
jumpDur := fallCancelFrames + hold
2424
c.jmpSrc = c.Core.F
2525
src := c.jmpSrc
2626
c.Core.Player.SetAirborne(player.AirborneOroron)
2727

28-
// Jump cannot be cancelled before NS status is added, so no need to check src here.
28+
// Don't add NS if jump is cancelled before NS would be added.
2929
jumpNsDuration := jumpDur - jumpNsDelay
30-
c.QueueCharTask(func() { c.AddStatus(jumpNsStatusTag, jumpNsDuration, true) }, jumpNsDelay)
30+
c.QueueCharTask(func() {
31+
if src != c.jmpSrc {
32+
return
33+
}
34+
c.AddStatus(jumpNsStatusTag, jumpNsDuration, true)
35+
}, jumpNsDelay)
3136

32-
jumpStamDrainCb := func() {
37+
// Consume stamina.
38+
c.QueueCharTask(func() {
3339
h := c.Core.Player
3440
// Apply stamina reduction mods.
3541
stamDrain := h.AbilStamCost(c.Index, action.ActionJump, map[string]int{"hold": 1})
@@ -40,28 +46,26 @@ func (c *char) highJump(hold int) (action.Info, error) {
4046
// While in high jump, ororon cannot start resuming stamina regen until after landing.
4147
h.LastStamUse = *h.F + jumpDur + fallFrames
4248
h.Events.Emit(event.OnStamUse, action.ActionJump)
43-
}
44-
c.QueueCharTask(jumpStamDrainCb, jumpStamDrainDelay)
49+
}, jumpStamDrainDelay)
4550

4651
act := action.Info{
4752
Frames: frames.NewAbilFunc(jumpHoldFrames[0]),
4853
AnimationLength: jumpDur + fallFrames,
49-
CanQueueAfter: minCancelFrames, // earliest cancel
54+
CanQueueAfter: plungeCancelFrames, // earliest cancel
5055
State: action.JumpState,
5156
}
5257

5358
// Trigger a fall after max jump duration
54-
fallCb := func() {
59+
// TODO: Is this hitlag extended? Does this skip if the action is canceled?
60+
act.QueueAction(func() {
5561
if src != c.jmpSrc {
5662
return
5763
}
5864

5965
fallParam := map[string]int{"fall": 1}
6066
// Ideally this would inject the action into the queue of actions to take from the config file, rather than calling exec directly
6167
c.Core.Player.Exec(action.ActionHighPlunge, c.Base.Key, fallParam)
62-
}
63-
// TODO: Is this hitlag extended? Does this skip if the action is canceled?
64-
act.QueueAction(fallCb, jumpDur)
68+
}, jumpDur)
6569
// c.QueueCharTask(fallCb, jumpDur)
6670
return act, nil
6771
}

internal/characters/ororon/ororon.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ const (
2424
jumpStamDrainAmt = 75
2525
jumpStamReqAmt = 1 // TODO: Find real value
2626

27-
maxJumpFrames = 162 // From swap ui gray to glider wings appear
28-
minCancelFrames = superJumpBeginFrames + 18 // From start of jump animation to plunge animation start
29-
fallCancelFrames = superJumpBeginFrames + 46 // From From start of jump animation to UI changes from gliding to standard UI
27+
maxJumpFrames = 162 // From swap ui gray to glider wings appear
28+
plungeCancelFrames = superJumpBeginFrames + 18 // From start of jump animation to plunge animation start
29+
fallCancelFrames = superJumpBeginFrames + 46 // From From start of jump animation to UI changes from gliding to standard UI
3030

31-
fallFrames = superJumpBeginFrames + 43 // From fall animation start to swap icon un-gray.
31+
fallFrames = 43 // From fall animation start to swap icon un-gray.
3232
)
3333

3434
func init() {
@@ -38,7 +38,7 @@ func init() {
3838
jumpHoldFrames = make([][]int, 2)
3939
// Hold Jump -> X
4040
jumpHoldFrames[0] = frames.InitAbilSlice(60 * 10) // set to very high number for most abilities
41-
jumpHoldFrames[0][action.ActionHighPlunge] = minCancelFrames
41+
jumpHoldFrames[0][action.ActionHighPlunge] = plungeCancelFrames
4242
// Fall -> X
4343
jumpHoldFrames[1] = frames.InitAbilSlice(fallFrames)
4444
jumpHoldFrames[1][action.ActionAttack] = fallFrames + 10

internal/characters/ororon/plunge.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ func init() {
1717
}
1818

1919
func (c *char) fall() (action.Info, error) {
20-
c.Core.Player.SetAirborne(player.Grounded)
21-
2220
// Fall cancel can't happen until after high_plunge can happen. Delay all side effects if try to fall cancel too early.
2321
delay := fallCancelFrames - (c.Core.F - c.jmpSrc)
2422
if delay <= 0 {
@@ -30,6 +28,9 @@ func (c *char) fall() (action.Info, error) {
3028
c.Index)
3129
}
3230

31+
// Cleanup high jump.
32+
c.Core.Player.SetAirborne(player.Grounded)
33+
c.jmpSrc = 0
3334
c.QueueCharTask(func() { c.DeleteStatus(jumpNsStatusTag) }, delay)
3435
// Allow stam to start regen when landing
3536
c.Core.Player.LastStamUse = c.Core.F + jumpHoldFrames[1][action.ActionSwap] + delay
@@ -46,8 +47,10 @@ func (c *char) fall() (action.Info, error) {
4647
}
4748

4849
func (c *char) HighPlungeAirborneOroron(p map[string]int) (action.Info, error) {
50+
// Cleanup high jump.
4951
c.Core.Player.SetAirborne(player.Grounded)
5052
c.DeleteStatus(jumpNsStatusTag)
53+
c.jmpSrc = 0
5154

5255
// Allow player to resume stam as soon as plunge is initiated
5356
c.Core.Player.LastStamUse = c.Core.F

0 commit comments

Comments
 (0)