本文整理汇总了C#中SevenWondersGUI.PlayerState.setWonderCards方法的典型用法代码示例。如果您正苦于以下问题:C# PlayerState.setWonderCards方法的具体用法?C# PlayerState.setWonderCards怎么用?C# PlayerState.setWonderCards使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SevenWondersGUI.PlayerState
的用法示例。
在下文中一共展示了PlayerState.setWonderCards方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getNextCard
public Card getNextCard(PlayerState p, List<Card> hand)
{
Card cur = ult.playPrimary(p, hand);
if (cur != null)
{
return cur;
}
//attempts to play wonder to increase science
if((p.getBoard().getName().Equals("WB3"))
&& (p.getBoard().getCurrentWonderLevel() < 2)
&& (ResourceManager.GetInstance().ValidateWonder(p))){
for (int i = 0; i < hand.Count; i++){
if(hand[i].getType() != 6){
p.setWonderCards(hand[i]);
p.getBoard().incrementWonderLevel(p);
return hand[i];
}
}
}
if((p.getBoard().getName().Equals("WB4"))
&& (p.getBoard().getCurrentWonderLevel() < 3)
&& (ResourceManager.GetInstance().ValidateWonder(p))){
for (int i = 0; i < hand.Count; i++){
if(hand[i].getType() != 6){
p.setWonderCards(hand[i]);
p.getBoard().incrementWonderLevel(p);
return hand[i];
}
}
}
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);
}
示例2: buildWonder
//attempts to build a wonder
public Card buildWonder(PlayerState p, List<Card> hand)
{
if (ResourceManager.GetInstance().ValidateWonder(p))
{
for (int i = 0; i < hand.Count; i++)
{
if (hand[i].getType() == strategy)
{
p.setWonderCards(hand[i]);
p.getBoard().incrementWonderLevel(p);
return hand[i];
}
}
return hand[0];
}
return null;
}
示例3: getNextCard
public Card getNextCard(PlayerState p, List<Card> hand)
{
PlayerState left = ResourceManager.GetInstance().getGameState().getLeftPlayer(p);
PlayerState right = ResourceManager.GetInstance().getGameState().getRightPlayer(p);
int age = ResourceManager.GetInstance().getGameState().getAge();
Card cur;
//Checks to see if AI has enough MilitaryPower to win the
//the battles at the end of the Age
if ((left.getMilitaryPower() >= p.getMilitaryPower() - age) ||
(right.getMilitaryPower() >= p.getMilitaryPower() - age))
{
cur = ult.playPrimary(p, hand);
if (cur != null)
{
return cur;
}
}
//attempts to play wonder to increase military
if ((p.getBoard().getName().Equals("WB7"))
&& (p.getBoard().getCurrentWonderLevel() < 2)
&& (ResourceManager.GetInstance().ValidateWonder(p)))
{
for (int i = 0; i < hand.Count; i++)
{
if (hand[i].getType() != 6)
{
p.setWonderCards(hand[i]);
p.getBoard().incrementWonderLevel(p);
return hand[i];
}
}
}
if ((p.getBoard().getName().Equals("WB8"))
&& (p.getBoard().getCurrentWonderLevel() < 2)
&& (ResourceManager.GetInstance().ValidateWonder(p)))
{
for (int i = 0; i < hand.Count; i++)
{
if (hand[i].getType() != 6)
{
p.setWonderCards(hand[i]);
p.getBoard().incrementWonderLevel(p);
return hand[i];
}
}
}
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);
}
示例4: 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;
}
示例5: BuildWonder
private Card BuildWonder(PlayerState p, List<Card> hand)
{
if (p.getBoard().notMaxYet())
{
for (int i = 0; i < hand.Count(); i++)
{
if (hand[i].getType() == 1 || hand[i].getType() == 2)
{
if (ResourceManager.GetInstance().ValidateWonder(p))
{
strategy = new CommerceStrategy();
p.setWonderCards(hand[i]);
p.getBoard().incrementWonderLevel(p);
return hand[i];
}
}
}
}
return null;
}