private void AddDmgBtn_Click(object sender, EventArgs e) { if (fCreature != null) { DamageModifier dm = new DamageModifier(); DamageModifierForm dlg = new DamageModifierForm(dm); if (dlg.ShowDialog() == DialogResult.OK) { fModifiers.Add(dlg.Modifier); update_damage_list(); } } if (fTemplate != null) { DamageModifierTemplate dm = new DamageModifierTemplate(); DamageModifierTemplateForm dlg = new DamageModifierTemplateForm(dm); if (dlg.ShowDialog() == DialogResult.OK) { fModifierTemplates.Add(dlg.Modifier); update_damage_list(); } } }
public DamageModifierTemplateForm(DamageModifierTemplate dmt) { InitializeComponent(); foreach (DamageType type in Enum.GetValues(typeof(DamageType))) { if (type == DamageType.Untyped) { continue; } DamageTypeBox.Items.Add(type); } TypeBox.Items.Add("Immunity to this damage type"); TypeBox.Items.Add("Resistance to this damage type"); TypeBox.Items.Add("Vulnerability to this damage type"); fMod = dmt.Copy(); if (fMod.Type == DamageType.Untyped) { DamageTypeBox.SelectedIndex = 0; } else { DamageTypeBox.SelectedItem = fMod.Type; } int total_mod = fMod.HeroicValue + fMod.ParagonValue + fMod.EpicValue; if (total_mod == 0) { TypeBox.SelectedIndex = 0; } if (total_mod < 0) { TypeBox.SelectedIndex = 1; } if (total_mod > 0) { TypeBox.SelectedIndex = 2; } HeroicBox.Value = Math.Abs(fMod.HeroicValue); ParagonBox.Value = Math.Abs(fMod.ParagonValue); EpicBox.Value = Math.Abs(fMod.EpicValue); }
public DamageModifierTemplateForm(DamageModifierTemplate dmt) { this.InitializeComponent(); foreach (DamageType value in Enum.GetValues(typeof(DamageType))) { if (value == DamageType.Untyped) { continue; } this.DamageTypeBox.Items.Add(value); } this.TypeBox.Items.Add("Immunity to this damage type"); this.TypeBox.Items.Add("Resistance to this damage type"); this.TypeBox.Items.Add("Vulnerability to this damage type"); this.fMod = dmt.Copy(); if (this.fMod.Type != DamageType.Untyped) { this.DamageTypeBox.SelectedItem = this.fMod.Type; } else { this.DamageTypeBox.SelectedIndex = 0; } int heroicValue = this.fMod.HeroicValue + this.fMod.ParagonValue + this.fMod.EpicValue; if (heroicValue == 0) { this.TypeBox.SelectedIndex = 0; } if (heroicValue < 0) { this.TypeBox.SelectedIndex = 1; } if (heroicValue > 0) { this.TypeBox.SelectedIndex = 2; } this.HeroicBox.Value = Math.Abs(this.fMod.HeroicValue); this.ParagonBox.Value = Math.Abs(this.fMod.ParagonValue); this.EpicBox.Value = Math.Abs(this.fMod.EpicValue); }