mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-30 16:28:00 +01:00
Change level effects to be scaled so we can allow arbitrarily high caster levels
This commit is contained in:
parent
bb09feca7e
commit
0bc9f447f6
15 changed files with 23 additions and 19 deletions
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<Identifier> names = new ArrayList<>(Registry.PARTICLE_TYPE.getIds());
|
||||
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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<LivingEntity> 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);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ public class GhastBehaviour extends MobBehaviour<GhastEntity> {
|
|||
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,
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -32,7 +32,7 @@ class PlayerLevelStore implements Levelled.LevelStore {
|
|||
|
||||
@Override
|
||||
public int getMax() {
|
||||
return 3;
|
||||
return 900;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -392,7 +392,7 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> 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<PlayerEntity> 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;
|
||||
|
|
|
@ -411,7 +411,7 @@ public class Pony extends Living<PlayerEntity> implements Transmittable, Copieab
|
|||
if (!entity.isCreative() && !entity.isSpectator()) {
|
||||
|
||||
if (extraProtection) {
|
||||
distance /= (getLevel().get() + 1);
|
||||
distance /= (getLevel().getScaled(3) + 1);
|
||||
if (entity.isSneaking()) {
|
||||
distance /= 2;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue