Merge branch 'gamma-delta:main' into main

This commit is contained in:
ChuijkYahus 2023-02-27 11:09:17 +08:00 committed by GitHub
commit 128b1b9882
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 47 additions and 13 deletions

View file

@ -0,0 +1,16 @@
package at.petrak.hexcasting.common.casting.operators.math.logic
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.getBool
import at.petrak.hexcasting.api.casting.iota.Iota
object OpBoolToNumber : ConstMediaAction {
override val argc = 1
override fun execute(args: List<Iota>, ctx: CastingEnvironment): List<Iota> {
val arg = args.getBool(0, argc)
return (if (arg) 1.0 else 0.0).asActionResult
}
}

View file

@ -1,16 +1,20 @@
package at.petrak.hexcasting.common.casting.operators.spells
import at.petrak.hexcasting.api.misc.MediaConstants
import at.petrak.hexcasting.api.mod.HexConfig
import at.petrak.hexcasting.api.mod.HexTags
import at.petrak.hexcasting.api.casting.*
import at.petrak.hexcasting.api.casting.ParticleSpray
import at.petrak.hexcasting.api.casting.RenderedSpell
import at.petrak.hexcasting.api.casting.castables.SpellAction
import at.petrak.hexcasting.api.casting.eval.CastingEnvironment
import at.petrak.hexcasting.api.casting.getDouble
import at.petrak.hexcasting.api.casting.getEntity
import at.petrak.hexcasting.api.casting.iota.Iota
import at.petrak.hexcasting.api.casting.mishaps.MishapImmuneEntity
import at.petrak.hexcasting.api.casting.mishaps.MishapLocationTooFarAway
import at.petrak.hexcasting.api.misc.MediaConstants
import at.petrak.hexcasting.api.mod.HexConfig
import at.petrak.hexcasting.api.mod.HexTags
import at.petrak.hexcasting.common.casting.operators.spells.great.OpTeleport
import net.minecraft.world.entity.Entity
import kotlin.math.absoluteValue
import kotlin.math.roundToInt
object OpBlink : SpellAction {
@ -42,7 +46,7 @@ object OpBlink : SpellAction {
return Triple(
Spell(target, delta),
(MediaConstants.SHARD_UNIT * delta * 0.5).roundToInt(),
(MediaConstants.SHARD_UNIT * delta.absoluteValue * 0.5).roundToInt(),
listOf(
ParticleSpray.cloud(targetMiddlePos, 2.0, 50),
ParticleSpray.burst(targetMiddlePos.add(dvec), 2.0, 100)

View file

@ -191,6 +191,8 @@ public class HexActions {
new ActionRegistryEntry(HexPattern.fromAngles("dw", HexDir.NORTH_WEST), OpBoolNot.INSTANCE));
public static final ActionRegistryEntry BOOL_COERCE = make("bool_coerce",
new ActionRegistryEntry(HexPattern.fromAngles("aw", HexDir.NORTH_EAST), OpCoerceToBool.INSTANCE));
public static final ActionRegistryEntry BOOL_TO_NUMBER = make("bool_to_number",
new ActionRegistryEntry(HexPattern.fromAngles("awd", HexDir.SOUTH_EAST), OpBoolToNumber.INSTANCE));
public static final ActionRegistryEntry IF = make("if",
new ActionRegistryEntry(HexPattern.fromAngles("awdd", HexDir.SOUTH_EAST), OpBoolIf.INSTANCE));

View file

@ -332,6 +332,7 @@
"hexcasting.action.book.hexcasting:const/vec/y": "Vector Rfln. +Y/-Y",
"hexcasting.action.book.hexcasting:const/vec/z": "Vector Rfln. +Z/-Z",
"hexcasting.action.book.hexcasting:read/entity": "Chronicler's Prfn.",
"hexcasting.action.book.hexcasting:bool_to_number": "Numerologist's Prfn.",
"hexcasting.action.book.hexcasting:number": "Numerical Reflection",
"hexcasting.action.book.hexcasting:mask": "Bookkeeper's Gambit",
@ -427,6 +428,7 @@
"hexcasting.action.hexcasting:not_equals": "Inequality Distillation",
"hexcasting.action.hexcasting:not": "Negation Purification",
"hexcasting.action.hexcasting:bool_coerce": "Augur's Purification",
"hexcasting.action.hexcasting:bool_to_number": "Numerologist's Purification",
"hexcasting.action.hexcasting:if": "Augur's Exaltation",
"hexcasting.action.hexcasting:add": "Additive Distillation",
@ -557,6 +559,7 @@
"hexcasting.mishap.invalid_value.int.positive.less.equal": "a positive integer less than or equal to %d",
"hexcasting.mishap.invalid_value.int.between": "an integer between %d and %d",
"hexcasting.mishap.invalid_value.evaluatable": "something evaluatable",
"hexcasting.mishap.invalid_value.bool_commute": "a boolean, 0, or 1",
"hexcasting.mishap.not_enough_args": "expected %s or more arguments but the stack was only %s tall",
"hexcasting.mishap.no_args": "expected %s or more arguments but the stack was empty",
"hexcasting.mishap.too_many_close_parens": "Did not first use Introspection",
@ -1002,6 +1005,7 @@
"hexcasting.entry.logic": "Logical Operators",
"hexcasting.page.logic.bool_coerce": "Convert an argument to a boolean. The number $(thing)0/$, $(l:influences#null)$(thing)Null/$, and the empty list become False; everything else becomes True.",
"hexcasting.page.logic.bool_to_number": "Convert a boolean to a number; True becomes $(thing)1/$, and False becomes $(thing)0/$.",
"hexcasting.page.logic.not": "If the argument is True, return False; if it is False, return True.",
"hexcasting.page.logic.or": "Returns True if at least one of the arguments are True; otherwise returns False.",
"hexcasting.page.logic.and": "Returns True if both arguments are true; otherwise returns False.",

View file

@ -6,14 +6,6 @@
"advancement": "hexcasting:root",
"read_by_default": true,
"pages": [
{
"type": "hexcasting:pattern",
"op_id": "hexcasting:not",
"anchor": "hexcasting:not",
"input": "any",
"output": "number",
"text": "hexcasting.page.logic.not"
},
{
"type": "hexcasting:pattern",
"op_id": "hexcasting:bool_coerce",
@ -22,6 +14,22 @@
"output": "bool",
"text": "hexcasting.page.logic.bool_coerce"
},
{
"type": "hexcasting:pattern",
"op_id": "hexcasting:bool_to_number",
"anchor": "hexcasting:bool_to_number",
"input": "bool",
"output": "number",
"text": "hexcasting.page.logic.bool_to_number"
},
{
"type": "hexcasting:pattern",
"op_id": "hexcasting:not",
"anchor": "hexcasting:not",
"input": "any",
"output": "number",
"text": "hexcasting.page.logic.not"
},
{
"type": "hexcasting:pattern",
"op_id": "hexcasting:or",