Fix EnergyManager indentation.

This commit is contained in:
ImmuState 2022-05-22 12:50:28 -07:00 committed by Melledy
parent ab1341f0d9
commit 922ae91771

View File

@ -24,20 +24,20 @@ import java.util.Optional;
import com.google.protobuf.InvalidProtocolBufferException; import com.google.protobuf.InvalidProtocolBufferException;
public class EnergyManager { public class EnergyManager {
private final Player player; private final Player player;
public EnergyManager(Player player) { public EnergyManager(Player player) {
this.player = player; this.player = player;
} }
public Player getPlayer() { public Player getPlayer() {
return this.player; return this.player;
} }
/********** /**********
Particle creation for elemental skills. Particle creation for elemental skills.
**********/ **********/
private int getCastingAvatarIdForElemBall(int invokeEntityId) { private int getCastingAvatarIdForElemBall(int invokeEntityId) {
// To determine the avatar that has cast the skill that caused the energy particle to be generated, // To determine the avatar that has cast the skill that caused the energy particle to be generated,
// we have to look at the entity that has invoked the ability. This can either be that avatar directly, // we have to look at the entity that has invoked the ability. This can either be that avatar directly,
// or it can be an `EntityClientGadget`, owned (some way up the owner hierarchy) by the avatar // or it can be an `EntityClientGadget`, owned (some way up the owner hierarchy) by the avatar
@ -65,7 +65,7 @@ public class EnergyManager {
return res; return res;
} }
public void handleGenerateElemBall(AbilityInvokeEntry invoke) throws InvalidProtocolBufferException { public void handleGenerateElemBall(AbilityInvokeEntry invoke) throws InvalidProtocolBufferException {
// ToDo: // ToDo:
// This is also called when a weapon like Favonius Warbow etc. creates energy through its passive. // This is also called when a weapon like Favonius Warbow etc. creates energy through its passive.
// We are not handling this correctly at the moment. // We are not handling this correctly at the moment.
@ -130,11 +130,11 @@ public class EnergyManager {
this.getPlayer().getScene().addEntity(energyBall); this.getPlayer().getScene().addEntity(energyBall);
} }
/********** /**********
Pickup of elemental particles and orbs. Pickup of elemental particles and orbs.
**********/ **********/
public void handlePickupElemBall(GameItem elemBall) { public void handlePickupElemBall(GameItem elemBall) {
// Check if the item is indeed an energy particle/orb. // Check if the item is indeed an energy particle/orb.
if (elemBall.getItemId() < 2001 ||elemBall.getItemId() > 2024) { if (elemBall.getItemId() < 2001 ||elemBall.getItemId() > 2024) {
return; return;
} }
@ -150,10 +150,10 @@ public class EnergyManager {
// On-field vs off-field multiplier. // On-field vs off-field multiplier.
// The on-field character gets no penalty. // The on-field character gets no penalty.
// Off-field characters get a penalty depending on the team size, as follows: // Off-field characters get a penalty depending on the team size, as follows:
// - 2 character team: 0.8 // - 2 character team: 0.8
// - 3 character team: 0.7 // - 3 character team: 0.7
// - 4 character team: 0.6 // - 4 character team: 0.6
// - etc. // - etc.
// We set a lower bound of 0.1 here, to avoid gaining no or negative energy. // We set a lower bound of 0.1 here, to avoid gaining no or negative energy.
float offFieldPenalty = float offFieldPenalty =
(this.player.getTeamManager().getCurrentCharacterIndex() == i) (this.player.getTeamManager().getCurrentCharacterIndex() == i)
@ -185,37 +185,37 @@ public class EnergyManager {
// Add the energy. // Add the energy.
entity.addEnergy(baseEnergy * elementBonus * offFieldPenalty, PropChangeReason.PROP_CHANGE_ENERGY_BALL); entity.addEnergy(baseEnergy * elementBonus * offFieldPenalty, PropChangeReason.PROP_CHANGE_ENERGY_BALL);
} }
} }
/********** /**********
Energy logic related to using skills. Energy logic related to using skills.
**********/ **********/
private void handleBurstCast(Avatar avatar, int skillId) { private void handleBurstCast(Avatar avatar, int skillId) {
// Don't do anything if energy usage is disabled. // Don't do anything if energy usage is disabled.
if (!GAME_OPTIONS.energyUsage) { if (!GAME_OPTIONS.energyUsage) {
return; return;
} }
// If the cast skill was a burst, consume energy. // If the cast skill was a burst, consume energy.
if (avatar.getSkillDepot() != null && skillId == avatar.getSkillDepot().getEnergySkill()) { if (avatar.getSkillDepot() != null && skillId == avatar.getSkillDepot().getEnergySkill()) {
avatar.getAsEntity().clearEnergy(PropChangeReason.PROP_CHANGE_ABILITY); avatar.getAsEntity().clearEnergy(PropChangeReason.PROP_CHANGE_ABILITY);
} }
} }
public void handleEvtDoSkillSuccNotify(GameSession session, int skillId, int casterId) { public void handleEvtDoSkillSuccNotify(GameSession session, int skillId, int casterId) {
// Determine the entity that has cast the skill. Cancel if we can't find that avatar. // Determine the entity that has cast the skill. Cancel if we can't find that avatar.
Optional<EntityAvatar> caster = this.player.getTeamManager().getActiveTeam().stream() Optional<EntityAvatar> caster = this.player.getTeamManager().getActiveTeam().stream()
.filter(character -> character.getId() == casterId) .filter(character -> character.getId() == casterId)
.findFirst(); .findFirst();
if (caster.isEmpty()) { if (caster.isEmpty()) {
return; return;
} }
Avatar avatar = caster.get().getAvatar(); Avatar avatar = caster.get().getAvatar();
// Handle elemental burst. // Handle elemental burst.
this.handleBurstCast(avatar, skillId); this.handleBurstCast(avatar, skillId);
} }
} }