Skip to content

Commit

Permalink
Added grimoire too full mishap
Browse files Browse the repository at this point in the history
  • Loading branch information
miyucomics committed Mar 11, 2024
1 parent ce036c0 commit fe8cd7c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package miyucomics.hexical.casting.mishaps

import at.petrak.hexcasting.api.misc.FrozenColorizer
import at.petrak.hexcasting.api.spell.ParticleSpray
import at.petrak.hexcasting.api.spell.casting.CastingContext
import at.petrak.hexcasting.api.spell.iota.Iota
import at.petrak.hexcasting.api.spell.mishaps.Mishap
import miyucomics.hexical.Hexical
import net.minecraft.text.Text
import net.minecraft.util.DyeColor
import net.minecraft.util.Hand

class GrimoireTooFullMishap : Mishap() {
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer = dyeColor(DyeColor.BLUE)
override fun particleSpray(ctx: CastingContext) = ParticleSpray.burst(ctx.caster.pos, 1.0)
override fun errorMessage(ctx: CastingContext, errorCtx: Context): Text = error(Hexical.MOD_ID + ":grimoire_too_full")

override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<Iota>) {
yeetHeldItem(ctx, Hand.OFF_HAND)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import at.petrak.hexcasting.api.spell.casting.CastingContext
import at.petrak.hexcasting.api.spell.iota.Iota
import at.petrak.hexcasting.api.spell.math.HexPattern
import at.petrak.hexcasting.api.spell.mishaps.MishapOthersName
import miyucomics.hexical.casting.mishaps.GrimoireTooFullMishap
import miyucomics.hexical.items.GrimoireItem
import net.minecraft.item.ItemStack

Expand All @@ -19,6 +20,8 @@ class OpGrimoireWrite : SpellAction {
val trueName = MishapOthersName.getTrueNameFromArgs(hex, ctx.caster)
if (trueName != null)
throw MishapOthersName(trueName)
if (GrimoireItem.getPatternsInGrimoire(stack).size >= 16)
throw GrimoireTooFullMishap()
return Triple(Spell(pattern, hex, stack), 0, listOf())
}

Expand Down
1 change: 1 addition & 0 deletions common/src/main/resources/assets/hexical/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"hexcasting.mishap.hexical:needs_lamp": "Expected to be cast by Genieless Lamp.",
"hexcasting.mishap.hexical:needs_active_arch_lamp": "Expected to have an active Arch Genieless Lamp.",
"hexcasting.mishap.hexical:grimoire_access_denied": "Tried to increase the amount of a restricted binding.",
"hexcasting.mishap.hexical:grimoire_too_full": "Tried to fit too many bindings in a grimoire.",

"hexical.page.hexical_changes.title": "Hexical Changes",
"hexical.page.hexical_changes.0": "I feel strangely more receptive of the ambient media around me. It feels $(o)friendlier$() somehow... I can even feel it responding to certain actions, as if suggesting new spells to me. I also notice I require less concentration with my staff and can move around while using it. Unfortunately, Nature has not become more forgiving of my mishaps.",
Expand Down

0 comments on commit fe8cd7c

Please sign in to comment.