private void FOLLOWTHETACO_Click(object sender, EventArgs e) { List <AttackOutcome> followedTacos = new List <AttackOutcome>(); foreach (AttackOutcome tacoToFollow in allAttacks) { AttackOutcome followedTaco = CombatScripts.RunCombat(tacoToFollow.Attacker, tacoToFollow.Defender, tacoToFollow.attackRoll, tacoToFollow.defendRoll, null); followedTaco.Attacker.CombatStuff.AttackNotes = followedTaco.Notes; followedTaco.Defender.CombatStuff.DefendNotes = followedTaco.Notes; followedTacos.Add(followedTaco); } CombatScripts.fatigueCharactersAndRecordCombat(followedTacos); foreach (AttackOutcome Whack in followedTacos) { CombatScripts.applyAttackOutcome(Whack); } EffectHolder.ClearUselessEffects(); CombatHolder.MoveAttackingCharsToHasAttackedChars(); if (CombatHolder._masterOfDeclarations != null) { CombatHolder._masterOfDeclarations.UpdateRTB(); } CombatHolder.updateCombatDeclarations(); AfterCrits frmCreator = new AfterCrits(); frmCreator.Show(); Master_Attacker frmCloser = this; frmCloser.Hide(); }
private void resolveSpells(bool updateboxes) { foreach (SpellToCast stc in spells) { foreach (Effect eff in stc.effectResult.Keys) { EffectHolder.CreateEffect(eff, stc.effectResult[eff], false); } foreach (AttackOutcome ao in stc.weaponResult) { CombatScripts.applyAttackOutcome(ao); } stc.caster.Stamina -= stc.spell.SpellCost; attemptToAddResult(stc.caster, stc); foreach (Character c in stc.targets) { attemptToAddResult(c, stc); } stc.targets.Clear(); stc.spellPower = 0; } EffectHolder.ClearUselessEffects(); if (updateboxes) { if (CombatHolder._masterOfDeclarations != null) { CombatHolder._masterOfDeclarations.UpdateRTB(); } CombatHolder.updateCombatDeclarations(); } SpellResults frmCloser = this; frmCloser.Hide(); }
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(); } }