public SpellResults(bool waitForConfirmation)
 {
     InitializeComponent();
     foreach (Character example in CombatHolder._inCombatChars)
     {
         foreach (SpellToCast stc in example.CombatStuff.SpellsToCast)
         {
             if (stc != null && stc.IsCorrectlyFormattedAndReadyToCast())
             {
                 spells.Add(stc);
                 rtbResults.Text += "--------------------------------------------------------\n";
                 rtbResults.Text += "Caster: " + stc.caster.CombatStuff.CombatName + "\n";
                 rtbResults.Text += "Instigator: " + example.CombatStuff.CombatName + "\n";
                 rtbResults.Text += "Spell: " + stc.spell.SpellName + "\n";
                 rtbResults.Text += "Power: " + stc.spellPower + "\n";
                 rtbResults.Text += "------------------\n";
                 foreach (Character c in stc.targets)
                 {
                     rtbResults.Text += c.CombatStuff.CombatName + "\n";
                     rtbResults.Text += "-----ATTACKS-----\n";
                     Tuple <List <AttackOutcome>, List <Effect> > result = SpellScripts.castSpell(stc.caster, c, stc.spell, stc.spellPower, Utilities.addedRandomness.NextDouble() * 20);
                     stc.weaponResult = result.Item1;
                     foreach (Effect ef in result.Item2)
                     {
                         stc.effectResult.Add(ef, c);
                     }
                     foreach (AttackOutcome ao in result.Item1)
                     {
                         rtbResults.Text += "Weapon: " + ao.Attacker.CombatStuff.CombatWeapon.ItemName + "\n";
                         rtbResults.Text += "Result: " + ao.Othertext + "\n";
                         if (ao.Othertext == Utilities.AttackResultType.Hit)
                         {
                             rtbResults.Text += "Location: " + ao.HitLocation + "\n";
                             rtbResults.Text += "Hit Caliber: " + Convert.ToString(ao.HitCaliber) + "\n";
                             rtbResults.Text += "Hit Strength: " + Convert.ToString(ao.HitStrength) + "\n";
                             rtbResults.Text += "Strike Power: " + Convert.ToString(ao.TotalStrikeAmountFromAllTypes()) + "\n\n";
                             rtbResults.Text += "Harm: " + Convert.ToString(ao.harm) + "\n" + "Bleed: " + Convert.ToString(ao.bleed) + "\n" + "Disorientation: " + Convert.ToString(ao.disorientation) + "\n" + "Impairment: " + Convert.ToString(ao.impairment) + "\n" + "Trauma: " + Convert.ToString(ao.trauma) + "\n" + "KO: " + Convert.ToString(ao.ko) + "\n";
                         }
                         rtbResults.Text += ao.HitLocation.ToString() + "\n";
                         rtbResults.Text += "---------------------\n";
                     }
                     rtbResults.Text += "-----EFFECTS-----\n";
                     foreach (Effect ef in result.Item2)
                     {
                         rtbResults.Text += ef.getDisplayString()
                                            + "\n---------------------\n";
                     }
                     rtbResults.Text += "---------------------\n";
                 }
                 rtbResults.Text += "--------------------------------------------------------\n";
             }
         }
     }
     if (!waitForConfirmation)
     {
         resolveSpells(false);
     }
 }
        private void btnCastSpell_Click(object sender, EventArgs e)
        {
            if (!Utilities.ValidateComboBox(cboBoxChars.Text) || !Utilities.ValidateComboBox(cboBoxSpells.Text))
            {
                return;
            }
            if (chkBoxSecurity.Checked)
            {
                chkBoxSecurity.Checked = false;
            }
            else
            {
                return;
            }
            richTextBox1.Text = "";
            double spellPower = 0.0;

            Double.TryParse(txtBoxSpellPower.Text, out spellPower);
            double defensePower = 0.0;

            Double.TryParse(txtBoxDefenseRoll.Text, out defensePower);

            // Character c = Utilities.GetCharByName(cboBoxChars.Text); something like this needs to work eventually
            Character target = CombatHolder._inCombatChars.Find(A => A.CombatStuff.CombatName == cboBoxChars.Text);

            Character caster = new Character();

            if (cboBoxCaster.Text.Equals("Nobody"))
            {
                caster = Utilities.GetCharByName("Nobody");
                caster.CombatStuff.CombatShield = caster.Shields.First();
                caster.Stamina = CombatScripts.GetBaseStamina(caster);
                caster.CombatStuff.CombatName = "Nobody";
            }
            else
            {
                caster = CombatHolder._inCombatChars.Find(A => A.CombatStuff.CombatName == cboBoxCaster.Text);
            }


            if (target == null)  //fail
            {
                Utilities.ValidateComboBox("");
            }
            Spell s = Utilities.GetSpellByName(cboBoxSpells.Text);


            caster.Stamina -= s.SpellCost;

            Tuple <List <AttackOutcome>, List <Effect> > results = SpellScripts.castSpell(caster, target, s, spellPower, defensePower);

            foreach (Effect effMultiplied in results.Item2)
            {
                richTextBox1.Text += effMultiplied.getDisplayString();

                EffectHolder.CreateEffect(effMultiplied, target, false);
            }

            foreach (AttackOutcome outcome in results.Item1)
            {
                richTextBox1.Text += outcome.Attacker.CombatStuff.CombatName + " against " + outcome.Defender.CombatStuff.CombatName + " with " + outcome.Attacker.CombatStuff.CombatWeapon.ItemName + "\n";
                richTextBox1.Text += "Attackroll: " + outcome.attackRoll.ToString() + "\n";
                richTextBox1.Text += "Defendroll: " + outcome.defendRoll.ToString() + "\n";
                richTextBox1.Text += "Result: " + outcome.Othertext.ToString() + "\n";
                if (outcome.Othertext == Utilities.AttackResultType.Hit)
                {
                    richTextBox1.Text += "Location: " + outcome.HitLocation + "\n";
                    richTextBox1.Text += "Hit Caliber: " + Convert.ToString(outcome.HitCaliber) + "\n";
                    richTextBox1.Text += "Hit Strength: " + Convert.ToString(outcome.HitStrength) + "\n";
                    richTextBox1.Text += "Strike Power: " + Convert.ToString(outcome.TotalStrikeAmountFromAllTypes()) + "\n\n";
                    richTextBox1.Text += "Harm: " + Convert.ToString(outcome.harm) + "\n" + "Bleed: " + Convert.ToString(outcome.bleed) + "\n" + "Disorientation: " + Convert.ToString(outcome.disorientation) + "\n" + "Impairment: " + Convert.ToString(outcome.impairment) + "\n" + "Trauma: " + Convert.ToString(outcome.trauma) + "\n" + "KO: " + Convert.ToString(outcome.ko) + "\n";
                }
                richTextBox1.Text += outcome.HitLocation.ToString() + "\n\n";
                CombatScripts.applyAttackOutcome(outcome);
                EffectHolder.ClearUselessEffects();
            }
        }