Skip to content

Commit

Permalink
Activate Genie spell
Browse files Browse the repository at this point in the history
  • Loading branch information
miyucomics committed Jul 5, 2024
1 parent 2062563 commit de9c0ab
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package miyucomics.hexical.casting.patterns.lamp

import at.petrak.hexcasting.api.misc.DiscoveryHandlers
import at.petrak.hexcasting.api.misc.MediaConstants
import at.petrak.hexcasting.api.spell.ParticleSpray
import at.petrak.hexcasting.api.spell.RenderedSpell
import at.petrak.hexcasting.api.spell.SpellAction
import at.petrak.hexcasting.api.spell.casting.CastingContext
import at.petrak.hexcasting.api.spell.iota.Iota
import miyucomics.hexical.registry.HexicalItems
import net.minecraft.item.ItemStack

class OpActivateArchLamp : SpellAction {
override val argc = 0
override fun execute(args: List<Iota>, ctx: CastingContext): Triple<RenderedSpell, Int, List<ParticleSpray>> {
for (stack in DiscoveryHandlers.collectItemSlots(ctx)) {
if (stack.isEmpty)
continue
if (!stack.isOf(HexicalItems.ARCH_LAMP_ITEM))
continue
if (!stack.orCreateNbt.getBoolean("active"))
return Triple(Spell(stack), MediaConstants.DUST_UNIT, listOf())
}
return Triple(Spell(null), 0, listOf())
}

private class Spell(val stack: ItemStack?) : RenderedSpell {
override fun cast(ctx: CastingContext) {
for (slot in ctx.caster.inventory.main)
if (slot.item == HexicalItems.ARCH_LAMP_ITEM)
slot.orCreateNbt.putBoolean("active", false)
if (stack == null)
return
stack.orCreateNbt.putBoolean("active", true)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import at.petrak.hexcasting.api.spell.iota.Iota
import miyucomics.hexical.casting.mishaps.NeedsActiveArchLampMishap
import miyucomics.hexical.items.hasActiveArchLamp
import miyucomics.hexical.registry.HexicalItems
import miyucomics.hexical.registry.HexicalSounds

class OpTerminateArchLamp : SpellAction {
override val argc = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ object HexicalPatterns {
register("get_arch_lamp_storage", "qaqwddedqwaqqqqq", HexDir.NORTH_EAST, OpGetArchLampData(4))
register("set_arch_lamp_storage", "qaqwddedqedeeeee", HexDir.NORTH_EAST, OpSetArchLampStorage())
register("get_arch_lamp_media", "qaqwddedaeeeee", HexDir.NORTH_EAST, OpGetArchLampMedia())
register("activate_arch_lamp", "qaqwddedadeaqq", HexDir.NORTH_EAST, OpActivateArchLamp())
register("terminate_arch_lamp", "qaqwddedwaqdee", HexDir.NORTH_EAST, OpTerminateArchLamp())
register("has_arch_lamp", "qaqwddedqeed", HexDir.NORTH_EAST, OpIsUsingArchLamp())
register("lamp_finale", "aaddaddad", HexDir.EAST, OpGetFinale())
Expand Down
12 changes: 7 additions & 5 deletions src/main/resources/assets/hexical/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,12 @@
"hexical.page.arch_lamps.0": "Rather just losing memories, the master villager's mind exited its body and completely supplanted the original genie. Because a separate entity casts my spells, a lamp should be able to cast even without me holding it. These archgenie lamps are activated and deactivated rather than used and while active in my inventory, they cast every moment even without my input.",
"hexical.page.arch_lamps.1": "The output of an archgenie lamp is so grand that it saturates the air around me with media... it's incredible. Unfortunately, if two lamps are active at once within my inventory, the resonances clash and deactivate both lamps, as well as rendering every archgenie lamp in my inventory useless for a few seconds. I should only have one archgenie lamp active at once, although I can still simutaneously use a regular lamp.",
"hexical.page.arch_lamps.2": "$(o)I am a great soft jelly thing. Smoothly rounded, with no mouth, with pulsing white holes filled by fog where my eyes used to be. Rubbery appendages that were once my arms; bulks rounding down into legless humps of soft slippery matter.$(br2)I have no mouth. And I must scream.$()",
"hexcasting.spell.hexical:activate_arch_lamp": "Activate Archgenie",
"hexical.page.activate_arch_lamp.summary": "Can be casted by a casting device, staff, or within an arch lamp. Deactivates current active archgenie lamp if one exists and activates an previously inactive lamp if there is one. If cast without an active arch lamp, it essentially activates one.",
"hexcasting.spell.hexical:terminate_arch_lamp": "Terminate Archgenie",
"hexical.page.terminate_arch_lamp.summary": "Can be casted by a casting device, staff, or within the arch lamp itself. Deactivates the lamp's operation, similar to Charon's.",
"hexcasting.spell.hexical:has_arch_lamp": "Archgenie Purification",
"hexical.page.has_arch_lamp.summary": "Pushes whether a player currently has an active arch lamp.",
"hexcasting.spell.hexical:get_arch_lamp_position": "Archgenie Reflection: Spatial",
"hexical.page.get_arch_lamp_position.summary": "Pushes the original position of the caster when the arch lamp started casting.",
"hexcasting.spell.hexical:get_arch_lamp_rotation": "Archgenie Reflection: Rotational",
Expand All @@ -210,10 +216,6 @@
"hexical.page.get_arch_lamp_use_time.summary": "Pushes how many times the lamp has casted. Divided by 20, it returns how many times in seconds the lamp has been in use.",
"hexcasting.spell.hexical:get_arch_lamp_media": "Archgenie Reflection: Media",
"hexical.page.get_arch_lamp_media.summary": "Pushes the remaining amount of media left in the lamp, in units of dust.",
"hexcasting.spell.hexical:has_arch_lamp": "Archgenie Purification",
"hexical.page.has_arch_lamp.summary": "Pushes whether a player currently has an active arch lamp.",
"hexcasting.spell.hexical:terminate_arch_lamp": "Terminate Archgenie",
"hexical.page.terminate_arch_lamp.summary": "Can be casted by a casting device, staff, or within the arch lamp itself. Deactivates the lamp's operation, similar to Charon's.",

"hexical.page.arch_lamp_storage.title": "Arch Lamp Memory",
"hexical.page.arch_lamp_storage": "An archgenie can remember an iota, persisting between casts. If I need to save an iota between casts of the lamp, I can stash it in its memory. The two patterns responsible for interacting with the memory can also be cast by a staff or casting device if an arch lamp is active.",
Expand Down Expand Up @@ -481,4 +483,4 @@
"hexical.page.greater_blink.0": "Greater Blink is a significantly cheaper alternative to Greater Teleport. It also does not carry the risk of splattering your items upon arrival. However, it only has pitiful range compared to Greater Teleport and its destination calculations are... esoteric. I also can not specify a target other than myself.",
"hexical.page.greater_blink.desc": "Teleports me up to 128 blocks away, relative to my position and rotation. Costs two shards.",
"hexical.page.greater_blink.1": "A vector of (1, 0, 0) would teleport me one block in the position I'm facing. A vector of (0, 1, 0) would teleport me one block forwards in the perpendicular of the top of my head. A vector of (10, 1, 0) would teleport me ten blocks forward in the direction I'm facing, and one block upwards from the top of my head, at that point."
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
},
{
"type": "hexcasting:pattern",
"op_id": "hexical:has_arch_lamp",
"anchor": "hexical:has_arch_lamp",
"input": "entity",
"output": "boolean",
"text": "hexical.page.has_arch_lamp.summary"
"op_id": "hexical:activate_arch_lamp",
"anchor": "hexical:activate_arch_lamp",
"input": "",
"output": "",
"text": "hexical.page.activate_arch_lamp.summary"
},
{
"type": "hexcasting:pattern",
Expand All @@ -33,6 +33,14 @@
"output": "",
"text": "hexical.page.terminate_arch_lamp.summary"
},
{
"type": "hexcasting:pattern",
"op_id": "hexical:has_arch_lamp",
"anchor": "hexical:has_arch_lamp",
"input": "entity",
"output": "boolean",
"text": "hexical.page.has_arch_lamp.summary"
},
{
"type": "hexcasting:pattern",
"op_id": "hexical:get_arch_lamp_position",
Expand Down

0 comments on commit de9c0ab

Please sign in to comment.