private void ExecuteAddDamageReduction() { AddDamageReductionWindowViewModel addDamageReductionWindowViewModel = new AddDamageReductionWindowViewModel(); Model.DamageReduction dr = addDamageReductionWindowViewModel.GetDamageReduction(); if (dr != null) { DamageReductions.Add(dr); } }
public override void ReadXML(XmlNode xmlNode) { base.ReadXML(xmlNode); try { foreach (XmlNode childNode in xmlNode.ChildNodes) { if (childNode.Name == "Type") { try { Type = Methods.GetCreatureTypeFromString(childNode.InnerText); } catch (FormatException) { Type = Types.Creature.Humanoid; } } else if (childNode.Name == "ChallengeRating") { ChallengeRating = Convert.ToSingle(childNode.InnerText); } else if (childNode.Name == "AttackSets") { AttackSets.Clear(); foreach (XmlNode attackSetNode in childNode.ChildNodes) { if (attackSetNode.Name == "AttackSet") { AttackSets.Add(new AttackSet(attackSetNode)); } } } else if (childNode.Name == "Strength") { Strength = Convert.ToInt32(childNode.InnerText); } else if (childNode.Name == "Dexterity") { Dexterity = Convert.ToInt32(childNode.InnerText); } else if (childNode.Name == "Constitution") { Constitution = Convert.ToInt32(childNode.InnerText); } else if (childNode.Name == "Intelligence") { Intelligence = Convert.ToInt32(childNode.InnerText); } else if (childNode.Name == "Wisdom") { Wisdom = Convert.ToInt32(childNode.InnerText); } else if (childNode.Name == "Charisma") { Charisma = Convert.ToInt32(childNode.InnerText); } else if (childNode.Name == "BaseAttackBonus") { BaseAttackBonus = Convert.ToInt32(childNode.InnerText); } else if (childNode.Name == "GrappleModifier") { GrappleModifier = Convert.ToInt32(childNode.InnerText); } else if (childNode.Name == "HitPoints") { HitPoints = Convert.ToInt32(childNode.InnerText); } else if (childNode.Name == "HitDice") { HitDice = Convert.ToInt32(childNode.InnerText); } else if (childNode.Name == "HitDieType") { HitDieType = Methods.GetDieTypeFromString(childNode.InnerText); } else if (childNode.Name == "ArmorClass") { ArmorClass = Convert.ToInt32(childNode.InnerText); } else if (childNode.Name == "TouchArmorClass") { TouchArmorClass = Convert.ToInt32(childNode.InnerText); } else if (childNode.Name == "FlatFootedArmorClass") { FlatFootedArmorClass = Convert.ToInt32(childNode.InnerText); } else if (childNode.Name == "Speed") { Speed.ReadXML(childNode); } else if (childNode.Name == "FortitudeSave") { FortitudeSave = Convert.ToInt32(childNode.InnerText); } else if (childNode.Name == "ReflexSave") { ReflexSave = Convert.ToInt32(childNode.InnerText); } else if (childNode.Name == "WillSave") { WillSave = Convert.ToInt32(childNode.InnerText); } else if (childNode.Name == "Feats") { foreach (XmlNode featNode in childNode.ChildNodes) { if (featNode.Name == "Feat") { Feats.Add(featNode.InnerText); } } } else if (childNode.Name == "Space") { Space = Convert.ToInt32(childNode.InnerText); } else if (childNode.Name == "Reach") { Reach = Convert.ToInt32(childNode.InnerText); } else if (childNode.Name == "Size") { Size = Methods.GetSizeFromString(childNode.InnerText); } else if (childNode.Name == "DamageReductions") { foreach (XmlNode drNode in childNode.ChildNodes) { if (drNode.Name == "DamageReduction") { DamageReduction dr = new DamageReduction(); dr.ReadXML(drNode); DamageReductions.Add(dr); } } } else if (childNode.Name == "Immunities") { Immunities.ReadXML(childNode); } else if (childNode.Name == "EnergyResistances") { foreach (XmlNode erNode in childNode.ChildNodes) { if (erNode.Name == "EnergyResistance") { EnergyResistance er = new EnergyResistance(); er.ReadXML(erNode); EnergyResistances.Add(er); } } } else if (childNode.Name == "SpellResistance") { SpellResistance = Convert.ToInt32(childNode.InnerText); } else if (childNode.Name == "FastHealing") { FastHealing = Convert.ToInt32(childNode.InnerText); } else if (childNode.Name == "SpecialAttacks") { SpecialAttacks = childNode.InnerText; } else if (childNode.Name == "SpecialQualities") { foreach (string specialQuality in childNode.InnerText.Split(',')) { SpecialQualities.Add(specialQuality.Trim()); } } } } catch (XmlException e) { MessageBox.Show(e.ToString()); } }