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()
|
exception.printStackTrace()
|
||||||
return CastResult(
|
return CastResult(
|
||||||
this.getFunctionalData(),
|
this.getFunctionalData(),
|
||||||
ResolvedPatternType.ERROR,
|
ResolvedPatternType.ERRORED,
|
||||||
listOf(OperatorSideEffect.DoMishap(MishapError(exception), Mishap.Context(iota.payload as? HexPattern ?: HexPattern(HexDir.WEST), null)))
|
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(
|
return CastResult(
|
||||||
fd,
|
fd,
|
||||||
ResolvedPatternType.OK,
|
ResolvedPatternType.EVALUATED,
|
||||||
sideEffects,
|
sideEffects,
|
||||||
)
|
)
|
||||||
} catch (mishap: Mishap) {
|
} catch (mishap: Mishap) {
|
||||||
|
@ -140,7 +140,7 @@ class CastingHarness private constructor(
|
||||||
exception.printStackTrace()
|
exception.printStackTrace()
|
||||||
return CastResult(
|
return CastResult(
|
||||||
this.getFunctionalData(),
|
this.getFunctionalData(),
|
||||||
ResolvedPatternType.ERROR,
|
ResolvedPatternType.ERRORED,
|
||||||
listOf(OperatorSideEffect.DoMishap(MishapError(exception), Mishap.Context(newPat, operatorIdPair?.second)))
|
listOf(OperatorSideEffect.DoMishap(MishapError(exception), Mishap.Context(newPat, operatorIdPair?.second)))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -217,11 +217,11 @@ class CastingHarness private constructor(
|
||||||
this.getFunctionalData().copy(
|
this.getFunctionalData().copy(
|
||||||
escapeNext = false,
|
escapeNext = false,
|
||||||
parenthesized = newParens
|
parenthesized = newParens
|
||||||
) to ResolvedPatternType.PATTERN
|
) to ResolvedPatternType.ESCAPED
|
||||||
} else if (operator == Widget.ESCAPE) {
|
} else if (operator == Widget.ESCAPE) {
|
||||||
this.getFunctionalData().copy(
|
this.getFunctionalData().copy(
|
||||||
escapeNext = true,
|
escapeNext = true,
|
||||||
) to ResolvedPatternType.OK
|
) to ResolvedPatternType.EVALUATED
|
||||||
} else if (operator == Widget.OPEN_PAREN) {
|
} else if (operator == Widget.OPEN_PAREN) {
|
||||||
// we have escaped the parens onto the stack; we just also record our count.
|
// we have escaped the parens onto the stack; we just also record our count.
|
||||||
val newParens = this.parenthesized.toMutableList()
|
val newParens = this.parenthesized.toMutableList()
|
||||||
|
@ -229,7 +229,7 @@ class CastingHarness private constructor(
|
||||||
this.getFunctionalData().copy(
|
this.getFunctionalData().copy(
|
||||||
parenthesized = newParens,
|
parenthesized = newParens,
|
||||||
parenCount = this.parenCount + 1
|
parenCount = this.parenCount + 1
|
||||||
) to ResolvedPatternType.OK
|
) to ResolvedPatternType.EVALUATED
|
||||||
} else if (operator == Widget.CLOSE_PAREN) {
|
} else if (operator == Widget.CLOSE_PAREN) {
|
||||||
val newParenCount = this.parenCount - 1
|
val newParenCount = this.parenCount - 1
|
||||||
if (newParenCount == 0) {
|
if (newParenCount == 0) {
|
||||||
|
@ -239,7 +239,7 @@ class CastingHarness private constructor(
|
||||||
stack = newStack,
|
stack = newStack,
|
||||||
parenCount = newParenCount,
|
parenCount = newParenCount,
|
||||||
parenthesized = listOf()
|
parenthesized = listOf()
|
||||||
) to ResolvedPatternType.OK
|
) to ResolvedPatternType.EVALUATED
|
||||||
} else if (newParenCount < 0) {
|
} else if (newParenCount < 0) {
|
||||||
throw MishapTooManyCloseParens()
|
throw MishapTooManyCloseParens()
|
||||||
} else {
|
} else {
|
||||||
|
@ -250,14 +250,14 @@ class CastingHarness private constructor(
|
||||||
this.getFunctionalData().copy(
|
this.getFunctionalData().copy(
|
||||||
parenCount = newParenCount,
|
parenCount = newParenCount,
|
||||||
parenthesized = newParens
|
parenthesized = newParens
|
||||||
) to ResolvedPatternType.PATTERN
|
) to ResolvedPatternType.ESCAPED
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
val newParens = this.parenthesized.toMutableList()
|
val newParens = this.parenthesized.toMutableList()
|
||||||
newParens.add(iota)
|
newParens.add(iota)
|
||||||
this.getFunctionalData().copy(
|
this.getFunctionalData().copy(
|
||||||
parenthesized = newParens
|
parenthesized = newParens
|
||||||
) to ResolvedPatternType.PATTERN
|
) to ResolvedPatternType.ESCAPED
|
||||||
}
|
}
|
||||||
} else if (this.escapeNext) {
|
} else if (this.escapeNext) {
|
||||||
val newStack = this.stack.toMutableList()
|
val newStack = this.stack.toMutableList()
|
||||||
|
@ -265,15 +265,15 @@ class CastingHarness private constructor(
|
||||||
this.getFunctionalData().copy(
|
this.getFunctionalData().copy(
|
||||||
stack = newStack,
|
stack = newStack,
|
||||||
escapeNext = false,
|
escapeNext = false,
|
||||||
) to ResolvedPatternType.PATTERN
|
) to ResolvedPatternType.ESCAPED
|
||||||
} else if (operator == Widget.ESCAPE) {
|
} else if (operator == Widget.ESCAPE) {
|
||||||
this.getFunctionalData().copy(
|
this.getFunctionalData().copy(
|
||||||
escapeNext = true
|
escapeNext = true
|
||||||
) to ResolvedPatternType.OK
|
) to ResolvedPatternType.EVALUATED
|
||||||
} else if (operator == Widget.OPEN_PAREN) {
|
} else if (operator == Widget.OPEN_PAREN) {
|
||||||
this.getFunctionalData().copy(
|
this.getFunctionalData().copy(
|
||||||
parenCount = this.parenCount + 1
|
parenCount = this.parenCount + 1
|
||||||
) to ResolvedPatternType.OK
|
) to ResolvedPatternType.EVALUATED
|
||||||
} else if (operator == Widget.CLOSE_PAREN) {
|
} else if (operator == Widget.CLOSE_PAREN) {
|
||||||
throw MishapTooManyCloseParens()
|
throw MishapTooManyCloseParens()
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -24,7 +24,7 @@ data class ResolvedPattern(val pattern: HexPattern, val origin: HexCoord, var ty
|
||||||
val valid = try {
|
val valid = try {
|
||||||
ResolvedPatternType.valueOf(tag.getString("Valid").uppercase(Locale.ROOT))
|
ResolvedPatternType.valueOf(tag.getString("Valid").uppercase(Locale.ROOT))
|
||||||
} catch (e: IllegalArgumentException) {
|
} catch (e: IllegalArgumentException) {
|
||||||
ResolvedPatternType.UNKNOWN
|
ResolvedPatternType.UNRESOLVED
|
||||||
}
|
}
|
||||||
return ResolvedPattern(pattern, origin, valid)
|
return ResolvedPattern(pattern, origin, valid)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package at.petrak.hexcasting.api.spell.casting
|
package at.petrak.hexcasting.api.spell.casting
|
||||||
|
|
||||||
enum class ResolvedPatternType(val color: Int, val fadeColor: Int, val success: Boolean) {
|
enum class ResolvedPatternType(val color: Int, val fadeColor: Int, val success: Boolean) {
|
||||||
UNKNOWN(0x7f7f7f, 0xcccccc, false),
|
UNRESOLVED(0x7f7f7f, 0xcccccc, false),
|
||||||
OK(0x7385de, 0xfecbe6, true),
|
EVALUATED(0x7385de, 0xfecbe6, true),
|
||||||
PATTERN(0xdddd73, 0xffffe5, true),
|
ESCAPED(0xddcc73, 0xfffae5, true),
|
||||||
ERROR(0xde6262, 0xffc7a0, false),
|
ERRORED(0xde6262, 0xffc7a0, false),
|
||||||
INVALID(0xddbcbc, 0xfff0e5, 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)
|
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.
|
* Execute the actual effect, not any sfx.
|
||||||
|
|
|
@ -211,7 +211,7 @@ class GuiSpellcasting(
|
||||||
is PatternDrawState.Drawing -> {
|
is PatternDrawState.Drawing -> {
|
||||||
val (start, _, pat) = this.drawState as PatternDrawState.Drawing
|
val (start, _, pat) = this.drawState as PatternDrawState.Drawing
|
||||||
this.drawState = PatternDrawState.BetweenPatterns
|
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))
|
this.usedSpots.addAll(pat.positions(start))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue