Ejemplo n.º 1
0
        public override void ReadAttributesXML(XmlNode xmlNode)
        {
            bool readBase     = false;
            bool readModified = false;

            try
            {
                foreach (XmlNode childNode in xmlNode.ChildNodes)
                {
                    if (childNode.Name == "BaseAttributes")
                    {
                        BaseAttributes.ReadXML(childNode.ChildNodes[0]);
                        readBase = true;
                    }
                    else if (childNode.Name == "ModifiedAttributes")
                    {
                        ModifiedAttributes.ReadXML(childNode.ChildNodes[0]);
                        readModified = true;
                    }
                }
            }
            catch (XmlException e)
            {
                MessageBox.Show(e.ToString());
            }

            if (readBase && !readModified)
            {
                ModifiedAttributes = new CreatureAttributes(BaseAttributes);
            }
        }
Ejemplo n.º 2
0
        public override void WriteAttributesXML(XmlWriter xmlWriter)
        {
            xmlWriter.WriteStartElement("BaseAttributes");
            BaseAttributes.WriteXML(xmlWriter);
            xmlWriter.WriteEndElement();

            xmlWriter.WriteStartElement("ModifiedAttributes");
            ModifiedAttributes.WriteXML(xmlWriter);
            xmlWriter.WriteEndElement();
        }
Ejemplo n.º 3
0
        public new CreatureAttributes GetEffectiveAttributes()
        {
            CreatureAttributes effectiveAttributes = ModifiedAttributes.Clone();

            foreach (Effect.Effect effect in Effects)
            {
                if (!effect.PerTurn)
                {
                    effect.ApplyTo(effectiveAttributes, BaseAttributes);
                }
            }
            return(effectiveAttributes);
        }
Ejemplo n.º 4
0
 public void ModifyAbilityScore(Types.Ability ability, int change)
 {
     ModifiedAttributes.ModifyAbilityScore(ability, change);
     NotifyPropertyChanged(Methods.GetAbilityString(ability));
 }