예제 #1
0
        public void TestMapAndRoomActivation()
        {
            DndGame dndGame         = new DndGame();
            DndMap  map             = dndGame.AddMap(new DndMap("Caves of the Wandering Winds"));
            DndRoom wizardsWorkshop = map.AddRoom(new DndRoom("Wizard's Workshop"));

            Assert.IsNull(dndGame.ActiveMap);
            dndGame.ActivateMap(map);
            Assert.IsNull(dndGame.ActiveRoom);
            Assert.IsNull(map.ActiveRoom);
            dndGame.ActivateRoom(wizardsWorkshop);
            Assert.AreEqual(map, dndGame.ActiveMap);
            Assert.AreEqual(wizardsWorkshop, dndGame.ActiveRoom);
            Assert.AreEqual(wizardsWorkshop, map.ActiveRoom);
        }
예제 #2
0
        public void TestMapAndRoomActivation()
        {
            DndGame game = DndGame.Instance;

            game.GetReadyToPlay();
            DndMap  map             = game.AddMap(new DndMap("Caves of the Wandering Winds"));
            DndRoom wizardsWorkshop = map.AddRoom(new DndRoom("Wizard's Workshop"));

            Assert.IsNull(game.ActiveMap);
            game.ActivateMap(map);
            Assert.IsNull(game.ActiveRoom);
            Assert.IsNull(map.ActiveRoom);
            game.ActivateRoom(wizardsWorkshop);
            Assert.AreEqual(map, game.ActiveMap);
            Assert.AreEqual(wizardsWorkshop, game.ActiveRoom);
            Assert.AreEqual(wizardsWorkshop, map.ActiveRoom);
        }
예제 #3
0
        public void TestPositionCreatures()
        {
            DndGame game = DndGame.Instance;

            game.GetReadyToPlay();
            Character alice   = game.AddPlayer(CharacterBuilder.BuildTestBarbarian("a"));
            Character betty   = game.AddPlayer(CharacterBuilder.BuildTestDruid("b"));
            Character charlie = game.AddPlayer(CharacterBuilder.BuildTestElf("c"));
            Character david   = game.AddPlayer(CharacterBuilder.BuildTestWizard("d"));
            DndMap    map     = game.AddMap(new DndMap("Caves of the Wandering Winds"));
            DndRoom   dndRoom = map.AddRoom(new DndRoom("Wizard's Workshop"));

            Assert.AreEqual(new Vector(0, 0), alice.Location);
            Assert.AreEqual(Vector.zero, betty.Location);
            dndRoom.PositionCreatures(@"
┌───────────────┐
│               │
│               │
│    a          │
│            c  │
│               └───────────────┐
│       b                       │
│                                       │
│                               │
│                               │
│               ┌───────────────┘
│           d   │
│               │
│    e          │
│               │
│               │
└───────────────┘");
            game.ActivateMap(map);
            game.ActivateRoom(dndRoom);
            Assert.AreEqual(new Vector(DndMap.SquareSide * 5, DndMap.SquareSide * 3), alice.Location);
            Assert.AreEqual(new Vector(DndMap.SquareSide * 8, DndMap.SquareSide * 6), betty.Location);
            Assert.AreEqual(new Vector(DndMap.SquareSide * 13, DndMap.SquareSide * 4), charlie.Location);
            Assert.AreEqual(new Vector(DndMap.SquareSide * 12, DndMap.SquareSide * 11), david.Location);

            //dndGame.EnterCombat(true);
            //ergo.QueueAction(new ActionAttack(alice, AttackNames.Constrict));
        }
예제 #4
0
        public void TestPositionCreatures()
        {
            DndGame   dndGame = new DndGame();
            Character alice   = dndGame.AddPlayer(CharacterBuilder.BuildTestBarbarian("a"));
            Character betty   = dndGame.AddPlayer(CharacterBuilder.BuildTestDruid("b"));
            Character charlie = dndGame.AddPlayer(CharacterBuilder.BuildTestElf("c"));
            Character david   = dndGame.AddPlayer(CharacterBuilder.BuildTestWizard("d"));
            DndMap    map     = dndGame.AddMap(new DndMap("Caves of the Wandering Winds"));
            DndRoom   dndRoom = map.AddRoom(new DndRoom("Wizard's Workshop"));

            Assert.AreEqual(new Vector(0, 0), alice.WorldPosition);
            Assert.AreEqual(Vector.zero, betty.WorldPosition);
            dndRoom.PositionCreatures(@"
┌───────────────┐
│               │
│               │
│    a          │
│            c  │
│               └───────────────┐
│       b                       │
│                                       │
│                               │
│                               │
│               ┌───────────────┘
│           d   │
│               │
│    e          │
│               │
│               │
└───────────────┘");
            dndGame.ActivateMap(map);
            dndGame.ActivateRoom(dndRoom);
            Assert.AreEqual(new Vector(5, 3), alice.WorldPosition);
            Assert.AreEqual(new Vector(8, 6), betty.WorldPosition);
            Assert.AreEqual(new Vector(13, 4), charlie.WorldPosition);
            Assert.AreEqual(new Vector(12, 11), david.WorldPosition);

            //dndGame.EnterCombat(true);
            //ergo.QueueAction(new ActionAttack(alice, AttackNames.Constrict));
        }