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

This commit is contained in:
ImmuState 2022-05-20 15:57:59 -07:00 committed by Melledy
parent 531683f370
commit 1d2fde40d5
3 changed files with 14 additions and 2 deletions

View File

@ -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 {
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());
if (GAME_OPTIONS.energyUsage) {
this.setFightProperty(element.getCurEnergyProp(), currentEnergy); this.setFightProperty(element.getCurEnergyProp(), currentEnergy);
//this.setFightProperty((element.getMaxEnergyProp().getId() % 70) + 1000, data.getSkillDepot().getEnergySkillData().getCostElemVal()); }
else {
this.setFightProperty(element.getCurEnergyProp(), data.getSkillDepot().getEnergySkillData().getCostElemVal());
}
} }
// Artifacts // Artifacts

View File

@ -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)

View File

@ -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 {