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
6bba3c84
Commit
6bba3c84
authored
May 07, 2022
by
gentlespoon
Committed by
Melledy
May 07, 2022
Browse files
Kamisato Ayaka and Mona talent moving costs stamina
parent
9b3ca239
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/game/managers/MovementManager/MovementManager.java
View file @
6bba3c84
...
...
@@ -37,6 +37,7 @@ public class MovementManager {
SWIM_DASH_START
(-
200
),
SWIM_DASH
(-
200
),
SWIMMING
(-
80
),
FIGHT
(
0
),
// restore
STANDBY
(
500
),
...
...
@@ -75,8 +76,9 @@ public class MovementManager {
private
Timer
movementManagerTickTimer
;
private
GameSession
cachedSession
=
null
;
private
GameEntity
cachedEntity
=
null
;
private
int
staminaRecoverDelay
=
0
;
private
int
skillCaster
=
0
;
private
int
skillCasting
=
0
;
public
MovementManager
(
Player
player
)
{
previousCoordinates
.
add
(
new
Position
(
0
,
0
,
0
));
...
...
@@ -125,6 +127,12 @@ public class MovementManager {
MotionState
.
MOTION_WALK
,
MotionState
.
MOTION_DANGER_WALK
)));
MotionStatesCategorized
.
put
(
"FIGHT"
,
new
HashSet
<>(
Arrays
.
asList
(
MotionState
.
MOTION_FIGHT
)));
}
public
void
handle
(
GameSession
session
,
EntityMoveInfoOuterClass
.
EntityMoveInfo
moveInfo
,
GameEntity
entity
)
{
...
...
@@ -145,7 +153,7 @@ public class MovementManager {
currentCoordinates
=
newPos
;
}
currentState
=
motionInfo
.
getState
();
Grasscutter
.
getLogger
().
debug
(
""
+
currentState
);
Grasscutter
.
getLogger
().
debug
(
""
+
currentState
+
"\t"
+
(
moveInfo
.
getIsReliable
()
?
"reliable"
:
""
)
);
handleFallOnGround
(
motionInfo
);
}
...
...
@@ -293,6 +301,8 @@ public class MovementManager {
consumption
=
getFlyConsumption
();
}
else
if
(
MotionStatesCategorized
.
get
(
"STANDBY"
).
contains
(
currentState
))
{
consumption
=
getStandConsumption
();
}
else
if
(
MotionStatesCategorized
.
get
(
"FIGHT"
).
contains
(
currentState
))
{
consumption
=
getFightConsumption
();
}
// delay 2 seconds before start recovering - as official server does.
...
...
@@ -306,7 +316,7 @@ public class MovementManager {
consumption
=
new
Consumption
(
ConsumptionType
.
None
);
}
}
Grasscutter
.
getLogger
().
debug
(
getCurrentStamina
()
+
"/"
+
getMaximumStamina
()
+
"\t"
+
currentState
+
"\t"
+
"isMoving: "
+
isPlayerMoving
()
+
"\t("
+
consumption
.
consumptionType
+
","
+
consumption
.
amount
+
")"
);
//
Grasscutter.getLogger().debug(getCurrentStamina() + "/" + getMaximumStamina() + "\t" + currentState + "\t" + "isMoving: " + isPlayerMoving() + "\t(" + consumption.consumptionType + "," + consumption.amount + ")");
updateStamina
(
cachedSession
,
consumption
.
amount
);
}
...
...
@@ -340,8 +350,6 @@ public class MovementManager {
return
consumption
;
}
// TODO: Kamisato Ayaka & Mona
private
Consumption
getSwimConsumptions
()
{
Consumption
consumption
=
new
Consumption
(
ConsumptionType
.
None
);
if
(
currentState
==
MotionState
.
MOTION_SWIM_MOVE
)
{
...
...
@@ -410,5 +418,25 @@ public class MovementManager {
}
return
consumption
;
}
private
Consumption
getFightConsumption
()
{
Consumption
consumption
=
new
Consumption
(
ConsumptionType
.
None
);
HashMap
<
Integer
,
Integer
>
fightingCost
=
new
HashMap
<>()
{{
put
(
10013
,
-
1000
);
// Kamisato Ayaka
put
(
10413
,
-
1000
);
// Mona
}};
if
(
fightingCost
.
containsKey
(
skillCasting
))
{
consumption
=
new
Consumption
(
ConsumptionType
.
FIGHT
,
fightingCost
.
get
(
skillCasting
));
// only handle once, so reset.
skillCasting
=
0
;
skillCaster
=
0
;
}
return
consumption
;
}
public
void
notifySkill
(
int
caster
,
int
skillId
)
{
skillCaster
=
caster
;
skillCasting
=
skillId
;
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerEvtDoSkillSuccNotify.java
View file @
6bba3c84
...
...
@@ -16,11 +16,9 @@ public class HandlerEvtDoSkillSuccNotify extends PacketHandler {
// TODO: Will be used for deducting stamina for charged skills.
int
caster
=
notify
.
getCasterId
();
int
skill
=
notify
.
getSkillId
();
int
skill
Id
=
notify
.
getSkillId
();
// Grasscutter.getLogger().warn(caster + "\t" + skill);
// session.getPlayer().getScene().broadcastPacket(new PacketEvtAvatarStandUpNotify(notify));
session
.
getPlayer
().
getMovementManager
().
notifySkill
(
caster
,
skillId
);
}
}
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