private void update_list() { OngoingCondition selection = SelectedEffect; EffectList.BeginUpdate(); EffectList.Items.Clear(); foreach (OngoingCondition oc in fData.Conditions) { if (oc.Duration != DurationType.SaveEnds) { continue; } int mod = (int)ModBox.Value; int roll = fRolls[oc]; ListViewItem lvi = EffectList.Items.Add(oc.ToString(fEncounter, false)); lvi.Tag = oc; if (oc == selection) { lvi.Selected = true; } if (roll == 0) { lvi.SubItems.Add("(not rolled)"); lvi.SubItems.Add("(not rolled)"); lvi.ForeColor = SystemColors.GrayText; } else if (roll == int.MinValue) { lvi.SubItems.Add("-"); lvi.SubItems.Add("Not saved"); } else if (roll == int.MaxValue) { lvi.SubItems.Add("-"); lvi.SubItems.Add("Saved"); lvi.ForeColor = SystemColors.GrayText; } else { int result = roll + oc.SavingThrowModifier + mod; if (result == roll) { lvi.SubItems.Add(roll.ToString()); } else { lvi.SubItems.Add(roll + " => " + result); } if (result >= 10) { lvi.SubItems.Add("Saved"); lvi.ForeColor = SystemColors.GrayText; } else { lvi.SubItems.Add("Not saved"); } } } if (EffectList.Items.Count == 0) { ListViewItem lvi = EffectList.Items.Add("(no conditions)"); lvi.ForeColor = SystemColors.GrayText; } EffectList.EndUpdate(); }
private void update_list() { Guid selection = SelectedPowerID; EffectList.BeginUpdate(); EffectList.Items.Clear(); foreach (Guid power_id in fData.UsedPowers) { if (!fRolls.ContainsKey(power_id)) { continue; } CreaturePower power = get_power(power_id); if (power == null) { continue; } int roll = fRolls[power_id]; ListViewItem lvi = EffectList.Items.Add(power.Name); lvi.SubItems.Add(power.Action.Recharge); lvi.Tag = power.ID; if (power_id == selection) { lvi.Selected = true; } if (roll == int.MinValue) { lvi.SubItems.Add("-"); lvi.SubItems.Add("Not recharged"); } else if (roll == int.MaxValue) { lvi.SubItems.Add("-"); lvi.SubItems.Add("Recharged"); lvi.ForeColor = SystemColors.GrayText; } else { int min = get_minimum(power.Action.Recharge); if (min == int.MaxValue) { lvi.SubItems.Add("Not rolled"); lvi.SubItems.Add("Not rolled"); } else { lvi.SubItems.Add(roll.ToString()); if (roll >= min) { lvi.SubItems.Add("Recharged"); lvi.ForeColor = SystemColors.GrayText; } else { lvi.SubItems.Add("Not recharged"); } } } } if (EffectList.Items.Count == 0) { ListViewItem lvi = EffectList.Items.Add("(no rechargable powers)"); lvi.ForeColor = SystemColors.GrayText; } EffectList.EndUpdate(); }