Skip to content
Snippets Groups Projects
Commit 6bba3c84 authored by gentlespoon's avatar gentlespoon Committed by Melledy
Browse files

Kamisato Ayaka and Mona talent moving costs stamina

parent 9b3ca239
Branches
Tags
No related merge requests found
...@@ -37,6 +37,7 @@ public class MovementManager { ...@@ -37,6 +37,7 @@ public class MovementManager {
SWIM_DASH_START(-200), SWIM_DASH_START(-200),
SWIM_DASH(-200), SWIM_DASH(-200),
SWIMMING(-80), SWIMMING(-80),
FIGHT(0),
// restore // restore
STANDBY(500), STANDBY(500),
...@@ -75,8 +76,9 @@ public class MovementManager { ...@@ -75,8 +76,9 @@ public class MovementManager {
private Timer movementManagerTickTimer; private Timer movementManagerTickTimer;
private GameSession cachedSession = null; private GameSession cachedSession = null;
private GameEntity cachedEntity = null; private GameEntity cachedEntity = null;
private int staminaRecoverDelay = 0; private int staminaRecoverDelay = 0;
private int skillCaster = 0;
private int skillCasting = 0;
public MovementManager(Player player) { public MovementManager(Player player) {
previousCoordinates.add(new Position(0,0,0)); previousCoordinates.add(new Position(0,0,0));
...@@ -125,6 +127,12 @@ public class MovementManager { ...@@ -125,6 +127,12 @@ public class MovementManager {
MotionState.MOTION_WALK, MotionState.MOTION_WALK,
MotionState.MOTION_DANGER_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) { public void handle(GameSession session, EntityMoveInfoOuterClass.EntityMoveInfo moveInfo, GameEntity entity) {
...@@ -145,7 +153,7 @@ public class MovementManager { ...@@ -145,7 +153,7 @@ public class MovementManager {
currentCoordinates = newPos; currentCoordinates = newPos;
} }
currentState = motionInfo.getState(); currentState = motionInfo.getState();
Grasscutter.getLogger().debug("" + currentState); Grasscutter.getLogger().debug("" + currentState + "\t" + (moveInfo.getIsReliable() ? "reliable" : ""));
handleFallOnGround(motionInfo); handleFallOnGround(motionInfo);
} }
...@@ -293,6 +301,8 @@ public class MovementManager { ...@@ -293,6 +301,8 @@ public class MovementManager {
consumption = getFlyConsumption(); consumption = getFlyConsumption();
} else if (MotionStatesCategorized.get("STANDBY").contains(currentState)) { } else if (MotionStatesCategorized.get("STANDBY").contains(currentState)) {
consumption = getStandConsumption(); consumption = getStandConsumption();
} else if (MotionStatesCategorized.get("FIGHT").contains(currentState)) {
consumption = getFightConsumption();
} }
// delay 2 seconds before start recovering - as official server does. // delay 2 seconds before start recovering - as official server does.
...@@ -306,7 +316,7 @@ public class MovementManager { ...@@ -306,7 +316,7 @@ public class MovementManager {
consumption = new Consumption(ConsumptionType.None); 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); updateStamina(cachedSession, consumption.amount);
} }
...@@ -340,8 +350,6 @@ public class MovementManager { ...@@ -340,8 +350,6 @@ public class MovementManager {
return consumption; return consumption;
} }
// TODO: Kamisato Ayaka & Mona
private Consumption getSwimConsumptions() { private Consumption getSwimConsumptions() {
Consumption consumption = new Consumption(ConsumptionType.None); Consumption consumption = new Consumption(ConsumptionType.None);
if (currentState == MotionState.MOTION_SWIM_MOVE) { if (currentState == MotionState.MOTION_SWIM_MOVE) {
...@@ -410,5 +418,25 @@ public class MovementManager { ...@@ -410,5 +418,25 @@ public class MovementManager {
} }
return consumption; 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;
}
} }
...@@ -16,11 +16,9 @@ public class HandlerEvtDoSkillSuccNotify extends PacketHandler { ...@@ -16,11 +16,9 @@ public class HandlerEvtDoSkillSuccNotify extends PacketHandler {
// TODO: Will be used for deducting stamina for charged skills. // TODO: Will be used for deducting stamina for charged skills.
int caster = notify.getCasterId(); int caster = notify.getCasterId();
int skill = notify.getSkillId(); int skillId = notify.getSkillId();
// Grasscutter.getLogger().warn(caster + "\t" + skill); session.getPlayer().getMovementManager().notifySkill(caster, skillId);
// session.getPlayer().getScene().broadcastPacket(new PacketEvtAvatarStandUpNotify(notify));
} }
} }
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment