diff --git a/CHANGELOG.md b/CHANGELOG.md index 866a04cfa..f3ebf3620 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). - Sorter's Distillation and Stacking Distillation for items - Added Contemplation for escaping without the exponential growth of Consideration ([#1102](https://github.com/FallingColors/HexMod/pull/1102)) @IridescentVoid - Added Interjection, Meditation, and Recollection for advanced pattern-list creation ([#1103](https://github.com/FallingColors/HexMod/pull/1103)) @Robotgiggle +- Added Media Reflection for checking media available to the cast ([#1235](https://github.com/FallingColors/HexMod/pull/1235)) @IridescentVoid ### Changed diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/actions/environment/OpGetMedia.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/actions/environment/OpGetMedia.kt new file mode 100644 index 000000000..d918592ba --- /dev/null +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/actions/environment/OpGetMedia.kt @@ -0,0 +1,17 @@ +package at.petrak.hexcasting.common.casting.actions.environment + +import at.petrak.hexcasting.api.casting.asActionResult +import at.petrak.hexcasting.api.casting.castables.ConstMediaAction +import at.petrak.hexcasting.api.casting.eval.CastingEnvironment +import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.misc.MediaConstants + +object OpGetMedia : ConstMediaAction { + override val argc = 0 + + override fun execute(args: List, env: CastingEnvironment): List { + val mediaRaw = Long.MAX_VALUE - env.extractMedia(Long.MAX_VALUE, true) + + return (mediaRaw.toDouble() / MediaConstants.DUST_UNIT.toDouble()).asActionResult + } +} diff --git a/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexActions.java b/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexActions.java index 0eddf0b7e..1c81046e6 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexActions.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexActions.java @@ -16,6 +16,7 @@ import at.petrak.hexcasting.common.casting.actions.circles.OpCircleBounds; import at.petrak.hexcasting.common.casting.actions.circles.OpImpetusDir; import at.petrak.hexcasting.common.casting.actions.circles.OpImpetusPos; +import at.petrak.hexcasting.common.casting.actions.environment.OpGetMedia; import at.petrak.hexcasting.common.casting.actions.escaping.*; import at.petrak.hexcasting.common.casting.actions.eval.*; import at.petrak.hexcasting.common.casting.actions.lists.OpEmptyList; @@ -99,6 +100,8 @@ public class HexActions { new ActionRegistryEntry(HexPattern.fromAngles("weddwaa", HexDir.EAST), OpBlockAxisRaycast.INSTANCE)); public static final ActionRegistryEntry RAYCAST_ENTITY = make("raycast/entity", new ActionRegistryEntry(HexPattern.fromAngles("weaqa", HexDir.EAST), OpEntityRaycast.INSTANCE)); + public static final ActionRegistryEntry GET_MEDIA = make("get_media", + new ActionRegistryEntry(HexPattern.fromAngles("dde", HexDir.WEST), OpGetMedia.INSTANCE)); // == spell circle getters == diff --git a/Common/src/main/resources/assets/hexcasting/lang/en_us.flatten.json5 b/Common/src/main/resources/assets/hexcasting/lang/en_us.flatten.json5 index e8ce2e5f0..c361c595e 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/en_us.flatten.json5 +++ b/Common/src/main/resources/assets/hexcasting/lang/en_us.flatten.json5 @@ -752,6 +752,7 @@ raycast: "Archer's Distillation", "raycast/axis": "Architect's Distillation", "raycast/entity": "Scout's Distillation", + get_media: "Media Reflection", "circle/": { impetus_pos: "Waystone Reflection", @@ -1803,6 +1804,7 @@ "raycast/entity": "Like $(l:patterns/basics#hexcasting:raycast)$(action)Archer's Distillation/$, but instead returns the $(italic)entity/$ I am looking at. Costs a negligible amount of _media.", get_entity_height: "Transforms an entity on the stack into its height.", get_entity_velocity: "Transforms an entity on the stack into the direction in which it's moving, with the speed of that movement as that direction's magnitude.", + get_media: "Pushes the amount of _media available to the current cast, in units of $(l:items/amethyst)$(item)Amethyst Dust/$.", }, numbers: { diff --git a/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/basics.json b/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/basics.json index bca8f6ea4..60075a9dc 100644 --- a/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/basics.json +++ b/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/basics.json @@ -93,6 +93,14 @@ "input": "entity", "output": "vector", "text": "hexcasting.page.basics_pattern.get_entity_velocity" + }, + { + "type": "hexcasting:pattern", + "op_id": "hexcasting:get_media", + "anchor": "hexcasting:get_media", + "input": "", + "output": "num", + "text": "hexcasting.page.basics_pattern.get_media" } ] }