public static CGME.Game Build() { // BUILDING THE GAME TABLE game = new CGME.Game(); // BUILDING PLAYERS //CGME.Player game_player = Factory.BuildPlayer("Game Player", true); game.AddPlayer (new Player("Game Player")); //CGME.Player human_player = Factory.BuildPlayer("Human Player", true); game.AddPlayer (new Player("Human Player")); // ADDING RESOURCES game.AddResource(new Resource<int>("Life Points",30), "Human Player"); game.AddResource(new Resource<int>("Life Points",30), "Game Player"); game.AddResource (new Resource<int>("Victory Points", 0), "Human Player"); // BUILDING DECKS game.GetPlayer("Human Player").AddDeck(new Deck("Draw Pile")); // BUILDING CARDS for (int i = 1; i <= 2; i++){ game.GetPlayer ("Human Player").GetDeck ("Draw Pile").AddCard(new Card("Dwarf Dork")); game.AddResource(new Resource<string>("Description", "Drunk and Smelly"),"Dwarf Dork"); } // BUILDING RULESET game.AddRuleset(new Ruleset("Standard")); // BUILDING PHASES game.GetRuleset ("Standard").AddPhase (new Phase("Draw Phase")); game.GetRuleset ("Standard").AddPhase (new Phase("Play Phase")); // BUILDING ACTIONS game.GetRuleset ("Standard").GetPhase ("Draw Phase").AddAction(new EndPhaseAction("End Phase")); game.GetRuleset ("Standard").GetPhase("Draw Phase").AddAction(new SubtractResourceAction("Damage","Life Points", 5)); game.GetRuleset ("Standard").GetPhase ("Play Phase").AddAction(new EndGameAction("End Game")); return game; }
// inicia os parametros do jogo // PUBLIC FUNCTIONS ------------------------------------------ public bool Start() { Debug.Log("GM start"); game = GameBuilder.Build(); if (game == null){ Debug.Log("Error - game failed to load"); return false; } for (int game_index = 0; game_index < game.Rulesets_Size; game_index++){ // FOR EACH RULESET CGME.Ruleset ruleset = game.GetRuleset(game_index); Debug.Log ("RULESET:" + ruleset.Name + DebugRes(ruleset)); for (int rule_index = 0; rule_index < ruleset.Phases_Size; rule_index++){ // FOR EACH PHASE CGME.Phase phase = ruleset.GetPhase(rule_index); Debug.Log ("-----PHASE: " + phase.Name + DebugRes(phase)); for (int phase_index = 0; phase_index < phase.Actions_Size; phase_index++) {// FOR EACH ACTION CGME.Action action = phase.GetAction(phase_index); Debug.Log ("-------------ACTION:" + action.Name + DebugRes(action)); } } } for (int game_index = 0; game_index < game.Players_Size; game_index++){ // FOR EACH PLAYER CGME.Player player = game.GetPlayer (game_index); Debug.Log ("PLAYER: " + player.Name + DebugRes(player)); for (int player_index = 0; player_index < player.Decks_Size; player_index++){ // FOR EACH DECK CGME.Deck deck = player.GetDeck(player_index); Debug.Log ("------DECK: " + deck.Name + DebugRes(deck)); for (int deck_index = 0; deck_index < deck.Cards_Size; deck_index++) {// FOR EACH CARD CGME.Card card = deck.GetCard(deck_index); Debug.Log ("--------------CARD:" + card.Name + DebugRes(card)); } } } if (!DefineRuleset(game.GetRuleset(0)))// play the first ruleset by default return false; if (!DefinePhase(running_ruleset.GetPhase(0))) // play the first phase by default return false; return true; }