public Save() { Map world = new Map(5, 30); int resultat = 0; Boss Vador = new Vador(); string name; bool indice; string type_heros; String path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); using (StreamReader sr = new StreamReader(path + @"\load_heros.txt")) { int count = 0; string l1; sr.ReadLine(); string[] tab = new string[4]; while ((l1 = sr.ReadLine()) != null) { tab[count] = l1; count++; } name = tab[0]; indice = bool.Parse(tab[2]); type_heros = tab[1]; } if (type_heros == "jedi") { heros = new jedi(name); } else if (type_heros == "wookie") { heros = new wookie(name); } else if (type_heros == "contrebandier") { heros = new contrebandier(name); } else { Console.WriteLine("Erreur aucun heros"); } heros.loadSave(); while ((resultat == 0)) { world.affMap(heros); heros.Deplacement(world); if (world.Plateau[heros.x, heros.y].Type == Case.Lieu.Indice) { if (indice == false) { indice = heros.Indice(); } else { Console.WriteLine("Vous avez déjà obtenu l'indice"); } } if (world.Plateau[heros.x, heros.y].Type == Case.Lieu.Planet) { Boss storm = new Stormtrooper(heros); int storm_result = heros.Combat_storm(storm); if (storm_result == 2) { heros.x = 1; heros.y = 1; Console.WriteLine("Vous avez perdu contre un stormtrooper... Retour au spawn.Vous perdez 100 euros \n Continuer ->"); Console.ReadLine(); Console.Clear(); } else if (storm_result == 1) { Console.WriteLine("Vous avez gagné !"); Console.WriteLine("Il va falloir que J'avertisse Maitre Vador de la force de ce petit gamin... \n Continuer ->"); Console.ReadLine(); Console.Clear(); } } if (world.Plateau[heros.x, heros.y].Type == Case.Lieu.Spawn) { Console.Clear(); Console.WriteLine(@" /~\ |oo ) _\=/_ ___ / _ \ / ()\ //|/.\|\\ _|_____|_ \\ \_/ || | | === | | \|\ /| || |_| O |_| # _ _/ # || O || | | | ||__*__|| | | | |~ \___/ ~| []|[] /=\ /=\ /=\ | | | ________________[_]_[_]_[_]________/_]_[_\_________________________ "); Console.Write("Vous etes sur la planete des revolutionnaires, vous recupèrez vos pv"); heros.hp = heros.hp_base * (heros.lvl + 1); Thread.Sleep(1500); } if (world.Plateau[heros.x, heros.y].Type == Case.Lieu.Boss) { if (indice == false) { Console.WriteLine(@" . __---__ . . .-'...:...'-. . . / . . : .__ .\ . /........./ \ .\ . . . / : : :| () | :\ . . :...........\__/....: . . |___________________| . . |...................| . . : : : : : : : . . \................./ . . \ . . : . . / . . . . \._........._./ . . . -..___..- . . Vous ne pouvez pas entrer dans l'étoile de la mort sans indices ! Continuer -> "); Console.ReadLine(); } else { resultat = heros.Combat(Vador); } } if (world.Plateau[heros.x, heros.y].Type == Case.Lieu.Shop) { Shop shop = new Shop(heros); shop.affShop(); } Console.Clear(); //world.affMap(heros); } if (resultat == 1) { Console.Clear(); Console.WriteLine(@" _.-'~~~~~~`-._ / || \ / || \ | || | | _______||_______ | |/ ----- \/ ----- \| / ( ) ( ) \ / \ ----- () ----- / \ / \ /||\ / \ / \ /||||\ / \ / \ /||||||\ / \ /_ \o========o/ _\ `--...__|`-._ _.-'|__...--' | `' | "); Console.Write(heros.name + " je suis ton Pere ...."); Thread.Sleep(2500); Console.Clear(); Console.WriteLine(@" _______ .__ __. _______ | ____|| \ | | | \ | |__ | \| | | .--. | | __| | . ` | | | | | | |____ | |\ | | '--' | |_______||__| \__| |_______/ "); Console.ReadLine(); } else { Console.WriteLine(@" .______ _______ .______ _______ __ __ | _ \ | ____|| _ \ | \ | | | | | |_) | | |__ | |_) | | .--. || | | | | ___/ | __| | / | | | || | | | | | | |____ | |\ \----.| '--' || `--' | | _| |_______|| _| `._____||_______/ \______/ "); } }
public Game() { Introduction(); Map world = new Map(5, 30); Boolean indice = false; Console.WriteLine("Nom du joueur ?"); string name = Console.ReadLine(); int resultat = 0; Console.Clear(); Console.ForegroundColor = ConsoleColor.DarkGray; Console.WriteLine(@" | ,.------;:~~:-. | 1- Un wookie | /:.\`;;|||;:/;;:\ | Avantage: |:')\`:\||::/.-_':/) | +Def/hp |`:`\\\ ;'||'.''/,.:\ | |==`;.:`|;::/'/./';;= | |:-/-%%% | |%%%;;_- _: | |=// %wm)..(mw%`_ :`:\ | |;;--', /88\ -,- :-~~| | |-;~~::'`~^~:`::`/`-=:) | |(;':)%%%' `%%%.`:``:)\ | |(\ %%%/dV##Vb`%%%%:`-. | | |);/( ;~~~~ :)\`;;.``\| | //\'/,/|;;|:(: |.|\;|\| |/) |(/ | / \|\\`( )- ` | |;):):)/.):|/) (`:`\\`-`| |;%/ //;/(\`.':| ::`\\;`| |;/~( \|./;)|.|):;\. \\-| |/',:\//) ||`.|| (:\)):%| |,|/;/(%;.||| (|(\:- ; :| |_%__%:__;_:`_;_:_.\%_`_| Continuer -> "); Console.ReadLine(); Console.Clear(); Console.WriteLine(@" | .x%%%%%%x. | 2 - Un contrebandier | ,%%%%%%%%%%% | Avangtage : | ,%%%' )' \% | * Gagne 4 fois plus d'argent par combat | ,%x%) __ _ Y | + money | :%%% ~=-. <=~| | | :%%::. .:,\ | | | `;%:`\. `-' .' | | ``x`. -===-; | | / `:`.__.; | | .d8b. :: ..`. | | d88888b. ' /8 | |d888888888b. ( 8b /| |~ ~`888888b `8b /:| | ' ' `888888 `8. _ /:/| |' )88888b 8b |):X | | ~ - |888888 `8b/:/:\| | |888888 88\/~~;| | (888888b 88| / | |\ \888888 8-: /| |_\_______\88888_.'___\__/| Continuer -> "); Console.ReadLine(); Console.Clear(); Console.WriteLine(@" | ....... LS| 3 - Un Jedi | ::::::;;::. | Avantage : | .::;::::;::::. | * Attaque deux fois par combat | .:::::::::::::: | * + Atk/Speed | ::`_```_```;:::. | | ::=-) :=-` :::: | | `::| / : `::: | | '| `~' ;::: | | :-:==-. / :' | | `. _ .'.d8: | | _. |88bood88888._ | |~ `-+8888888888P `-. _| |-' ~~^^^^~~ `./8 ~ | |8b / / | \ \ `8 | |P ` 8 | | 8b | | `8 | | 8b | | . `8 | |________/_\___________8_| Continuer -> "); ; Console.ReadLine(); Console.Clear(); Console.WriteLine("\n Quel héros souhaites-tu incarner? \n 1- Un wookie \n 2- Un contrebandier \n 3- Un Jedi"); int heros_want = Program.AskChoice(1, 3); Console.Clear(); Console.WriteLine(@" _ _ /_| |_\ //|| ||\\ // || || \\ // ||___|| \\ / | | \ _ / __| |__ \ /_\ / .--~ | | ~--. \| | /.~ __\ | | / ~.| | .~ `=='\ | | / _.-'. | / / \| |/ .-~ _.-' | +---+ \ _.-~ | `=----.____/ # \____.----=' [::::::::| (_) |::::::::] .=----~~~~~\ /~~~~~----=. | /`---'\ | \ \ / \ / / `. / \ .' `. /._________.\ .' `--._________.--' Vous embarquez dans le faucon millenium direction l'etoile de la mort ... Continuer -> "); Console.ReadLine(); Console.ForegroundColor = ConsoleColor.White; Console.Clear(); switch (heros_want) { case 1: heros = new wookie(name); break; case 2: heros = new contrebandier(name); break; case 3: heros = new jedi(name); break; } Boss Vador = new Vador(); //world.affMap(heros); while ((resultat == 0)) { world.affMap(heros); heros.Deplacement(world); if (world.Plateau[heros.x, heros.y].Type == Case.Lieu.Indice) { if (indice == false) { indice = heros.Indice(); } else { Console.WriteLine("Vous avez déjà obtenu l'indice"); } } if (world.Plateau[heros.x, heros.y].Type == Case.Lieu.Planet) { Boss storm = new Stormtrooper(heros); int storm_result = heros.Combat_storm(storm); if (storm_result == 2) { heros.x = 1; heros.y = 1; Console.WriteLine("Vous avez perdu contre un stormtrooper... Retour au spawn.Vous perdez 100 euros \n Continuer ->"); Console.ReadLine(); Console.Clear(); } else if (storm_result == 1) { Console.WriteLine("Vous avez gagné !"); Console.WriteLine("Il va falloir que J'avertisse Maitre Vador de la force de ce petit gamin... \n Continuer ->"); Console.ReadLine(); Console.Clear(); } } if (world.Plateau[heros.x, heros.y].Type == Case.Lieu.Spawn) { Console.Clear(); Console.WriteLine(@" /~\ |oo ) _\=/_ ___ / _ \ / ()\ //|/.\|\\ _|_____|_ \\ \_/ || | | === | | \|\ /| || |_| O |_| # _ _/ # || O || | | | ||__*__|| | | | |~ \___/ ~| []|[] /=\ /=\ /=\ | | | ________________[_]_[_]_[_]________/_]_[_\_________________________ "); Console.Write("Vous etes sur la planete des revolutionnaires, vous recupèrez vos pv"); heros.hp = heros.hp_base * (heros.lvl + 1); Thread.Sleep(1500); } if (world.Plateau[heros.x, heros.y].Type == Case.Lieu.Boss) { if (indice == false) { Console.WriteLine(@" . __---__ . . .-'...:...'-. . . / . . : .__ .\ . /........./ \ .\ . . . / : : :| () | :\ . . :...........\__/....: . . |___________________| . . |...................| . . : : : : : : : . . \................./ . . \ . . : . . / . . . . \._........._./ . . . -..___..- . . Vous ne pouvez pas entrer dans l'étoile de la mort sans indices ! Continuer -> "); Console.ReadLine(); } else { resultat = heros.Combat(Vador); } } if (world.Plateau[heros.x, heros.y].Type == Case.Lieu.Shop) { Shop shop = new Shop(heros); shop.affShop(); } Console.Clear(); //world.affMap(heros); } if (resultat == 1) { Console.Clear(); Console.WriteLine(@" _.-'~~~~~~`-._ / || \ / || \ | || | | _______||_______ | |/ ----- \/ ----- \| / ( ) ( ) \ / \ ----- () ----- / \ / \ /||\ / \ / \ /||||\ / \ / \ /||||||\ / \ /_ \o========o/ _\ `--...__|`-._ _.-'|__...--' | `' | "); Console.Write(heros.name + " je suis ton Pere ...."); Thread.Sleep(2500); Console.Clear(); Console.WriteLine(@" _______ .__ __. _______ | ____|| \ | | | \ | |__ | \| | | .--. | | __| | . ` | | | | | | |____ | |\ | | '--' | |_______||__| \__| |_______/ "); Console.ReadLine(); } else { Console.WriteLine(@" .______ _______ .______ _______ __ __ | _ \ | ____|| _ \ | \ | | | | | |_) | | |__ | |_) | | .--. || | | | | ___/ | __| | / | | | || | | | | | | |____ | |\ \----.| '--' || `--' | | _| |_______|| _| `._____||_______/ \______/ "); } }
public void Deplacement(Map map) { int dep = 5; Boss vador = new Vador(); if ((x >= 1) && (x < 4) && (y >= 1) && (y < 29)) { Console.WriteLine("\n Vous souhaitez aller : \n 0-Nord \n 1-Sud \n 2-Est \n 3-Ouest \n 4-Inventaire \n 5-Information \n 6-Save"); dep = Program.AskChoice(0, 6); } if ((x == 0) && (x < 4) && (y > 0) && (y < 29)) { Console.WriteLine("\n Vous souhaitez aller : \n 1-Sud \n 2-Est \n 3-Ouest \n 4-Inventaire \n 5-Information \n 6-Save"); dep = Program.AskChoice(1, 6); } if ((x > 0) && (x == 4) && (y > 0) && (y < 29)) { Console.WriteLine("\n Vous souhaitez aller : \n 0-Nord \n 2-Est \n 3-Ouest \n 4-Inventaire \n 5-Information \n 6-Save"); do { dep = Program.AskChoice(0, 6); } while (dep == 1); } if ((x > 0) && (x < 4) && (y == 0) && (y < 29)) { Console.WriteLine("\n Vous souhaitez aller : \n 0-Nord \n 1-Sud \n 2-Est \n 4-Inventaire \n 5-Information \n 6-Save"); do { dep = Program.AskChoice(0, 6); } while (dep == 3); } if ((x > 0) && (x < 4) && (y > 0) && (y == 29)) { Console.WriteLine("\n Vous souhaitez aller : \n 0-Nord \n 1-Sud \n 3-Ouest \n 4-Inventaire \n 5-Information \n 6-Save"); do { dep = Program.AskChoice(0, 6); } while (dep == 2); } if ((x == 0) && (x < 4) && (y == 0) && (y < 29)) { Console.WriteLine("\n Vous souhaitez aller : \n 1-Sud \n 2-Est \n 4-Inventaire \n 5-Information \n 6-Save"); do { dep = Program.AskChoice(0, 6); } while ((dep == 0) || (dep == 3)); } if ((x == 0) && (x < 4) && (y > 0) && (y == 29)) { Console.WriteLine("\n Vous souhaitez aller : \n 1-Sud \n 3-Ouest \n 4-Inventaire \n 5-Information \n 6-Save"); do { dep = Program.AskChoice(0, 6); } while ((dep == 0) || (dep == 2)); } if ((x > 0) && (x == 4) && (y > 0) && (y == 29)) { Console.WriteLine("\n Vous souhaitez aller : \n 0-Nord \n 3-Ouest \n 4-Inventaire \n 5-Information \n 6-Save"); do { dep = Program.AskChoice(0, 6); } while ((dep == 1) || (dep == 2)); } if ((x > 0) && (x == 4) && (y == 0) && (y < 29)) { Console.WriteLine("\n Vous souhaitez aller : \n 0-Nord \n 2-Est \n 4-Inventaire \n 5-Information \n 6-Save"); do { dep = Program.AskChoice(0, 6); } while ((dep == 1) || (dep == 3)); } switch (dep) { case 0: x = x - 1; symbole = "˄"; break; case 1: x = x + 1; symbole = "˅"; break; case 2: y = y + 1; symbole = "˃"; break; case 3: y = y - 1; symbole = "˂"; break; case 4: inv.affInventaire(); inv.triInventaire(); int j = Program.AskChoice(0, inv.item.Count + 1); if (j < inv.item.Count) { Console.WriteLine("Voulez-vous vous équiper de " + inv.item[j].name + "\n 1- Oui \n 2- Non"); int use = Program.AskChoice(1, 2); if (use == 1) { equip.addEquip(inv.item[j]); atk = (atk_base * (lvl + 1)) + equip.equipement[1].value; def = (def_base * (lvl + 1)) + equip.equipement[0].value; speed = (speed_base * (lvl + 1)) + equip.equipement[2].value; } } break; case 5: Console.Clear(); information(); Console.WriteLine(@" Continuer ->"); Console.ReadLine(); Console.Clear(); break; case 6: save(); break; } }