public static Hike ContinueHike(Hike nowHike) { string name; Console.WriteLine("Enter hike name"); name = Console.ReadLine(); List <Character> characters = nowHike.GetAllCharacters(); Storage storage = nowHike.GetStorage(); Console.WriteLine("Choose quest"); TileWithCoords choosenTile = Map.ChooseTileOnMap(nowHike.GetHikePlacement()); List <Eventt> choosenQuests = ReadLoadTile.ReadTileById(choosenTile.GetTile()).GetQuests(); Coords destination = choosenTile.GetCoords(); int i = 0; foreach (Eventt qst in choosenQuests) { Console.WriteLine("{0}. {1}", i, qst.GetName()); i++; } int cho = PlayerInput.Input(0, choosenQuests.Count()); Eventt quest = choosenQuests[cho]; Console.WriteLine("Choose Path"); List <Coords> path = Map.BuildPath(nowHike.GetHikePlacement(), destination); return(new Hike(name, characters, path, quest, storage)); }
public Hike(string nam, int progres, List <Character> chars, List <Coords> way, Eventt questt, Storage storage) { progress = progres; name = nam; hikeStorage = storage; characters = chars; tilesCoords = way; quest = questt; id = maxId; maxId++; foreach (Character character in chars) { for (int i = 0; i < 9; i++) { if (strongAttr[i] < character.GetAttributeValue(i)) { strongAttr[i] = character.GetAttributeValue(i); } } for (int i = 0; i < 9; i++) { for (int j = 0; j < 5; j++) { if (strongTals[i][j] < character.GetTalentValue(i, j)) { strongTals[i][j] = character.GetTalentValue(i, j); } } } } }
public Hike(string nam, List <Character> chars, List <Coords> way, Eventt questt, List <Item> itemm, int v, int m) { name = nam; hikeStorage = new Storage(itemm, v, m); characters = chars; tilesCoords = way; quest = questt; id = maxId; maxId++; hikePlacement = way[0]; foreach (Character character in chars) { for (int i = 0; i < 9; i++) { if (strongAttr[i] < character.GetAttributeValue(i)) { strongAttr[i] = character.GetAttributeValue(i); } } for (int i = 0; i < 9; i++) { for (int j = 0; j < 5; j++) { if (strongTals[i][j] < character.GetTalentValue(i, j)) { strongTals[i][j] = character.GetTalentValue(i, j); } } } } }
public NextEventUseItem(string descr, string gDesc, string bDesc, string passiveUseNam, int reqLevel, Eventt nEvent) { description = descr; gDescription = gDesc; bDescription = bDesc; passiveUseName = passiveUseNam; requiredLevel = reqLevel; nextEventt = nEvent; }
public NextEventCharacterTest(string descr, int diff, int att, int tal, Eventt ngevent, Eventt nbeventt) { description = descr; difficulty = diff; attribute = att; talent = tal; nextGoodEventt = ngevent; nextBadEventt = nbeventt; }
public static Eventt GetQuestByTile(Tile tile) { int i = 0; List <Eventt> quests = tile.GetQuests(); Eventt choosenQuest = null; Console.WriteLine("Choose the quest in {0}", tile.GetName()); foreach (Eventt quest in quests) { Console.WriteLine("{0}. {1}", i, quest.GetName()); } choosenQuest = quests[PlayerInput.Input(0, quests.Count())]; return(choosenQuest); }
public static Hike LoadHike(int id) { Hike hike = null; XmlDocument xACPDoc = new XmlDocument(); xACPDoc.Load(AllHikesPathsPath); if (Functions.CheckHikeExistion(Convert.ToString(id))) { XmlDocument hikeDocument = new XmlDocument(); string characterDocumentPath = prefix + namePrefix + id + extention; hikeDocument.Load(characterDocumentPath); XmlNode hikeRoot = hikeDocument.DocumentElement; string name = hikeRoot.ChildNodes[0].InnerText; int progress = Convert.ToInt32(hikeRoot.ChildNodes[1].InnerText); List <Character> characters = new List <Character> { }; foreach (XmlNode characterNode in hikeRoot.ChildNodes[2]) { characters.Add(ReadLoadCharacter.ReadCharacterBySideAndId(characterNode.InnerText)); } List <Coords> coords = new List <Coords> { }; Coords coord; foreach (XmlNode coordNode in hikeRoot.ChildNodes[3]) { coord = new Coords(Convert.ToInt32(coordNode.ChildNodes[0].InnerText), Convert.ToInt32(coordNode.ChildNodes[1].InnerText)); coords.Add(coord); } Eventt quest = ReadLoadTile.GetEventt(hikeRoot.ChildNodes[4]);//!!!!!!!!! ReadLoadTile.tCheck(); XmlNode StorageNode = hikeRoot.ChildNodes[5]; int maxVolume = Convert.ToInt32(StorageNode.ChildNodes[0].InnerText); int maxMass = Convert.ToInt32(StorageNode.ChildNodes[1].InnerText); List <Item> items = new List <Item> { }; foreach (XmlNode itemNode in StorageNode.ChildNodes[2]) { items.Add(ReadLoadItem.ReadItemById(Convert.ToInt32(itemNode.InnerText))); } Storage storage = new Storage(items, maxVolume, maxMass); hike = new Hike(name, progress, characters, coords, quest, storage); } return(hike); }
public static Hike StartHike() { List <Coords> path; List <Character> characters = new List <Character> { }; Eventt quest = null; List <Eventt> choosenQuests; bool continuee = true; string name; int i; int cho; Console.WriteLine("Enter hike name"); name = Console.ReadLine(); Console.WriteLine("Choose characters"); while (continuee) { i = 0; Console.WriteLine("Choosen Characters:"); foreach (Character character1 in characters) { Console.WriteLine(character1.GetName()); } Console.WriteLine("Free Characters"); foreach (Character character in Town.GetFreeCharacters()) { Console.WriteLine("{0}. {1}", i, character.GetName()); i++; } Console.WriteLine("{0}. Remove characters from hike", i); i++; Console.WriteLine("{0}. That's all, continue", i); cho = PlayerInput.Input(0, Town.GetFreeCharacters().Count() + 2); Console.Write("\n"); if (cho >= 0 && cho < Town.GetFreeCharacters().Count()) { characters.Add(Town.GetFreeCharacters()[cho]); Town.RemoveFreeCharacter(Town.GetFreeCharacters()[cho]); } else { if (cho == Town.GetFreeCharacters().Count()) { do { i = 0; Console.WriteLine("Free Characters"); foreach (Character character in Town.GetFreeCharacters()) { Console.WriteLine(character.GetName()); } Console.WriteLine("Choosen Characters:"); foreach (Character character1 in characters) { Console.WriteLine("{0}. {1}", i, character1.GetName()); i++; } Console.WriteLine("{0}. Add characters to the hike", i); i++; cho = PlayerInput.Input(0, characters.Count() + 1); if (cho >= 0 && cho < characters.Count()) { Town.AddFreeCharacter(characters[cho]); characters.Remove(characters[cho]); } else { if (cho == characters.Count()) { continuee = false; } } } while (continuee); cho = 0; continuee = true; } if (cho == Town.GetFreeCharacters().Count() + 1) { if (characters.Count() != 0) { continuee = false; } else { Console.WriteLine("Choose at least one"); } } } } Console.WriteLine("Choose quest"); TileWithCoords choosenTile = Map.ChooseTileOnMap(Map.GetTownCoords()); choosenQuests = ReadLoadTile.ReadTileById(choosenTile.GetTile()).GetQuests(); Coords destination = choosenTile.GetCoords(); i = 0; foreach (Eventt qst in choosenQuests) { Console.WriteLine("{0}. {1}", i, qst.GetName()); i++; } cho = PlayerInput.Input(0, choosenQuests.Count()); quest = choosenQuests[cho]; Console.WriteLine("Choose Path"); path = Map.BuildPath(Map.GetTownCoords(), destination); return(new Hike(name, characters, path, quest, new List <Item> { }, 100, 100)); }
public NextEvent(string descr, Eventt nevent) { description = descr; nextEventt = nevent; }
public static IChoice GetIchoice(XmlNode choiceNode) { switch (choiceNode.Name) { case "sbc": { return(new StartBattleChoice(choiceNode.ChildNodes[0].InnerText, Convert.ToInt32(choiceNode.ChildNodes[1].InnerText))); } case "rttt": { return(new ReturnToTheTown(choiceNode.ChildNodes[0].InnerText)); } case "gst": { return(new GoodStrongTest(choiceNode.ChildNodes[0].InnerText, Convert.ToInt32(choiceNode.ChildNodes[1].InnerText), Convert.ToInt32(choiceNode.ChildNodes[2].InnerText), Convert.ToInt32(choiceNode.ChildNodes[3].InnerText))); } case "ne": { int jj = t; tCheck(); if (t > tMax) { tMax = t; } string ename = choiceNode.ChildNodes[0].InnerText; NextEvent nextEvent = new NextEvent(ename, GetEventt(choiceNode.ChildNodes[1])); t = jj; return(nextEvent); } case "nect": { int jj = t; tCheck(); if (t > tMax) { tMax = t; } string ename = choiceNode.ChildNodes[0].InnerText; int difficulty = Convert.ToInt32(choiceNode.ChildNodes[1].InnerText); int attribute = Convert.ToInt32(choiceNode.ChildNodes[2].InnerText); int talent = Convert.ToInt32(choiceNode.ChildNodes[3].InnerText); Eventt gEvent = GetEventt(choiceNode.ChildNodes[4]); t++; if (t > tMax) { tMax = t; } NextEventCharacterTest nextEvent = new NextEventCharacterTest(ename, difficulty, attribute, talent, gEvent, GetEventt(choiceNode.ChildNodes[5])); t = jj; return(nextEvent); } case "neui": { int jj = t; tCheck(); if (t > tMax) { tMax = t; } string eName = choiceNode.ChildNodes[0].InnerText; string gDescr = choiceNode.ChildNodes[1].InnerText; string bDescr = choiceNode.ChildNodes[2].InnerText; string passiveUseName = choiceNode.ChildNodes[3].InnerText; int reqLvl = Convert.ToInt32(choiceNode.ChildNodes[4].InnerText); NextEventUseItem nextEvent = new NextEventUseItem(eName, gDescr, bDescr, passiveUseName, reqLvl, GetEventt(choiceNode.ChildNodes[5])); t = jj; return(nextEvent); } case "ist": { return(new ItemStrongTest(choiceNode.ChildNodes[0].InnerText, choiceNode.ChildNodes[1].InnerText, choiceNode.ChildNodes[2].InnerText, Convert.ToInt32(choiceNode.ChildNodes[3].InnerText), Convert.ToInt32(choiceNode.ChildNodes[4].InnerText), Convert.ToInt32(choiceNode.ChildNodes[5].InnerText), Convert.ToInt32(choiceNode.ChildNodes[6].InnerText))); } case "dct": { return(new DamageCharacterTest(choiceNode.ChildNodes[0].InnerText, choiceNode.ChildNodes[1].InnerText, choiceNode.ChildNodes[2].InnerText, Convert.ToInt32(choiceNode.ChildNodes[3].InnerText), Convert.ToInt32(choiceNode.ChildNodes[4].InnerText), Convert.ToInt32(choiceNode.ChildNodes[5].InnerText), Convert.ToInt32(choiceNode.ChildNodes[6].InnerText))); } case "ncc": { return(new NextCharacterConsequence(choiceNode.ChildNodes[0].InnerText, GetCharacterConsequence(choiceNode.ChildNodes[1]))); } case "tcct": { return(new TwoConsequencesCharacterTest(choiceNode.ChildNodes[0].InnerText, choiceNode.ChildNodes[1].InnerText, choiceNode.ChildNodes[2].InnerText, Convert.ToInt32(choiceNode.ChildNodes[3].InnerText), Convert.ToInt32(choiceNode.ChildNodes[4].InnerText), Convert.ToInt32(choiceNode.ChildNodes[5].InnerText), GetCharacterConsequence(choiceNode.ChildNodes[6]), GetCharacterConsequence(choiceNode.ChildNodes[7]))); } case "tscct": { return(new TwoSquadConsequencesCharacterTest(choiceNode.ChildNodes[0].InnerText, choiceNode.ChildNodes[1].InnerText, choiceNode.ChildNodes[2].InnerText, Convert.ToInt32(choiceNode.ChildNodes[3].InnerText), Convert.ToInt32(choiceNode.ChildNodes[4].InnerText), Convert.ToInt32(choiceNode.ChildNodes[5].InnerText), GetCharacterConsequence(choiceNode.ChildNodes[6]), GetCharacterConsequence(choiceNode.ChildNodes[7]))); } case "tcact": { return(new TwoConsequencesAllCharacterTest(choiceNode.ChildNodes[0].InnerText, choiceNode.ChildNodes[1].InnerText, choiceNode.ChildNodes[2].InnerText, Convert.ToInt32(choiceNode.ChildNodes[3].InnerText), Convert.ToInt32(choiceNode.ChildNodes[4].InnerText), Convert.ToInt32(choiceNode.ChildNodes[5].InnerText), GetCharacterConsequence(choiceNode.ChildNodes[6]), GetCharacterConsequence(choiceNode.ChildNodes[7]))); } case "sc": { return(new SkipChoice(choiceNode.ChildNodes[0].InnerText, choiceNode.ChildNodes[1].InnerText)); } default: { return(null); } } }