示例#1
0
        private Faction InitFaction(XmlNode factionNode)
        {
            Faction faction = new Faction(village, factionNode.SelectSingleNode("Name").InnerText);
            if (factionNode.SelectSingleNode("Evil") != null) {
                faction.Alignment = Alignment.Evil;
            }
            if(factionNode.SelectSingleNode("Nightkill") != null ) {
                faction.AddPower(new Powers.NightkillPower());
            }
            if(factionNode.SelectSingleNode("KnowsGroup") != null) {
                faction.AddPower(new Powers.MembersPower());
            }

            string[] conditions = factionNode.SelectSingleNode("WinsWhen").InnerText.Split('|');
            foreach (string condition in conditions) {
                switch (condition) {
                    case "MajorityOrEqual":
                        faction.WinConditions.Add(new MajorityOrEqualCondition());
                        break;
                    case "NoEvilLeft":
                        faction.WinConditions.Add(new NoEvilLeftCondition());
                        break;
                }
            }
            return faction;
        }