public Score(GameState g) { finalScore = new int[g.getPlayers().Count,7]; for(int i = 0; i < g.getPlayers().Count; i++){ if (g.players[i].getPlayedCards().Count < 10) { g.players[i].setScore(0, 0); g.players[i].setScore(0, 1); g.players[i].setScore(0, 2); g.players[i].setScore(0, 3); g.players[i].setScore(0, 4); g.players[i].setScore(0, 5); g.players[i].setScore(0, 6); } else { g.players[i].setScore(militaryScore(g.getPlayerNum(i)), 0); g.players[i].setScore(treasuryScore(g.getPlayerNum(i)), 1); g.players[i].setScore(WonderScore(g.getPlayerNum(i)), 2); g.players[i].setScore(civScore(g.getPlayerNum(i)), 3); g.players[i].setScore(sciScore(g.getPlayerNum(i)), 4); g.players[i].setScore(comScore(g.getPlayerNum(i)), 5); g.players[i].setScore(0, 6); //g.players[i].setScore(,7); } } }
//private int[] coinTransactions; //private Logger _logger; //Constructor private ResourceManager(GameState g) { gameState = g; baseResources = new Dictionary<string,List<int>>(); SResources = new Dictionary<string, List<ResourceCard>>(); TempResources = new Dictionary<string, List<int>>(); //_logger = Logger.GetInstance(this, g); //_logger.SetLogging(true); //_logger.LogPlayer(1); List<PlayerState> players = gameState.getPlayers(); for (int i = 0; i < players.Count; i++) { List<int> boardResources = new List<int>(); List<int> empty = new List<int>(); List<ResourceCard> rclist = new List<ResourceCard>(); for (int j = 0; j < 7; j++) { boardResources.Add(players[i].getBoard().getResources()[j]); empty.Add(0); } baseResources.Add(players[i].getName(), boardResources); SResources.Add(players[i].getName(), rclist); TempResources.Add(players[i].getName(), empty); } }
public int calcCommerceIncome(Card playedCard, GameState gs, int playerId) { PlayerState thePlayer = gs.getPlayerNum(playerId); //System.Console.WriteLine(playedCard.getNumber()); if (!playedCard.getName().StartsWith("CO")) { return 0; } if(playedCard.GetType() != typeof(CommerceCard)) { return 0; } CommerceCard commCard = (CommerceCard)playedCard; if (commCard.getCoins() != 0) { return commCard.getCoins(); } if ((commCard.getNumber().Equals(77)) || (commCard.getNumber().Equals(78))) { return countCardType(1, thePlayer) + countCardType(1, gs.getLeftPlayer(thePlayer)) + countCardType(1, gs.getRightPlayer(thePlayer)); } if ((commCard.getNumber().Equals(80)) || (commCard.getNumber().Equals(79))) { return countCardType(2, thePlayer) + countCardType(2, gs.getLeftPlayer(thePlayer)) + countCardType(2, gs.getRightPlayer(thePlayer)); } //Haven if ((commCard.getNumber().Equals(119)) || (commCard.getNumber().Equals(120))) { return countCardType(1, thePlayer); } //LightHouse if ((commCard.getNumber().Equals(121)) || (commCard.getNumber().Equals(122))) { return countCardType(4, thePlayer); } //Chamber of Commerce if ((commCard.getNumber().Equals(123)) || (commCard.getNumber().Equals(124))) { return 2 * countCardType(2, thePlayer); } //Arena if ((commCard.getNumber().Equals(125)) || (commCard.getNumber().Equals(126)) || (commCard.getNumber().Equals(127))) { return 3 * thePlayer.getBoard().getCurrentWonderLevel(); } return 0; }
public ScoreWindow(GameState g, Grid gg) { game = g; parent = gg; InitializeComponent(); this.Loaded += new RoutedEventHandler(ScoreWindow_Loaded); addPlayers(scoreGrid);//scoreGrid is named in XAML addButton(scoreGrid); }
public static ResourceManager GetInstance(GameState g) { if (_instance == null) _instance = new ResourceManager(g); gameState = g; //Console.WriteLine("================= SET GAME STATE ==================="); return _instance; }
public WonderBuyingWindow(Resources res, Card c, PlayerGameBoard p, GameState g) { resources = res; card = c; board = p; game = g; manager = ResourceManager.GetInstance(); you = manager.getGameState().getPlayerNum(resources.getPlayerName()[1]); InitializeComponent(); createButtons(); createValueFields(); }
//Base Constructor, Needs GameState and PlayerState protected resourceChecks(GameState g, PlayerState p) { //coinTransactions = new int[3]{0,0,0}; //Getting left and right player of player P left = g.getLeftPlayer(p); right = g.getRightPlayer(p); //Initialize base resources baseResources = ResourceInitializer(p); lResources = ResourceInitializer(left); rResources = ResourceInitializer(right); //List of important resource cards SRCardLst = SRCardInitializer(p); lSRCardLst = SRCardInitializer(left); rSRCardLst = SRCardInitializer(right); }
public StartGame(List<Player> pending) { numPlayers = pending.Count; cardlistCreator lstC = new cardlistCreator(); allCards = lstC.getCardList(); cards = filterCards(allCards); boards = new CreateBoards().getBoards(); makePlayers(pending); game = new GameState(cards, players, boards); ResourceManager.GetInstance(game);// }
//private Logger _logger; private ResourceManager(GameState g) { gameState = g; hashtable = new Dictionary<string,List<int>>(); //_logger = Logger.GetInstance(this, g); //_logger.SetLogging(true); //_logger.LogPlayer(1); List<PlayerState> players = gameState.getPlayers(); for (int i = 0; i < players.Count; i++) { List<int> list = new List<int>(); for (int j = 0; j < 7; j++) list.Add(0); hashtable.Add(players[i].getName(), list); } }
public ResourceBuying(Resources res, Card c, PlayerGameBoard p, GameState g) { resources = res; //Console.WriteLine(resources.ToString()); card = c; board = p; game = g; manager = ResourceManager.GetInstance(); you = manager.getGameState().getPlayerNum(resources.getPlayerName()[1]); InitializeComponent(); createButtons(); createValueFields(); }
public List<int> getScores(PlayerState p, GameState g) { /* SetDefaults(); scores.Insert(_MILITARY_SCORE,MilitaryScore(p)); scores.Insert(_TREASURY_SCORE, TreasuryScore(p)); scores.Insert(_WONDER_SCORE, WonderScore(p)); scores.Insert(_CIVILIAN_SCORE, CivilianScore(p)); scores.Insert(_SCIENCE_SCORE, ScienceScore(p)); scores.Insert(_COMMERCE_SCORE, CommerceScore(p)); scores.Insert(_GUILD_SCORE, GuildScore(p)); */ scores = new List<int>(); scores.Add(MilitaryScore(p)); scores.Add(TreasuryScore(p)); scores.Add(WonderScore(p)); scores.Add(CivilianScore(p)); scores.Add(CommerceScore(p)); scores.Add(GuildScore(p, g)); scores.Add(ScienceScore(p)); return scores; }
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()); }
public void SetGameState(GameState g) { gameState = g; }
public static Logger GetInstance(Object o, GameState g) { if (_instance == null) _instance = new Logger(o, g); return _instance; }
private Logger(Object o, GameState g) { _class = o; _gameState = g; players = _gameState.getPlayers(); }
public List<int> getScores(GameState g) { scores = Calculator.getInstance().getScores(this, g); return this.scores; }
public static WonderBuyingWindow GetInstance(Resources r, Card c, PlayerGameBoard p, GameState g) { if (_instance == null) { _instance = new WonderBuyingWindow(r, c, p, g); } else { _instance.Close(); _instance.reset(); _instance = new WonderBuyingWindow(r, c, p, g); } return _instance; }
public void SetGameState(GameState g) { gameState = g; //_logger.SetGameState(g); }
private int GuildScore(PlayerState p, GameState g) { int score = 0; List<GuildCard> glist = new List<GuildCard>(); //GameState g = ; //Cycle through played cards for (int i = 0; i < p.getPlayedCards().Count; i++) { if (p.getPlayedCards()[i].getType() == Card._GUILD) { glist.Add((GuildCard)p.getPlayedCards()[i]); } } //Cycle through guild cards for (int i = 0; i < glist.Count; i++) { //worker if (glist[i].getNumber() == 98) { score = score + (2 * (g.getLeftPlayer(p).countCardType(2) + g.getRightPlayer(p).countCardType(2)));} //craft if (glist[i].getNumber() == 99) { score = score + (g.getLeftPlayer(p).countCardType(1) + g.getRightPlayer(p).countCardType(1)); } //trader if (glist[i].getNumber() == 100) { score = score + (g.getLeftPlayer(p).countCardType(4) + g.getRightPlayer(p).countCardType(4)); } //Philospher if (glist[i].getNumber() == 101) { score = score + (g.getLeftPlayer(p).countCardType(6) + g.getRightPlayer(p).countCardType(6)); } //Spies if (glist[i].getNumber() == 102) { score = score + (g.getLeftPlayer(p).countCardType(5) + g.getRightPlayer(p).countCardType(5)); } //strat if (glist[i].getNumber() == 103) { score = score + (g.getLeftPlayer(p).getNumLosses()) + (g.getRightPlayer(p).getNumLosses());} //ship if (glist[i].getNumber() == 104) { score = score + (p.countCardType(1)) + (p.countCardType(2)) + (p.countCardType(7));} //Science if (glist[i].getNumber() == 105) { scienceguildCard = true; } //magistrat if (glist[i].getNumber() == 106) { score = score + (g.getLeftPlayer(p).countCardType(3) + g.getRightPlayer(p).countCardType(3)); } //builders if (glist[i].getNumber() == 107) { score = score + (g.getRightPlayer(p).getBoard().getCurrentWonderLevel()); score = score + (g.getLeftPlayer(p).getBoard().getCurrentWonderLevel()); score = score + (p.getBoard().getCurrentWonderLevel()); } } return score; }