当前位置: 首页>>代码示例>>C#>>正文


C# Card.Equals方法代码示例

本文整理汇总了C#中Dominion.Card.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Card.Equals方法的具体用法?C# Card.Equals怎么用?C# Card.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Dominion.Card的用法示例。


在下文中一共展示了Card.Equals方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: trashACopperForCurrencyBonus

        //Passing in null counts as it being false, don't want to trash because they have the option
        public StatusObject trashACopperForCurrencyBonus(Card aCard)
        {
            StatusObject retVal = new StatusObject(false);
            if (this.trashesNeeded <= 0 || !this.myHand.contains(CardMother.Copper()))
            {
                this.trashesNeeded = 0;
                retVal.setCopperTrashedForCurrency(true);
                return retVal;
            }
            if (aCard == null)
            {
                retVal.setCopperTrashedForCurrency(true);
                return retVal;
            }
            if (!aCard.Equals(CardMother.Copper()))
            {
                return retVal;
            }

            if (!this.getHand().contains(aCard))
            {
                return retVal;
            }

            this.getHand().remove(aCard);
            this.bonusCurrencyForBuy += this.trashCurrencyBonus;
            this.trashesNeeded--;
            if (trashesNeeded == 0)
            {
                retVal.setCopperTrashedForCurrency(true);
            }
            else
            {
                retVal.setTrashACopperForCurrency(true);
            }
            return retVal;
        }
开发者ID:postcn,项目名称:Dominion,代码行数:38,代码来源:Player.cs

示例2: testEquals

 public void testEquals()
 {
     Card test = new Card(0, 0, 0, 0, 1, 0, 0, "Estate", "Single Victory Point", 2, "Null");
     Card estate = new Card(0, 0, 0, 0, 1, 0, 0, "Estate", "Single Victory Point", 2, "Null");
     Object generic = new Object();
     Assert.True(test.Equals(estate));
     Assert.False(test.Equals(generic));
     Card oneoff = new Card(1, 0, 0, 0, 1, 0, 0, "Estate", "Single Victory Point", 2, "Null");
     oneoff = new Card(0, 1, 0, 0, 1, 0, 0, "Estate", "Single Victory Point", 2, "Null");
     Assert.False(test.Equals(oneoff));
     oneoff = new Card(0, 0, 1, 0, 1, 0, 0, "Estate", "Single Victory Point", 2, "Null");
     Assert.False(test.Equals(oneoff));
     oneoff = new Card(0, 0, 0, 1, 1, 0, 0, "Estate", "Single Victory Point", 2, "Null");
     Assert.False(test.Equals(oneoff));
     oneoff = new Card(0, 0, 0, 0, 0, 0, 0, "Estate", "Single Victory Point", 2, "Null");
     Assert.False(test.Equals(oneoff));
     oneoff = new Card(0, 0, 0, 0, 1, 1, 0, "Estate", "Single Victory Point", 2, "Null");
     Assert.False(test.Equals(oneoff));
     oneoff = new Card(0, 0, 0, 0, 1, 0, 1, "Estate", "Single Victory Point", 2, "Null");
     Assert.False(test.Equals(oneoff));
     oneoff = new Card(0, 0, 0, 0, 1, 0, 0, "Not Estate", "Single Victory Point", 2, "Null");
     Assert.False(test.Equals(oneoff));
     oneoff = new Card(0, 0, 0, 0, 1, 0, 0, "Estate", "Changed Description", 2, "Null");
     Assert.False(test.Equals(oneoff));
     oneoff = new Card(0, 0, 0, 0, 1, 0, 0, "Estate", "Single Victory Point", 0, "Null");
     Assert.False(test.Equals(oneoff));
 }
开发者ID:postcn,项目名称:Dominion,代码行数:27,代码来源:CardTest.cs

示例3: mineATreasureCard

        public StatusObject mineATreasureCard(Card c)
        {
            StatusObject retVal = new StatusObject(false);
            if (c == null)
            {
                return retVal;
            }
            if (this.trashesNeeded <= 0 || (!this.myHand.contains(CardMother.Copper()) && !this.myHand.contains(CardMother.Silver())))
            {
                retVal.setMinedCorrectly(true);
                this.trashesNeeded = 0;
                return retVal;
            }
            if (c.Equals(CardMother.Copper()) || c.Equals(CardMother.Silver()))
            {
                if (c.Equals(CardMother.Copper()))
                {
                    this.getHand().getHand().Remove(c);
                    this.getHand().getHand().Add(CardMother.Silver());
                    retVal.setMinedCorrectly(true);
                    this.trashesNeeded--;
                }

                else
                {
                    this.getHand().getHand().Remove(c);
                    this.getHand().getHand().Add(CardMother.Gold());
                    retVal.setMinedCorrectly(true);
                    this.trashesNeeded--;
                }
                if (this.trashesNeeded > 0)
                {
                    retVal.setMinedCorrectly(false);
                    retVal.setMineTreasure(true);
                }
                return retVal;
            }
            else
            {
                return retVal;
            }
        }
开发者ID:postcn,项目名称:Dominion,代码行数:42,代码来源:Player.cs


注:本文中的Dominion.Card.Equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。