예제 #1
0
파일: Program.cs 프로젝트: cedlem/Tales
        static void Main(string[] args)
        {
            setReaction_Index(); //Move to game

            Game g = new Game();

            Player p = new Player();

            p.Position = g.getGameSpaces().Find(pos => pos.Name.Contains("Baghdad"));
            for (int k = 0; k < 3; k++) //3 tour
            {
                //Exemple d'un tour

                //Move
                Spaces s = askMove(p, g);
                p.Position = s;

                //Draw encounter card
                Encounter_Card ec = g.pick_Encounter_Card();
                int            encounterTableNumber = 0;

                //Get Encounter Table
                if (ec.Type == Encounter_Card.TYPE_TERRAIN)
                {
                    encounterTableNumber = ec.EncounterTable(p.Position.Type);
                }
                else if (ec.Type == Encounter_Card.TYPE_CHARACTER)
                {
                    encounterTableNumber = ec.EncounterTable(g.DayPeriod);
                }
                else if (ec.Type == Encounter_Card.TYPE_CITY)
                {
                    encounterTableNumber = ec.EncounterTable(0);
                }

                //Get encounter

                //Must throw dice
                //Misc m = Misc.Instance; // wtf fix this
                int diceroll = Misc.RandomNumber(1, 6); // wtf fix this

                int result = diceroll + p.Position.Value;
                if (p.CurrentDestiny == 3 || p.CurrentDestiny == 4)
                {
                    result += 1;
                }
                else if (p.CurrentDestiny >= 5)
                {
                    result += 2;
                }

                if (result > 12)
                {
                    result = 12;
                }


                Encounter_Matrix em = Encounter_Matrix.Instance;
                Encounter        e  = em.getEncounter(encounterTableNumber, result);

                Adjective_Matrix am = Adjective_Matrix.Instance;

                string Adjective = am.getAdjectiveText(e.ReactionTable, e.Adjective);
                string Name      = e.Name;
                if (Name == "")
                {
                    Name = ec.Name;
                }


                Console.WriteLine(Adjective + " " + Name + "\n");

                //Show reaction options
                Reaction_Matrix rm = Reaction_Matrix.Instance;
                for (int i = 0; i < rm.getReactionTableSize(e.ReactionTable); i++)
                {
                    Console.WriteLine((i + 1) + " - " + rm.getReactionText(e.ReactionTable, i));
                }

                //add verification
                int reponse = Convert.ToInt32(Console.ReadLine());

                Tales_Matrix tm = Tales_Matrix.Instance;

                Console.WriteLine(tm.getTaleID(e.ReactionTable, e.Adjective, reponse - 1));

                //IL MANQUE MAINTENANT LE DÉ DU DESTIN.
                //(Il y a aussi la verification si on a un skill au niveau magistral. mais on ne peut pas faire
                // ca tant qu'on a pas les resultats et les skill necessaire pour different resultat des Tales.)

                Console.ReadKey();
                Console.Clear();
            }


            Console.ReadKey();
        }
예제 #2
0
파일: Game.cs 프로젝트: cedlem/Tales
        public void doTurn()
        {
            Player p = player_list.ElementAt(currentPlayer);

            //Exemple d'un tour

            //Move
            Spaces s = askMove(p);

            p.Position = s;

            //Draw encounter card
            Encounter_Card ec = pick_Encounter_Card();
            int            encounterTableNumber = 0;

            //Get Encounter Table
            if (ec.Type == Encounter_Card.TYPE_TERRAIN)
            {
                encounterTableNumber = ec.EncounterTable(p.Position.Type);
            }
            else if (ec.Type == Encounter_Card.TYPE_CHARACTER)
            {
                encounterTableNumber = ec.EncounterTable(DayPeriod);
            }
            else if (ec.Type == Encounter_Card.TYPE_CITY)
            {
                encounterTableNumber = ec.EncounterTable(0);
            }

            //Get encounter

            //Must throw dice
            //Misc m = Misc.Instance; // wtf fix this
            int diceroll = Misc.RandomNumber(1, 6); // wtf fix this

            int result = diceroll + p.Position.Value;

            if (p.CurrentDestiny == 3 || p.CurrentDestiny == 4)
            {
                result += 1;
            }
            else if (p.CurrentDestiny >= 5)
            {
                result += 2;
            }

            if (result > 12)
            {
                result = 12;
            }


            Encounter_Matrix em = Encounter_Matrix.Instance;
            Encounter        e  = em.getEncounter(encounterTableNumber, result);

            Adjective_Matrix am = Adjective_Matrix.Instance;

            string Adjective = am.getAdjectiveText(e.ReactionTable, e.Adjective);
            string Name      = e.Name;

            if (Name == "")
            {
                Name = ec.Name;
            }


            Console.WriteLine(Adjective + " " + Name + "\n");

            //Show reaction options
            Reaction_Matrix rm = Reaction_Matrix.Instance;

            for (int i = 0; i < rm.getReactionTableSize(e.ReactionTable); i++)
            {
                Console.WriteLine((i + 1) + " - " + rm.getReactionText(e.ReactionTable, i));
            }

            //add verification
            int reponse = Convert.ToInt32(Console.ReadLine());

            Tales_Matrix tm = Tales_Matrix.Instance;

            Console.WriteLine(tm.getTaleID(e.ReactionTable, e.Adjective, reponse - 1));

            //IL MANQUE MAINTENANT LE DÉ DU DESTIN.
            //(Il y a aussi la verification si on a un skill au niveau magistral. mais on ne peut pas faire
            // ca tant qu'on a pas les resultats et les skill necessaire pour different resultat des Tales.)

            if (ec.Type == Encounter_Card.TYPE_CITY)
            {
                Console.Write("Do you want to keep this City Card? [Y/N]  ");
                do
                {
                } while (true);

                if (true)
                {
                }
                else
                {
                    discard_Encounter_Card(ec);
                }
            }
            else
            {
                discard_Encounter_Card(ec);
            }

            Console.ReadKey();
            Console.Clear();
        }