Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
Grasscutter
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
ziqian zhang
Grasscutter
Commits
6d678557
Commit
6d678557
authored
3 years ago
by
gentlespoon
Committed by
Melledy
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
fix/runningAndDashingStamina
parent
58cb6029
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/emu/grasscutter/game/managers/MovementManager/MovementManager.java
+9
-8
9 additions, 8 deletions
...cutter/game/managers/MovementManager/MovementManager.java
with
9 additions
and
8 deletions
src/main/java/emu/grasscutter/game/managers/MovementManager/MovementManager.java
+
9
−
8
View file @
6d678557
...
@@ -268,7 +268,7 @@ public class MovementManager {
...
@@ -268,7 +268,7 @@ public class MovementManager {
if
(
Grasscutter
.
getConfig
().
OpenStamina
)
{
if
(
Grasscutter
.
getConfig
().
OpenStamina
)
{
boolean
moving
=
isPlayerMoving
();
boolean
moving
=
isPlayerMoving
();
if
(
moving
||
(
getCurrentStamina
()
<
getMaximumStamina
()))
{
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
;
Consumption
consumption
=
Consumption
.
None
;
// TODO: refactor these conditions.
// TODO: refactor these conditions.
...
@@ -306,14 +306,16 @@ public class MovementManager {
...
@@ -306,14 +306,16 @@ public class MovementManager {
}
else
if
(
MotionStatesCategorized
.
get
(
"RUN"
).
contains
(
currentState
))
{
}
else
if
(
MotionStatesCategorized
.
get
(
"RUN"
).
contains
(
currentState
))
{
// RUN, DASH and WALK
// RUN, DASH and WALK
// DASH
// DASH
if
(
currentState
==
MotionState
.
MOTION_DASH
)
{
if
(
currentState
==
MotionState
.
MOTION_DASH_BEFORE_SHAKE
)
{
if
(
previousState
==
MotionState
.
MOTION_DASH
)
{
consumption
=
Consumption
.
DASH
;
if
(
previousState
==
MotionState
.
MOTION_DASH_BEFORE_SHAKE
)
{
// only charge once
consumption
=
Consumption
.
SPRINT
;
consumption
=
Consumption
.
SPRINT
;
}
else
{
// cost more to start dashing
consumption
=
Consumption
.
DASH
;
}
}
}
}
if
(
currentState
==
MotionState
.
MOTION_DASH
)
{
consumption
=
Consumption
.
SPRINT
;
}
// RUN
// RUN
if
(
currentState
==
MotionState
.
MOTION_RUN
)
{
if
(
currentState
==
MotionState
.
MOTION_RUN
)
{
consumption
=
Consumption
.
RUN
;
consumption
=
Consumption
.
RUN
;
...
@@ -347,14 +349,13 @@ public class MovementManager {
...
@@ -347,14 +349,13 @@ public class MovementManager {
staminaRecoverDelay
=
0
;
staminaRecoverDelay
=
0
;
}
}
if
(
consumption
.
amount
>
0
)
{
if
(
consumption
.
amount
>
0
)
{
if
(
staminaRecoverDelay
<
5
)
{
if
(
staminaRecoverDelay
<
10
)
{
staminaRecoverDelay
++;
staminaRecoverDelay
++;
consumption
=
Consumption
.
None
;
consumption
=
Consumption
.
None
;
}
}
}
}
int
newStamina
=
updateStamina
(
cachedSession
,
consumption
.
amount
);
int
newStamina
=
updateStamina
(
cachedSession
,
consumption
.
amount
);
cachedSession
.
send
(
new
PacketPlayerPropNotify
(
player
,
PlayerProperty
.
PROP_CUR_PERSIST_STAMINA
));
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
+
")"
);
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
+
")"
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment