示例#1
0
文件: Program.cs 项目: cedlem/Tales
        private static void getAllPossibleMove(Spaces s, int landDist, int seaDist, ref SpaceMouvement[] sm, Wealth w)
        {
            int index = s.ID;

            sm[index].Visited  = true;
            sm[index].Distance = landDist + seaDist;

            if (landDist + seaDist == Math.Max(w.LandMouvement(), w.SeaMouvement()))
            {
                return;
            }

            int newSea;
            int newLand;

            foreach (Spaces connection in s.Connections)
            {
                newSea  = seaDist;
                newLand = landDist;

                if (s.Type == Spaces.TYPE_SEA || connection.Type == Spaces.TYPE_SEA || s.Type == Spaces.TYPE_ISLAND || connection.Type == Spaces.TYPE_ISLAND)
                {
                    if (w.SeaMouvement() == seaDist)
                    {
                        continue;
                    }
                    newSea++;
                }
                else
                {
                    if (w.LandMouvement() == landDist)
                    {
                        continue;
                    }
                    newLand++;
                }

                if (sm[connection.ID].Visited == false || (sm[connection.ID].Visited == true && sm[connection.ID].Distance > (newLand + newSea)))
                {
                    getAllPossibleMove(connection, newLand, newSea, ref sm, w);
                }
            }
        }
示例#2
0
文件: Game.cs 项目: cedlem/Tales
        public void set_Spaces()
        {
            /*
             *      From CSV file: id; continent; nom; valeur; type; connection (Divided by comma)
             */

            string[] line_content;
            int[]    connections;

            string[] lines = System.IO.File.ReadAllLines("MapConnections.txt");

            spaces = new List <Spaces>(lines.Count());
            for (int i = 0; i < spaces.Capacity; i++)
            {
                spaces.Add(new Spaces());
            }

            for (int i = 0; i < lines.Length; i++)  //COMMENT THIS
            {
                Spaces s = spaces.ElementAt(i);

                line_content = lines[i].Split(';');


                s.ID        = Int32.Parse(line_content[0]);
                s.Continent = Int32.Parse(line_content[1]);
                s.Name      = line_content[2];
                s.Value     = Int32.Parse(line_content[3]);
                s.Type      = Int32.Parse(line_content[4]);
                connections = line_content[5].Split(',').Select(Int32.Parse).ToArray();

                foreach (int index in connections)
                {
                    s.Connections.Add(spaces.ElementAt(index));
                }
            }
        }
示例#3
0
文件: Program.cs 项目: cedlem/Tales
        static void Main(string[] args)
        {
            setReaction_Index(); //Move to game
            for (int i = 0; i < 15; i++)
            {
                Console.WriteLine(reaction_id.ElementAt(i));
            }

            //Game g = new Game();
            //Encounter_Card ec;

            //g.set_Encounter_Stack();

            //ec = g.pick_Encounter_Card();
            //Console.WriteLine(ec.getName());
            //Console.WriteLine(ec.getType());

            //ec = g.pick_Encounter_Card();
            //Console.WriteLine(ec.getName());
            //Console.WriteLine(ec.getType());

            //ec = g.pick_Encounter_Card();
            //Console.WriteLine(ec.getName());
            //Console.WriteLine(ec.getType());

            //ec = g.pick_Encounter_Card();
            //Console.WriteLine(ec.getName());
            //Console.WriteLine(ec.getType());


            /* Adjective and Reaction Matrix test */



            //Console.WriteLine(Adjective_Matrix.Instance.getAdjectiveID('A', "Disguised"));
            //Console.WriteLine(Adjective_Matrix.Instance.getAdjectiveID(0, "Disguised"));
            //Console.WriteLine(Adjective_Matrix.Instance.getAdjectiveText('A', 2));
            //Console.WriteLine(Adjective_Matrix.Instance.getAdjectiveText(0, 2));

            //Console.WriteLine(Reaction_Matrix.Instance.getReactionID('G', "Wait for help"));
            //Console.WriteLine(Reaction_Matrix.Instance.getReactionID(6, "Wait for help"));
            //Console.WriteLine(Reaction_Matrix.Instance.getReactionText('G',1));
            //Console.WriteLine(Reaction_Matrix.Instance.getReactionText(6,1));


            /* Encounter Matrix test */

            Encounter_Matrix em = Encounter_Matrix.Instance;
            Adjective_Matrix am = Adjective_Matrix.Instance;

            int rt  = em.getEncounter(56, 5).getReactionTable();
            int adj = em.getEncounter(56, 5).getAdjective();

            Console.WriteLine(rt);                                             //Should be 5
            Console.WriteLine(getReactionLetter(rt));                          //Should be F
            Console.WriteLine(adj);                                            //Should be 3
            Console.WriteLine(am.getAdjectiveText(getAdjectiveText(rt, adj))); //Should be House

            Console.WriteLine(em.getEncounter(56, 5).getName());               //Should be Fire



            /*Card + Position test*/


            Encounter_Card ec = new Terrain_Encounter("Dendan", new int[] { 42, 44, -1, 7, 46, 45 }, 'N');
            Spaces         s  = new Spaces("", 4, Spaces.TYPE_MOUNTAINS);

            Console.WriteLine(ec.getEncounterTable(s)); //should be 42


            /*Same as before, plus  Encounter*/
            int dicerole = 3;                                                                //Need Randomizer

            Encounter e = em.getEncounter(ec.getEncounterTable(s), s.getValue() + dicerole); //eventually add depending of the player points

            Console.WriteLine(e.getReactionTable());                                         // should be 5
            Console.WriteLine(getReactionLetter(e.getReactionTable()));                      // should be F
            Console.WriteLine(e.getName());                                                  // should be River
            Console.WriteLine(e.getAdjective());                                             // should be 7
            Console.WriteLine(am.getAdjectiveText(e.getAdjective()));                        // should be Mysterious

            //42;F;7;Mysterious;River


            /*Same as before, plus Tales*/
            int reaction;   //Need ask



            Console.ReadKey();
        }
示例#4
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();
        }
示例#5
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();
        }
示例#6
0
 public int EncounterTable(Spaces s)
 {
     return(encouter_List[s.Type]);
 }