Beispiel #1
0
		public Table(Game game, int numPlayers)
			: this(game)
		{
			_NumPlayers = numPlayers;

			int multiplier = _NumPlayers >= 5 ? 2 : 1;
			Copper = new Supply(game, null, Cards.Universal.TypeClass.Copper, 60 * multiplier);
			Silver = new Supply(game, null, Cards.Universal.TypeClass.Silver, 40 * multiplier);
			Gold = new Supply(game, null, Cards.Universal.TypeClass.Gold, 30 * multiplier);

			int extraProvinceCards = 0;
			switch (_NumPlayers)
			{
				case 1:
				case 2:
					_BaseVictoryCards = 8;
					break;
				case 5:
					extraProvinceCards = 3;
					break;
				case 6:
					extraProvinceCards = 6;
					break;
			}
			Estate = new Supply(game, null, Cards.Universal.TypeClass.Estate, 3 * _NumPlayers + _BaseVictoryCards);
			Duchy = new Supply(game, null, Cards.Universal.TypeClass.Duchy, _BaseVictoryCards);
			Province = new Supply(game, null, Cards.Universal.TypeClass.Province, _BaseVictoryCards + extraProvinceCards);

			Curse = new Supply(game, null, Cards.Universal.TypeClass.Curse, 10 * Math.Max(_NumPlayers - 1, 1));
		}
Beispiel #2
0
		public override void ActBefore(Game game)
		{
			Player.PlayCard(Card);
		}
Beispiel #3
0
		public override void ActBefore(Game game)
		{
			Player.Buy(this.Supply);
		}
Beispiel #4
0
		public virtual Thread ActAfter(Game game) { return null; }
Beispiel #5
0
		public virtual void ActBefore(Game game) { }
Beispiel #6
0
		public override void ActBefore(Game game)
		{
			game.Abort();
		}
Beispiel #7
0
		public override void ActBefore(Game game)
		{
			Player.PlayTokens(game, this.Token, this.Count);
		}
Beispiel #8
0
		public override void ActBefore(Game game)
		{
			Player.GoToBuyPhase();
		}
Beispiel #9
0
		public override void ActBefore(Game game)
		{
			Player.PlayTreasures(game);
		}
Beispiel #10
0
		public override Thread ActAfter(Game game)
		{
			return game.SetNextPlayer();
		}
Beispiel #11
0
		public override void ActBefore(Game game)
		{
			//if (Player.Phase != PhaseEnum.Waiting)
			Player.Cleanup();
			//game.SetNextPlayer();
		}
Beispiel #12
0
		public override void ActBefore(Game game)
		{
			if (this.Card != null)
				this.Player.UndoPlayCard(this.Card);
			//if (this.Phase != PhaseEnum.Waiting)
			this.Player.UndoPhaseChange(this.Phase);
		}
Beispiel #13
0
		protected virtual void Dispose(bool disposing)
		{
			// Check to see if Dispose has already been called.
			if (!this.disposed)
			{
				// If disposing equals true, dispose all managed
				// and unmanaged resources.
				if (disposing)
				{
					// Dispose managed resources.
					this._Game = null;
					this._SupplyPiles = null;
					this._SpecialPiles = null;
					this._TokenPiles = null;
					this._SupplyKeys = null;
					this._Trash = null;
				}

				// Call the appropriate methods to clean up
				// unmanaged resources here.
				// If disposing is false,
				// only the following code is executed.

				// Note disposing has been done.
				disposed = true;
			}
		}
Beispiel #14
0
		internal void FinalizeSupplies(Game game)
		{
			_SupplyPiles.FinalizeSetup();
		}
Beispiel #15
0
		public Table(Game game)
		{
			_Game = game;
		}
Beispiel #16
0
		internal void SetupSupplies(Game game)
		{
			// Check for addition of Platinum/Colony
			Boolean useColonyPlatinum = false;
			switch (game.Settings.ColonyPlatinumUsage)
			{
				case ColonyPlatinumUsage.Standard:
				case ColonyPlatinumUsage.Used:
				case ColonyPlatinumUsage.NotUsed:
					if (game.RNG.Next(1, _SupplyPiles.Values.Count(s => s.Location == Location.Kingdom) + 1) <=
						_SupplyPiles.Values.Count(s => s.Location == Location.Kingdom && s.Source == Source.Prosperity))
						// We have a winner!
						useColonyPlatinum = true;
					break;

				case ColonyPlatinumUsage.Always:
					useColonyPlatinum = true;
					break;
			}
			if (useColonyPlatinum)
			{
				this.Supplies[Cards.Prosperity.TypeClass.Platinum] = new Supply(game, null, Cards.Prosperity.TypeClass.Platinum, 12);
				this.Supplies[Cards.Prosperity.TypeClass.Colony] = new Supply(game, null, Cards.Prosperity.TypeClass.Colony, _BaseVictoryCards);
				game.Settings.ColonyPlatinumUsage = ColonyPlatinumUsage.Used;
			}
			else
			{
				game.Settings.ColonyPlatinumUsage = ColonyPlatinumUsage.NotUsed;
			}

			// Check for addition of Shelters
			Boolean useShelter = false;
			switch (game.Settings.ShelterUsage)
			{
				case ShelterUsage.Standard:
				case ShelterUsage.Used:
				case ShelterUsage.NotUsed:
					if (game.RNG.Next(1, _SupplyPiles.Values.Count(s => s.Location == Location.Kingdom) + 1) <=
						_SupplyPiles.Values.Count(s => s.Location == Location.Kingdom && s.Source == Source.DarkAges))
						// We have a winner!
						useShelter = true;
					break;

				case ShelterUsage.Always:
					useShelter = true;
					break;
			}
			if (useShelter)
			{
				this.Estate.Take(3 * game.Players.Count);
				this.Supplies[Cards.DarkAges.TypeClass.Shelters] = new Supply(game, null, Cards.DarkAges.TypeClass.Shelters, Visibility.Top);

				game.Settings.ShelterUsage = ShelterUsage.Used;
			}
			else
			{
				game.Settings.ShelterUsage = ShelterUsage.NotUsed;
			}

			_SupplyPiles.Setup();

			foreach (Supply supply in _SupplyPiles.Values.Concat(SpecialPiles.Values))
			{
				if (supply.CurrentCost.Potion.Value > 0 && !_SupplyPiles.ContainsKey(Cards.Alchemy.TypeClass.Potion))
				{
					Potion = new Supply(game, game.Players, Cards.Alchemy.TypeClass.Potion, 16);
					break;
				}

				if (supply.CardTypes.Count() > 1)
				{
					foreach (Type cardType in supply.CardTypes)
					{
						Card card = Card.CreateInstance(cardType);
						if (game.ComputeCost(card).Potion.Value > 0 && !_SupplyPiles.ContainsKey(Cards.Alchemy.TypeClass.Potion))
						{
							Potion = new Supply(game, game.Players, Cards.Alchemy.TypeClass.Potion, 16);
							break;
						}
					}
				}

				if (_SupplyPiles.ContainsKey(Cards.Alchemy.TypeClass.Potion))
					break;
			}
		}