public void SetAbilityScore(Types.Ability ability, int score) { switch (ability) { case Types.Ability.Strength: Strength = score; break; case Types.Ability.Dexterity: Dexterity = score; break; case Types.Ability.Constitution: Constitution = score; break; case Types.Ability.Intelligence: Intelligence = score; break; case Types.Ability.Wisdom: Wisdom = score; break; case Types.Ability.Charisma: Charisma = score; break; } }
private int GetAbilityIndex(Types.Ability ability) { for (int i = 0; i < Abilities.Count; ++i) { if (Abilities[i] == Methods.GetAbilityString(ability)) { return(i); } } return(0); }
public void ModifyAttackModifier(Types.Ability ability, int change) { foreach (AttackSet attackSet in AttackSets) { foreach (Attack attack in attackSet.Attacks) { if (attack.Ability == ability) { attack.Modifier += change; } } } NotifyPropertyChanged("AttackSets"); }
public void ModifyAbilityScore(Types.Ability ability, int change) { if (Type != Types.Creature.Construct) { int oldModifier = GetAbilityModifier(ability); SetAbilityScore(ability, GetAbilityScore(ability) + change); int newModifier = GetAbilityModifier(ability); int modifierDifference = newModifier - oldModifier; if (ability == Types.Ability.Strength || ability == Types.Ability.Dexterity) { ModifyAttackModifier(ability, modifierDifference); if (ability == Types.Ability.Strength) { ModifyDamageModifier(modifierDifference); } else if (ability == Types.Ability.Dexterity) { ReflexSave += modifierDifference; } } else if (ability == Types.Ability.Constitution) { if (Type != Types.Creature.Undead && Type != Types.Creature.Construct) { HitPoints += HitDice * modifierDifference; FortitudeSave += modifierDifference; } } else { // Modify spell DCs if (ability == Types.Ability.Wisdom) { WillSave += modifierDifference; } } } }
public override void ReadXML(XmlNode xmlNode) { base.ReadXML(xmlNode); try { foreach (XmlNode childNode in xmlNode.ChildNodes) { if (childNode.Name == "Value") { Value = Convert.ToInt32(childNode.InnerText); } else if (childNode.Name == "Ability") { Ability = Methods.GetAbilityFromString(childNode.InnerText); } } } catch (XmlException e) { MessageBox.Show(e.ToString()); } }
public void ReadXML(XmlNode xmlNode) { DamageDescriptorSets = new List <DamageDescriptorSet>(); try { foreach (XmlNode childNode in xmlNode.ChildNodes) { if (childNode.Name == "Name") { Name = childNode.InnerText; } else if (childNode.Name == "DamageDescriptorSet") { DamageDescriptorSets.Add(new DamageDescriptorSet(childNode)); } else if (childNode.Name == "AbilityDamage") { AbilityDamage = true; foreach (XmlAttribute attribute in childNode.Attributes) { if (attribute.Name == "Ability") { Ability = Methods.GetAbilityFromString(attribute.Value); } else if (attribute.Name == "Value") { AbilityDamageValue = Convert.ToInt32(attribute.Value); } } } } } catch (XmlException e) { MessageBox.Show(e.ToString()); } }
public int GetAbilityScore(Types.Ability ability) { switch (ability) { case Types.Ability.Strength: return(Strength); case Types.Ability.Dexterity: return(Dexterity); case Types.Ability.Constitution: return(Constitution); case Types.Ability.Intelligence: return(Intelligence); case Types.Ability.Wisdom: return(Wisdom); case Types.Ability.Charisma: return(Charisma); } return(0); }
public TimedAbilityValueEffect(Types.Effect effectType, Types.Ability ability, int value, int duration, bool perTurn) : base(effectType, duration, perTurn) { _ability = ability; _value = value; }
public int GetAbilityModifier(Types.Ability ability) { return(Methods.GetAbilityModifier(GetAbilityScore(ability))); }
public void ModifyAbilityScore(Types.Ability ability, int change) { ModifiedAttributes.ModifyAbilityScore(ability, change); NotifyPropertyChanged(Methods.GetAbilityString(ability)); }
public AbilityValueEffect(Types.Effect effectType, Types.Ability ability, int value) : base(effectType) { _ability = ability; _value = value; }