From a923bf11499cd0ac3af80c3b0c0f19ce053bc05e Mon Sep 17 00:00:00 2001 From: Alex Nisnevich Date: Mon, 21 Aug 2023 19:00:14 -0700 Subject: [PATCH] Support 'When enemy robots are adjacent to this structure all adjacent enemy robots can't attack' --- src/main/scala/wordbots/Lexicon.scala | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/scala/wordbots/Lexicon.scala b/src/main/scala/wordbots/Lexicon.scala index 137db09..8f7e0ab 100644 --- a/src/main/scala/wordbots/Lexicon.scala +++ b/src/main/scala/wordbots/Lexicon.scala @@ -389,16 +389,14 @@ object Lexicon { (NP|Num, λ {amount: Number => Life(amount)}), (NP/Adj, λ {amount: Number => Life(amount)}) )) + - ("if" -> Seq( - ((S|S)|S, λ {c: GlobalCondition => λ {a: Action => If(c, a)}}), // "if" for actions - ((S|S)|S, λ {c: GlobalCondition => λ {a: PassiveAbility => a.conditionOn(c)}}) // "if" for abilities - )) + + ("if" -> ((S|S)|S, λ {c: GlobalCondition => λ {a: Action => If(c, a)}})) + // "if" for actions + (Seq("if", "when", "whenever") -> ((S|S)|S, λ {c: GlobalCondition => λ {a: PassiveAbility => a.conditionOn(c)}})) + // "if" for abilities (Seq("in", "on", "of", "from", "into") -> (PP/NP, identity)) + ("increase" -> ((S/PP)/N, λ {a: TargetAttribute => λ {i: Scalar => ModifyAttribute(a.target, a.attr, Plus(i))}})) + // e.g. "increase its attack by X" ("instead" -> (S|S, λ {a: Action => Instead(a)})) + ("in combat" -> (S\S, λ {t: AfterDestroyed => AfterDestroyed(t.target, Combat)})) + (Seq("in play", "on the board") -> (NP\N, λ {o: ObjectType => ObjectsInPlay(o)})) + - ("is" -> (X|X, identity)) + + (Seq("is", "are") -> (X|X, identity)) + ("it" -> (NP, ItO: Sem)) + ("its" -> Seq( (Num/N, λ {a: SingleAttribute => AttributeValue(ItO, a)}),