Esempio n. 1
0
        public void TestBasicArmyCountLimits()
        {
            var track = new SupplyTrack(new List<ArmySizeSupplyLimit>()
                                    { new ArmySizeSupplyLimit()
                                      { ArmyCountLimit = null, Size = 1, Supply = 0 }});

              track.GetArmyCountLimit(supply: 0, size: 1).Should().Be(null);
        }
Esempio n. 2
0
        public void TestBasicSupplyAmount()
        {
            var baratheon = new Player(HouseName.Baratheon);
              var lannister = new Player(HouseName.Lannister);
              var stark = new Player(HouseName.Stark);

              var track = new SupplyTrack(null);

              track.Add(baratheon, supply: 2);
              track.Add(lannister, supply: 2);
              track.Add(stark,     supply: 1);

              track.GetSupply(baratheon).Should().Be(2);
              track.GetSupply(lannister).Should().Be(2);
              track.GetSupply(stark)    .Should().Be(1);
        }
Esempio n. 3
0
        public void TestMinimumSupply()
        {
            var baratheon = new Player(HouseName.Baratheon);
              var lannister = new Player(HouseName.Lannister);
              var stark = new Player(HouseName.Stark);

              var track = new SupplyTrack(null);

              track.Add(baratheon, supply: 2);
              track.Add(lannister, supply: 2);
              track.Add(stark, supply: 1);

              Action set = () => track.Set(stark, supply: -1);
              set.ShouldThrow<ArgumentOutOfRangeException>("because 0 is the minimum supply level.");

              track.GetSupply(baratheon).Should().Be(2);
              track.GetSupply(lannister).Should().Be(2);
              track.GetSupply(stark).Should().Be(1);
        }
        public void TestLoadLimitsFromFile()
        {
            var track = new SupplyTrack(GameData.GetSupplyLimits());

            track.GetArmyCountLimit(supply: 0, size: 1).Should().Be(null);
            track.GetArmyCountLimit(supply: 0, size: 2).Should().Be(2);
            track.GetArmyCountLimit(supply: 0, size: 3).Should().Be(0);
            track.GetArmyCountLimit(supply: 0, size: 4).Should().Be(0);

            track.GetArmyCountLimit(supply: 1, size: 1).Should().Be(null);
            track.GetArmyCountLimit(supply: 1, size: 2).Should().Be(1);
            track.GetArmyCountLimit(supply: 1, size: 3).Should().Be(1);
            track.GetArmyCountLimit(supply: 1, size: 4).Should().Be(0);

            track.GetArmyCountLimit(supply: 2, size: 1).Should().Be(null);
            track.GetArmyCountLimit(supply: 2, size: 2).Should().Be(2);
            track.GetArmyCountLimit(supply: 2, size: 3).Should().Be(1);
            track.GetArmyCountLimit(supply: 2, size: 4).Should().Be(0);

            track.GetArmyCountLimit(supply: 3, size: 1).Should().Be(null);
            track.GetArmyCountLimit(supply: 3, size: 2).Should().Be(3);
            track.GetArmyCountLimit(supply: 3, size: 3).Should().Be(1);
            track.GetArmyCountLimit(supply: 3, size: 4).Should().Be(0);

            track.GetArmyCountLimit(supply: 4, size: 1).Should().Be(null);
            track.GetArmyCountLimit(supply: 4, size: 2).Should().Be(2);
            track.GetArmyCountLimit(supply: 4, size: 3).Should().Be(2);
            track.GetArmyCountLimit(supply: 4, size: 4).Should().Be(0);

            track.GetArmyCountLimit(supply: 5, size: 1).Should().Be(null);
            track.GetArmyCountLimit(supply: 5, size: 2).Should().Be(2);
            track.GetArmyCountLimit(supply: 5, size: 3).Should().Be(1);
            track.GetArmyCountLimit(supply: 5, size: 4).Should().Be(1);

            track.GetArmyCountLimit(supply: 6, size: 1).Should().Be(null);
            track.GetArmyCountLimit(supply: 6, size: 2).Should().Be(3);
            track.GetArmyCountLimit(supply: 6, size: 3).Should().Be(1);
            track.GetArmyCountLimit(supply: 6, size: 4).Should().Be(1);
        }
    // Use this for initialization
    void Start()
    {
        #region InitializePositionArrays

        //Single Supply Icon
        PositionsOneArray[0] = PositionOne0;
        PositionsOneArray[1] = PositionOne1;
        PositionsOneArray[2] = PositionOne2;
        PositionsOneArray[3] = PositionOne3;
        PositionsOneArray[4] = PositionOne4;
        PositionsOneArray[5] = PositionOne5;
        PositionsOneArray[6] = PositionOne6;

        //Two Supply Icons
        PositionTwoArray[0, 0] = PositionTwo0First; PositionTwoArray[0, 1] = PositionTwo0Second;
        PositionTwoArray[1, 0] = PositionTwo1First; PositionTwoArray[1, 1] = PositionTwo1Second;
        PositionTwoArray[2, 0] = PositionTwo2First; PositionTwoArray[2, 1] = PositionTwo2Second;
        PositionTwoArray[3, 0] = PositionTwo3First; PositionTwoArray[3, 1] = PositionTwo3Second;
        PositionTwoArray[4, 0] = PositionTwo4First; PositionTwoArray[4, 1] = PositionTwo4Second;
        PositionTwoArray[5, 0] = PositionTwo5First; PositionTwoArray[5, 1] = PositionTwo5Second;
        PositionTwoArray[6, 0] = PositionTwo6First; PositionTwoArray[6, 1] = PositionTwo6Second;

        PositionThreeArray[0, 0] = PositionThree0First; PositionThreeArray[0, 1] = PositionThree0Second; PositionThreeArray[0, 2] = PositionThree0Third;
        PositionThreeArray[1, 0] = PositionThree1First; PositionThreeArray[1, 1] = PositionThree1Second; PositionThreeArray[1, 2] = PositionThree1Third;
        PositionThreeArray[2, 0] = PositionThree2First; PositionThreeArray[2, 1] = PositionThree2Second; PositionThreeArray[2, 2] = PositionThree2Third;
        PositionThreeArray[3, 0] = PositionThree3First; PositionThreeArray[3, 1] = PositionThree3Second; PositionThreeArray[3, 2] = PositionThree3Third;
        PositionThreeArray[4, 0] = PositionThree4First; PositionThreeArray[4, 1] = PositionThree4Second; PositionThreeArray[4, 2] = PositionThree4Third;
        PositionThreeArray[5, 0] = PositionThree5First; PositionThreeArray[5, 1] = PositionThree5Second; PositionThreeArray[5, 2] = PositionThree5Third;
        PositionThreeArray[6, 0] = PositionThree6First; PositionThreeArray[6, 1] = PositionThree6Second; PositionThreeArray[6, 2] = PositionThree6Third;

        PositionFourArray[0, 0] = PositionFour0First; PositionFourArray[0, 1] = PositionFour0Second; PositionFourArray[0, 2] = PositionFour0Third; PositionFourArray[0, 3] = PositionFour0Fourth;
        PositionFourArray[1, 0] = PositionFour1First; PositionFourArray[1, 1] = PositionFour1Second; PositionFourArray[1, 2] = PositionFour1Third; PositionFourArray[1, 3] = PositionFour1Fourth;
        PositionFourArray[2, 0] = PositionFour2First; PositionFourArray[2, 1] = PositionFour2Second; PositionFourArray[2, 2] = PositionFour2Third; PositionFourArray[2, 3] = PositionFour2Fourth;
        PositionFourArray[3, 0] = PositionFour3First; PositionFourArray[3, 1] = PositionFour3Second; PositionFourArray[3, 2] = PositionFour3Third; PositionFourArray[3, 3] = PositionFour3Fourth;
        PositionFourArray[4, 0] = PositionFour4First; PositionFourArray[4, 1] = PositionFour4Second; PositionFourArray[4, 2] = PositionFour4Third; PositionFourArray[4, 3] = PositionFour4Fourth;
        PositionFourArray[5, 0] = PositionFour5First; PositionFourArray[5, 1] = PositionFour5Second; PositionFourArray[5, 2] = PositionFour5Third; PositionFourArray[5, 3] = PositionFour5Fourth;
        PositionFourArray[6, 0] = PositionFour6First; PositionFourArray[6, 1] = PositionFour6Second; PositionFourArray[6, 2] = PositionFour6Third; PositionFourArray[6, 3] = PositionFour6Fourth;

        PositionSixArray[0, 0] = PositionSix0First; PositionSixArray[0, 1] = PositionSix0Second; PositionSixArray[0,2] = PositionSix0Third; PositionSixArray[0, 3] = PositionSix0Fourth; PositionSixArray[0, 4] = PositionSix0Fifth; PositionSixArray[0, 5] = PositionSix0Sixth;
        PositionSixArray[1, 0] = PositionSix1First; PositionSixArray[1, 1] = PositionSix1Second; PositionSixArray[1, 2] = PositionSix1Third; PositionSixArray[1, 3] = PositionSix1Fourth; PositionSixArray[1, 4] = PositionSix1Fifth; PositionSixArray[1, 5] = PositionSix1Sixth;
        PositionSixArray[2, 0] = PositionSix2First; PositionSixArray[2, 1] = PositionSix2Second; PositionSixArray[2, 2] = PositionSix2Third; PositionSixArray[2, 3] = PositionSix2Fourth; PositionSixArray[2, 4] = PositionSix2Fifth; PositionSixArray[2, 5] = PositionSix2Sixth;
        PositionSixArray[3, 0] = PositionSix3First; PositionSixArray[3, 1] = PositionSix3Second; PositionSixArray[3, 2] = PositionSix3Third; PositionSixArray[3, 3] = PositionSix3Fourth; PositionSixArray[3, 4] = PositionSix3Fifth; PositionSixArray[3, 5] = PositionSix3Sixth;
        PositionSixArray[4, 0] = PositionSix4First; PositionSixArray[4, 1] = PositionSix4Second; PositionSixArray[4, 2] = PositionSix4Third; PositionSixArray[4, 3] = PositionSix4Fourth; PositionSixArray[4, 4] = PositionSix4Fifth; PositionSixArray[4, 5] = PositionSix4Sixth;
        PositionSixArray[5, 0] = PositionSix5First; PositionSixArray[5, 1] = PositionSix5Second; PositionSixArray[5, 2] = PositionSix5Third; PositionSixArray[5, 3] = PositionSix5Fourth; PositionSixArray[5, 4] = PositionSix5Fifth; PositionSixArray[5, 5] = PositionSix5Sixth;
        PositionSixArray[6, 0] = PositionSix6First; PositionSixArray[6, 1] = PositionSix6Second; PositionSixArray[6, 2] = PositionSix6Third; PositionSixArray[6, 3] = PositionSix6Fourth; PositionSixArray[6, 4] = PositionSix6Fifth; PositionSixArray[6, 5] = PositionSix6Sixth;

        #endregion
        supplyTrack = GameBase.supplyTrack;
        mySubject = GameBase.supplyTrack;
        mySubject.DefineObserver(this);
        mySubject.InitialObserverCall();
    }
Esempio n. 6
0
        public void TestSharedSupplyLevels()
        {
            var baratheon = new Player(HouseName.Baratheon);
              var lannister = new Player(HouseName.Lannister);
              var stark = new Player(HouseName.Stark);
              var tyrell = new Player(HouseName.Tyrell);
              var greyjoy = new Player(HouseName.Greyjoy);
              var martell = new Player(HouseName.Martell);

              var track = new SupplyTrack(null);

              track.Add(baratheon, supply: 2);
              track.Add(lannister, supply: 2);
              track.Add(stark,     supply: 2);
              track.Add(tyrell,    supply: 2);
              track.Add(greyjoy,   supply: 2);
              track.Add(martell,   supply: 2);

              track.GetSupply(baratheon).Should().Be(2);
              track.GetSupply(lannister).Should().Be(2);
              track.GetSupply(stark)    .Should().Be(2);
              track.GetSupply(tyrell)   .Should().Be(2);
              track.GetSupply(greyjoy)  .Should().Be(2);
              track.GetSupply(martell)  .Should().Be(2);
        }
Esempio n. 7
0
File: Game.cs Progetto: jtheis85/GoT
 /// <summary>
 /// 
 /// </summary>
 public Game()
 {
     players = new List<Player>();
       influenceTracks = new List<InfluenceTrack>();
       supplyTrack = new SupplyTrack(GameData.GetSupplyLimits());
 }
