Skip to content

Commit

Permalink
Funny balancing
Browse files Browse the repository at this point in the history
  • Loading branch information
enjarai committed Aug 13, 2024
1 parent ee5c1fb commit f6da13d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import dev.enjarai.trickster.spell.trick.Trick;
import dev.enjarai.trickster.spell.trick.blunder.BlunderException;
import dev.enjarai.trickster.spell.trick.blunder.UnknownEntityBlunder;
import net.minecraft.util.math.MathHelper;
import virtuoel.pehkui.api.ScaleTypes;

import java.util.List;
Expand All @@ -23,12 +24,12 @@ public Fragment activate(SpellContext ctx, List<Fragment> fragments) throws Blun

fragments = tryWard(ctx, target, fragments);

var scale = expectInput(fragments, FragmentType.NUMBER, 1);
var scale = MathHelper.clamp(expectInput(fragments, FragmentType.NUMBER, 1).number(), 0.0625, 5.0);
var scaleData = ScaleTypes.BASE.getScaleData(target);

var difference = Math.abs(scale.number() - scaleData.getScale());
ctx.useMana(this, (float) (difference * difference * 10));
scaleData.setScale((float) scale.number());
var difference = Math.abs(scale - scaleData.getScale());
ctx.useMana(this, (float) (difference * difference * 10 + scale * 50));
scaleData.setScale((float) scale);

return BooleanFragment.TRUE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ Returns the scale of the given entity.

entity, number -> boolean

<|cost-rule@trickster:templates|formula=abs(currentScale - newScale)^2 * 10|>
<|cost-rule@trickster:templates|formula=abs(currentScale - newScale)^2 * 10kG + newScale * 50kG|>

Changes the scale of the given entity.
Changes the scale of the given entity. Entities cannot be scaled below 0.0625 or above 5 times their usual size.

0 comments on commit f6da13d

Please sign in to comment.