Commit 1d2fde40 authored by ImmuState's avatar ImmuState Committed by Melledy
Browse files

Make energy usage configurable, and preserve current behavior as the default.

parent 531683f3
...@@ -62,6 +62,8 @@ import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap; ...@@ -62,6 +62,8 @@ import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import static emu.grasscutter.Configuration.GAME_OPTIONS;
@Entity(value = "avatars", useDiscriminator = false) @Entity(value = "avatars", useDiscriminator = false)
public class Avatar { public class Avatar {
@Id private ObjectId id; @Id private ObjectId id;
...@@ -517,8 +519,13 @@ public class Avatar { ...@@ -517,8 +519,13 @@ public class Avatar {
if (data.getSkillDepot() != null && data.getSkillDepot().getEnergySkillData() != null) { if (data.getSkillDepot() != null && data.getSkillDepot().getEnergySkillData() != null) {
ElementType element = data.getSkillDepot().getElementType(); ElementType element = data.getSkillDepot().getElementType();
this.setFightProperty(element.getMaxEnergyProp(), data.getSkillDepot().getEnergySkillData().getCostElemVal()); this.setFightProperty(element.getMaxEnergyProp(), data.getSkillDepot().getEnergySkillData().getCostElemVal());
this.setFightProperty(element.getCurEnergyProp(), currentEnergy);
//this.setFightProperty((element.getMaxEnergyProp().getId() % 70) + 1000, data.getSkillDepot().getEnergySkillData().getCostElemVal()); if (GAME_OPTIONS.energyUsage) {
this.setFightProperty(element.getCurEnergyProp(), currentEnergy);
}
else {
this.setFightProperty(element.getCurEnergyProp(), data.getSkillDepot().getEnergySkillData().getCostElemVal());
}
} }
// Artifacts // Artifacts
......
...@@ -621,6 +621,10 @@ public class TeamManager { ...@@ -621,6 +621,10 @@ public class TeamManager {
} }
public void handleEvtDoSkillSuccNotify(GameSession session, int skillId, int casterId) { public void handleEvtDoSkillSuccNotify(GameSession session, int skillId, int casterId) {
if (!GAME_OPTIONS.energyUsage) {
return;
}
// Determine the entity that has cast the skill. // Determine the entity that has cast the skill.
Optional<EntityAvatar> caster = this.getActiveTeam().stream() Optional<EntityAvatar> caster = this.getActiveTeam().stream()
.filter(character -> character.getId() == casterId) .filter(character -> character.getId() == casterId)
......
...@@ -176,6 +176,7 @@ public class ConfigContainer { ...@@ -176,6 +176,7 @@ public class ConfigContainer {
public boolean watchGachaConfig = false; public boolean watchGachaConfig = false;
public boolean enableShopItems = true; public boolean enableShopItems = true;
public boolean staminaUsage = true; public boolean staminaUsage = true;
public boolean energyUsage = false;
public Rates rates = new Rates(); public Rates rates = new Rates();
public static class InventoryLimits { public static class InventoryLimits {
......
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