From 312afe3d46d3383147e9e4d7374f9e76cfdc3ab8 Mon Sep 17 00:00:00 2001 From: Sollace Date: Fri, 9 Oct 2020 19:35:47 +0200 Subject: [PATCH] Fixed mana not being consumed at correct rates and added a ring for the xp progress --- .../minelittlepony/unicopia/client/gui/ManaRingSlot.java | 4 +++- .../unicopia/entity/player/MagicReserves.java | 6 ++++++ .../unicopia/entity/player/ManaContainer.java | 6 ++---- .../unicopia/entity/player/PlayerPhysics.java | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/minelittlepony/unicopia/client/gui/ManaRingSlot.java b/src/main/java/com/minelittlepony/unicopia/client/gui/ManaRingSlot.java index 7184f262..9c21a071 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/gui/ManaRingSlot.java +++ b/src/main/java/com/minelittlepony/unicopia/client/gui/ManaRingSlot.java @@ -35,6 +35,8 @@ class ManaRingSlot extends Slot { arcBegin = renderRing(matrices, 17, 13, 0, mana.getMana(), 0xFF88FF99); if (!uHud.client.player.isCreative()) { + renderRing(matrices, 13, 11, 0, mana.getXp(), 0x88880099); + double cost = abilities.getStats().stream() .mapToDouble(s -> s.getCost(KeyBindingsHandler.INSTANCE.page)) .reduce(Double::sum) @@ -44,7 +46,7 @@ class ManaRingSlot extends Slot { float percent = mana.getMana().getPercentFill(); float max = mana.getMana().getMax(); - cost = Math.min(max, cost) / max; + cost = Math.min(max, cost * 10) / max; cost = Math.min(percent, cost); diff --git a/src/main/java/com/minelittlepony/unicopia/entity/player/MagicReserves.java b/src/main/java/com/minelittlepony/unicopia/entity/player/MagicReserves.java index 14ad9026..83624519 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/player/MagicReserves.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/player/MagicReserves.java @@ -20,6 +20,12 @@ public interface MagicReserves { */ Bar getMana(); + /** + * The progress to the next experience level. + * This is increased slowly by performing actions that consume mana. + */ + Bar getXp(); + public interface Bar { /** diff --git a/src/main/java/com/minelittlepony/unicopia/entity/player/ManaContainer.java b/src/main/java/com/minelittlepony/unicopia/entity/player/ManaContainer.java index 31e6cd37..dca16f81 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/player/ManaContainer.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/player/ManaContainer.java @@ -34,6 +34,7 @@ public class ManaContainer implements MagicReserves { return mana; } + @Override public Bar getXp() { return xp; } @@ -49,10 +50,7 @@ public class ManaContainer implements MagicReserves { float diff = value - get(); if (diff < 0) { if (pony.getLevel().canLevelUp()) { - - diff /= Math.pow(1000, 1 + pony.getLevel().get()); - - xp.add(-diff); + xp.add(-diff / (float)Math.pow(1000, 1 + pony.getLevel().get())); if (xp.getPercentFill() >= 1) { pony.getLevel().add(1); xp.set(0); diff --git a/src/main/java/com/minelittlepony/unicopia/entity/player/PlayerPhysics.java b/src/main/java/com/minelittlepony/unicopia/entity/player/PlayerPhysics.java index ee17ed87..877bebeb 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/player/PlayerPhysics.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/player/PlayerPhysics.java @@ -130,7 +130,7 @@ public class PlayerPhysics extends EntityPhysics implements Tickable, Moti if (ticksInAir++ > (level * 100)) { Bar mana = pony.getMagicalReserves().getMana(); - mana.add((int)(-getHorizontalMotion(entity) * 50 / level)); + mana.add((float)-getHorizontalMotion(entity) * 20F / level); if (mana.getPercentFill() < 0.2) { pony.getMagicalReserves().getExertion().add(2);