本文整理匯總了C#中SevenWondersGUI.PlayerState.updateCoins方法的典型用法代碼示例。如果您正苦於以下問題:C# PlayerState.updateCoins方法的具體用法?C# PlayerState.updateCoins怎麽用?C# PlayerState.updateCoins使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SevenWondersGUI.PlayerState
的用法示例。
在下文中一共展示了PlayerState.updateCoins方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: incrementWonderLevel
//public int[] getResources() { return resources; }
public override void incrementWonderLevel(PlayerState p)
{
if(notMaxYet()){
currentWonderLevel++;
switch (currentWonderLevel)
{
case 1:
p.updateMilitaryPower(1);
victoryPoints = 3;
p.updateCoins(3);
return;
case 2:
p.updateMilitaryPower(1);
victoryPoints = 7;
p.updateCoins(4);
break;
}
}
}
示例2: incrementWonderLevel
//public int[] getResources() { return resources; }
public override void incrementWonderLevel(PlayerState p)
{
if(notMaxYet()){
currentWonderLevel++;
switch (currentWonderLevel)
{
case 1:
victoryPoints = 2;
p.updateCoins(4);
return;
case 2:
victoryPoints = 5;
p.updateCoins(4);
break;
case 3:
victoryPoints = 10;
p.updateCoins(4);
break;
}
}
}
示例3: 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;
}
示例4: UpdateResources
private void UpdateResources(PlayerState p, Card c)
{
//_logger.UpdatingPlayersResources(p,c);
//_logger.DisplayResourceCost(p,c);
if (c is CommerceCard)
{
KensUtilityfunctions k = new KensUtilityfunctions();
int income = k.calcCommerceIncome(c, gameState, p.getSeatNumber());
p.updateCoins(income);
return;
}
if (c is ResourceCard)
{
//_logger.CheckResourceCard(p,c);
//_logger.DisplayPlayersResources(p, hashtable);
List<int> current = baseResources[p.getName()];
if (((ResourceCard)c).hasTradableResources())
{
if ((((ResourceCard)c).getNumber() > 7) && (((ResourceCard)c).getNumber() < 14))
{
//populate Special Resource Hashmap if the Card is a special resource
List<ResourceCard> srlst = SResources[p.getName()];
srlst.Add((ResourceCard)c);
SResources[p.getName()] = srlst;
System.Console.WriteLine(p.getName() + " is adding Special Resource Card: {" + ((ResourceCard)c).getResources()[0] + "," + ((ResourceCard)c).getResources()[1] + "," + ((ResourceCard)c).getResources()[2] + "," + ((ResourceCard)c).getResources()[3] + "," + ((ResourceCard)c).getResources()[4] + "," + ((ResourceCard)c).getResources()[5] + "," + ((ResourceCard)c).getResources()[6] + "}");
}
else
{
int[] tradableResources = ((ResourceCard)c).getResources();
for (int index = 0; index < tradableResources.Count(); index++)
{
switch (index)
{
case (int)Resource.Wood:
current[(int)Resource.Wood] += tradableResources[index];
break;
case (int)Resource.Stone:
current[(int)Resource.Stone] += tradableResources[index];
break;
case (int)Resource.Clay:
current[(int)Resource.Clay] += tradableResources[index];
break;
case (int)Resource.Ore:
current[(int)Resource.Ore] += tradableResources[index];
break;
case (int)Resource.Glass:
current[(int)Resource.Glass] += tradableResources[index];
break;
case (int)Resource.Loom:
current[(int)Resource.Loom] += tradableResources[index];
break;
case (int)Resource.Paper:
current[(int)Resource.Paper] += tradableResources[index];
break;
}
}
System.Console.WriteLine(p.getName() +" is adding: {" + tradableResources[0] + "," + tradableResources[1] + "," + tradableResources[2] + "," + tradableResources[3] + "," + tradableResources[4] + "," + tradableResources[5] + "," + tradableResources[6] + "}");
baseResources[p.getName()] = current;
//_logger.DisplayPlayersResources(p, hashtable);
}
}
return;
}
//_logger.CheckDictionary(p,hashtable);
//_logger.DisplayPlayersResources(p, hashtable);
}
開發者ID:sunneh,項目名稱:7Wonders,代碼行數:71,代碼來源:ResourceManager+(Scott+Needham's+conflicted+copy+2013-04-05).cs
示例5: 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
示例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: 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;
}
示例8: 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;
}
示例9: 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);
}
示例10: 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;
}