本文整理匯總了C#中SevenWondersGUI.PlayerState.addPlayedCards方法的典型用法代碼示例。如果您正苦於以下問題:C# PlayerState.addPlayedCards方法的具體用法?C# PlayerState.addPlayedCards怎麽用?C# PlayerState.addPlayedCards使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SevenWondersGUI.PlayerState
的用法示例。
在下文中一共展示了PlayerState.addPlayedCards方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: playPrimary
//please the primary card for the type baes AIs
public Card playPrimary(PlayerState p, List<Card> hand)
{
int trade;
for (int i = 0; i < hand.Count; i++)
{
if (hand[i].getType() == strategy)
{
if (ResourceManager.GetInstance().ValidateCard(p, hand[i]))
{
//System.Console.WriteLine("ScienceStrategy():: getNextCard({0})", hand[i]);
p.addPlayedCards(hand[i]);
return hand[i];
}
trade = ResourceManager.GetInstance().validateTrade(p, hand[i], 0);
if ((trade > 0) && (p.getCoins() >= trade))
{
//.WriteLine(p.getName() + " trading for " + trade);
p.updateCoins(-trade);
ResourceManager.GetInstance().getGameState().getRightPlayer(p).updateCoins(trade);
p.addPlayedCards(hand[i]);
return hand[i];
}
trade = ResourceManager.GetInstance().validateTrade(p, hand[i], 1);
if ((trade > 0) && (p.getCoins() >= trade))
{
//Console.WriteLine(p.getName() + " trading for " + trade);
p.updateCoins(-trade);
ResourceManager.GetInstance().getGameState().getLeftPlayer(p).updateCoins(trade);
p.addPlayedCards(hand[i]);
return hand[i];
}
}
}
return null;
}
示例2: playSecondary
//plays a resource or commodity
public Card playSecondary(PlayerState p, List<Card> hand)
{
for (int i = 0; i < hand.Count; i++)
{
if ((hand[i].getType() == 1) && (ResourceManager.GetInstance().ValidateCard(p, hand[i])))
{
//System.Console.WriteLine("ScienceStrategy():: getNextCard({0})", hand[i]);
p.addPlayedCards(hand[i]);
return hand[i];
}
}
for (int i = 0; i < hand.Count; i++)
{
if ((hand[i].getType() == 2) && (ResourceManager.GetInstance().ValidateCard(p, hand[i])))
{
//System.Console.WriteLine("ScienceStrategy():: getNextCard({0})", hand[i]);
p.addPlayedCards(hand[i]);
return hand[i];
}
}
return null;
}
示例3: getNextCard
public Card getNextCard(PlayerState p, List<Card> hand)
{
Random random = new Random();
int randomNumber;
Card c = null;
if (ResourceManager.GetInstance().ValidateWonder(p))
{
randomNumber = random.Next(0, 2);
Console.WriteLine("attempting to play wonder " + randomNumber);
if (randomNumber == 1)
{
Console.WriteLine("playing wonder " + randomNumber);
randomNumber = random.Next(0, hand.Count - 1);
c = hand[randomNumber];
p.setWonderCards(c);
p.getBoard().incrementWonderLevel(p);
}
}
List<int> availCards = new List<int>();
for (int i = 0; i < hand.Count; i++)
{
availCards.Add(i);
}
int trade;
//selects a card to play
for (int i = 0; i < hand.Count; i++)
{
randomNumber = random.Next(0, availCards.Count - 1);
c = hand[availCards[randomNumber]];
if (ResourceManager.GetInstance().ValidateCard(p, c))
{
p.addPlayedCards(c);
return c;
//Console.WriteLine("===================== CHECKED CARD ===========================");
}
trade = ResourceManager.GetInstance().validateTrade(p, c, 0);
if ((trade > 0) && (p.getCoins() >= trade))
{
//.WriteLine(p.getName() + " trading for " + trade);
p.updateCoins(-trade);
ResourceManager.GetInstance().getGameState().getRightPlayer(p).updateCoins(trade);
p.addPlayedCards(c);
return c;
}
trade = ResourceManager.GetInstance().validateTrade(p, c, 1);
if ((trade > 0) && (p.getCoins() >= trade))
{
//Console.WriteLine(p.getName() + " trading for " + trade);
p.updateCoins(-trade);
p.addPlayedCards(c);
ResourceManager.GetInstance().getGameState().getLeftPlayer(p).updateCoins(trade);
return c;
}
availCards.Remove(randomNumber);
//Console.Write("RANDOM STRATEGY:: AGE :: ");
//Console.WriteLine(ResourceManager.GetInstance().getGameState().getAge());
}
return null;
}
示例4: getNextCard
public Card getNextCard(PlayerState p, List<Card> hand)
{
List<CivilianCard> civCards = new List<CivilianCard>();
for (int i = 0; i < hand.Count; i++)
{
if (hand[i].getType() == 3)
{
System.Console.WriteLine("CivilianStrategy():: getNextCard({0})", hand[i]);
civCards.Add((CivilianCard)hand[i]);
}
}
// && (ResourceManager.GetInstance().ValidateCard(p, hand[i]))
int trade;
while (civCards.Count != 0)
{
CivilianCard bestCard = civCards[0];
for (int i = 1; i < civCards.Count; i++)
{
if (bestCard.getVictoryPoints() < civCards[i].getVictoryPoints())
{
bestCard = civCards[i];
}
}
if (ResourceManager.GetInstance().ValidateCard(p, bestCard))
{
p.addPlayedCards(bestCard);
return bestCard;
}
trade = ResourceManager.GetInstance().validateTrade(p, bestCard, 0);
if ((trade > 0) && (p.getCoins() >= trade))
{
//.WriteLine(p.getName() + " trading for " + trade);
p.updateCoins(-trade);
ResourceManager.GetInstance().getGameState().getRightPlayer(p).updateCoins(trade);
p.addPlayedCards(bestCard);
return bestCard;
}
trade = ResourceManager.GetInstance().validateTrade(p, bestCard, 1);
if ((trade > 0) && (p.getCoins() >= trade))
{
//Console.WriteLine(p.getName() + " trading for " + trade);
p.updateCoins(-trade);
p.addPlayedCards(bestCard);
ResourceManager.GetInstance().getGameState().getLeftPlayer(p).updateCoins(trade);
return bestCard;
}
civCards.Remove(bestCard);
}
Card cur = ult.playSecondary(p, hand);
if (cur != null)
{
return cur;
}
cur = ult.buildWonder(p, hand);
if (cur != null)
{
return cur;
}
return ult.playAnyCard(p, hand);
}
示例5: SetCivilianStrategy
private Card SetCivilianStrategy(PlayerState p, List<Card> hand)
{
for (int i = 0; i < hand.Count(); i++)
{
if (noOfPlayers == 3 || noOfPlayers == 7)
if (hand[i].getName() == "C22"
|| hand[i].getName() == "C23"
|| hand[i].getName() == "C63"
|| hand[i].getName() == "C64")
if (ResourceManager.GetInstance().ValidateCard(p, hand[i]))
{
strategy = new CivilianStrategy();
p.addPlayedCards(hand[i]);
return hand[i];
}
if (noOfPlayers == 3 || noOfPlayers == 6)
if (hand[i].getName() == "C24"
|| hand[i].getName() == "C25"
|| hand[i].getName() == "C108"
|| hand[i].getName() == "C109")
if (ResourceManager.GetInstance().ValidateCard(p, hand[i]))
{
strategy = new CivilianStrategy();
p.addPlayedCards(hand[i]);
return hand[i];
}
}
int vc = 0, index = 0;
for (int i = 0; i < hand.Count(); i++)
{
if (hand[i] is CivilianCard)
{
CivilianCard c = (CivilianCard)hand[i];
if (c.getVictoryPoints() > vc)
{
vc = c.getVictoryPoints();
index = i;
}
}
}
if (index != 0)
if (ResourceManager.GetInstance().ValidateCard(p, hand[index]))
{
strategy = new CivilianStrategy();
p.addPlayedCards(hand[index]);
return hand[index];
}
return null;
}
示例6: TradeCard
private bool TradeCard(PlayerState p, Card c)
{
int trade = ResourceManager.GetInstance().validateTrade(p, c, 0);
if ((trade > 0) && (p.getCoins() >= trade))
{
p.updateCoins(-trade);
ResourceManager.GetInstance().getGameState().getRightPlayer(p).updateCoins(trade);
p.addPlayedCards(c);
return true;
}
trade = ResourceManager.GetInstance().validateTrade(p, c, 1);
if ((trade > 0) && (p.getCoins() >= trade))
{
p.updateCoins(-trade);
ResourceManager.GetInstance().getGameState().getLeftPlayer(p).updateCoins(trade);
p.addPlayedCards(c);
return true;
}
return false;
}
示例7: SetCommerceStrategy
private Card SetCommerceStrategy(PlayerState p, List<Card> hand)
{
for (int i = 0; i < hand.Count(); i++)
{
if (hand[i].getName() == "C0123"
|| hand[i].getName() == "C0124")
if (ResourceManager.GetInstance().ValidateCard(p, hand[i]))
{
strategy = new CommerceStrategy();
p.addPlayedCards(hand[i]);
return hand[i];
}
if (noOfPlayers == 3)
{
if (hand[i].getName() == "C031"
|| hand[i].getName() == "CO33"
|| hand[i].getName() == "CO71"
|| hand[i].getName() == "CO74"
|| hand[i].getName() == "CO77"
|| hand[i].getName() == "CO121"
|| hand[i].getName() == "CO125")
if (ResourceManager.GetInstance().ValidateCard(p, hand[i]))
{
strategy = new CommerceStrategy();
p.addPlayedCards(hand[i]);
return hand[i];
}
}
if (noOfPlayers == 4)
{
if (hand[i].getName() == "C028"
|| hand[i].getName() == "CO79"
|| hand[i].getName() == "C0120")
if (ResourceManager.GetInstance().ValidateCard(p, hand[i]))
{
strategy = new CommerceStrategy();
p.addPlayedCards(hand[i]);
return hand[i];
}
}
if (noOfPlayers == 5)
{
if (hand[i].getName() == "C029"
|| hand[i].getName() == "CO75"
|| hand[i].getName() == "C0126")
if (ResourceManager.GetInstance().ValidateCard(p, hand[i]))
{
strategy = new CommerceStrategy();
p.addPlayedCards(hand[i]);
return hand[i];
}
}
if (noOfPlayers == 6)
{
if (hand[i].getName() == "C036"
|| hand[i].getName() == "CO72"
|| hand[i].getName() == "C076"
|| hand[i].getName() == "CO78"
|| hand[i].getName() == "C0122"
|| hand[i].getName() == "C0124")
if (ResourceManager.GetInstance().ValidateCard(p, hand[i]))
{
strategy = new CommerceStrategy();
p.addPlayedCards(hand[i]);
return hand[i];
}
}
if (noOfPlayers == 7)
{
if (hand[i].getName() == "C030"
|| hand[i].getName() == "C032"
|| hand[i].getName() == "C034"
|| hand[i].getName() == "C032"
|| hand[i].getName() == "C073"
|| hand[i].getName() == "C080"
|| hand[i].getName() == "C0127")
if (ResourceManager.GetInstance().ValidateCard(p, hand[i]))
{
strategy = new CommerceStrategy();
p.addPlayedCards(hand[i]);
return hand[i];
}
}
if (TradeCard(p, hand[i]))
return hand[i];
}
return null;
}