Exemple #1
0
        public void RemapTest1()
        {
            string    code   = "iftrue: {IncreaseHealth:5}, IncreaseHealth:1";
            IOJMethod method = parser.Parse(code, Filename);

            method.Invoke(context);
            Assert.AreEqual(15, context.hostCard.health);
        }
Exemple #2
0
        public static void TestMethod2()
        {
            //string code = @"if: true, {IncreaseHealth:;Log:'in ',health; iftrue}";
            string code = "if:true or false, log:'in'";
            Dictionary <string, string> remaps = new Dictionary <string, string>();

            remaps.Add("iftrue", "if:{Equals:health,10},$1");

            var         parser  = new OJParser(typeof(CardCommondDefiner), remaps);
            IOJMethod   method  = parser.Parse(code, Filename);
            GameContext context = new GameContext();

            context.hostCard = new Card()
            {
                health = 10
            };
            DateTime time = DateTime.Now;

            for (int i = 0; i < 1; i++)
            {
                method.Invoke(context);
            }
            Console.WriteLine($"{DateTime.Now - time}");
        }
        public void ORTest3()
        {
            string    code   = "if:false or true, IncreaseHealth";
            IOJMethod method = parser.Parse(code, Filename);

            method.Invoke(context);
            Assert.AreEqual(15, context.hostCard.health);
        }