Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
ziqian zhang
Grasscutter
Commits
6d678557
Commit
6d678557
authored
May 06, 2022
by
gentlespoon
Committed by
Melledy
May 06, 2022
Browse files
fix/runningAndDashingStamina
parent
58cb6029
Changes
1
Show whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/game/managers/MovementManager/MovementManager.java
View file @
6d678557
...
...
@@ -268,7 +268,7 @@ public class MovementManager {
if
(
Grasscutter
.
getConfig
().
OpenStamina
)
{
boolean
moving
=
isPlayerMoving
();
if
(
moving
||
(
getCurrentStamina
()
<
getMaximumStamina
()))
{
Grasscutter
.
getLogger
().
debug
(
"Player moving: "
+
moving
+
", stamina full: "
+
(
getCurrentStamina
()
>=
getMaximumStamina
())
+
", recalculate stamina"
);
//
Grasscutter.getLogger().debug("Player moving: " + moving + ", stamina full: " + (getCurrentStamina() >= getMaximumStamina()) + ", recalculate stamina");
Consumption
consumption
=
Consumption
.
None
;
// TODO: refactor these conditions.
...
...
@@ -306,14 +306,16 @@ public class MovementManager {
}
else
if
(
MotionStatesCategorized
.
get
(
"RUN"
).
contains
(
currentState
))
{
// RUN, DASH and WALK
// DASH
if
(
currentState
==
MotionState
.
MOTION_DASH
)
{
if
(
previousState
==
MotionState
.
MOTION_DASH
)
{
consumption
=
Consumption
.
SPRINT
;
}
else
{
// cost more to start dashing
if
(
currentState
==
MotionState
.
MOTION_DASH_BEFORE_SHAKE
)
{
consumption
=
Consumption
.
DASH
;
if
(
previousState
==
MotionState
.
MOTION_DASH_BEFORE_SHAKE
)
{
// only charge once
consumption
=
Consumption
.
SPRINT
;
}
}
if
(
currentState
==
MotionState
.
MOTION_DASH
)
{
consumption
=
Consumption
.
SPRINT
;
}
// RUN
if
(
currentState
==
MotionState
.
MOTION_RUN
)
{
consumption
=
Consumption
.
RUN
;
...
...
@@ -347,14 +349,13 @@ public class MovementManager {
staminaRecoverDelay
=
0
;
}
if
(
consumption
.
amount
>
0
)
{
if
(
staminaRecoverDelay
<
5
)
{
if
(
staminaRecoverDelay
<
10
)
{
staminaRecoverDelay
++;
consumption
=
Consumption
.
None
;
}
}
int
newStamina
=
updateStamina
(
cachedSession
,
consumption
.
amount
);
cachedSession
.
send
(
new
PacketPlayerPropNotify
(
player
,
PlayerProperty
.
PROP_CUR_PERSIST_STAMINA
));
Grasscutter
.
getLogger
().
debug
(
player
.
getProperty
(
PlayerProperty
.
PROP_CUR_PERSIST_STAMINA
)
+
"/"
+
player
.
getProperty
(
PlayerProperty
.
PROP_MAX_STAMINA
)
+
"\t"
+
currentState
+
"\t"
+
"isMoving: "
+
isPlayerMoving
()
+
"\t"
+
consumption
+
"("
+
consumption
.
amount
+
")"
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment