Пример #1
0
        /// <summary>
        /// Generate place holders for monsters in army
        /// </summary>
        private void gen_placeholders(ComboArmyComposition composition)
        {
            ComboArmyCompositionVariant v = get_random_composition_variant(composition);

            if (v != null)
            {
                foreach (string r in v.References)   //add traits for each reference
                {
                    ComboArmyComposition comp = ca_parser_.Compositions.Find(
                        delegate(ComboArmyComposition c)
                    {
                        return(c.Name == r);
                    }
                        );
                    gen_placeholders(comp);
                }
                foreach (MonsterTraits mt in v.Traits)   //add traits for variant
                {
                    placeholders_.Add(new MonsterPlaceHolder(mt));
                }
            }
            if (composition == null && placeholders_.Count == 0)
            {
                placeholders_.Add(new MonsterPlaceHolder(MonsterTraits.Any));
            }
        }
Пример #2
0
 private void parse(XmlNode node)
 {
     size_ = int.Parse(node.Attributes["Size"].Value);
     name_ = node.Attributes["Name"].Value;
     foreach (string s in node.Attributes["Composition"].Value.Split(new char[] { ';' }))
     {
         ComboArmyCompositionVariant v = new ComboArmyCompositionVariant(s);
         if (v.IsParseOK)
         {
             variants_.Add(v);
         }
     }
 }