diff --git a/src/main/java/com/minelittlepony/unicopia/ability/magic/Levelled.java b/src/main/java/com/minelittlepony/unicopia/ability/magic/Levelled.java index a2fe7ea1..84ea1495 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/magic/Levelled.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/magic/Levelled.java @@ -32,6 +32,10 @@ public interface Levelled { void set(int level); + default float getScaled(float max) { + return (1 + ((float)get() / getMax())) * max; + } + default boolean canLevelUp() { int max = getMax(); return max < 0 || get() < max; diff --git a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/RainboomAbilitySpell.java b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/RainboomAbilitySpell.java index e3934a01..b4be5215 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/RainboomAbilitySpell.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/RainboomAbilitySpell.java @@ -88,7 +88,7 @@ public class RainboomAbilitySpell extends AbstractSpell { ((Pony)source).getMagicalReserves().getExhaustion().multiply(0.2F); } - return !source.getEntity().isRemoved() && age++ < 90 + 7 * (source.getLevel().get() + 1); + return !source.getEntity().isRemoved() && age++ < 90 + 7 * source.getLevel().getScaled(9); } private boolean canBreak(BlockPos pos, LivingEntity entity) { diff --git a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/AttractiveSpell.java b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/AttractiveSpell.java index 6983f29e..86bc1edc 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/AttractiveSpell.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/AttractiveSpell.java @@ -36,7 +36,7 @@ public class AttractiveSpell extends ShieldSpell implements ProjectileSpell { @Override public double getDrawDropOffRange(Caster caster) { - return 10 + (caster.getLevel().get() * 2); + return 10 + (caster.getLevel().getScaled(8) * 2); } @Override diff --git a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/AwkwardSpell.java b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/AwkwardSpell.java index 8d1c9faa..24f203bc 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/AwkwardSpell.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/AwkwardSpell.java @@ -25,7 +25,7 @@ public class AwkwardSpell extends AbstractSpell { @Override public boolean tick(Caster source, Situation situation) { if (source.isClient()) { - source.spawnParticles(new Sphere(false, (1 + source.getLevel().get()) * 8), 10, pos -> { + source.spawnParticles(new Sphere(false, (1 + source.getLevel().getScaled(8)) * 8), 10, pos -> { List names = new ArrayList<>(Registry.PARTICLE_TYPE.getIds()); diff --git a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/FireSpell.java b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/FireSpell.java index 511d2c70..e9f764d0 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/FireSpell.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/FireSpell.java @@ -67,7 +67,7 @@ public class FireSpell extends AbstractAreaEffectSpell implements ProjectileSpel } protected void generateParticles(Caster source) { - source.spawnParticles(new Sphere(false, Math.max(0, 4 + getTraits().get(Trait.POWER))), (1 + source.getLevel().get()) * 6, pos -> { + source.spawnParticles(new Sphere(false, Math.max(0, 4 + getTraits().get(Trait.POWER))), (int)(1 + source.getLevel().getScaled(8)) * 6, pos -> { source.addParticle(ParticleTypes.LARGE_SMOKE, pos, Vec3d.ZERO); }); } diff --git a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/InfernoSpell.java b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/InfernoSpell.java index 23bee836..49f23209 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/InfernoSpell.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/InfernoSpell.java @@ -34,7 +34,7 @@ public class InfernoSpell extends FireSpell { World w = source.getReferenceWorld(); if (!w.isClient) { - int radius = 4 + (source.getLevel().get() * 4); + float radius = 4 + (source.getLevel().getScaled(4) * 4); Shape shape = new Sphere(false, radius); Vec3d origin = source.getOriginVector(); diff --git a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/NecromancySpell.java b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/NecromancySpell.java index 2f68e3de..59be0428 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/NecromancySpell.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/NecromancySpell.java @@ -50,7 +50,7 @@ public class NecromancySpell extends AbstractAreaEffectSpell { @Override public boolean tick(Caster source, Situation situation) { - float radius = (source.getLevel().get() + 1) * 4 + getTraits().get(Trait.POWER); + float radius = source.getLevel().getScaled(4) * 4 + getTraits().get(Trait.POWER); if (radius <= 0) { return false; diff --git a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/ShieldSpell.java b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/ShieldSpell.java index f056c5cd..8dafb8ad 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/ShieldSpell.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/ShieldSpell.java @@ -87,7 +87,7 @@ public class ShieldSpell extends AbstractSpell { long costMultiplier = applyEntities(source); if (costMultiplier > 0) { - double cost = 2 + source.getLevel().get(); + double cost = 2 - source.getLevel().getScaled(2); cost *= costMultiplier / ((1 + source.getLevel().get()) * 3F); cost /= 2.725D; @@ -107,7 +107,7 @@ public class ShieldSpell extends AbstractSpell { public double getDrawDropOffRange(Caster source) { float multiplier = source.getMaster() != null && source.getMaster().isSneaking() ? 1 : 2; float min = 4 + getTraits().get(Trait.POWER); - return (min + (source.getLevel().get() * 2)) / multiplier; + return (min + (source.getLevel().getScaled(8) * 2)) / multiplier; } protected boolean isValidTarget(Caster source, Entity entity) { diff --git a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/SiphoningSpell.java b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/SiphoningSpell.java index 394bb5f4..5bc2dd0b 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/SiphoningSpell.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/SiphoningSpell.java @@ -52,7 +52,7 @@ public class SiphoningSpell extends AbstractAreaEffectSpell { } if (source.isClient()) { - int radius = 4 + source.getLevel().get(); + float radius = 4 + source.getLevel().getScaled(5); int direction = isFriendlyTogether(source) ? 1 : -1; source.spawnParticles(new Sphere(true, radius, 1, 0, 1), 1, pos -> { @@ -79,7 +79,7 @@ public class SiphoningSpell extends AbstractAreaEffectSpell { } private Stream getTargets(Caster source) { - return VecHelper.findInRange(null, source.getReferenceWorld(), source.getOriginVector(), 4 + source.getLevel().get(), EntityPredicates.EXCEPT_CREATIVE_OR_SPECTATOR.and(e -> e instanceof LivingEntity)) + return VecHelper.findInRange(null, source.getReferenceWorld(), source.getOriginVector(), 4 + source.getLevel().getScaled(6), EntityPredicates.EXCEPT_CREATIVE_OR_SPECTATOR.and(e -> e instanceof LivingEntity)) .stream() .map(e -> (LivingEntity)e); } @@ -101,7 +101,7 @@ public class SiphoningSpell extends AbstractAreaEffectSpell { setDirty(); } } else { - e.heal((float)Math.min(0.5F * (1 + source.getLevel().get()), maxHealthGain * 0.6)); + e.heal((float)Math.min(source.getLevel().getScaled(e.getHealth()) / 2F, maxHealthGain * 0.6)); ParticleUtils.spawnParticle(e.world, new FollowingParticleEffect(UParticles.HEALTH_DRAIN, e, 0.2F), e.getPos(), Vec3d.ZERO); } }); 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 609a7309..87b90828 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/gui/ManaRingSlot.java +++ b/src/main/java/com/minelittlepony/unicopia/client/gui/ManaRingSlot.java @@ -42,7 +42,7 @@ class ManaRingSlot extends Slot { float max = mana.getMana().getMax(); cost *= 10; - cost /= 1 + pony.getLevel().get(); + cost /= 1 + pony.getLevel().getScaled(3); int color = cost / max > percent ? 0xFF000099 : 0xFFFF0099; diff --git a/src/main/java/com/minelittlepony/unicopia/entity/behaviour/GhastBehaviour.java b/src/main/java/com/minelittlepony/unicopia/entity/behaviour/GhastBehaviour.java index e92d4d0e..9094247f 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/behaviour/GhastBehaviour.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/behaviour/GhastBehaviour.java @@ -31,7 +31,7 @@ public class GhastBehaviour extends MobBehaviour { rot.getX(), rot.getY(), rot.getZ(), - entity.getFireballStrength() * (player.getLevel().get() + 1) + (int)player.getLevel().getScaled(entity.getFireballStrength()) ); proj.updatePosition( entity.getX() + rot.x * 4, 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 d36b683b..5daf4278 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/player/ManaContainer.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/player/ManaContainer.java @@ -85,9 +85,9 @@ public class ManaContainer implements MagicReserves, Tickable { @Override public void set(float value) { float diff = value - get(); - if (diff < 0) { + if (diff > 0) { if (pony.getLevel().canLevelUp()) { - xp.add(-diff / (float)Math.pow(1000, 1 + pony.getLevel().get())); + 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/PlayerLevelStore.java b/src/main/java/com/minelittlepony/unicopia/entity/player/PlayerLevelStore.java index 38a22725..2be9ee25 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/player/PlayerLevelStore.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/player/PlayerLevelStore.java @@ -32,7 +32,7 @@ class PlayerLevelStore implements Levelled.LevelStore { @Override public int getMax() { - return 3; + return 900; } @Override 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 e0afd16d..328a7826 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/player/PlayerPhysics.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/player/PlayerPhysics.java @@ -392,7 +392,7 @@ public class PlayerPhysics extends EntityPhysics implements Tickab } private void tickNaturalFlight(MutableVector velocity) { - int level = pony.getLevel().get() + 1; + float level = pony.getLevel().getScaled(5) + 1; if (ticksInAir > (level * 100)) { Bar mana = pony.getMagicalReserves().getMana(); @@ -482,7 +482,7 @@ public class PlayerPhysics extends EntityPhysics implements Tickab private void moveFlying(MutableVector velocity) { double motion = getHorizontalMotion(); - float forward = 0.000015F * (1 + (pony.getLevel().get() / 10F)) * (float)Math.sqrt(motion); + float forward = 0.000015F * (1 + (pony.getLevel().getScaled(10) / 10F)) * (float)Math.sqrt(motion); // vertical drop due to gravity forward += 0.005F; diff --git a/src/main/java/com/minelittlepony/unicopia/entity/player/Pony.java b/src/main/java/com/minelittlepony/unicopia/entity/player/Pony.java index 7b30a3e3..c2892485 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/player/Pony.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/player/Pony.java @@ -411,7 +411,7 @@ public class Pony extends Living implements Transmittable, Copieab if (!entity.isCreative() && !entity.isSpectator()) { if (extraProtection) { - distance /= (getLevel().get() + 1); + distance /= (getLevel().getScaled(3) + 1); if (entity.isSneaking()) { distance /= 2; }