Example #1
0
        public static void AddDefense(object target, SpecialDefenses defense)
        {
            // is there an existing custom attacks attachment to add to?
            XmlCustomDefenses a = (XmlCustomDefenses)XmlAttach.FindAttachment(target, typeof(XmlCustomDefenses));

            if (a == null)
            {
                // add a new custom attacks attachment
                XmlAttach.AttachTo(target, new XmlCustomDefenses(defense));
            }
            else
            {
                // add the new attack to existing attack list
                a.AddSpecial(defense);
            }
        }