/// <summary> /// Initializes a new instance of the <see cref="Game.Equipment"/> class. /// </summary> /// <param name='name'> /// Name. /// </param> /// <param name='ch'> /// Ch. /// </param> /// <param name='lst'> /// Lst. /// </param> public Equipment(string name, Characteristics ch, Array lst) : base(name) { this.CanBeEquiped = true; this.Characteristics = ch; this.Body = new Body(lst); }
/// <summary> /// Initializes a new instance of the <see cref="Game.Being"/> class. /// </summary> /// <param name='name'> /// Name. /// </param> /// <param name='ch'> /// Ch. /// </param> /// <param name='bagsize'> /// Bagsize. /// </param> public Being(string name, Characteristics ch, Characteristics currentCh, int bagsize) { this.Name = name; this.Characteristics = ch; this.CurrentCharacteristics = currentCh; this.bag = new Inventory(bagsize); this.equiped = new Inventory(bagsize); this.Body = new Body( new string[0]); this.symbol = 'B'; }
public static Player CreateNewPlayer() { // Pick name Console.WriteLine("What is your name?"); string name = Console.ReadLine().Trim(); // lets egyptize the name int choice = 0; string userInput = ""; string[] names = {(name.ToLower() + "nefer").ToUpperFirstLetter(), (name.ToLower() + "hotep").ToUpperFirstLetter(), "Ptah" + name.ToLower() + "tep", "Nefe" + name.ToLower() + "bet", "Ankh" + name.ToLower() + "amun", "Iset" + name.ToLower() + "rure", "Neb" + name.ToLower() + "kare"}; while (choice < 1 || choice > 7) { Console.WriteLine("That sounds just bad. What about:"); for (int i=0; i<names.Length; i++) Console.WriteLine("\t{0}: {1}", i+1, names[i]); userInput = Console.ReadLine(); int.TryParse(userInput, out choice ); } // create new name string newname = names[choice-1]; Characteristics ch = new Characteristics(10,2,1,0); Characteristics ch2 = new Characteristics(10,2,1,0); Player p = new Player(newname, ch, ch2, 100, 2, 2); p.SetCurrentDungeon("dungeon1"); Item amulet = new Item("Amulet with crocodile"); p.PickItem(amulet); Console.Clear(); Console.WriteLine("You wake up."); Console.WriteLine("Your head is spinning and you feel throbbing pain on the back of your head."); Console.WriteLine("There is pitch dark all around you, not a single ray of light. And who are you, anyway?"); Console.ReadKey(); Console.WriteLine("Oh yes, your name is {0} and you were building the tomb for Khasekhemre, pharaohs chief accountant.", newname); Console.WriteLine("And thats the last thing you remember"); Console.ReadKey(); Console.WriteLine("You should probably find out what happened."); Console.ReadKey(); return p; }
public void SetCurrentCharacteriscs(Characteristics ch) { this.CurrentCharacteristics = ch; }
public Player (string name, Characteristics ch, Characteristics currentCh, int bagsize, int x, int y) :base(name, ch, currentCh, bagsize) { X = x; Y = y; symbol = 'P'; }
public static Player LoadPlayerFromXml(string playername) { string path = filePath + "players/" + playername.ToLower() + "/player.xml"; XmlDocument doc = new XmlDocument(); doc.Load(path); XmlNode root = doc.DocumentElement; // get attributes of player - name and positions string name = root.Attributes["name"].Value; int x = int.Parse(root.Attributes["x"].Value); int y = int.Parse(root.Attributes["y"].Value); string dungeonName = root.Attributes["currentDungeon"].Value; Characteristics ch = new Characteristics(0,0,0,0); Characteristics cch = new Characteristics(0,0,0,0); Inventory bag = new Inventory(0); Inventory equiped = new Inventory(0); string[] b = new string[6]; foreach (XmlNode node in root.ChildNodes) { string nodeName = node.Name; switch (nodeName) { case "Characteristics": { ch = LoadCharacteristicsFromXml((XmlElement)node); break; } case "CurrentCharacteristics": { cch = LoadCharacteristicsFromXml((XmlElement)node); break; } case "Bag": { bag = LoadInventoryFromXml((XmlElement)node); break; } case "Equiped": { equiped = LoadInventoryFromXml((XmlElement)node); break; } case "Body": { b = LoadBodyFromXML((XmlElement)node); break; } } } Player p = new Player(name, ch, cch, bag.maxsize, x, y); p.bag = bag; p.equiped = equiped; p.SetBody(new Body(b)); p.SetCurrentDungeon(dungeonName); lua.DoFile(filePath + "players/" + p.Name.ToLower() + "/config.lua"); return p; }
public static Characteristics LoadCharacteristicsFromXml(XmlElement node) { int hp = int.Parse (node.GetAttribute("hitpoints")); int attack = int.Parse (node.GetAttribute("attack")); int defence = int.Parse (node.GetAttribute("defence")); int speed = int.Parse (node.GetAttribute("speed")); Characteristics ch = new Characteristics(hp, attack, defence, speed); return ch; }
public static Being LoadBeingFromXml(XmlElement node) { // get name of being string name = node.Attributes["name"].Value; string symbol = node.Attributes["symbol"].Value; Characteristics ch = new Characteristics(0,0,0,0); Characteristics cch = new Characteristics(0,0,0,0); Inventory bag = new Inventory(0); Inventory equiped = new Inventory(0); string[] b = new string[6]; foreach (XmlNode subnode in node.ChildNodes) { string nodeName = subnode.Name; switch (nodeName) { case "Characteristics": { ch = LoadCharacteristicsFromXml((XmlElement)subnode); break; } case "CurrentCharacteristics": { cch = LoadCharacteristicsFromXml((XmlElement)subnode); break; } case "Bag": { bag = LoadInventoryFromXml((XmlElement)subnode); break; } case "Equiped": { equiped = LoadInventoryFromXml((XmlElement)subnode); break; } case "Body": { b = LoadBodyFromXML((XmlElement)subnode); break; } } } Being being = new Being(name, ch, cch, bag.maxsize); being.bag = bag; being.equiped = equiped; being.SetBody(new Body(b)); being.SetSymbol(symbol); return being; }
public Weapon(string name, Characteristics ch, Array lst, int nrFacets) : base(name, ch, lst) { this.NrFacets = nrFacets; }