コード例 #1
0
ファイル: AIDecider.cs プロジェクト: bodommer/Monopoly
 public static bool TradeOfferDecide(Card item, float money, Cards.PropertyManager pm, AIPlayer player)
 {
     if (item is PropertyCard)
     {
         PropertyCard propCard      = (PropertyCard)item;
         float        requiredMoney = (3 + player.dangerFactor) * propCard.Cost;
         if (!(pm.OwnsWholeGroup(item.Group, player)))
         {
             if (money > requiredMoney)
             {
                 return(true);
             }
         }
     }
     else if (item is BonusCard)
     {
         if (money > (2 + player.dangerFactor) * item.Cost)
         {
             return(true);
         }
     }
     else
     {
         if (money > (1.5 + 2 * player.dangerFactor) * item.Cost)
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #2
0
 /**
  * The cosntructor. Prepares the game, assigns/creates its helping classes/data manipulators.
  */
 public Game(Player[] players, Monopoly window)
 {
     this.players = players;
     GameState    = GameStage.DICE;
     this.window  = window;
     //bgw = new BackgroundWorker();
     colorGroups = new int[, ] {
         { 0, 0, 0 }, { 255, 51, 51 }, { 0, 128, 255 }, { 152, 76, 0 },
         { 255, 153, 51 }, { 255, 102, 255 }, { 0, 0, 204 },
         { 0, 204, 102 }, { 255, 255, 51 }
     };
     currentPlayer       = players[playerTurnPointer];
     riskCardManager     = new RiskCardManager();
     treasureCardManager = new TreasureCardManager();
     propertyManager     = new Cards.PropertyManager();
     gameplan            = new Gameplan(players, propertyManager.GetFieldTypes());
     window.ShowPlayerInfo(currentPlayer);
     window.Load   += OnLoad;
     window.Enabled = true;
 }