Beispiel #1
0
 public static void BecomeCouncilMember(this Hornwood hornwood)
 {
     if (hornwood.Profesion != Profesions.CouncilMember)
     {
         throw new Exception("is'not concil member");
     }
     else
     {
         KINGINTHENORTH.CouncilMembers.Add(hornwood.Northhuman_Hornwood);
     }
 }
        public static void Writeinfo(this Hornwood hornwood, string filename)
        {
            XDocument xDocument   = new XDocument();
            var       weaponslist = hornwood.Weapons.Select(weapons => new XElement("weapon", weapons));
            XElement  xElement    = new XElement("name", hornwood.Name,
                                                 new XElement("Profesions", hornwood.Profesion), new XElement("Age", hornwood.age),
                                                 new XElement("money", hornwood.money), new XElement("Gender", hornwood.Gender),
                                                 new XElement("eyescolor", hornwood.Eyescolor), new XElement("isalive", hornwood.Isalive), new XElement("Health", hornwood.Health),
                                                 new XElement("fight", new XAttribute("FightSkills", hornwood.FightSkills), new XAttribute("Durability", hornwood.Durability), new XAttribute("Quickness", hornwood.Quickness)),
                                                 new XElement("weapons", weaponslist));

            xDocument.Add(xElement);
            xDocument.Save(filename);
        }
 public static void Goingtowall(this Hornwood hornwood)
 {
     if (hornwood.Gender == gender.female)
     {
         throw new Exception("woman can't be knightwatch");
     }
     hornwood.Profesion   = null;
     north.king.treasury += hornwood.money;
     hornwood.money       = 0;
     hornwood.Weapons.Clear();
     if (hornwood.Profesion == Profesions.CouncilMember)
     {
         KINGINTHENORTH.CouncilMembers.Remove(hornwood.Northhuman_Hornwood);
     }
     Hornwood.Hornwoods_people.Remove(hornwood);
     if (hornwood.Profesion == Profesions.soldier)
     {
         Hornwood.Hornwoods_soldiers.Remove(hornwood);
     }
     CastlesontheWall.Knightswatchpeople.Add(hornwood.Northhuman_Hornwood);
 }