private void comboBoxEffectableTypes_SelectedIndexChanged(object sender, EventArgs e) { if (Utilities.EffectableTypes.Character == (Utilities.EffectableTypes)comboBoxEffectableTypes.SelectedItem) { List <String> names = Utilities.GetCharacterNames(); foreach (string combatName in CombatHolder.getInCombatCharNames()) { names.Add(combatName); } names.Insert(0, ""); cboBoxName.DataSource = names; } else { Item itToReadFrom = new Item(); if (comboBoxEffectableTypes.Text == "Item") { cboBoxName.DataSource = Utilities.GetItemNames(); } if (comboBoxEffectableTypes.Text == "Shield") { cboBoxName.DataSource = Utilities.GetShieldNames(); } if (comboBoxEffectableTypes.Text == "Weapon") { cboBoxName.DataSource = Utilities.GetWeaponNames(); } if (comboBoxEffectableTypes.Text == "Armor") { cboBoxName.DataSource = Utilities.GetArmorNames(); } } }
public CombatEntry() { InitializeComponent(); cboBoxNames.DataSource = Utilities.GetCharacterNames(); cboBoxInCombat.DataSource = CombatHolder.getInCombatCharNames(); updateRTBWithCharacternames(); }
public MasterDeclarations() { InitializeComponent(); cboBoxName.DataSource = CombatHolder.getInCombatCharNames(); UpdateRTB(); CombatHolder.updateCombatDeclarations(); CombatHolder._masterOfDeclarations = this; }
//update character private void button1_Click(object sender, EventArgs e) { foreach (Character update in CombatHolder._inCombatChars) { Character c = Utilities.GetCharByName(update.Name); CombatHolder.UpdateCharInventorySpellsSkillsEffectsAndStats(c); } updateRTBWithCharacternames(); cboBoxInCombat.DataSource = CombatHolder.getInCombatCharNames(); }
private void buttonDelete_Click(object sender, EventArgs e) { if (cboBoxInCombat.Text == "") { MessageBox.Show("Please Enter A Character"); return; } Character found = CombatHolder._inCombatChars.Find(FitChar => cboBoxInCombat.Text == FitChar.CombatStuff.CombatName); if (found != null) { CombatHolder._inCombatChars.Remove(found); } updateRTBWithCharacternames(); cboBoxInCombat.DataSource = CombatHolder.getInCombatCharNames(); }
//add character private void button3_Click(object sender, EventArgs e) { if (cboBoxNames.Text == "") { MessageBox.Show("Please Enter A Character"); return; } Character charToAdd = Utilities.GetCharByName(cboBoxNames.Text); if (!charToAdd.Weapons.Any() || !charToAdd.Shields.Any()) { return; } charToAdd.CombatStuff.CombatWeapon = charToAdd.Weapons[0]; charToAdd.CombatStuff.CombatShield = charToAdd.Shields[0]; List <Character> found = CombatHolder._inCombatChars.FindAll(FitChar => cboBoxNames.Text == FitChar.Name); int appendnum = found.Count + 1; //while there is a character that has the same combatname while (CombatHolder._inCombatChars.FindAll(FitChar => charToAdd.Name + appendnum == FitChar.CombatStuff.CombatName).Count != 0) { appendnum++; } charToAdd.CombatStuff.CombatName = charToAdd.Name + appendnum; charToAdd.Stamina = CombatScripts.GetBaseStamina(charToAdd); charToAdd.HitPoints = CombatScripts.GetBaseHealth(charToAdd); charToAdd.CombatStuff.targets = new List <Character>(); CombatHolder._inCombatChars.Add(charToAdd); EnchantmentUtilities.triggerAllEnchantmentsForChar(charToAdd, new EnchantmentParameters() { triggerSource = EnchantmentUtilities.SourceTypes.CombatEntry }); updateRTBWithCharacternames(); cboBoxInCombat.DataSource = CombatHolder.getInCombatCharNames(); }