本文整理汇总了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;
}
示例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));
}
示例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;
}
}