Commit 2a3708ee authored by gentlespoon's avatar gentlespoon Committed by Melledy
Browse files

Talent moving stamina cost

parent 99dbac8a
...@@ -2,27 +2,22 @@ package emu.grasscutter.game.ability; ...@@ -2,27 +2,22 @@ package emu.grasscutter.game.ability;
import com.google.protobuf.InvalidProtocolBufferException; import com.google.protobuf.InvalidProtocolBufferException;
import emu.grasscutter.Grasscutter;
import emu.grasscutter.data.GameData; import emu.grasscutter.data.GameData;
import emu.grasscutter.data.custom.AbilityModifier;
import emu.grasscutter.data.custom.AbilityModifier.AbilityModifierAction; import emu.grasscutter.data.custom.AbilityModifier.AbilityModifierAction;
import emu.grasscutter.data.custom.AbilityModifier.AbilityModifierActionType;
import emu.grasscutter.data.def.ItemData; import emu.grasscutter.data.def.ItemData;
import emu.grasscutter.data.custom.AbilityModifierEntry; import emu.grasscutter.data.custom.AbilityModifierEntry;
import emu.grasscutter.game.entity.EntityItem; import emu.grasscutter.game.entity.EntityItem;
import emu.grasscutter.game.entity.GameEntity; import emu.grasscutter.game.entity.GameEntity;
import emu.grasscutter.game.player.Player; import emu.grasscutter.game.player.Player;
import emu.grasscutter.net.proto.AbilityActionGenerateElemBallOuterClass.AbilityActionGenerateElemBall; import emu.grasscutter.net.proto.AbilityActionGenerateElemBallOuterClass.AbilityActionGenerateElemBall;
import emu.grasscutter.net.proto.AbilityInvokeArgumentOuterClass.AbilityInvokeArgument;
import emu.grasscutter.net.proto.AbilityInvokeEntryHeadOuterClass.AbilityInvokeEntryHead; import emu.grasscutter.net.proto.AbilityInvokeEntryHeadOuterClass.AbilityInvokeEntryHead;
import emu.grasscutter.net.proto.AbilityInvokeEntryOuterClass.AbilityInvokeEntry; import emu.grasscutter.net.proto.AbilityInvokeEntryOuterClass.AbilityInvokeEntry;
import emu.grasscutter.net.proto.AbilityMetaModifierChangeOuterClass.AbilityMetaModifierChange; import emu.grasscutter.net.proto.AbilityMetaModifierChangeOuterClass.AbilityMetaModifierChange;
import emu.grasscutter.net.proto.AbilityMetaReInitOverrideMapOuterClass.AbilityMetaReInitOverrideMap; import emu.grasscutter.net.proto.AbilityMetaReInitOverrideMapOuterClass.AbilityMetaReInitOverrideMap;
import emu.grasscutter.net.proto.AbilityScalarTypeOuterClass.AbilityScalarType; import emu.grasscutter.net.proto.AbilityMixinCostStaminaOuterClass.AbilityMixinCostStamina;
import emu.grasscutter.net.proto.AbilityScalarValueEntryOuterClass.AbilityScalarValueEntry; import emu.grasscutter.net.proto.AbilityScalarValueEntryOuterClass.AbilityScalarValueEntry;
import emu.grasscutter.net.proto.ModifierActionOuterClass.ModifierAction; import emu.grasscutter.net.proto.ModifierActionOuterClass.ModifierAction;
import emu.grasscutter.utils.Position; import emu.grasscutter.utils.Position;
import emu.grasscutter.utils.Utils;
public class AbilityManager { public class AbilityManager {
private Player player; private Player player;
...@@ -138,13 +133,9 @@ public class AbilityManager { ...@@ -138,13 +133,9 @@ public class AbilityManager {
} }
} }
private void handleMixinCostStamina(AbilityInvokeEntry invoke) { private void handleMixinCostStamina(AbilityInvokeEntry invoke) throws InvalidProtocolBufferException {
// Not the right way of doing this AbilityMixinCostStamina costStamina = AbilityMixinCostStamina.parseFrom((invoke.getAbilityData()));
if (Grasscutter.getConfig().OpenStamina) { getPlayer().getStaminaManager().handleMixinCostStamina(costStamina.getIsSwim());
// getPlayer().getStaminaManager().updateStamina(getPlayer().getSession(), -450);
// TODO
// set flag in stamina/movement manager that specifies the player is currently using an alternate sprint
}
} }
private void handleGenerateElemBall(AbilityInvokeEntry invoke) throws InvalidProtocolBufferException { private void handleGenerateElemBall(AbilityInvokeEntry invoke) throws InvalidProtocolBufferException {
......
package emu.grasscutter.game.managers.StaminaManager; package emu.grasscutter.game.managers.StaminaManager;
public class Consumption { public class Consumption {
public ConsumptionType consumptionType; public ConsumptionType type = ConsumptionType.None;
public int amount; public int amount = 0;
public Consumption(ConsumptionType ct, int a) { public Consumption(ConsumptionType type, int amount) {
consumptionType = ct; this.type = type;
amount = a; this.amount = amount;
} }
public Consumption(ConsumptionType ct) { public Consumption(ConsumptionType type) {
this(ct, ct.amount); this(type, type.amount);
}
public Consumption() {
} }
} }
...@@ -4,23 +4,29 @@ public enum ConsumptionType { ...@@ -4,23 +4,29 @@ public enum ConsumptionType {
None(0), None(0),
// consume // consume
CLIMB_START(-500),
CLIMBING(-150), CLIMBING(-150),
CLIMB_START(-500),
CLIMB_JUMP(-2500), CLIMB_JUMP(-2500),
SPRINT(-1800),
DASH(-360), DASH(-360),
FIGHT(0), // See StaminaManager.getFightConsumption()
FLY(-60), FLY(-60),
// Slow swimming is handled per movement, not per second.
// Arm movement frequency depends on gender/age/height.
// TODO: Instead of cost -80 per tick, find a proper way to calculate cost.
SKIFF(-300), // TODO: Get real value
SPRINT(-1800),
SWIM_DASH_START(-20), SWIM_DASH_START(-20),
SWIM_DASH(-204), SWIM_DASH(-204), // -10.2 per second, 5Hz = -204 each tick
SWIMMING(-80), // TODO: Slow swimming is handled per movement, not per second. Movement frequency depends on gender/age/height. SWIMMING(-80),
FIGHT(0), // See StaminaManager.getFightConsumption() TALENT_DASH(-300), // -1500 per second, 5Hz = -300 each tick
TALENT_DASH_START(-1000),
// restore // restore
STANDBY(500), POWERED_FLY(500), // TODO: Get real value
POWERED_SKIFF(2000), // TODO: Get real value
RUN(500), RUN(500),
WALK(500), STANDBY(500),
STANDBY_MOVE(500), WALK(500);
POWERED_FLY(500);
public final int amount; public final int amount;
......
...@@ -30,7 +30,7 @@ public enum PlayerProperty { ...@@ -30,7 +30,7 @@ public enum PlayerProperty {
// his gems and then got a money refund, so negative is allowed. // his gems and then got a money refund, so negative is allowed.
PROP_PLAYER_SCOIN (10016), // Mora [0, +inf) PROP_PLAYER_SCOIN (10016), // Mora [0, +inf)
PROP_PLAYER_MP_SETTING_TYPE (10017), // Do you allow other players to join your game? [0=no 1=direct 2=approval] PROP_PLAYER_MP_SETTING_TYPE (10017), // Do you allow other players to join your game? [0=no 1=direct 2=approval]
PROP_IS_MP_MODE_AVAILABLE (10018), // Are you not in a quest or something that disables MP? [0, 1] PROP_IS_MP_MODE_AVAILABLE (10018), // 0 if in quest or something that disables MP [0, 1]
PROP_PLAYER_WORLD_LEVEL (10019), // [0, 8] PROP_PLAYER_WORLD_LEVEL (10019), // [0, 8]
PROP_PLAYER_RESIN (10020), // Original Resin [0, +inf) PROP_PLAYER_RESIN (10020), // Original Resin [0, +inf)
PROP_PLAYER_WAIT_SUB_HCOIN (10022), PROP_PLAYER_WAIT_SUB_HCOIN (10022),
......
...@@ -4,7 +4,9 @@ import emu.grasscutter.net.packet.Opcodes; ...@@ -4,7 +4,9 @@ import emu.grasscutter.net.packet.Opcodes;
import emu.grasscutter.net.packet.PacketHandler; import emu.grasscutter.net.packet.PacketHandler;
import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.EvtDoSkillSuccNotifyOuterClass.EvtDoSkillSuccNotify; import emu.grasscutter.net.proto.EvtDoSkillSuccNotifyOuterClass.EvtDoSkillSuccNotify;
import emu.grasscutter.net.proto.VectorOuterClass.Vector;
import emu.grasscutter.server.game.GameSession; import emu.grasscutter.server.game.GameSession;
import emu.grasscutter.utils.Position;
@Opcodes(PacketOpcodes.EvtDoSkillSuccNotify) @Opcodes(PacketOpcodes.EvtDoSkillSuccNotify)
public class HandlerEvtDoSkillSuccNotify extends PacketHandler { public class HandlerEvtDoSkillSuccNotify extends PacketHandler {
...@@ -12,9 +14,10 @@ public class HandlerEvtDoSkillSuccNotify extends PacketHandler { ...@@ -12,9 +14,10 @@ public class HandlerEvtDoSkillSuccNotify extends PacketHandler {
@Override @Override
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
EvtDoSkillSuccNotify notify = EvtDoSkillSuccNotify.parseFrom(payload); EvtDoSkillSuccNotify notify = EvtDoSkillSuccNotify.parseFrom(payload);
// TODO: Will be used for deducting stamina for charged skills. int skillId = notify.getSkillId();
int casterId = notify.getCasterId();
session.getPlayer().getStaminaManager().handleEvtDoSkillSuccNotify(session, notify); Vector forwardVector = notify.getForward();
Position forward = new Position(forwardVector.getX(), forwardVector.getY(), forwardVector.getZ());
session.getPlayer().getStaminaManager().handleEvtDoSkillSuccNotify(session, skillId, casterId);
} }
} }
Markdown is supported
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