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;
import com.google.protobuf.InvalidProtocolBufferException;
import emu.grasscutter.Grasscutter;
import emu.grasscutter.data.GameData;
import emu.grasscutter.data.custom.AbilityModifier;
import emu.grasscutter.data.custom.AbilityModifier.AbilityModifierAction;
import emu.grasscutter.data.custom.AbilityModifier.AbilityModifierActionType;
import emu.grasscutter.data.def.ItemData;
import emu.grasscutter.data.custom.AbilityModifierEntry;
import emu.grasscutter.game.entity.EntityItem;
import emu.grasscutter.game.entity.GameEntity;
import emu.grasscutter.game.player.Player;
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.AbilityInvokeEntryOuterClass.AbilityInvokeEntry;
import emu.grasscutter.net.proto.AbilityMetaModifierChangeOuterClass.AbilityMetaModifierChange;
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.ModifierActionOuterClass.ModifierAction;
import emu.grasscutter.utils.Position;
import emu.grasscutter.utils.Utils;
public class AbilityManager {
private Player player;
......@@ -138,13 +133,9 @@ public class AbilityManager {
}
}
private void handleMixinCostStamina(AbilityInvokeEntry invoke) {
// Not the right way of doing this
if (Grasscutter.getConfig().OpenStamina) {
// 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 handleMixinCostStamina(AbilityInvokeEntry invoke) throws InvalidProtocolBufferException {
AbilityMixinCostStamina costStamina = AbilityMixinCostStamina.parseFrom((invoke.getAbilityData()));
getPlayer().getStaminaManager().handleMixinCostStamina(costStamina.getIsSwim());
}
private void handleGenerateElemBall(AbilityInvokeEntry invoke) throws InvalidProtocolBufferException {
......
package emu.grasscutter.game.managers.StaminaManager;
public class Consumption {
public ConsumptionType consumptionType;
public int amount;
public ConsumptionType type = ConsumptionType.None;
public int amount = 0;
public Consumption(ConsumptionType ct, int a) {
consumptionType = ct;
amount = a;
public Consumption(ConsumptionType type, int amount) {
this.type = type;
this.amount = amount;
}
public Consumption(ConsumptionType ct) {
this(ct, ct.amount);
public Consumption(ConsumptionType type) {
this(type, type.amount);
}
public Consumption() {
}
}
......@@ -4,23 +4,29 @@ public enum ConsumptionType {
None(0),
// consume
CLIMB_START(-500),
CLIMBING(-150),
CLIMB_START(-500),
CLIMB_JUMP(-2500),
SPRINT(-1800),
DASH(-360),
FIGHT(0), // See StaminaManager.getFightConsumption()
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(-204),
SWIMMING(-80), // TODO: Slow swimming is handled per movement, not per second. Movement frequency depends on gender/age/height.
FIGHT(0), // See StaminaManager.getFightConsumption()
SWIM_DASH(-204), // -10.2 per second, 5Hz = -204 each tick
SWIMMING(-80),
TALENT_DASH(-300), // -1500 per second, 5Hz = -300 each tick
TALENT_DASH_START(-1000),
// restore
STANDBY(500),
POWERED_FLY(500), // TODO: Get real value
POWERED_SKIFF(2000), // TODO: Get real value
RUN(500),
WALK(500),
STANDBY_MOVE(500),
POWERED_FLY(500);
STANDBY(500),
WALK(500);
public final int amount;
......
......@@ -30,7 +30,7 @@ public enum PlayerProperty {
// his gems and then got a money refund, so negative is allowed.
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_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_RESIN (10020), // Original Resin [0, +inf)
PROP_PLAYER_WAIT_SUB_HCOIN (10022),
......
......@@ -4,7 +4,9 @@ import emu.grasscutter.net.packet.Opcodes;
import emu.grasscutter.net.packet.PacketHandler;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.EvtDoSkillSuccNotifyOuterClass.EvtDoSkillSuccNotify;
import emu.grasscutter.net.proto.VectorOuterClass.Vector;
import emu.grasscutter.server.game.GameSession;
import emu.grasscutter.utils.Position;
@Opcodes(PacketOpcodes.EvtDoSkillSuccNotify)
public class HandlerEvtDoSkillSuccNotify extends PacketHandler {
......@@ -12,9 +14,10 @@ public class HandlerEvtDoSkillSuccNotify extends PacketHandler {
@Override
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
EvtDoSkillSuccNotify notify = EvtDoSkillSuccNotify.parseFrom(payload);
// TODO: Will be used for deducting stamina for charged skills.
session.getPlayer().getStaminaManager().handleEvtDoSkillSuccNotify(session, notify);
int skillId = notify.getSkillId();
int casterId = notify.getCasterId();
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