コード例 #1
0
        internal Card(String name, Category category, Source source, Location location)
        {
            _Name     = name;
            _Category = category;
            _Source   = source;
            _Location = location;
            Boolean isTreasure = (_Category & Category.Treasure) == Category.Treasure;

            _Benefit         = new CardBenefit(isTreasure);
            _DurationBenefit = new CardBenefit(isTreasure);

            if ((category & Cards.Category.Attack) == Cards.Category.Attack)
            {
                _GroupMembership |= Group.AffectOthers;
            }

            Boolean isAction   = (category & Cards.Category.Action) == Cards.Category.Action;
            Boolean isVictory  = (category & Cards.Category.Victory) == Cards.Category.Victory;
            Boolean isReaction = (category & Cards.Category.Reaction) == Cards.Category.Reaction;
            Boolean isShelter  = (category & Cards.Category.Shelter) == Cards.Category.Shelter;

            if (((isAction && isTreasure) || (isAction && isVictory) || (isAction && isShelter)) ||
                ((isTreasure && isVictory) || (isTreasure && isReaction) || (isTreasure && isShelter)) ||
                ((isVictory && isReaction) || (isVictory && isShelter)) ||
                (isReaction && isShelter))
            {
                _GroupMembership |= Group.MultiType;
            }
        }
コード例 #2
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.
                    _BaseCost        = null;
                    _Benefit         = null;
                    _DurationBenefit = null;
                    _ModifiedBy      = null;
                    _Owner           = 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;
            }
        }
コード例 #3
0
		public bool Equals(CardBenefit other)
		{
			// Check for null
			if (ReferenceEquals(other, null))
				return false;

			// Check for same reference
			if (ReferenceEquals(this, other))
				return true;

			return _Cards.Equals(other.Cards) &&
				_Actions.Equals(other.Actions) &&
				_Buys.Equals(other.Buys) &&
				_Currency.Equals(other.Currency) &&
				_VictoryPoints.Equals(other.VictoryPoints) &&
				_IsTreasure.Equals(other._IsTreasure);
		}
コード例 #4
0
        public bool Equals(CardBenefit other)
        {
            // Check for null
            if (ReferenceEquals(other, null))
            {
                return(false);
            }

            // Check for same reference
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return(_Cards.Equals(other.Cards) &&
                   _Actions.Equals(other.Actions) &&
                   _Buys.Equals(other.Buys) &&
                   _Currency.Equals(other.Currency) &&
                   _VictoryPoints.Equals(other.VictoryPoints) &&
                   _IsTreasure.Equals(other._IsTreasure));
        }
コード例 #5
0
		internal void RemoveBenefit(Card sourceOfBenefit, CardBenefit benefit, Boolean isInternal)
		{
			ReceiveBenefit(sourceOfBenefit, new CardBenefit()
			{
				Actions = -benefit.Actions,
				Buys = -benefit.Buys,
				Cards = -benefit.Cards,
				Currency = -benefit.Currency,
				FlavorText = benefit.FlavorText,
				VictoryPoints = -benefit.VictoryPoints
			}, isInternal);
		}
コード例 #6
0
		internal void ReceiveBenefit(Token sourceOfBenefit, CardBenefit benefit)
		{
			if (benefit.Any && BenefitReceiving != null)
			{
				BenefitReceivingEventArgs brea = new BenefitReceivingEventArgs(this, benefit);
				BenefitReceiving(sourceOfBenefit, brea);
			}

			if (benefit.Cards > 0)
				this.Draw(benefit.Cards, DeckLocation.Hand);

			this.Actions += benefit.Actions;
			this.Buys += benefit.Buys;
			this.Currency += benefit.Currency;
			for (int count = 0; count < benefit.VictoryPoints; count++)
				this.TokenPiles.Add(new Cards.Prosperity.VictoryToken(), this);
		}
コード例 #7
0
		internal void ReceiveBenefit(Card sourceOfBenefit, CardBenefit benefit, Boolean isInternal)
		{
			if (benefit.Any && BenefitReceiving != null && 
				((sourceOfBenefit.Category & Category.Action) == Category.Action ||
				((sourceOfBenefit.Category & Category.Treasure) == Category.Treasure && !isInternal)))
			{
				BenefitReceivingEventArgs brea = new BenefitReceivingEventArgs(this, benefit);
				BenefitReceiving(sourceOfBenefit, brea);
			}

			if (benefit.Cards > 0)
				this.Draw(benefit.Cards, DeckLocation.Hand);

			this.Actions += benefit.Actions;
			this.Buys += benefit.Buys;
			this.Currency += benefit.Currency;
			for (int count = 0; count < benefit.VictoryPoints; count++)
				this.TokenPiles.Add(new Cards.Prosperity.VictoryToken(), this);

			if (benefit.Cards < 0)
			{
				Choice choice = new Choice(String.Format("Discard {0}.", Utilities.StringUtility.Plural("card", -benefit.Cards)), sourceOfBenefit, this.Hand, this, false, -benefit.Cards, -benefit.Cards);
				ChoiceResult result = this.MakeChoice(choice);
				this.Discard(DeckLocation.Hand, result.Cards);
			}
		}
コード例 #8
0
		internal void ReceiveBenefit(Card sourceOfBenefit, CardBenefit benefit)
		{
			ReceiveBenefit(sourceOfBenefit, benefit, false);
		}
コード例 #9
0
		public BenefitReceivingEventArgs(Player player, CardBenefit cardBenefit)
		{
			this.Player = new Visual.VisualPlayer(player);
			this.Benefit = cardBenefit;
			this.Phase = player.Phase;
		}