close #288
This commit is contained in:
parent
558476caf4
commit
47c429bc7b
3 changed files with 24 additions and 8 deletions
|
@ -10,20 +10,32 @@ import net.minecraft.world.effect.MobEffects
|
||||||
import net.minecraft.world.entity.player.Player
|
import net.minecraft.world.entity.player.Player
|
||||||
import net.minecraft.world.item.DyeColor
|
import net.minecraft.world.item.DyeColor
|
||||||
|
|
||||||
class MishapOthersName(val other: Player) : Mishap() {
|
/**
|
||||||
|
* Also throwable for your *own* name, for cases like Chronicler's Gambit
|
||||||
|
*/
|
||||||
|
class MishapOthersName(val confidant: Player) : Mishap() {
|
||||||
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer =
|
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer =
|
||||||
dyeColor(DyeColor.BLACK)
|
dyeColor(DyeColor.BLACK)
|
||||||
|
|
||||||
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<Iota>) {
|
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<Iota>) {
|
||||||
ctx.caster.addEffect(MobEffectInstance(MobEffects.BLINDNESS, 20 * 60))
|
val seconds = if (this.confidant == ctx.caster) 5 else 60;
|
||||||
|
ctx.caster.addEffect(MobEffectInstance(MobEffects.BLINDNESS, seconds * 20))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun errorMessage(ctx: CastingContext, errorCtx: Context) =
|
override fun errorMessage(ctx: CastingContext, errorCtx: Context) =
|
||||||
error("others_name", other.name)
|
if (this.confidant == ctx.caster)
|
||||||
|
error("others_name.self")
|
||||||
|
else
|
||||||
|
error("others_name", confidant.name)
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
/**
|
||||||
|
* Return any true names found in this iota.
|
||||||
|
*
|
||||||
|
* If `caster` is non-null, it will ignore that when checking.
|
||||||
|
*/
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun getTrueNameFromDatum(datum: Iota, caster: Player): Player? {
|
fun getTrueNameFromDatum(datum: Iota, caster: Player?): Player? {
|
||||||
val poolToSearch = ArrayDeque<Iota>()
|
val poolToSearch = ArrayDeque<Iota>()
|
||||||
poolToSearch.addLast(datum)
|
poolToSearch.addLast(datum)
|
||||||
|
|
||||||
|
|
|
@ -17,15 +17,17 @@ object OpTheCoolerWrite : SpellAction {
|
||||||
args: List<Iota>,
|
args: List<Iota>,
|
||||||
ctx: CastingContext
|
ctx: CastingContext
|
||||||
): Triple<RenderedSpell, Int, List<ParticleSpray>> {
|
): Triple<RenderedSpell, Int, List<ParticleSpray>> {
|
||||||
val datum = args[0]
|
val target = args.getEntity(0, argc)
|
||||||
val target = args.getEntity(1, argc)
|
val datum = args[1]
|
||||||
|
|
||||||
ctx.assertEntityInRange(target)
|
ctx.assertEntityInRange(target)
|
||||||
|
|
||||||
val datumHolder = IXplatAbstractions.INSTANCE.findDataHolder(target)
|
val datumHolder = IXplatAbstractions.INSTANCE.findDataHolder(target)
|
||||||
?: throw MishapBadEntity.of(target, "iota.write")
|
?: throw MishapBadEntity.of(target, "iota.write")
|
||||||
|
|
||||||
val trueName = MishapOthersName.getTrueNameFromDatum(datum, ctx.caster)
|
// We pass null here so that even the own caster won't be allowed into a focus.
|
||||||
|
// Otherwise, you could sentinel scout to people and remotely write their names into things using a cleric circle.
|
||||||
|
val trueName = MishapOthersName.getTrueNameFromDatum(datum, null)
|
||||||
if (trueName != null)
|
if (trueName != null)
|
||||||
throw MishapOthersName(trueName)
|
throw MishapOthersName(trueName)
|
||||||
|
|
||||||
|
|
|
@ -270,6 +270,7 @@
|
||||||
"hexcasting.spell.book.hexcasting:const/vec/x": "Vector Rfln. +X/-X",
|
"hexcasting.spell.book.hexcasting:const/vec/x": "Vector Rfln. +X/-X",
|
||||||
"hexcasting.spell.book.hexcasting:const/vec/y": "Vector Rfln. +Y/-Y",
|
"hexcasting.spell.book.hexcasting:const/vec/y": "Vector Rfln. +Y/-Y",
|
||||||
"hexcasting.spell.book.hexcasting:const/vec/z": "Vector Rfln. +Z/-Z",
|
"hexcasting.spell.book.hexcasting:const/vec/z": "Vector Rfln. +Z/-Z",
|
||||||
|
"hexcasting.spell.book.hexcasting:write/entity": "Chronicler's Prfn.",
|
||||||
"hexcasting.spell.book.hexcasting:number": "Numerical Reflection",
|
"hexcasting.spell.book.hexcasting:number": "Numerical Reflection",
|
||||||
"hexcasting.spell.book.hexcasting:mask": "Bookkeeper's Gambit",
|
"hexcasting.spell.book.hexcasting:mask": "Bookkeeper's Gambit",
|
||||||
|
|
||||||
|
@ -519,6 +520,7 @@
|
||||||
"hexcasting.mishap.already_brainswept": "The villager has already been used",
|
"hexcasting.mishap.already_brainswept": "The villager has already been used",
|
||||||
"hexcasting.mishap.no_spell_circle": "%s requires a spell circle",
|
"hexcasting.mishap.no_spell_circle": "%s requires a spell circle",
|
||||||
"hexcasting.mishap.others_name": "Tried to invade the privacy of %s's soul",
|
"hexcasting.mishap.others_name": "Tried to invade the privacy of %s's soul",
|
||||||
|
"hexcasting.mishap.others_name.self": "Tried to divulge my Name too recklessly",
|
||||||
"hexcasting.mishap.divide_by_zero.divide": "Attempted to divide %s by %s",
|
"hexcasting.mishap.divide_by_zero.divide": "Attempted to divide %s by %s",
|
||||||
"hexcasting.mishap.divide_by_zero.project": "Attempted to project %s onto %s",
|
"hexcasting.mishap.divide_by_zero.project": "Attempted to project %s onto %s",
|
||||||
"hexcasting.mishap.divide_by_zero.exponent": "Attempted to raise %s to the %s",
|
"hexcasting.mishap.divide_by_zero.exponent": "Attempted to raise %s to the %s",
|
||||||
|
@ -975,7 +977,7 @@
|
||||||
"hexcasting.page.readwrite.read": "Copy the iota stored in the item in my other hand and add it to the stack.",
|
"hexcasting.page.readwrite.read": "Copy the iota stored in the item in my other hand and add it to the stack.",
|
||||||
"hexcasting.page.readwrite.write": "Remove the top iota from the stack, and save it into the item in my other hand.",
|
"hexcasting.page.readwrite.write": "Remove the top iota from the stack, and save it into the item in my other hand.",
|
||||||
"hexcasting.page.readwrite.read/entity": "Like $(l:patterns/readwrite#hexcasting:read)$(action)Scribe's Reflection/$, but the iota is read out of an entity instead of my other hand.",
|
"hexcasting.page.readwrite.read/entity": "Like $(l:patterns/readwrite#hexcasting:read)$(action)Scribe's Reflection/$, but the iota is read out of an entity instead of my other hand.",
|
||||||
"hexcasting.page.readwrite.write/entity": "Like $(l:patterns/readwrite#hexcasting:read)$(action)Scribe's Reflection/$, but the iota is written to an entity instead of my other hand.",
|
"hexcasting.page.readwrite.write/entity": "Like $(l:patterns/readwrite#hexcasting:read)$(action)Scribe's Gambit/$, but the iota is written to an entity instead of my other hand.$(br2)Interestingly enough, it looks like I cannot write my own Name using this spell. I get a sense that I might be endangered if I could.",
|
||||||
"hexcasting.page.readwrite.readable": "If the item in my other hand holds an iota I can read, returns True. Otherwise, returns False.",
|
"hexcasting.page.readwrite.readable": "If the item in my other hand holds an iota I can read, returns True. Otherwise, returns False.",
|
||||||
"hexcasting.page.readwrite.readable/entity": "Like $(l:patterns/readwrite#hexcasting:readable)$(action)Auditor's Reflection/$, but the readability of an entity is checked instead of my other hand.",
|
"hexcasting.page.readwrite.readable/entity": "Like $(l:patterns/readwrite#hexcasting:readable)$(action)Auditor's Reflection/$, but the readability of an entity is checked instead of my other hand.",
|
||||||
"hexcasting.page.readwrite.writable": "If I could save an iota into the item in my other hand, returns True. Otherwise, returns False.",
|
"hexcasting.page.readwrite.writable": "If I could save an iota into the item in my other hand, returns True. Otherwise, returns False.",
|
||||||
|
|
Loading…
Reference in a new issue