Esempio n. 1
0
        public static Dictionary <string, CombatEncounter> Get_Encounters()
        {
            Generator gen = new Generator("default", 0, 20);
            Dictionary <string, CombatEncounter> encounterDict = new Dictionary <string, CombatEncounter>();
            XmlDocument doc = new XmlDocument();

            doc.Load("D:\\C#\\RPG1\\RPG1\\data\\encounters.xml");
            foreach (XmlNode node in doc.DocumentElement.ChildNodes)
            {
                string        encIdName  = node.Attributes["id"]?.InnerText;
                string        encName    = "";
                List <Player> encEnemies = new List <Player>();

                foreach (XmlNode subnode in node)
                {
                    switch (subnode.Name)
                    {
                    case "name":
                        encName = subnode.InnerText;
                        break;

                    case "enemy":
                        Player newEn = gen.player();
                        foreach (XmlNode enAttr in subnode)
                        {
                            switch (enAttr.Name)
                            {
                            case "skill":
                                newEn.skills.Add(Get_Skill(enAttr.InnerText));
                                break;

                            case "name":
                                newEn.name = enAttr.InnerText;
                                break;
                            }
                        }
                        encEnemies.Add(newEn);
                        break;
                    }
                }

                CombatEncounter newEnc = new CombatEncounter(encName, encIdName, encEnemies);
                encounterDict.Add(encIdName, newEnc);
            }
            return(encounterDict);
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Runtime main = new Runtime(); Player test_player = main.stdGen.player(); main.defaultPlayer = test_player; test_player.Add_Skill("SLASH"); test_player.Add_Skill("HEAL");

            //EVENT RUNNING
            //main.Run_Event("TEST_EVENT_1");test_player.info();

            //LOCATION EVENT RUNNING
            //Dictionary<string, Map> maps = main.Get_Maps();foreach (string mapkey in maps.Keys){Map map = maps[mapkey];map.info();foreach (Location loc in map.locations){main.Run(loc, test_player);}}

            //SKILL GATHERING
            //Dictionary<string, Skill> skills = main.Get_Skills();foreach (string skillname in skills.Keys){Skill skill = skills[skillname];skill.info();}

            //SKILL DAMAGE TESTING
            //foreach (float dmg in main.Get_Damages(main.Get_Skill("SLASH"), 0, 5)) {Console.WriteLine(dmg);}

            //COMBAT ENCOUNTER READING
            //Dictionary<string, CombatEncounter> encounters = main.Get_Encounters();foreach (string key in encounters.Keys){encounters[key].info(true);}

            //COMBAT ENCOUNTER RUNNING
            CombatEncounter encounter = main.Get_Encounter("ENCOUNTER_1"); encounter.run(test_player);

            Console.ReadLine();
        }