mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-01 19:46:42 +01:00
Display the amount of corruption you would gain from casting a spell
This commit is contained in:
parent
95ffe5b0b5
commit
8a3abf5622
5 changed files with 13 additions and 6 deletions
|
@ -45,7 +45,7 @@ public enum Affinity implements StringIdentifiable {
|
|||
}
|
||||
|
||||
public Text getDisplayName() {
|
||||
return Text.translatable(getTranslationKey());
|
||||
return Text.translatable(getTranslationKey()).formatted(getColor());
|
||||
}
|
||||
|
||||
public int getCorruption() {
|
||||
|
|
|
@ -194,7 +194,7 @@ public class DismissSpellScreen extends GameGui {
|
|||
tooltip.add(Text.translatable("gui.unicopia.dispell_screen.spell_type", name));
|
||||
type.traits().appendTooltip(tooltip);
|
||||
tooltip.add(ScreenTexts.EMPTY);
|
||||
tooltip.add(Text.translatable("gui.unicopia.dispell_screen.affinity", affinity.getDisplayName()).formatted(affinity.getColor()));
|
||||
tooltip.add(Text.translatable("gui.unicopia.dispell_screen.affinity", affinity.getDisplayName()));
|
||||
tooltip.add(ScreenTexts.EMPTY);
|
||||
tooltip.addAll(TextHelper.wrap(Text.translatable(type.type().getTranslationKey() + ".lore").formatted(affinity.getColor()), 180).toList());
|
||||
if (spell instanceof TimedSpell timed) {
|
||||
|
|
|
@ -955,7 +955,7 @@ public class Pony extends Living<PlayerEntity> implements Copyable<Pony>, Update
|
|||
if (spell.getAffinity() == Affinity.BAD && entity.getWorld().random.nextInt(20) == 0) {
|
||||
getCorruption().add(entity.getRandom().nextBetween(1, 10));
|
||||
}
|
||||
getCorruption().add((int)spell.getTypeAndTraits().traits().getCorruption() * 10);
|
||||
getCorruption().add(((int)spell.getTypeAndTraits().traits().getCorruption() * 10) + spell.getTypeAndTraits().type().getAffinity().getCorruption());
|
||||
setDirty();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,15 +80,20 @@ public class GemstoneItem extends Item implements MultiItem, EnchantableItem {
|
|||
super.appendTooltip(stack, world, lines, tooltipContext);
|
||||
|
||||
if (EnchantableItem.isEnchanted(stack)) {
|
||||
SpellType<?> key = EnchantableItem.getSpellKey(stack);
|
||||
CustomisedSpellType<?> type = getSpellEffect(stack);
|
||||
|
||||
MutableText line = Text.translatable(key.getTranslationKey() + ".lore").formatted(key.getAffinity().getColor());
|
||||
MutableText line = Text.translatable(type.type().getTranslationKey() + ".lore").formatted(type.type().getAffinity().getColor());
|
||||
|
||||
if (!InteractionManager.getInstance().getClientSpecies().canCast()) {
|
||||
line = line.formatted(Formatting.OBFUSCATED);
|
||||
}
|
||||
|
||||
lines.addAll(TextHelper.wrap(line, 180).toList());
|
||||
lines.add(Text.empty());
|
||||
float corruption = ((int)type.traits().getCorruption() * 10) + type.type().getAffinity().getCorruption();
|
||||
if (corruption != 0) {
|
||||
lines.add(Text.translatable("affinity.unicopia.when_cast").formatted(Formatting.GRAY));
|
||||
lines.add(Text.translatable("affinity.unicopia.corruption", corruption > 0 ? "+" : "-", ItemStack.MODIFIER_FORMAT.format(Math.abs(corruption))).formatted(corruption < 0 ? Formatting.DARK_GREEN : Formatting.RED));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -729,6 +729,8 @@
|
|||
"affinity.unicopia.good": "Good",
|
||||
"affinity.unicopia.bad": "Bad",
|
||||
"affinity.unicopia.neutral": "Neutral",
|
||||
"affinity.unicopia.when_cast": "When Cast:",
|
||||
"affinity.unicopia.corruption": " %s%.2f Corruption",
|
||||
|
||||
"gui.unicopia.trait.label": "Element of %s",
|
||||
"gui.unicopia.trait.group": "\n %s",
|
||||
|
|
Loading…
Reference in a new issue