public object Clone() { AttributeModifier mod = new AttributeModifier(); mod.ItemId = ItemId; mod.Attribute = Attribute; mod.Value = Value; mod.Type = Type; mod.Duration = Duration; mod.TimeLeft = TimeLeft; return mod; }
public object Clone() { AttributeModifier mod = new AttributeModifier(); mod.ItemId = ItemId; mod.Attribute = Attribute; mod.Value = Value; mod.Type = Type; mod.Duration = Duration; mod.TimeLeft = TimeLeft; return(mod); }
public void AddModifier(AttributeModifier modifier) { AttributeSheet sheet = Global.Player.Attributes; switch (modifier.Type) { case ModifierType.Current: int att = sheet.Current[modifier.Attribute] + modifier.Value; if (att > sheet.Calculated[modifier.Attribute]) att = sheet.Calculated[modifier.Attribute]; else if (att < 0) att = 0; sheet.Current[modifier.Attribute] = att; break; case ModifierType.Permanent: case ModifierType.Temporary: case ModifierType.Equipment: sheet.Modifiers.Add(modifier); break; } sheet.Recalculate(); }
private void modEditButton_Click(object sender, EventArgs e) { if (currentModifier != null) modifiers.Remove(currentModifier); else currentModifier = new AttributeModifier(); currentModifier.Attribute = (CharacterAttribute)Enum.Parse(typeof(CharacterAttribute), modAttribute.Text); currentModifier.Type = (ModifierType)Enum.Parse(typeof(ModifierType), modType.Text); currentModifier.Value = int.Parse(modValue.Text); modifiers.Add(currentModifier); LoadModifiers(); }
private void modList_SelectedIndexChanged(object sender, EventArgs e) { if (currentItem != null && modList.SelectedIndex >= 0 && modList.SelectedIndex < currentItem.Modifiers.Count) { currentModifier = modifiers[modList.SelectedIndex]; FillModifier(); } }
private void modNewButton_Click(object sender, EventArgs e) { currentModifier = null; modList.SelectedIndex = -1; ClearModifier(); }
private void Clear() { currentItem = null; currentModifier = null; imagePicker.ResetGid(); var allTextBoxes = Utils.GetChildControls<TextBox>(this); foreach (TextBox tb in allTextBoxes) { tb.Text = ""; } ClearModifier(); modList.Items.Clear(); modifiers.Clear(); }