added boost charge when eating snacks

This commit is contained in:
2025-10-06 17:31:04 +02:00
parent 84de61388e
commit ec76dd5c85
2 changed files with 7 additions and 3 deletions

View File

@@ -122,6 +122,7 @@ class TurtleGame extends StatelessGame {
this.snacks.remove(snack); this.snacks.remove(snack);
snack.remove(); snack.remove();
this.turtlePlayerMap.get(p).increaseScore(); this.turtlePlayerMap.get(p).increaseScore();
this.turtlePlayerMap.get(p).increaseBoostChargeLevel(0.02f);
} }
protected void explode(Player p, Entity bomb) { protected void explode(Player p, Entity bomb) {
@@ -184,7 +185,6 @@ class TurtleGame extends StatelessGame {
meta.setBlock(this.snackBlock.withProperty("half", "upper")); meta.setBlock(this.snackBlock.withProperty("half", "upper"));
meta.setCustomName(Component.text("Snack").color(NamedTextColor.WHITE)); meta.setCustomName(Component.text("Snack").color(NamedTextColor.WHITE));
meta.setCustomNameVisible(true); meta.setCustomNameVisible(true);
meta.setHasGlowingEffect(true);
snack.setInstance(this); snack.setInstance(this);
Pos spawnPosition = this.newSpawnPosition(snack); Pos spawnPosition = this.newSpawnPosition(snack);
if(spawnPosition == null) { if(spawnPosition == null) {

View File

@@ -38,8 +38,7 @@ public class Turtle extends EntityCreature {
public void startBoostRefill() { public void startBoostRefill() {
this.boostRefillTask = MinecraftServer.getSchedulerManager().scheduleTask(() -> { this.boostRefillTask = MinecraftServer.getSchedulerManager().scheduleTask(() -> {
if(this.boostChargeLevel >= 1f) return; if(this.boostChargeLevel >= 1f) return;
this.boostChargeLevel = Math.min(1f, this.boostChargeLevel + 0.025f); this.increaseBoostChargeLevel(0.02f);
this.player.setExp(this.boostChargeLevel);
}, TaskSchedule.seconds(1), TaskSchedule.seconds(1)); }, TaskSchedule.seconds(1), TaskSchedule.seconds(1));
} }
@@ -88,6 +87,11 @@ public class Turtle extends EntityCreature {
this.boostSpeedMultiplier = 1; this.boostSpeedMultiplier = 1;
} }
public void increaseBoostChargeLevel(float amount) {
this.boostChargeLevel = Math.min(1f, this.boostChargeLevel + amount);
this.player.setExp(this.boostChargeLevel);
}
public void addSpeed(double amount) { public void addSpeed(double amount) {
this.speed += amount; this.speed += amount;
} }