本文整理匯總了C#中SevenWondersGUI.PlayerState.getPlayedCards方法的典型用法代碼示例。如果您正苦於以下問題:C# PlayerState.getPlayedCards方法的具體用法?C# PlayerState.getPlayedCards怎麽用?C# PlayerState.getPlayedCards使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SevenWondersGUI.PlayerState
的用法示例。
在下文中一共展示了PlayerState.getPlayedCards方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: SRCardInitializer
protected List<ResourceCard> SRCardInitializer(PlayerState p)
{
List<ResourceCard> tempList = new List<ResourceCard>();
for (int i = 0; i < p.getPlayedCards().Count; i++)
{
if ((p.getPlayedCards()[i].getNumber() > 7) && (p.getPlayedCards()[i].getNumber() < 14))
{ tempList.Add((ResourceCard)p.getPlayedCards()[i]); }
}
return tempList;
}
示例2: SetStrategy
private Card SetStrategy(PlayerState p, List<Card> hand)
{
Card bestCard = null;
int currentAge = ResourceManager.GetInstance().getGameState().getAge();
if (p.getPlayedCards().Count() == 0)
bestCard = BuildWonder(p, hand);
if (bestCard == null)
if (noOfPlayers == 3 || noOfPlayers == 7)
if (p.getBoard().getCurrentWonderLevel() != currentAge)
bestCard = BuildWonder(p, hand);
if (bestCard == null)
SetMilitaryStrategy(p, hand);
if (bestCard == null)
bestCard = SetScienceStrategy(p, hand);
if (bestCard == null)
bestCard = SetCommerceStrategy(p, hand);
if (bestCard == null)
bestCard = SetCivilianStrategy(p, hand);
if (bestCard == null)
{
strategy = new RandomStrategy();
bestCard = strategy.getNextCard(p, hand);
}
return bestCard;
}
示例3: civScore
private int civScore(PlayerState p)
{
List<CivilianCard> civlist;
//Civilian Structures
civlist = new List<CivilianCard>();
int score = 0;
//Cycle through played cards
//Add all civilian cards to list
for (int i = 0; i < p.getPlayedCards().Count; i++) {
if (p.getPlayedCards()[i].getType() == 3) { civlist.Add((CivilianCard)p.getPlayedCards()[i]); }
}
//Cycle through civ card list to add points
for (int i = 0; i < civlist.Count; i++) {
score = score + civlist[i].getVictoryPoints();
}
return score;
}
示例4: countCardType
public int countCardType(int cType, PlayerState pState)
{
int count = 0;
foreach (Card cCard in pState.getPlayedCards())
{
if (cCard.getType() == cType)
{
count++;
}
}
return count;
}
示例5: preCardCheck
//preCardCheck checks if the player p has the prerequisite card for free play
protected bool preCardCheck(Card c, PlayerState p)
{
//Get a list of preCards
int[] preCard = c.getPreCard();
//Go through list of preCards
console.writeline(preCard[0] + " " + preCard[1] + " " + preCard[2] + " " + preCard[3]);
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; }
}
}
}
//else return false
return false;
}
示例6: sciScore
private int sciScore(PlayerState p)
{
List<ScienceCard> scilist;
scilist = new List<ScienceCard>();
int score = 0;
//Cycle through played cards
for (int i = 0; i < p.getPlayedCards().Count; i++) {
if (p.getPlayedCards()[i].getType() == 3) { scilist.Add((ScienceCard)p.getPlayedCards()[i]); }
}
//Cycle through science card list to add up sciencetype totals
int[] sciTotals = new int[3] { 0, 0, 0 };
for (int i = 0; i < scilist.Count; i++) { sciTotals[scilist[i].getSciType()]++; }
//Set points
score = score + (sciTotals.Min() * 7);
//Points for types
score = score + (sciTotals[0] * sciTotals[0]);
score = score + (sciTotals[1] * sciTotals[1]);
score = score + (sciTotals[2] * sciTotals[2]);
return score;
}
示例7: PlayerGameBoard
int g_index = 0;//needed to reset ZIndex to original value upon mouse events
public PlayerGameBoard(Grid gameGrid, PlayerState p, GameState g)
{
player = p;
parent = gameGrid;//only 1 child
if (parent.Children.Count > 1)//handle the case where there is existing child when we change views
{
parent.Children.Remove(parent.Children[1]);
//System.Console.WriteLine("Child Removed");
}
game = g;
if (game.getAge() == 4)//game is over
{
ScoreWindow s = new ScoreWindow(game, parent);
s.Show(); ;
}
playBoard = new Canvas();
parent.Children.Add(playBoard);//now child[1], two children
createCardStack("R", 179, 10, playBoard);//0-9
createCardStack("M", 336, 10, playBoard);//10-19
createCardStack("S", 493, 10, playBoard);//20-29
createCardStack("Civ", 650, 10, playBoard);//30-39
createCardStack("Com", 807, 10, playBoard);//40-49
createCardStack("G", 964, 6, playBoard);//50-55
createHandStack();//56-62
updateAge(game.getAge());//63
createWonderBoard(player.getBoard().getName());//64
createPlayerButtons();//65-71
createPlayerRedCircles();//72-78
createPlayerBlueCircles();//79-85
createMoveButtons();//86-89
updateMoney();//90
createWonderSpots(player.getBoard().getMaxWonderLevel());//[91-94] variable length
createRulesButton();//variable base on above wonder
updateWonderSpots(player.getWonderCards());
updateHand(player.getHand());
updateCards(player.getPlayedCards());
}
示例8: ResourceInitializer
//initial baseResources build up, SRCard initializer
protected int[] ResourceInitializer(PlayerState p) {
int[] rTotals = p.getBoard().getResources();
int[] tempResource = new int[7];
//Fill rTotals first, Wonder then Cards
//Cards
for (int i = 0; i < p.getPlayedCards().Count; i++)
{
//resource/manufactured good cards only
if ((p.getPlayedCards()[i].getType() == 1) || (p.getPlayedCards()[i].getType() == 2))
{
//remove optional resource cards from total
if ((p.getPlayedCards()[i].getNumber() < 7) || (p.getPlayedCards()[i].getNumber() > 14))
{
ResourceCard tempCard = (ResourceCard)p.getPlayedCards()[i];
System.Console.WriteLine("tempCard: " + tempCard.getResources());
addResources(rTotals,tempCard.getResources());
}
}
}
return rTotals;
}
示例9: preCardCheck
//Actual Important Functions
//Checks for precard within the player's hand
private bool preCardCheck(PlayerState p, Card c)
{
//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; }
}
}
}
return false;
}
開發者ID:sunneh,項目名稱:7Wonders,代碼行數:21,代碼來源:ResourceManager+(Scott+Needham's+conflicted+copy+2013-04-05).cs
示例10: resetSpecialResourceSingular
public void resetSpecialResourceSingular(PlayerState p)
{
List<ResourceCard> tempList = new List<ResourceCard>();
for (int i = 0; i < p.getPlayedCards().Count; i++)
{
if (p.getPlayedCards()[i].getType() < 3)
{
ResourceCard c = (ResourceCard)p.getPlayedCards()[i];
if (((c.getNumber() > 7) && (c.getNumber() < 14)))
{
tempList.Add(c);
}
}
}
SResources[p.getName()] = tempList;
}
開發者ID:sunneh,項目名稱:7Wonders,代碼行數:20,代碼來源:ResourceManager+(Scott+Needham's+conflicted+copy+2013-04-05).cs
示例11: resetCommerceCards
//Missing Code in this Function
public void resetCommerceCards(PlayerState p) {
List<CommerceCard> tempList = new List<CommerceCard>();
for (int i = 0; i < p.getPlayedCards().Count; i++)
{
if (p.getPlayedCards()[i].getType() == 4)
{
CommerceCard c = (CommerceCard)p.getPlayedCards()[i];
if (((c.getNumber() > 30) && (c.getNumber() < 37)) || ((c.getNumber() > 70) && (c.getNumber() < 77)))
{
tempList.Add(c);
}
}
}
ComCards[p.getName()] = tempList;
}
示例12: validateTrade
/*
* Input: A Player, a Card and a direction(0 = right, 1 = left)
*
*
* Output: number of coins required to trade for resources for card with the player
* at the given direction. negitive number if impossible
*/
public int validateTrade(PlayerState p, Card c, int direction)
{
int recCost = 2;
int comCost = 2;
//checkes to see if a player can play card with thier own resources
if (ValidateCard(p, c))
{
return 0;
}
PlayerState trader;
if ((p.getBoard().getName().Equals("WB10")
&& (p.getBoard().getCurrentWonderLevel() >= 1)))
{
recCost = 1;
}
if (direction == 0)
{
trader = gameState.getRightPlayer(p);
for (int i = 0; i < p.getPlayedCards().Count; i++)
{
if ((p.getPlayedCards()[i].getNumber() == 31) ||
(p.getPlayedCards()[i].getNumber() == 32))
{
recCost = 1;
break;
}
}
}
else
{
trader = gameState.getLeftPlayer(p);
for (int i = 0; i < p.getPlayedCards().Count; i++)
{
if ((p.getPlayedCards()[i].getNumber() == 33) ||
(p.getPlayedCards()[i].getNumber() == 34))
{
recCost = 1;
break;
}
}
}
for (int i = 0; i < p.getPlayedCards().Count; i++)
{
if ((p.getPlayedCards()[i].getNumber() == 35) ||
(p.getPlayedCards()[i].getNumber() == 36))
{
comCost = 1;
}
}
if (!baseResources.ContainsKey(trader.getName()))
{
return -1;
}
int cost = 0;
List<int> traderResources = baseResources[trader.getName()];
int[] requiredResources = new int[c.getCost().Length];
for (int i = 0; i < c.getCost().Length; i++)
{
requiredResources[i] = c.getCost()[i];
requiredResources[i] -= baseResources[p.getName()][i];//p.getResources()[i];
if (requiredResources[i] < 0)
{
requiredResources[i] = 0;
}
if (traderResources[i] < requiredResources[i])
{
return -1;
}
if (i < 4)
{
cost += requiredResources[i] * recCost;
}
else
{
cost += requiredResources[i] * comCost;
}
Console.WriteLine("cost " + cost + " cur rec " + requiredResources[i]);
}
return cost;
}
示例13: 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;
}
示例14: ScienceScore
private int ScienceScore(PlayerState p)
{
//System.Console.WriteLine("sciencescore start");
List<ScienceCard> scilist = new List<ScienceCard>();
//Cycle through played cards
for (int i = 0; i < p.getPlayedCards().Count; i++) {
if (p.getPlayedCards()[i].getType() == Card._SCIENCE)
{
scilist.Add((ScienceCard)p.getPlayedCards()[i]);
}
}
//Cycle through science card list to add up sciencetype totals
int[] sciTotals = new int[3] { 0, 0, 0 };
for (int i = 0; i < scilist.Count; i++)
{
//System.Console.WriteLine(scilist[i].getSciType());
sciTotals[scilist[i].getSciType()]++;
}
int score = 0;
if (scienceguildCard == true)
{
if (sciTotals.Max() > 5) { sciTotals[Array.IndexOf(sciTotals, sciTotals.Max())]++; }
else { sciTotals[Array.IndexOf(sciTotals, sciTotals.Min())]++; }
}
//Set points
score = score + (sciTotals.Min() * 7);
//System.Console.WriteLine("Min Score" + sciTotals.Min());
//Points for types
//System.Console.WriteLine("Type 0" + sciTotals[0]);
score = score + (sciTotals[0] * sciTotals[0]);
//System.Console.WriteLine("Type 1" + sciTotals[1]);
score = score + (sciTotals[1] * sciTotals[1]);
//System.Console.WriteLine("Type 2" + sciTotals[2]);
score = score + (sciTotals[2] * sciTotals[2]);
System.Console.WriteLine(score);
return score;
}
示例15: comScore
private int comScore(PlayerState p) {
int score = 0;
List<CommerceCard> comlist;
//Commercial Structure
comlist = new List<CommerceCard>();
//Cycle through played cards
//Add all Commerce cards to list
for (int i = 0; i < p.getPlayedCards().Count; i++)
{
if ((p.getPlayedCards()[i].getType() == 4) && (p.getPlayedCards()[i].getAct() == 3))
{
comlist.Add((CommerceCard)p.getPlayedCards()[i]);
}
}
for (int i = 0; i < comlist.Count; i++){
//Victorypoints per wonder
if (comlist[i].getPerWonder() == 2) { score = score + p.getBoard().getCurrentWonderLevel(); }
//Victorypoint per card
if((comlist[i].getCollect()[2] > 0)){
//crawl through all played cards of player
for (int j = 0; j < p.getPlayedCards().Count; j++)
{
//if card type matches victorypoint condition of commercial card
if (p.getPlayedCards()[j].getType() == comlist[i].getCollect()[0])
{
//add points appropriate to commercial card parameters
score = score + comlist[i].getCollect()[2];
}
}
}
}
return score;
//Guilds
}