private void btnAddTarget_Click(object sender, EventArgs e) { if (CombatHolder._makingAttackChars.Any(A => A.CombatStuff.CombatName == cboBoxAttackers.SelectedItem.ToString())) { SingleAttack frmCreator = new SingleAttack(CombatHolder._makingAttackChars.Find(TChar => TChar.CombatStuff.CombatName == cboBoxAttackers.SelectedItem.ToString()), CombatHolder._inCombatChars, this, CombatHolder._inCombatChars.First()); frmCreator.Show(); } }
//this is what happens when you click the 'Attack' button. The method name is an inside joke. private void followTheTaco_Click(object sender, EventArgs e) { double offenseRoll = 0.0; double defendRoll = 0.0; Double.TryParse(txtBoxOffensiveRoll.Text, out offenseRoll); Double.TryParse(txtBoxDefensiveRoll.Text, out defendRoll); Character _defender = _canAttack.Find(Ch => Ch.CombatStuff.CombatName == comboBox1.Text); if (_attacker.Weapons.Any(A => A.ItemName == comboBoxAttackerWeapon.Text)) { _attacker.CombatStuff.CombatWeapon = _attacker.Weapons.Find(A => A.ItemName == comboBoxAttackerWeapon.Text); } else { _attacker.CombatStuff.CombatWeapon = Utilities.GetWeaponByName(comboBoxAttackerWeapon.Text); } if (_defender.Weapons.Any(A => A.ItemName == comboBoxDefenderWeapon.Text)) { _defender.CombatStuff.CombatWeapon = _defender.Weapons.Find(A => A.ItemName == comboBoxDefenderWeapon.Text); } else { _defender.CombatStuff.CombatWeapon = Utilities.GetWeaponByName(comboBoxDefenderWeapon.Text); } _outcome = new AttackOutcome(); _outcome.Attacker = _attacker; _outcome.Defender = _defender; _outcome.attackRoll = offenseRoll; _outcome.defendRoll = defendRoll; _parentForm.AddToAttacks(_outcome); SingleAttack frmRemover = this; frmRemover.Hide(); }
public Master_Attacker() { InitializeComponent(); foreach (Character attacker in CombatHolder._makingAttackChars) { cboBoxAttackers.Items.Add(attacker.CombatStuff.CombatName); if (attacker.CombatStuff.targets == null || attacker.CombatStuff.targets.Count == 0) { attacker.CombatStuff.targets.Add(CombatHolder._inCombatChars.First()); } foreach (Character target in attacker.CombatStuff.targets) { SingleAttack frmCreator = new SingleAttack(attacker, CombatHolder._inCombatChars, this, target); frmCreator.Show(); } /*if (TacoFollower.CombatStuff.CurrentlyInCombat == true) * {//currently depreciated * * }*/ } }