protected void Term() { bool minus = false; bool not = false; SkipWhite(); if (Next == Grammar.MINUS) { Consume(Grammar.MINUS); minus = true; } else if (Next == Grammar.EXCL) { Consume(Grammar.EXCL); not = true; } if (IsDigit(Next)) { GetNum(); short value = short.Parse(Current); if (minus) { value = (short)-value; } emitter.Literal(value); } else if (IsString(Next)) { GetString(); if (StringResolver == null) { throw new Exception("Tried to resolve a string without resolver set"); } short sindex = StringResolver.GetStringID(Current); emitter.Literal(sindex); } else { GetName(); if (IsBuiltinFunction(Current)) { BuiltinFunctionCall(); } else if (IsInternal(Current)) { InternalTerm(); } else if (IsScript(Current)) { ScriptTerm(); } else if (variables.ContainsKey(Current)) { VarTerm(); } else { if (NameResolver == null) { throw new Exception("Tried to resolve a name without resolver set"); } short id = NameResolver.GetNameValue(Current); emitter.Literal(id); } } if (not) { emitter.Negate(); } SkipWhite(); }
static void OpFilterHPBelow(Emitter e, int args, bool returnResult) { e.Literal(FilterHPBelow); e.Emit(Op.FilterTargets); }
static void OpSelectRandom(Emitter e, int args, bool returnResult) { e.Literal(SelectRandom); e.Emit(Op.SelectTarget); }
static void OpFilterRange(Emitter e, int args, bool returnResult) { e.Literal(FilterRange); e.Emit(Op.FilterTargets); }
static void OpSelectEnemies(Emitter e, int args, bool returnResult) { e.Literal(SelectEnemies); e.Emit(Op.SelectTargets); }