mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-21 12:24:22 +01:00
Account for corruption when computing a unicorn's job title
This commit is contained in:
parent
edad4678ca
commit
518c418072
3 changed files with 33 additions and 24 deletions
|
@ -40,7 +40,7 @@ public class SpellbookProfilePageContent extends DrawableHelper implements Spell
|
||||||
int currentLevel = pony.getLevel().get();
|
int currentLevel = pony.getLevel().get();
|
||||||
|
|
||||||
DrawableUtil.drawScaledText(matrices, pony.getEntity().getName(), SpellbookScreen.TITLE_X, y, 1.3F, SpellbookScreen.TITLE_COLOR);
|
DrawableUtil.drawScaledText(matrices, pony.getEntity().getName(), SpellbookScreen.TITLE_X, y, 1.3F, SpellbookScreen.TITLE_COLOR);
|
||||||
DrawableUtil.drawScaledText(matrices, ExperienceGroup.forLevel(currentLevel).getLabel(), SpellbookScreen.TITLE_X, y + 13, 0.8F, 0xAA0040FF);
|
DrawableUtil.drawScaledText(matrices, ExperienceGroup.forLevel(currentLevel, pony.getCorruption().get()), SpellbookScreen.TITLE_X, y + 13, 0.8F, 0xAA0040FF);
|
||||||
|
|
||||||
MagicReserves reserves = pony.getMagicalReserves();
|
MagicReserves reserves = pony.getMagicalReserves();
|
||||||
|
|
||||||
|
|
|
@ -180,6 +180,7 @@ public class SpellbookScreen extends HandledScreen<SpellbookScreenHandler> imple
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawForeground(MatrixStack matrices, int mouseX, int mouseY) {
|
protected void drawForeground(MatrixStack matrices, int mouseX, int mouseY) {
|
||||||
|
this.clearAndInit();
|
||||||
chapters.getCurrentChapter().content().ifPresent(content -> content.draw(matrices, mouseX, mouseY, (IViewRoot)this));
|
chapters.getCurrentChapter().content().ifPresent(content -> content.draw(matrices, mouseX, mouseY, (IViewRoot)this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,31 +3,39 @@ package com.minelittlepony.unicopia.entity.player;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
public enum ExperienceGroup {
|
public record ExperienceGroup (String experience, String corruption) {
|
||||||
MAGICAL_KINDERGARTENER,
|
public static final LinearSelector<String> EXPERIENCES = new LinearSelector<>(new String[] {
|
||||||
FRIENDSHIP_STUDENT,
|
"MAGICAL_KINDERGARTENER",
|
||||||
SENIOR_FRIENDSHIP_STUDENT,
|
"FRIENDSHIP_STUDENT",
|
||||||
JUNIOR_MAGE,
|
"SENIOR_FRIENDSHIP_STUDENT",
|
||||||
MAGE,
|
"JUNIOR_MAGE",
|
||||||
ARCHMAGE,
|
"MAGE",
|
||||||
ARCHMAGUS,
|
"ARCHMAGE",
|
||||||
SENIOR_ARCHMAGUS,
|
"ARCHMAGUS",
|
||||||
ASCENDED_SENIOR_ARCHMAGUS,
|
"SENIOR_ARCHMAGUS",
|
||||||
DEMI_GOD,
|
"ASCENDED_SENIOR_ARCHMAGUS",
|
||||||
ARCH_DEMI_GOD,
|
"DEMI_GOD",
|
||||||
ALICORN_PRINCESS,
|
"ARCH_DEMI_GOD",
|
||||||
POLYCORN_PRINCESS,
|
"ALICORN_PRINCESS",
|
||||||
FAUSTIAN_LEGEND;
|
"POLYCORN_PRINCESS",
|
||||||
|
"FAUSTIAN_LEGEND"
|
||||||
|
}, 2);
|
||||||
|
public static final LinearSelector<String> CORRUPTIONS = new LinearSelector<>(new String[] {
|
||||||
|
"PURE",
|
||||||
|
"IMPURE",
|
||||||
|
"TAINTED",
|
||||||
|
"TWISTED",
|
||||||
|
"CORRUPT",
|
||||||
|
"MONSTROUS"
|
||||||
|
}, 1F/8F);
|
||||||
|
|
||||||
private final Text label = Text.literal(name().toLowerCase());
|
public static Text forLevel(int level, int corruption) {
|
||||||
|
return Text.of(CORRUPTIONS.get(corruption).toLowerCase() + " " + EXPERIENCES.get(level).toLowerCase());
|
||||||
public Text getLabel() {
|
|
||||||
return label;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ExperienceGroup forLevel(int level) {
|
public record LinearSelector<T> (T[] values, float ratio) {
|
||||||
level /= 20;
|
public T get(int level) {
|
||||||
level = MathHelper.clamp(level, 0, values().length - 1);
|
return values()[MathHelper.clamp(MathHelper.floor(MathHelper.sqrt(level * ratio())), 0, values().length - 1)];
|
||||||
return values()[level];
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue