コード例 #1
0
        private void CheckFreeMovingToBonus(BonusIDType bonusID)
        {
            var availInBonus = _income.BonusRestrictions[bonusID] - _armiesUsedOnBonuses.ValueOrZero(bonusID);

            Assert.Fatal(availInBonus > 0, "CheckFreeMovingToBonus called with 0 armies available to move");

            foreach (var terrID in _map.Bonuses[bonusID].Territories)
            {
                var free = _freeArmiesUsedOn.ValueOrZero(terrID);

                if (free > 0)
                {
                    var toMove = SharedUtility.MathMin(free, availInBonus);

                    _freeArmiesUsedOn.AddTo(terrID, -toMove);
                    _armiesUsedOnBonuses.AddTo(bonusID, toMove);
                    availInBonus -= toMove;

                    if (availInBonus == 0)
                    {
                        return;
                    }
                }
            }
        }
コード例 #2
0
ファイル: BonusDetails.cs プロジェクト: Norman1/WarLightAI
 public BonusDetails(MapDetails parent, BonusIDType id, int armiesReward)
 {
     this.Parent      = parent;
     this.ID          = id;
     this.Amount      = armiesReward;
     this.Territories = new List <TerritoryIDType>();
 }
コード例 #3
0
 internal PlayerIncomeProgress(BonusIDType bonusID, int deployed, int totalToDeploy)
 {
     this.Restriction   = bonusID;
     this.Deployed      = deployed;
     this.TotalToDeploy = totalToDeploy;
 }
コード例 #4
0
        public static GameOrderPlayCardSurveillance Create(CardInstanceIDType cardInstanceID, PlayerIDType playerID, BonusIDType targetBonus)
        {
            var o = new GameOrderPlayCardSurveillance();

            o.CardInstanceID = cardInstanceID;
            o.PlayerID       = playerID;
            o.TargetBonus    = targetBonus;
            return(o);
        }