public object Clone() { SpecialAbility s = new SpecialAbility(); s.Name = Name; s.Text = Text; s.Type = Type; s.ConstructionPoints = ConstructionPoints; return(s); }
private void AddSpecialAbilityButton_Click(object sender, System.Windows.RoutedEventArgs e) { SpecialAbility ab = new SpecialAbility(); ab.Name = ""; ab.Type = "Ex"; _Monster.SpecialAbilitiesList.Add(ab); SpecialAbilitiesListBox.DataContext = _SpecialAbilitiesView; _SpecialAbilitiesView.Refresh(); }
public static Affliction FromSpecialAbility(Monster monster, SpecialAbility sa) { Affliction a = null; Regex reg = new Regex(RegexString, RegexOptions.IgnoreCase); Match m = reg.Match(sa.Text); if (m.Success) { a = new Affliction(); a.Type = sa.Name; if (m.Groups["afflictionname"].Success && m.Groups["afflictionname"].Value.Trim().Length > 0) { a.Name = m.Groups["afflictionname"].Value.Trim(); a.Name = a.Name.Capitalize(); if (a.Name == "Filth Fever") { a.Name += " - " + monster.Name; } } else { a.Name = monster.Name + " " + a.Type; } if (m.Groups["cause"].Success) { a.Cause = m.Groups["cause"].Value.Trim(); } a.SaveType = m.Groups["savetype"].Value; a.Save = int.Parse(m.Groups["savedc"].Value); if (m.Groups["onset"].Success) { if (m.Groups["immediateonset"].Success) { a.Immediate = true; } else { a.Onset = GetDie(m.Groups["onsetdie"].Value); a.OnsetUnit = m.Groups["onsetunit"].Value; } } if (m.Groups["once"].Success) { a.Once = true; } else { a.Frequency = int.Parse(m.Groups["frequencycount"].Value); a.FrequencyUnit = m.Groups["frequencyunit"].Value; if (m.Groups["Limit"].Success) { a.Limit = int.Parse(m.Groups["limitcount"].Value); a.LimitUnit = m.Groups["limittype"].Value; } } if (m.Groups["damageeffect"].Success) { a.DamageDie = GetDie(m.Groups["damagedie"].Value); a.DamageType = m.Groups["damagetype"].Value; if (m.Groups["secondarydamagedie"].Success) { a.SecondaryDamageDie = GetDie(m.Groups["secondarydamagedie"].Value); a.SecondaryDamageType = m.Groups["secondarydamagetype"].Value; } } else if (m.Groups["specialeffect"].Success) { a.SpecialEffectTime = GetDie(m.Groups["specialeffectdie"].Value); a.SpecialEffectName = m.Groups["specialeffectname"].Value; a.SpecialEffectUnit = m.Groups["specialeffectunit"].Value; } else if (m.Groups["othereffect"].Success) { a.OtherEffect = m.Groups["othereffect"].Value.Trim(); } a.Cure = m.Groups["cure"].Value; if (m.Groups["details"].Success) { a.Details = m.Groups["details"].Value.Trim(); } } return(a); }
private void SpecialAbilityDeleteButton_Click(object sender, System.Windows.RoutedEventArgs e) { SpecialAbility ab = (SpecialAbility)((FrameworkElement)sender).DataContext; _Monster.SpecialAbilitiesList.Remove(ab); }