本文整理匯總了C#中SevenWondersGUI.PlayerState.getCoins方法的典型用法代碼示例。如果您正苦於以下問題:C# PlayerState.getCoins方法的具體用法?C# PlayerState.getCoins怎麽用?C# PlayerState.getCoins使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SevenWondersGUI.PlayerState
的用法示例。
在下文中一共展示了PlayerState.getCoins方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: ValidateCard
//Initial call to check for card validity
public bool ValidateCard (PlayerState p, Card c)
{
//_logger.ValidatingCard(p, c);
//_logger.CheckDictionary(p,hashtable);
//Check for precards
if (preCardCheck(p, c)) { return true; }
// First check what the coin costs and total resource cost are
if (c.getCoinCost() == 0 && c.getTotalResourceCost() == 0)
{
//_logger.print(p,"Card dosn't cost anything");
UpdateResources(p, c);
return true;
}
// If the coin cost is not equal to 0 then does the player have enoguh coins ?
if (c.getCoinCost() != 0 && c.getTotalResourceCost() == 0)
{
//_logger.CheckingCoins(p, c);
if (c.getCoinCost() <= p.getCoins())
{
UpdateResources(p, c);
p.updateCoins(-c.getCoinCost());
// _logger.CheckingPlayersCoins(p);
return true;
}
return false;
}
if (c.getTotalResourceCost() != 0)
{
//_logger.print(p,"Now we are working on the players Resources");
return CheckResourceCost(p,c.getCost());
}
return false;
}
開發者ID:sunneh,項目名稱:7Wonders,代碼行數:39,代碼來源:ResourceManager+(Scott+Needham's+conflicted+copy+2013-04-05).cs
示例3: CheckingPlayersCoins
public void CheckingPlayersCoins(PlayerState p)
{
if (Log(p))
System.Console.WriteLine("[{0}] Player now has {1} coins", _class.GetType().Name, p.getCoins());
}
示例4: CheckingCoins
public void CheckingCoins(PlayerState p, Card c)
{
if (Log(p))
Console.WriteLine("[{0}] Checking to see if we have enough coins: Cost {1} Has {2}"
, _class.GetType().Name
, c.getCoinCost()
, p.getCoins());
}
示例5: 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;
}
示例6: ValidateCard
public bool ValidateCard (PlayerState p, Card c)
{
//_logger.ValidatingCard(p, c);
//_logger.CheckDictionary(p,hashtable);
//Get a list of preCards
int[] preCard = c.getPreCard();
//Go through list of preCards
for (int i = 0; i < preCard.Length; i++)
{
//Check if preCard Value is valid
if (preCard[i] < 150)
{
//cycle through player's playedcards
for (int j = 0; j < p.getPlayedCards().Count; j++)
{//if the cards match then return true
if (p.getPlayedCards()[j].getNumber() == preCard[i]) { return true; }
}
}
}
// First check what the coin costs and total resource cost are
if (c.getCoinCost() == 0 && c.getTotalResourceCost() == 0)
{
//_logger.print(p,"Card dosn't cost anything");
UpdateResources(p, c);
return true;
}
// If the coin cost is not equal to 0 then does the player have enoguh coins ?
if (c.getCoinCost() != 0 && c.getTotalResourceCost() == 0)
{
//_logger.CheckingCoins(p, c);
if (c.getCoinCost() <= p.getCoins())
{
UpdateResources(p, c);
p.updateCoins(-c.getCoinCost());
// _logger.CheckingPlayersCoins(p);
return true;
}
return false;
}
if (c.getTotalResourceCost() != 0)
{
//_logger.print(p,"Now we are working on the players Resources");
return CheckResourceCost(p,c);
}
return false;
}
示例7: treasuryScore
private int treasuryScore(PlayerState p) { return (p.getCoins() / 3); }
示例8: canAfford
//CoinTransaction Check
public bool canAfford(PlayerState p)
{
if (p.getCoins() < (coinTransactions[0] + coinTransactions[1]))
{
return false;
}
return true;
}
示例9: ValidateCard
/*
* Input: A Player and a Card
*
*
* Output: True or False -> Does the player have enough resources to play given card already?
*/
public bool ValidateCard (PlayerState p, Card c)
{
//_logger.ValidatingCard(p, c);
//_logger.CheckDictionary(p,hashtable);
//c.toString();
//Check for duplicity
for (int i = 0; i < p.getPlayedCards().Count; i++)
{
if (c.getCardName() == p.getPlayedCards()[i].getCardName())
{
if (p.getName().Equals("P0"))
{
System.Console.WriteLine("!Can't play card with the same name!");
}
return false;
}
}
//Check for precards
if (preCardCheck(p, c)) { return true; }
// First check what the coin costs and total resource cost are
if (c.getCoinCost() == 0 && c.getTotalResourceCost() == 0)
{
//_logger.print(p,"Card dosn't cost anything");
UpdateResources(p, c);
return true;
}
// If the coin cost is not equal to 0 then does the player have enoguh coins ?
if (c.getCoinCost() != 0 && c.getTotalResourceCost() == 0)
{
//_logger.CheckingCoins(p, c);
if (c.getCoinCost() <= p.getCoins())
{
UpdateResources(p, c);
p.updateCoins(-c.getCoinCost());
// _logger.CheckingPlayersCoins(p);
return true;
}
return false;
}
if (c.getTotalResourceCost() != 0)
{
//_logger.print(p,"Now we are working on the players Resources");
return CheckResourceCost(p,c.getCost());
}
return false;
}
示例10: 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);
}
示例11: 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;
}