//public Przeciwnik(string nazwa, int _id, int obrazenia, int nagrodaexp, int nagrodagold, int basehp, int basemp) : base(basehp, basemp) private static void zaladujNPC() // wykorzystany konstruktor bez obrazka postaci i lokacji, przeznaczony wiec dla walk losowych gdzie nie sa potrzebne { Przeciwnik enemy; enemy = new Przeciwnik("Nietoperz", enemyId_nietoperz, 4, 10, 10, 25, 0, Gra.Properties.Resources.babybat, Gra.Properties.Resources.babybat_battleimage); przeciwnik.Add(enemy); enemy = new Przeciwnik("Ogromny szczur", enemyId_ogromnyszczur, 5, 15, 15, 30, 0, Gra.Properties.Resources.Empty, Gra.Properties.Resources.Empty); przeciwnik.Add(enemy); enemy = new Przeciwnik("Wilk", enemyId_wilk, 7, 20, 20, 40, 0, Gra.Properties.Resources.Wolf, Gra.Properties.Resources.Wolf_battleimage); przeciwnik.Add(enemy); enemy = new Przeciwnik("Szkielet", enemyId_szkielet, 8, 25, 25, 30, 0, Gra.Properties.Resources.Empty, Gra.Properties.Resources.Empty); przeciwnik.Add(enemy); enemy = new Przeciwnik("Szkielet czarownik", enemyId_szkielet_czarownik, 4, 30, 20, 40, 30, Gra.Properties.Resources.Empty, Gra.Properties.Resources.Empty); enemy.PoznajAtak(1); przeciwnik.Add(enemy); enemy = new Przeciwnik("Minotaur", enemyId_minotaur, 12, 50, 40, 80, 30, Gra.Properties.Resources.Minotaur, Gra.Properties.Resources.Minotaur_battleimage); enemy.PoznajAtak(2); enemy.PoznajAtak(4); przeciwnik.Add(enemy); PrzyjaznyNPC friendly; friendly = new PrzyjaznyNPC(friendlyId_Vincent, "Vincent", Gra.Properties.Resources.npc_knight_1, Gra.Properties.Resources.npc_knight_1_talk, "Powodzenia!"); friendly.AddQuest(Task.questId_Cave); friendly.Questy.ElementAt(0).setIsActive(true); friendly.Questy.ElementAt(0).setStatus(QuestStatus.Active); przyjazny.Add(friendly); friendly = new PrzyjaznyNPC(friendlyId_King, "Król", Gra.Properties.Resources.npc_king, Gra.Properties.Resources.npc_king_talk, "Co tutaj nadal robisz?"); friendly.AddQuest(Task.questId_Cave); friendly.Questy.ElementAt(0).setIsActive(true); friendly.Questy.ElementAt(0).setStatus(QuestStatus.Complited); friendly.AddQuest(Task.questId_Danger); friendly.Questy.ElementAt(1).setIsActive(true); friendly.Questy.ElementAt(1).setStatus(QuestStatus.Active); przyjazny.Add(friendly); friendly = new PrzyjaznyNPC(friendlyId_Peasant, "Chłop", Gra.Properties.Resources.npc_peasant, Gra.Properties.Resources.Empty, "..."); friendly.AddQuest(Task.questId_Peasant); friendly.Questy.ElementAt(0).setIsActive(true); friendly.Questy.ElementAt(0).setStatus(QuestStatus.Active); przyjazny.Add(friendly); friendly = new PrzyjaznyNPC(friendlyId_Sorceress, "Czarodziejka", Gra.Properties.Resources.npc_sorceress, Gra.Properties.Resources.Empty, "Co tutaj robisz?"); friendly.AddQuest(Task.questId_Danger); friendly.Questy.ElementAt(0).setIsActive(true); friendly.Questy.ElementAt(0).setStatus(QuestStatus.Active); przyjazny.Add(friendly); }
public static PrzyjaznyNPC FriendlyById(int _id) { foreach (PrzyjaznyNPC friendly in przyjazny) { if (friendly.getId() == _id) { PrzyjaznyNPC temp = new PrzyjaznyNPC(friendly.getId(), friendly.getNazwa(), friendly.getObrazekPostaci(), friendly.getDialogImage(), friendly.getEndingLine()); foreach (Quest quest in friendly.Questy) { temp.AddQuest(quest.getId()); } return(temp); } } return(null); }
public void UpdateDialog(Bohater Player, PrzyjaznyNPC Npc) { postac = Player; npc = Npc; PlayerPB.Image = postac.getDialogImage(); NPCPB.Image = npc.getDialogImage(); PlayerName.Text = "Godric"; NPCName.Text = npc.getNazwa(); if (npc.getActiveQuestID() > 0) { for (i = 0; ; i++) { if (npc.Questy.ElementAt(i).getIsActive()) { break; } } if (npc.Questy.ElementAt(i).getDialogOccured() == false) { Reader = new StreamReader(@"Dialogs\Quest" + npc.getActiveQuestID() + npc.Questy.ElementAt(i).getStatus().ToString() + ".txt"); if (!Reader.EndOfStream) { line = Reader.ReadLine(); if (line == npc.getId().ToString()) { line = Reader.ReadLine(); if (line != "PLAYER" && line != "NPC" && line != "NEWQUEST" && line != "UPDATEQUEST" && line != "UPDATEFAKE" && line != "STARTNEWDIALOG") { Player.ChangeQuestDescription(npc.getActiveQuestID(), line); } while (line != "PLAYER" && line != "NPC") { line = Reader.ReadLine(); } if (line == "PLAYER") { textBox1.Text = "Godric" + Environment.NewLine; PlayerIsTalking = true; } else if (line == "NPC") { textBox1.Text = npc.getNazwa() + Environment.NewLine; PlayerIsTalking = false; } line = Reader.ReadLine(); while (line != "PLAYER" && line != "NPC") { if (!Reader.EndOfStream) { if (line == "\n") { textBox1.Text += Environment.NewLine; } else if (line == "NEWQUEST") { bool found = false; foreach (Quest quest in Player.quests) { if (quest.getId() == npc.Questy.ElementAt(i).getId() && quest.getIsActive() == true && quest.getStatus() != QuestStatus.Complited) { found = true; } } if (!found) { for (i = 0; i < npc.Questy.Count; i++) { if (npc.Questy.ElementAt(i).getIsActive()) { break; } } Player.AddQuest(npc.Questy.ElementAt(i).getId()); Player.ChangeQuestIsActive(npc.Questy.ElementAt(i).getId(), true); Player.ChangeQuestStatus(npc.Questy.ElementAt(i).getId(), QuestStatus.Active); questNotification = new QuestNotification(); questNotification.Size = new Size(DesktopBounds.Width / 5, DesktopBounds.Height * 3 / 7); questNotification.DesktopLocation = new Point(DesktopBounds.Width * 2 / 5, DesktopBounds.Height / 16); questNotification.Show(); questNotification.Owner = Owner; this.Focus(); this.Activate(); } } else if (line == "UPDATEQUEST") { bool found = false; foreach (Quest quest in Player.quests) { if (quest.getId() == npc.Questy.ElementAt(i).getId()) { found = true; } } if (found) { Player.UpdateQuestStatus(npc.Questy.ElementAt(i).getId()); //npc.UpdateQuestStatus(npc.Questy.ElementAt(i).getId()); questNotification = new QuestNotification(); questNotification.Size = new Size(DesktopBounds.Width / 5, DesktopBounds.Height * 3 / 7); questNotification.DesktopLocation = new Point(DesktopBounds.Width * 2 / 5, DesktopBounds.Height / 16); questNotification.Show(); questNotification.Owner = Owner; this.Focus(); this.Activate(); } } else if (line == "UPDATEFAKE") { questNotification = new QuestNotification(); questNotification.Size = new Size(DesktopBounds.Width / 5, DesktopBounds.Height * 3 / 7); questNotification.DesktopLocation = new Point(DesktopBounds.Width * 2 / 5, DesktopBounds.Height / 16); questNotification.Show(); questNotification.Owner = Owner; this.Focus(); this.Activate(); } else if (line == "STARTNEWDIALOG") { Dialog dialog = new Dialog(); dialog.Size = new Size(this.Width, this.Height); dialog.DesktopLocation = new Point(0, this.Location.Y); dialog.UpdateDialog(Player, npc); dialog.Show(); dialog.Focus(); this.Close(); } else { textBox1.Text = textBox1.Text + line; } line = Reader.ReadLine(); } else { //npc.Questy.ElementAt(i).setDialogOccured(true); if (line == "NEWQUEST") { bool found = false; foreach (Quest quest in Player.quests) { if (quest.getId() == npc.Questy.ElementAt(i).getId() && quest.getIsActive() == true && quest.getStatus() != QuestStatus.Complited) { found = true; } } if (!found) { for (i = 0; i < npc.Questy.Count; i++) { if (npc.Questy.ElementAt(i).getIsActive()) { break; } } Player.AddQuest(npc.Questy.ElementAt(i).getId()); Player.ChangeQuestIsActive(npc.Questy.ElementAt(i).getId(), true); Player.ChangeQuestStatus(npc.Questy.ElementAt(i).getId(), QuestStatus.Active); questNotification = new QuestNotification(); questNotification.Size = new Size(DesktopBounds.Width / 5, DesktopBounds.Height * 3 / 7); questNotification.DesktopLocation = new Point(DesktopBounds.Width * 2 / 5, DesktopBounds.Height / 16); questNotification.Show(); questNotification.Owner = Owner; this.Focus(); this.Activate(); } } else if (line == "UPDATEQUEST") { bool found = false; foreach (Quest quest in Player.quests) { if (quest.getId() == npc.Questy.ElementAt(i).getId()) { found = true; } } if (found) { Player.UpdateQuestStatus(npc.Questy.ElementAt(i).getId()); //npc.UpdateQuestStatus(npc.Questy.ElementAt(i).getId()); questNotification = new QuestNotification(); questNotification.Size = new Size(DesktopBounds.Width / 5, DesktopBounds.Height * 3 / 7); questNotification.DesktopLocation = new Point(DesktopBounds.Width * 2 / 5, DesktopBounds.Height / 16); questNotification.Show(); questNotification.Owner = Owner; this.Focus(); this.Activate(); } } else if (line == "UPDATEFAKE") { questNotification = new QuestNotification(); questNotification.Size = new Size(DesktopBounds.Width / 5, DesktopBounds.Height * 3 / 7); questNotification.DesktopLocation = new Point(DesktopBounds.Width * 2 / 5, DesktopBounds.Height / 16); questNotification.Show(); questNotification.Owner = Owner; this.Focus(); this.Activate(); } else if (line == "STARTNEWDIALOG") { Dialog dialog = new Dialog(); dialog.Size = new Size(this.Width, this.Height); dialog.DesktopLocation = new Point(0, this.Location.Y); dialog.UpdateDialog(Player, npc); dialog.Show(); } else { textBox1.Text = textBox1.Text + line; } break; } } } else { textBox1.Text = npc.getEndingLine(); } } } else { textBox1.Text = npc.getEndingLine(); } } else { textBox1.Text = npc.getEndingLine(); } }
private void ReadDialog(Bohater Player, PrzyjaznyNPC Npc) { if (textBox1.Text == npc.getEndingLine()) { this.Close(); } else if (!Reader.EndOfStream) { if (line == "PLAYER") { textBox1.Text = "Godric" + Environment.NewLine; PlayerIsTalking = true; line = Reader.ReadLine(); } else if (line == "NPC") { textBox1.Text = npc.getNazwa() + Environment.NewLine; PlayerIsTalking = false; line = Reader.ReadLine(); } while (line != "PLAYER" && line != "NPC") { if (!Reader.EndOfStream) { if (line == "\\n") { textBox1.Text = textBox1.Text + Environment.NewLine; } else if (line == "NEWQUEST") { bool found = false; foreach (Quest quest in Player.quests) { if (quest.getId() == npc.Questy.ElementAt(i).getId()) { found = true; } } if (!found) { Player.AddQuest(npc.Questy.ElementAt(i).getId()); Player.ChangeQuestIsActive(npc.Questy.ElementAt(i).getId(), true); Player.ChangeQuestStatus(npc.Questy.ElementAt(i).getId(), QuestStatus.Active); questNotification = new QuestNotification(); questNotification.Size = new Size(DesktopBounds.Width / 5, DesktopBounds.Height * 3 / 7); questNotification.DesktopLocation = new Point(DesktopBounds.Width * 2 / 5, DesktopBounds.Height / 16); questNotification.Show(); questNotification.Owner = Owner; this.Focus(); this.Activate(); } } else if (line == "UPDATEQUEST") { bool found = false; foreach (Quest quest in Player.quests) { if (quest.getId() == npc.Questy.ElementAt(i).getId()) { found = true; } } if (found) { Player.UpdateQuestStatus(npc.Questy.ElementAt(i).getId()); //npc.UpdateQuestStatus(npc.Questy.ElementAt(i).getId()); questNotification = new QuestNotification(); questNotification.Size = new Size(DesktopBounds.Width / 5, DesktopBounds.Height * 3 / 7); questNotification.DesktopLocation = new Point(DesktopBounds.Width * 2 / 5, DesktopBounds.Height / 16); questNotification.Show(); questNotification.Owner = Owner; this.Focus(); this.Activate(); } } else if (line == "UPDATEFAKE") { questNotification = new QuestNotification(); questNotification.Size = new Size(DesktopBounds.Width / 5, DesktopBounds.Height * 3 / 7); questNotification.DesktopLocation = new Point(DesktopBounds.Width * 2 / 5, DesktopBounds.Height / 16); questNotification.Show(); questNotification.Owner = Owner; this.Focus(); this.Activate(); } else if (line == "STARTNEWDIALOG") { Dialog dialog = new Dialog(); dialog.Size = new Size(this.Width, this.Height); dialog.DesktopLocation = new Point(0, this.Location.Y); dialog.UpdateDialog(Player, npc); dialog.Show(); dialog.Focus(); this.Close(); } else { textBox1.Text = textBox1.Text + line; } line = Reader.ReadLine(); } else { npc.Questy.ElementAt(i).setDialogOccured(true); if (line == "NEWQUEST") { bool found = false; foreach (Quest quest in Player.quests) { if (quest.getId() == npc.Questy.ElementAt(i).getId()) { found = true; } } if (!found) { Player.AddQuest(npc.Questy.ElementAt(i).getId()); Player.ChangeQuestIsActive(npc.Questy.ElementAt(i).getId(), true); Player.ChangeQuestStatus(npc.Questy.ElementAt(i).getId(), QuestStatus.Active); questNotification = new QuestNotification(); questNotification.Size = new Size(DesktopBounds.Width / 5, DesktopBounds.Height * 3 / 7); questNotification.DesktopLocation = new Point(DesktopBounds.Width * 2 / 5, DesktopBounds.Height / 16); questNotification.Show(); questNotification.Owner = Owner; this.Focus(); this.Activate(); } } else if (line == "UPDATEQUEST") { bool found = false; foreach (Quest quest in Player.quests) { if (quest.getId() == npc.Questy.ElementAt(i).getId()) { found = true; } } if (found) { Player.UpdateQuestStatus(npc.Questy.ElementAt(i).getId()); //npc.UpdateQuestStatus(npc.Questy.ElementAt(i).getId()); questNotification = new QuestNotification(); questNotification.Size = new Size(DesktopBounds.Width / 5, DesktopBounds.Height * 3 / 7); questNotification.DesktopLocation = new Point(DesktopBounds.Width * 2 / 5, DesktopBounds.Height / 16); questNotification.Show(); questNotification.Owner = Owner; this.Focus(); this.Activate(); } } else if (line == "UPDATEFAKE") { questNotification = new QuestNotification(); questNotification.Size = new Size(DesktopBounds.Width / 5, DesktopBounds.Height * 3 / 7); questNotification.DesktopLocation = new Point(DesktopBounds.Width * 2 / 5, DesktopBounds.Height / 16); questNotification.Show(); questNotification.Owner = Owner; this.Focus(); this.Activate(); //npc.Questy.ElementAt(i).setDialogOccured(false); } else if (line == "STARTNEWDIALOG") { Dialog dialog = new Dialog(); dialog.Size = new Size(this.Width, this.Height); dialog.DesktopLocation = new Point(0, this.Location.Y); dialog.UpdateDialog(Player, npc); dialog.Show(); } else { textBox1.Text = textBox1.Text + line; } break; } } } else { foreach (Quest _quest in Player.quests) { if (_quest.getId() == Task.questId_Danger) { if (_quest.getStatus() == QuestStatus.Complited) { Ending ending = new Ending(); ending.Size = new Size(DesktopBounds.Width, DesktopBounds.Height); ending.sendForm(Owner); ending.UpdateEnding(true); ending.Show(); ending.Focus(); } } } this.Close(); } }
public void LoadMap(string MapName, int TileWidth, int TileHeight, bool NewMap, List <Przeciwnik> EnemiesList, List <PrzyjaznyNPC> FriendlyList) //Wczytywanie świata { MapTiles.Clear(); //Czyścimy obecny świat if (NewMap) { worldMapItems.Clear(); } EnemiesList.Clear(); FriendlyList.Clear(); StreamReader Reader = new StreamReader(@"MapTileData\1_maptiles" + MapName + ".txt"); //Wczytywanie danych z pliku o podanej ścieżce int x = 0; int y = 0; int enemycount = 0; int friendlycount = 0; while (!Reader.EndOfStream) //Wykonuj aż do końca pliku { string line = Reader.ReadLine(); //Wczytaj linię for (int z = 0; z < line.Length; z += 4) { Tile T = new Tile(); //Tworzymy obiekt T.TileLoc = new Point(x * TileWidth, y * TileHeight); //Ustalamy położenie obiektu (bierzemy pod uwagę jego rozmiar) if (line[z].ToString() == "t") // Przechodzenie pomiędzy światami { T.TileImage = new Bitmap(Gra.Properties.Resources.Empty, TileWidth, TileHeight); T.isWalkable = true; //Ustalamy czy można się po nim poruszać T.isInteractive = false; //Sprawdzamy czy jest interaktywny T.isMapLoader = true; //Sprawdzamy czy wczytuje świat T.SwitchState = false; //Sprawdzamy czy przycisko został przełączony T.isShop = false; T.isNPC = false; } else if (line[z].ToString() == "s") // dostęp do sklepu { T.TileImage = new Bitmap(Gra.Properties.Resources.shop, TileWidth * 3, TileHeight * 2); T.isWalkable = false; T.isInteractive = true; T.isMapLoader = false; T.SwitchState = false; T.isShop = true; T.isNPC = false; } else if (line[z].ToString() == "S") // dostęp do sklepu { T.TileImage = new Bitmap(Gra.Properties.Resources.Empty, TileWidth, TileHeight); T.isWalkable = false; T.isInteractive = true; T.isMapLoader = false; T.SwitchState = false; T.isShop = true; T.isNPC = false; } else if (line[z].ToString() == "0") //Zablokowana przestrzeń { T.TileImage = new Bitmap(Gra.Properties.Resources.Empty, TileWidth, TileHeight); T.isWalkable = false; T.isInteractive = false; T.isMapLoader = false; T.SwitchState = false; T.isShop = false; T.isNPC = false; } else if (line[z].ToString() == "1") //Domyślna, możliwa do chodzenia przestrzeć { T.TileImage = new Bitmap(Gra.Properties.Resources.Empty, TileWidth, TileHeight); T.isWalkable = true; T.isInteractive = false; T.isMapLoader = false; T.SwitchState = false; T.isShop = false; T.isNPC = false; } else if (line[z].ToString() == "2") //Przedmiot { T.TileImage = new Bitmap(Gra.Properties.Resources.Empty, TileWidth, TileHeight); T.isWalkable = false; T.isInteractive = true; T.isMapLoader = false; T.SwitchState = false; T.isShop = false; T.isNPC = false; if (line[z + 1].ToString() == "0") // potions { if (line[z + 2].ToString() == "0") { worldMapItems.Add(new WorldMapItem(new Point(x * TileWidth, y * TileHeight), new Bitmap(Gra.Properties.Resources.WaterTile), Item.ItemsById(1))); item = worldMapItems.Find(c => c.GetLocation() == new Point(x * TileWidth, y * TileHeight)); T.TileImage = new Bitmap(Gra.Properties.Resources.healthpotion_1, TileWidth, TileHeight); } else if (line[z + 2].ToString() == "1") { worldMapItems.Add(new WorldMapItem(new Point(x * TileWidth, y * TileHeight), new Bitmap(Gra.Properties.Resources.GrassTile), Item.ItemsById(2))); item = worldMapItems.Find(c => c.GetLocation() == new Point(x * TileWidth, y * TileHeight)); T.TileImage = new Bitmap(Gra.Properties.Resources.healthpotion_1, TileWidth, TileHeight); } else if (line[z + 2].ToString() == "2") { worldMapItems.Add(new WorldMapItem(new Point(x * TileWidth, y * TileHeight), new Bitmap(Gra.Properties.Resources.WaterTile), Item.ItemsById(3))); item = worldMapItems.Find(c => c.GetLocation() == new Point(x * TileWidth, y * TileHeight)); T.TileImage = new Bitmap(Gra.Properties.Resources.manapotion_1, TileWidth, TileHeight); } else if (line[z + 2].ToString() == "3") { worldMapItems.Add(new WorldMapItem(new Point(x * TileWidth, y * TileHeight), new Bitmap(Gra.Properties.Resources.WaterTile), Item.ItemsById(4))); item = worldMapItems.Find(c => c.GetLocation() == new Point(x * TileWidth, y * TileHeight)); T.TileImage = new Bitmap(Gra.Properties.Resources.manapotion_1, TileWidth, TileHeight); } } else if (line[z + 1].ToString() == "1") // weapons { if (line[z + 2].ToString() == "0") { worldMapItems.Add(new WorldMapItem(new Point(x * TileWidth, y * TileHeight), new Bitmap(Gra.Properties.Resources.WaterTile), Item.ItemsById(6))); item = worldMapItems.Find(c => c.GetLocation() == new Point(x * TileWidth, y * TileHeight)); T.TileImage = new Bitmap(Gra.Properties.Resources.sword_1, TileWidth, TileHeight); } else if (line[z + 2].ToString() == "1") { worldMapItems.Add(new WorldMapItem(new Point(x * TileWidth, y * TileHeight), new Bitmap(Gra.Properties.Resources.WaterTile), Item.ItemsById(7))); item = worldMapItems.Find(c => c.GetLocation() == new Point(x * TileWidth, y * TileHeight)); T.TileImage = new Bitmap(Gra.Properties.Resources.sword_2, TileWidth, TileHeight); } } else if (line[z + 1].ToString() == "2") // armors { if (line[z + 2].ToString() == "0") { worldMapItems.Add(new WorldMapItem(new Point(x * TileWidth, y * TileHeight), new Bitmap(Gra.Properties.Resources.WaterTile), Item.ItemsById(8))); item = worldMapItems.Find(c => c.GetLocation() == new Point(x * TileWidth, y * TileHeight)); T.TileImage = new Bitmap(Gra.Properties.Resources.armor_1, TileWidth, TileHeight); } } else if (line[z + 1].ToString() == "3") // gold { worldMapItems.Add(new WorldMapItem(new Point(x * TileWidth, y * TileHeight), new Bitmap(Gra.Properties.Resources.WaterTile), Item.ItemsById(0))); item = worldMapItems.Find(c => c.GetLocation() == new Point(x * TileWidth, y * TileHeight)); T.TileImage = new Bitmap(Gra.Properties.Resources.zloto, TileWidth * 2 / 3, TileHeight * 2 / 3); } } else if (line[z].ToString() == "3") //NPC { T.TileImage = new Bitmap(Gra.Properties.Resources.Empty, TileWidth, TileHeight); T.isWalkable = false; T.isInteractive = false; T.isMapLoader = false; T.SwitchState = false; T.isShop = false; T.isNPC = true; if (line[z + 1].ToString() == "0") //Wrogi { if (line[z + 2].ToString() == "0") { EnemiesList.Add(new Przeciwnik(NPC.EnemyById(NPC.enemyId_nietoperz).getNazwa(), NPC.EnemyById(NPC.enemyId_nietoperz).getId(), NPC.EnemyById(NPC.enemyId_nietoperz).GetObrazenia(), NPC.EnemyById(NPC.enemyId_nietoperz).getNagrodaExp(), NPC.EnemyById(NPC.enemyId_nietoperz).getNagrodaGold(), NPC.EnemyById(NPC.enemyId_nietoperz).GetBaseHP(), NPC.EnemyById(NPC.enemyId_nietoperz).GetBaseMP(), new Point(x * TileWidth, y * TileHeight), Gra.Properties.Resources.babybat, Gra.Properties.Resources.babybat_battleimage)); foreach (Atak atak in NPC.EnemyById(NPC.enemyId_nietoperz).SpecjalneAtaki) { EnemiesList.ElementAt(enemycount).PoznajAtak(atak.GetId()); } foreach (Przedmiot item in NPC.EnemyById(NPC.enemyId_nietoperz).Ekwipunek) { EnemiesList.ElementAt(enemycount).DodajPrzedmiot(item.getId()); } //EnemiesList.Add(NPC.przeciwnik.ElementAt(NPC.enemyId_nietoperz - 1)); //EnemiesList.ElementAt(enemycount).SetCharacterSprite(new Point(x * TileWidth, y * TileHeight), NPC.przeciwnik.ElementAt(NPC.enemyId_nietoperz - 1).getObrazekPostaci()); enemycount++; } else if (line[z + 2].ToString() == "1") { EnemiesList.Add(new Przeciwnik(NPC.EnemyById(NPC.enemyId_ogromnyszczur).getNazwa(), NPC.EnemyById(NPC.enemyId_ogromnyszczur).getId(), NPC.EnemyById(NPC.enemyId_ogromnyszczur).GetObrazenia(), NPC.EnemyById(NPC.enemyId_ogromnyszczur).getNagrodaExp(), NPC.EnemyById(NPC.enemyId_ogromnyszczur).getNagrodaGold(), NPC.EnemyById(NPC.enemyId_ogromnyszczur).GetBaseHP(), NPC.EnemyById(NPC.enemyId_ogromnyszczur).GetBaseMP(), new Point(x * TileWidth, y * TileHeight), Gra.Properties.Resources.Empty, Gra.Properties.Resources.Empty)); foreach (Atak atak in NPC.EnemyById(NPC.enemyId_ogromnyszczur).SpecjalneAtaki) { EnemiesList.ElementAt(enemycount).PoznajAtak(atak.GetId()); } foreach (Przedmiot item in NPC.EnemyById(NPC.enemyId_ogromnyszczur).Ekwipunek) { EnemiesList.ElementAt(enemycount).DodajPrzedmiot(item.getId()); } //EnemiesList.Add(NPC.przeciwnik.ElementAt(NPC.enemyId_ogromnyszczur - 1)); //EnemiesList.ElementAt(enemycount).SetCharacterSprite(new Point(x * TileWidth, y * TileHeight), NPC.przeciwnik.ElementAt(NPC.enemyId_ogromnyszczur - 1).getObrazekPostaci()); enemycount++; } else if (line[z + 2].ToString() == "2") { EnemiesList.Add(new Przeciwnik(NPC.EnemyById(NPC.enemyId_wilk).getNazwa(), NPC.EnemyById(NPC.enemyId_wilk).getId(), NPC.EnemyById(NPC.enemyId_wilk).GetObrazenia(), NPC.EnemyById(NPC.enemyId_wilk).getNagrodaExp(), NPC.EnemyById(NPC.enemyId_wilk).getNagrodaGold(), NPC.EnemyById(NPC.enemyId_wilk).GetBaseHP(), NPC.EnemyById(NPC.enemyId_wilk).GetBaseMP(), new Point(x * TileWidth, y * TileHeight), Gra.Properties.Resources.Wolf, Gra.Properties.Resources.Wolf_battleimage)); foreach (Atak atak in NPC.EnemyById(NPC.enemyId_wilk).SpecjalneAtaki) { EnemiesList.ElementAt(enemycount).PoznajAtak(atak.GetId()); } foreach (Przedmiot item in NPC.EnemyById(NPC.enemyId_wilk).Ekwipunek) { EnemiesList.ElementAt(enemycount).DodajPrzedmiot(item.getId()); } //EnemiesList.Add(NPC.przeciwnik.ElementAt(NPC.enemyId_wilk - 1)); //EnemiesList.ElementAt(enemycount).SetCharacterSprite(new Point(x * TileWidth, y * TileHeight), NPC.przeciwnik.ElementAt(NPC.enemyId_wilk - 1).getObrazekPostaci()); enemycount++; } else if (line[z + 2].ToString() == "3") { EnemiesList.Add(new Przeciwnik(NPC.EnemyById(NPC.enemyId_szkielet).getNazwa(), NPC.EnemyById(NPC.enemyId_szkielet).getId(), NPC.EnemyById(NPC.enemyId_szkielet).GetObrazenia(), NPC.EnemyById(NPC.enemyId_szkielet).getNagrodaExp(), NPC.EnemyById(NPC.enemyId_szkielet).getNagrodaGold(), NPC.EnemyById(NPC.enemyId_szkielet).GetBaseHP(), NPC.EnemyById(NPC.enemyId_szkielet).GetBaseMP(), new Point(x * TileWidth, y * TileHeight), Gra.Properties.Resources.Empty, Gra.Properties.Resources.Empty)); foreach (Atak atak in NPC.EnemyById(NPC.enemyId_szkielet).SpecjalneAtaki) { EnemiesList.ElementAt(enemycount).PoznajAtak(atak.GetId()); } foreach (Przedmiot item in NPC.EnemyById(NPC.enemyId_szkielet).Ekwipunek) { EnemiesList.ElementAt(enemycount).DodajPrzedmiot(item.getId()); } //EnemiesList.Add(NPC.przeciwnik.ElementAt(NPC.enemyId_szkielet - 1)); //EnemiesList.ElementAt(enemycount).SetCharacterSprite(new Point(x * TileWidth, y * TileHeight), NPC.przeciwnik.ElementAt(NPC.enemyId_szkielet - 1).getObrazekPostaci()); enemycount++; } else if (line[z + 2].ToString() == "4") { EnemiesList.Add(new Przeciwnik(NPC.EnemyById(NPC.enemyId_szkielet_czarownik).getNazwa(), NPC.EnemyById(NPC.enemyId_szkielet_czarownik).getId(), NPC.EnemyById(NPC.enemyId_szkielet_czarownik).GetObrazenia(), NPC.EnemyById(NPC.enemyId_szkielet_czarownik).getNagrodaExp(), NPC.EnemyById(NPC.enemyId_szkielet_czarownik).getNagrodaGold(), NPC.EnemyById(NPC.enemyId_szkielet_czarownik).GetBaseHP(), NPC.EnemyById(NPC.enemyId_szkielet_czarownik).GetBaseMP(), new Point(x * TileWidth, y * TileHeight), Gra.Properties.Resources.Empty, Gra.Properties.Resources.Empty)); foreach (Atak atak in NPC.EnemyById(NPC.enemyId_szkielet_czarownik).SpecjalneAtaki) { EnemiesList.ElementAt(enemycount).PoznajAtak(atak.GetId()); } foreach (Przedmiot item in NPC.EnemyById(NPC.enemyId_szkielet_czarownik).Ekwipunek) { EnemiesList.ElementAt(enemycount).DodajPrzedmiot(item.getId()); } //EnemiesList.Add(NPC.przeciwnik.ElementAt(NPC.enemyId_szkielet_czarownik - 1)); //EnemiesList.ElementAt(enemycount).SetCharacterSprite(new Point(x * TileWidth, y * TileHeight), NPC.przeciwnik.ElementAt(NPC.enemyId_szkielet_czarownik - 1).getObrazekPostaci()); enemycount++; } else if (line[z + 2].ToString() == "5") { EnemiesList.Add(new Przeciwnik(NPC.EnemyById(NPC.enemyId_minotaur).getNazwa(), NPC.EnemyById(NPC.enemyId_minotaur).getId(), NPC.EnemyById(NPC.enemyId_minotaur).GetObrazenia(), NPC.EnemyById(NPC.enemyId_minotaur).getNagrodaExp(), NPC.EnemyById(NPC.enemyId_minotaur).getNagrodaGold(), NPC.EnemyById(NPC.enemyId_minotaur).GetBaseHP(), NPC.EnemyById(NPC.enemyId_minotaur).GetBaseMP(), new Point(x * TileWidth, y * TileHeight), Gra.Properties.Resources.Minotaur, Gra.Properties.Resources.Minotaur_battleimage)); foreach (Atak atak in NPC.EnemyById(NPC.enemyId_minotaur).SpecjalneAtaki) { EnemiesList.ElementAt(enemycount).PoznajAtak(atak.GetId()); } foreach (Przedmiot item in NPC.EnemyById(NPC.enemyId_minotaur).Ekwipunek) { EnemiesList.ElementAt(enemycount).DodajPrzedmiot(item.getId()); } //EnemiesList.Add(NPC.przeciwnik.ElementAt(NPC.enemyId_minotaur - 1)); //EnemiesList.ElementAt(enemycount).SetCharacterSprite(new Point(x * TileWidth, y * TileHeight), NPC.przeciwnik.ElementAt(NPC.enemyId_minotaur - 1).getObrazekPostaci()); enemycount++; } } else if (line[z + 1].ToString() == "1") //Przyjazny { if (line[z + 2].ToString() == "0") { FriendlyList.Add(NPC.przyjazny.ElementAt(NPC.friendlyId_Vincent - 1)); FriendlyList.ElementAt(friendlycount).SetCharacterSprite(new Point(x * TileWidth, y * TileHeight), NPC.przyjazny.ElementAt(NPC.friendlyId_Vincent - 1).getObrazekPostaci()); friendlycount++; } else if (line[z + 2].ToString() == "1") { FriendlyList.Add(NPC.przyjazny.ElementAt(NPC.friendlyId_King - 1)); FriendlyList.ElementAt(friendlycount).SetCharacterSprite(new Point(x * TileWidth, y * TileHeight), NPC.przyjazny.ElementAt(NPC.friendlyId_King - 1).getObrazekPostaci()); friendlycount++; } else if (line[z + 2].ToString() == "2") { FriendlyList.Add(NPC.przyjazny.ElementAt(NPC.friendlyId_Peasant - 1)); FriendlyList.ElementAt(friendlycount).SetCharacterSprite(new Point(x * TileWidth, y * TileHeight), NPC.przyjazny.ElementAt(NPC.friendlyId_Peasant - 1).getObrazekPostaci()); friendlycount++; } else if (line[z + 2].ToString() == "3") { FriendlyList.Add(NPC.przyjazny.ElementAt(NPC.friendlyId_Sorceress - 1)); FriendlyList.ElementAt(friendlycount).SetCharacterSprite(new Point(x * TileWidth, y * TileHeight), NPC.przyjazny.ElementAt(NPC.friendlyId_Sorceress - 1).getObrazekPostaci()); friendlycount++; } else if (line[z + 2].ToString() == "4") { PrzyjaznyNPC friendly = new PrzyjaznyNPC(999, "Rycerz", Gra.Properties.Resources.npc_knight_2, Gra.Properties.Resources.Empty, "Za króla!"); FriendlyList.Add(friendly); FriendlyList.ElementAt(friendlycount).SetCharacterSprite(new Point(x * TileWidth, y * TileHeight), friendly.getObrazekPostaci()); friendlycount++; } else if (line[z + 2].ToString() == "5") { PrzyjaznyNPC friendly = new PrzyjaznyNPC(999, "Rycerz", Gra.Properties.Resources.npc_knight_3, Gra.Properties.Resources.Empty, "Za króla!"); FriendlyList.Add(friendly); FriendlyList.ElementAt(friendlycount).SetCharacterSprite(new Point(x * TileWidth, y * TileHeight), friendly.getObrazekPostaci()); friendlycount++; } else if (line[z + 2].ToString() == "6") { PrzyjaznyNPC friendly = new PrzyjaznyNPC(999, "Rycerz", Gra.Properties.Resources.npc_knight_4, Gra.Properties.Resources.Empty, "Za cezara! Znaczy... Uhm... Za króla!"); FriendlyList.Add(friendly); FriendlyList.ElementAt(friendlycount).SetCharacterSprite(new Point(x * TileWidth, y * TileHeight), friendly.getObrazekPostaci()); friendlycount++; } else if (line[z + 2].ToString() == "7") { PrzyjaznyNPC friendly = new PrzyjaznyNPC(999, "Rycerz", Gra.Properties.Resources.npc_knight_5, Gra.Properties.Resources.Empty, "Za króla!"); FriendlyList.Add(friendly); FriendlyList.ElementAt(friendlycount).SetCharacterSprite(new Point(x * TileWidth, y * TileHeight), friendly.getObrazekPostaci()); friendlycount++; } else if (line[z + 2].ToString() == "8") { PrzyjaznyNPC friendly = new PrzyjaznyNPC(999, "Chłop", Gra.Properties.Resources.npc_peasant_2, Gra.Properties.Resources.Empty, "Chłop potęgą jest i basta."); FriendlyList.Add(friendly); FriendlyList.ElementAt(friendlycount).SetCharacterSprite(new Point(x * TileWidth, y * TileHeight), friendly.getObrazekPostaci()); friendlycount++; } else if (line[z + 2].ToString() == "9") { PrzyjaznyNPC friendly = new PrzyjaznyNPC(999, "Chłop", Gra.Properties.Resources.npc_peasant_3, Gra.Properties.Resources.Empty, "Cóż tam, panie w polityce? Magowi trzymają się mocno!?"); FriendlyList.Add(friendly); FriendlyList.ElementAt(friendlycount).SetCharacterSprite(new Point(x * TileWidth, y * TileHeight), friendly.getObrazekPostaci()); friendlycount++; } else if (line[z + 2].ToString() == "a") { PrzyjaznyNPC friendly = new PrzyjaznyNPC(999, "Chłop", Gra.Properties.Resources.npc_peasant_4, Gra.Properties.Resources.Empty, "Kiedyś to było..."); FriendlyList.Add(friendly); FriendlyList.ElementAt(friendlycount).SetCharacterSprite(new Point(x * TileWidth, y * TileHeight), friendly.getObrazekPostaci()); friendlycount++; } } } MapTiles.Add(T); //Dodajemy dany obiekt mapy do listy x++; } x = 0; y++; } Reader.Close(); //Kończymy czytanie pliku }