예제 #1
0
        public void PourOutTest()
        {
            string testMap = @"Testmap
5 5
#####
#...#
#~.##
#.*.#
#####
";


            var DM = DungeonMaster.CreateFromMap(testMap, data);

            DM.Sides.Add(new Side("Test"));
            DM.currentSideID = DM.Sides[0].ID;
            var chaliceBearer = new Character("Chalice Bearer", 10, 10, 10, 10, 10, 10);
            var injuredGuy    = new Character("Injured", 10, 10, 10, 10, 10, 10);

            injuredGuy.TakeDamage(DamageEffect.DamageType.True, 1);
            chaliceBearer.Pos = new Position(2, 2);
            injuredGuy.Pos    = new Position(2, 1);
            DM.CreateCharacter(chaliceBearer);
            DM.CreateCharacter(injuredGuy);
            string vis = DM.VisualizeWorld();

            var pourOut      = data.Actions.First(a => a.Name == "Pour Out");
            var validTargets = pourOut.GetValidTargets(DM, chaliceBearer);

            Assert.AreEqual(7, validTargets.Count);

            var outcome = new Outcome();

            pourOut.ResolveAction(DM, chaliceBearer, chaliceBearer.Pos + Map.DirectionToPosition[Map.Direction.N], injuredGuy, "", outcome);
            Assert.AreEqual(injuredGuy.Vitality.Max, injuredGuy.Vitality.Value);
            Assert.AreEqual("Shallow Pool", DM.map.GetTile(injuredGuy.Pos).Name);

            var south = chaliceBearer.Pos + Map.DirectionToPosition[Map.Direction.S];

            pourOut.ResolveAction(DM, chaliceBearer, south, null, "", outcome);
            Assert.AreEqual("Floor", DM.map.GetTile(south).Name);
        }