change the names of resolution types
also fancier colors
This commit is contained in:
parent
9ccfba83f9
commit
539c7d1005
5 changed files with 20 additions and 20 deletions
|
@ -84,7 +84,7 @@ class CastingHarness private constructor(
|
|||
exception.printStackTrace()
|
||||
return CastResult(
|
||||
this.getFunctionalData(),
|
||||
ResolvedPatternType.ERROR,
|
||||
ResolvedPatternType.ERRORED,
|
||||
listOf(OperatorSideEffect.DoMishap(MishapError(exception), Mishap.Context(iota.payload as? HexPattern ?: HexPattern(HexDir.WEST), null)))
|
||||
)
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ class CastingHarness private constructor(
|
|||
|
||||
return CastResult(
|
||||
fd,
|
||||
ResolvedPatternType.OK,
|
||||
ResolvedPatternType.EVALUATED,
|
||||
sideEffects,
|
||||
)
|
||||
} catch (mishap: Mishap) {
|
||||
|
@ -140,7 +140,7 @@ class CastingHarness private constructor(
|
|||
exception.printStackTrace()
|
||||
return CastResult(
|
||||
this.getFunctionalData(),
|
||||
ResolvedPatternType.ERROR,
|
||||
ResolvedPatternType.ERRORED,
|
||||
listOf(OperatorSideEffect.DoMishap(MishapError(exception), Mishap.Context(newPat, operatorIdPair?.second)))
|
||||
)
|
||||
}
|
||||
|
@ -217,11 +217,11 @@ class CastingHarness private constructor(
|
|||
this.getFunctionalData().copy(
|
||||
escapeNext = false,
|
||||
parenthesized = newParens
|
||||
) to ResolvedPatternType.PATTERN
|
||||
) to ResolvedPatternType.ESCAPED
|
||||
} else if (operator == Widget.ESCAPE) {
|
||||
this.getFunctionalData().copy(
|
||||
escapeNext = true,
|
||||
) to ResolvedPatternType.OK
|
||||
) to ResolvedPatternType.EVALUATED
|
||||
} else if (operator == Widget.OPEN_PAREN) {
|
||||
// we have escaped the parens onto the stack; we just also record our count.
|
||||
val newParens = this.parenthesized.toMutableList()
|
||||
|
@ -229,7 +229,7 @@ class CastingHarness private constructor(
|
|||
this.getFunctionalData().copy(
|
||||
parenthesized = newParens,
|
||||
parenCount = this.parenCount + 1
|
||||
) to ResolvedPatternType.OK
|
||||
) to ResolvedPatternType.EVALUATED
|
||||
} else if (operator == Widget.CLOSE_PAREN) {
|
||||
val newParenCount = this.parenCount - 1
|
||||
if (newParenCount == 0) {
|
||||
|
@ -239,7 +239,7 @@ class CastingHarness private constructor(
|
|||
stack = newStack,
|
||||
parenCount = newParenCount,
|
||||
parenthesized = listOf()
|
||||
) to ResolvedPatternType.OK
|
||||
) to ResolvedPatternType.EVALUATED
|
||||
} else if (newParenCount < 0) {
|
||||
throw MishapTooManyCloseParens()
|
||||
} else {
|
||||
|
@ -250,14 +250,14 @@ class CastingHarness private constructor(
|
|||
this.getFunctionalData().copy(
|
||||
parenCount = newParenCount,
|
||||
parenthesized = newParens
|
||||
) to ResolvedPatternType.PATTERN
|
||||
) to ResolvedPatternType.ESCAPED
|
||||
}
|
||||
} else {
|
||||
val newParens = this.parenthesized.toMutableList()
|
||||
newParens.add(iota)
|
||||
this.getFunctionalData().copy(
|
||||
parenthesized = newParens
|
||||
) to ResolvedPatternType.PATTERN
|
||||
) to ResolvedPatternType.ESCAPED
|
||||
}
|
||||
} else if (this.escapeNext) {
|
||||
val newStack = this.stack.toMutableList()
|
||||
|
@ -265,15 +265,15 @@ class CastingHarness private constructor(
|
|||
this.getFunctionalData().copy(
|
||||
stack = newStack,
|
||||
escapeNext = false,
|
||||
) to ResolvedPatternType.PATTERN
|
||||
) to ResolvedPatternType.ESCAPED
|
||||
} else if (operator == Widget.ESCAPE) {
|
||||
this.getFunctionalData().copy(
|
||||
escapeNext = true
|
||||
) to ResolvedPatternType.OK
|
||||
) to ResolvedPatternType.EVALUATED
|
||||
} else if (operator == Widget.OPEN_PAREN) {
|
||||
this.getFunctionalData().copy(
|
||||
parenCount = this.parenCount + 1
|
||||
) to ResolvedPatternType.OK
|
||||
) to ResolvedPatternType.EVALUATED
|
||||
} else if (operator == Widget.CLOSE_PAREN) {
|
||||
throw MishapTooManyCloseParens()
|
||||
} else {
|
||||
|
|
|
@ -24,7 +24,7 @@ data class ResolvedPattern(val pattern: HexPattern, val origin: HexCoord, var ty
|
|||
val valid = try {
|
||||
ResolvedPatternType.valueOf(tag.getString("Valid").uppercase(Locale.ROOT))
|
||||
} catch (e: IllegalArgumentException) {
|
||||
ResolvedPatternType.UNKNOWN
|
||||
ResolvedPatternType.UNRESOLVED
|
||||
}
|
||||
return ResolvedPattern(pattern, origin, valid)
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package at.petrak.hexcasting.api.spell.casting
|
||||
|
||||
enum class ResolvedPatternType(val color: Int, val fadeColor: Int, val success: Boolean) {
|
||||
UNKNOWN(0x7f7f7f, 0xcccccc, false),
|
||||
OK(0x7385de, 0xfecbe6, true),
|
||||
PATTERN(0xdddd73, 0xffffe5, true),
|
||||
ERROR(0xde6262, 0xffc7a0, false),
|
||||
INVALID(0xddbcbc, 0xfff0e5, false)
|
||||
UNRESOLVED(0x7f7f7f, 0xcccccc, false),
|
||||
EVALUATED(0x7385de, 0xfecbe6, true),
|
||||
ESCAPED(0xddcc73, 0xfffae5, true),
|
||||
ERRORED(0xde6262, 0xffc7a0, false),
|
||||
INVALID(0xb26b6b, 0xcca88e, false)
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ sealed class Mishap : Throwable() {
|
|||
return ParticleSpray(ctx.position.add(0.0, 0.2, 0.0), Vec3(0.0, 2.0, 0.0), 0.2, Math.PI / 4, 40)
|
||||
}
|
||||
|
||||
open fun resolutionType(ctx: CastingContext): ResolvedPatternType = ResolvedPatternType.ERROR
|
||||
open fun resolutionType(ctx: CastingContext): ResolvedPatternType = ResolvedPatternType.ERRORED
|
||||
|
||||
/**
|
||||
* Execute the actual effect, not any sfx.
|
||||
|
|
|
@ -211,7 +211,7 @@ class GuiSpellcasting(
|
|||
is PatternDrawState.Drawing -> {
|
||||
val (start, _, pat) = this.drawState as PatternDrawState.Drawing
|
||||
this.drawState = PatternDrawState.BetweenPatterns
|
||||
this.patterns.add(ResolvedPattern(pat, start, ResolvedPatternType.UNKNOWN))
|
||||
this.patterns.add(ResolvedPattern(pat, start, ResolvedPatternType.UNRESOLVED))
|
||||
|
||||
this.usedSpots.addAll(pat.positions(start))
|
||||
|
||||
|
|
Loading…
Reference in a new issue