コード例 #1
0
        public void TestAddRoster()
        {
            UnitBook book = new UnitBook(UnitTeam.team1);

            UnitRoster rosterOne = new UnitRoster(null, UnitTeam.team1);
            UnitEntity mu1       = new UnitEntity();

            rosterOne.AddUnit(mu1);

            //expect success the first time
            Assert.IsTrue(book.AddRoster(rosterOne, TeamRelation.player), "Roster not added to GameMap");

            //and failure the next
            Assert.IsFalse(book.AddRoster(rosterOne, TeamRelation.player), "Duplicate roster added");

            UnitRoster rosterTwo = new UnitRoster(null, UnitTeam.team2);
            UnitEntity mu2       = new UnitEntity();

            rosterTwo.AddUnit(mu2);

            Assert.IsTrue(book.AddRoster(rosterTwo, TeamRelation.enemy), "second roster not successfully added");
        }
コード例 #2
0
        internal static UnitBook GetLausUnits()
        {
            UnitBook ub = new UnitBook();

            //Enemy Units
            UnitEntity[] enemyUnits = new UnitEntity[4] {
                new FE7UnitEntity()
                {
                    InternalName   = "Erik",
                    InitalPosition = new Position(1, 10),
                    MaxHP          = 30,
                    Constitution   = 12,
                    Move           = 7,
                },
                new FE7UnitEntity()
                {
                    InternalName   = "Cavalier1",
                    InitalPosition = new Position(2, 9),
                    MaxHP          = 20,
                    Constitution   = 11,
                    Move           = 7,
                },
                new FE7UnitEntity()
                {
                    InternalName   = "Cavalier2",
                    InitalPosition = new Position(2, 8),
                    MaxHP          = 20,
                    Constitution   = 11,
                    Move           = 7,
                },
                new FE7UnitEntity()
                {
                    InternalName   = "EasternMerc",
                    InitalPosition = new Position(20, 16),
                    MaxHP          = 10,
                    Constitution   = 9,
                    Move           = 5,
                }
            };

            UnitRoster enemyRoster = new UnitRoster(enemyUnits, UnitTeam.team2);;

            //Player Units
            UnitEntity[] playerUnits = new UnitEntity[3] {
                new FE7UnitEntity()
                {
                    InternalName   = "Hector",
                    InitalPosition = new Position(20, 13),
                    Move           = 5,
                    MaxHP          = 20,
                    Constitution   = 15,
                    WeaponList     = new List <IWeaponItem>(new IWeaponItem[1]
                    {
                        new FE7Weapon()
                        {
                            Range = new List <int>(new int[1] {
                                1
                            }),
                            Weight     = 10,
                            Might      = 10,
                            Hit        = 75,
                            Crit       = 5,
                            WeaponType = FE7WeaponType.Axe,
                            Name       = "Wolf Beil",
                        }
                    })
                },
                new FE7UnitEntity()
                {
                    InternalName   = "Eliwood",
                    InitalPosition = new Position(20, 14),
                    Move           = 5,
                    MaxHP          = 20,
                    Constitution   = 12,
                    WeaponList     = new List <IWeaponItem>(new IWeaponItem[1]
                    {
                        new FE7Weapon()
                        {
                            Range = new List <int>(new int[1] {
                                1
                            }),
                            Weight     = 5,
                            Might      = 7,
                            Hit        = 95,
                            Crit       = 10,
                            WeaponType = FE7WeaponType.Sword,
                            Name       = "Rapier",
                        }
                    })
                },
                new FE7UnitEntity()
                {
                    InternalName   = "Serra",
                    InitalPosition = new Position(23, 11),
                    Move           = 5,
                    MaxHP          = 15,
                    Constitution   = 7,
                }
            };

            UnitRoster playerRoster = new UnitRoster(playerUnits, UnitTeam.team1);

            //team Erk
            UnitEntity[] erkUnits = new UnitEntity[1] {
                new FE7UnitEntity()
                {
                    InternalName   = "Erk",
                    InitalPosition = new Position(14, 15),
                    Move           = 7
                }
            };

            UnitRoster erkRoster = new UnitRoster(erkUnits, UnitTeam.team3);

            ub.AddRoster(enemyRoster, TeamRelation.enemy);
            ub.AddRoster(playerRoster, TeamRelation.player);
            ub.AddRoster(erkRoster, TeamRelation.ally);

            return(ub);
        }