Esempio n. 8
0
    // Use this for initialization
    void Start()
    {
        GameBase.TerritoryList = DeclareTerritories.MakeTerritories();
        GameBase.wildlingTrack = new WildlingTrack(2);
        GameBase.IronThroneTrack = new InfluenceTrack(6);
        GameBase.FeifdomTrack = new InfluenceTrack(6);
        GameBase.KingsCourtTrack = new InfluenceTrack(6);
        GameBase.roundTrack = new RoundTrack(1);
        GameBase.supplyTrack = new SupplyTrack();
        GameBase.bannedOrders = new BannedOrders();

        #region Houses are created from the Selected Houses in HouseSelection level
        /*
        List<HouseSelect> houseSelectList_fromHouseSelect = HouseSelectList.houseSelectList;

        foreach (HouseSelect hs in houseSelectList_fromHouseSelect)
        {
            if (hs.House == "Stark")
            {
                House Stark = new House(HouseCharacter.Stark, StarkTerritory, null, 15, 5, hs.gp);
                HouseList.Add(Stark);
            }
            else if (hs.House == "Baratheon")
            {
                House Baratheon = new House(HouseCharacter.Baratheon, BaratheonTerritory, null, 15, 5, hs.gp);
                HouseList.Add(Baratheon);
            }
            else if (hs.House == "Greyjoy")
            {
                House Greyjoy = new House(HouseCharacter.Greyjoy, GreyjoyTerritory, null, 15, 5, hs.gp);
                HouseList.Add(Greyjoy);
            }
            else if (hs.House == "Lannister")
            {
                House Lannister = new House(HouseCharacter.Lannister, LannisterTerritory, null, 15, 5, hs.gp);
                HouseList.Add(Lannister);
            }
            else if (hs.House == "Tyrell")
            {
                House Tyrell = new House(HouseCharacter.Tyrell, TyrellTerritory, null, 15, 5,hs.gp);
                HouseList.Add(Tyrell);
            }
            else if (hs.House == "Martell")
            {
                House Martell = new House(HouseCharacter.Martell, MartellTerritory, null, 15, 5, hs.gp);
                HouseList.Add(Martell);
            }
        }
        */
        #endregion

        #region myHouse set
        /*
        foreach (HouseSelect hs in houseSelectList_fromHouseSelect)
        {
            if (hs.gp._player == Network.player)
            {
                foreach (House h in HouseList)
                {
                    if (hs.House == "Stark" && h.HouseCharacter == HouseCharacter.Stark)
                    {
                        myHouse = h;
                    }
                    else if (hs.House == "Greyjoy" && h.HouseCharacter == HouseCharacter.Greyjoy)
                    {
                        myHouse = h;
                    }
                    else if (hs.House == "Baratheon" && h.HouseCharacter == HouseCharacter.Baratheon)
                    {
                        myHouse = h;
                    }
                    else if (hs.House == "Lannister" && h.HouseCharacter == HouseCharacter.Lannister)
                    {
                        myHouse = h;
                    }
                    else if (hs.House == "Martell" && h.HouseCharacter == HouseCharacter.Martell)
                    {
                        myHouse = h;
                    }
                    else if (hs.House == "Tyrell" && h.HouseCharacter == HouseCharacter.Tyrell)
                    {
                        myHouse = h;
                    }
                }
            }
        }
        */
        #endregion
    }