private void txtBoxOffensiveRoll_TextChanged(object sender, EventArgs e) { double d1; Double.TryParse(txtBoxOffensiveRoll.Text, out d1); d1 += _attacker.CombatStuff.CombatOB; d1 += Utilities.GetWeaponByName(comboBoxAttackerWeapon.Text).OffensiveBonus; d1 += _attacker.CombatStuff.CombatShield.OffensiveBonus; d1 += Utilities.GetTotalOffensiveBonusOfAllArmor(_attacker); d1 += CombatScripts.GetWeightFactor(_attacker); d1 = d1 * CombatScripts.GetStaminaFactor(_attacker); labelAfterOffensiveMods.Text = d1.ToString(); }
private void txtBoxDefensiveRoll_TextChanged(object sender, EventArgs e) { double d1; Double.TryParse(txtBoxDefensiveRoll.Text, out d1); Character _defender = Utilities.getCharacterFromXmlOrCombatHolderByString(comboBox1.Text); d1 += _defender.CombatStuff.CombatDB; d1 += Utilities.GetWeaponByName(comboBoxDefenderWeapon.Text).DefensiveBonus; d1 += _defender.CombatStuff.CombatShield.DefensiveBonus; d1 += Utilities.GetTotalDefensiveBonusOfAllArmor(_defender); d1 += CombatScripts.GetWeightFactor(_defender); d1 = d1 * CombatScripts.GetStaminaFactor(_defender); labelAfterDefensiveMods.Text = d1.ToString(); }
public void ChangeStatLabels() { //Now, fill out some labels about the attacker's stats Character statCharacter = Utilities.getCharacterFromXmlOrCombatHolderByString(cboBoxChar1.Text); lblHealth.Text = "Health: " + Convert.ToString(CombatScripts.GetBaseHealth(statCharacter)); lblStamina.Text = "Stamina: " + Convert.ToString(CombatScripts.GetBaseStamina(statCharacter)); statCharacter.CombatStuff.CombatWeapon = statCharacter.Weapons.Find(A => A.ItemName == cboBoxWeapon1.Text) ?? new Weapon(); statCharacter.CombatStuff.CombatShield = statCharacter.Shields.Find(A => A.ItemName == cboBoxShield1.Text) ?? new Shield(); double attackerWeightFactor = CombatScripts.GetWeightFactor(statCharacter); lblWeightFactor.Text = "WeightFactor: " + Convert.ToString(CombatScripts.GetWeightFactor(statCharacter)); double dxMod1 = (Convert.ToDouble(statCharacter.Statistics.Dexterity + EffectHolder.GetValidEffectsByEffect(statCharacter, EffectHolder.EffectType.Dexterity)) - 10) / 2; double attackerReflex = CombatScripts.GetBaseReflex(statCharacter); lblReflex.Text = "Reflex: " + attackerReflex.ToString(); }
public static string CombatTerminal(Character c) { var doc = new HtmlDocument(); doc.Load("HTMLPages\\CombatTerminal.html"); doc.GetElementbyId("menuform").Attributes["action"].Value = BaseURL(); doc.GetElementbyId("inventoryform").Attributes["action"].Value = BaseURL() + "/Combat/" + c.CombatStuff.CombatName + "/Inventory"; doc.GetElementbyId("combatform").Attributes["action"].Value = CombatTerminalPage(c); doc.GetElementbyId("CharacterName").InnerHtml = c.Name; doc.GetElementbyId("str").InnerHtml = c.Statistics.Strength.ToString(); doc.GetElementbyId("dex").InnerHtml = c.Statistics.Dexterity.ToString(); doc.GetElementbyId("con").InnerHtml = c.Statistics.Constitution.ToString(); doc.GetElementbyId("int").InnerHtml = c.Statistics.Intelligence.ToString(); doc.GetElementbyId("wis").InnerHtml = c.Statistics.Wisdom.ToString(); doc.GetElementbyId("cha").InnerHtml = c.Statistics.Charisma.ToString(); doc.GetElementbyId("hp").InnerHtml = ((int)(c.HitPoints + EffectHolder.GetValidEffectsByEffect(c, EffectHolder.EffectType.Health))).ToString(); doc.GetElementbyId("stamina").InnerHtml = ((int)c.Stamina).ToString(); doc.GetElementbyId("regen").InnerHtml = EffectHolder.GetValidEffectsByEffect(c, EffectHolder.EffectType.Regeneration).ToString(); doc.GetElementbyId("exhaustion").InnerHtml = (Math.Round(1.0 / CombatScripts.GetStaminaFactor(c), 2)).ToString(); doc.GetElementbyId("obmod").InnerHtml = (EffectHolder.GetValidEffectsByEffect(c, EffectHolder.EffectType.OB)).ToString(); doc.GetElementbyId("dbmod").InnerHtml = (EffectHolder.GetValidEffectsByEffect(c, EffectHolder.EffectType.DB)).ToString(); doc.GetElementbyId("focus").InnerHtml = (EffectHolder.GetValidEffectsByEffect(c, EffectHolder.EffectType.Focus)).ToString(); doc.GetElementbyId("weightfactor").InnerHtml = (Math.Round(CombatScripts.GetWeightFactor(c), 2)).ToString(); doc.GetElementbyId("reflex").InnerHtml = (Math.Round(CombatScripts.CalculateReflex(c, 0), 2)).ToString(); doc.GetElementbyId("offbonus").Attributes["value"].Value = c.CombatStuff.CombatOB.ToString(); doc.GetElementbyId("defbonus").Attributes["value"].Value = c.CombatStuff.CombatDB.ToString(); doc.GetElementbyId("roll").Attributes["value"].Value = c.CombatStuff.CombatRoll.ToString(); doc.GetElementbyId("spellpower").Attributes["value"].Value = c.CombatStuff.SpellsToCast[0].spellPower.ToString(); foreach (Character target in CombatHolder._inCombatChars) { if (target.CombatStuff.CombatName == c.LastAttackTargetSelected) { doc.GetElementbyId("targets").InnerHtml += "\r\n<option selected>" + target.CombatStuff.CombatName; } else { doc.GetElementbyId("targets").InnerHtml += "\r\n<option>" + target.CombatStuff.CombatName; } if (target.CombatStuff.CombatName == c.LastSpellTargetSelected) { doc.GetElementbyId("spelltargets").InnerHtml += "\r\n<option selected>" + target.CombatStuff.CombatName; } else { doc.GetElementbyId("spelltargets").InnerHtml += "\r\n<option>" + target.CombatStuff.CombatName; } } foreach (Weapon weap in c.Weapons) { if (weap == c.CombatStuff.CombatWeapon) { doc.GetElementbyId("weapons").InnerHtml += "\r\n<option selected>" + weap.ItemName; } else { doc.GetElementbyId("weapons").InnerHtml += "\r\n<option>" + weap.ItemName; } } foreach (Shield sh in c.Shields) { if (sh == c.CombatStuff.CombatShield) { doc.GetElementbyId("shields").InnerHtml += "\r\n<option selected>" + sh.ItemName; } else { doc.GetElementbyId("shields").InnerHtml += "\r\n<option>" + sh.ItemName; } } foreach (Spell sp in c.Spells) { if (sp == c.CombatStuff.SpellsToCast[0].spell) { doc.GetElementbyId("spells").InnerHtml += "\r\n<option selected>" + sp.SpellName; } else { doc.GetElementbyId("spells").InnerHtml += "\r\n<option>" + sp.SpellName; } } if (c.CombatStuff.SpellsToCast[0].targets.Any()) { doc.GetElementbyId("attacks").InnerHtml += "\r\n<p>Casting " + c.CombatStuff.SpellsToCast[0].spell.SpellName + " at:"; foreach (Character target in c.CombatStuff.SpellsToCast[0].targets) { doc.GetElementbyId("attacks").InnerHtml += target.CombatStuff.CombatName + "<br>"; } doc.GetElementbyId("attacks").InnerHtml += " </ p > "; } foreach (Character attacking in CombatHolder._makingAttackChars) { doc.GetElementbyId("attacks").InnerHtml += "\r\n<p>" + attacking.CombatStuff.CombatName + " is attacking:"; foreach (Character beingattacked in attacking.CombatStuff.targets) { doc.GetElementbyId("attacks").InnerHtml += beingattacked.CombatStuff.CombatName + "<br>"; } doc.GetElementbyId("attacks").InnerHtml += "with " + attacking.CombatStuff.CombatWeapon.ItemName + " </ p > "; } doc.GetElementbyId("attackresults").InnerHtml += " </ p > "; foreach (List <String> attack in c.CombatStuff.attackResultsForDisplay) { doc.GetElementbyId("attackresults").InnerHtml += "\r\n<p>ATTACK<br>"; foreach (string str in attack) { if (str.Length > 7 && str.Substring(0, 7) == "http://") { doc.GetElementbyId("attackresults").InnerHtml += "<a href=\"" + str + "\">Display Attack</a>"; } else { doc.GetElementbyId("attackresults").InnerHtml += str + "<br>"; } } doc.GetElementbyId("attackresults").InnerHtml += " </ p > "; } foreach (List <String> defence in c.CombatStuff.defendResultsForDisplay) { doc.GetElementbyId("attackresults").InnerHtml += "\r\n<p>DEFENCE<br>"; foreach (string str in defence) { if (str.Length > 7 && str.Substring(0, 7) == "http://") { doc.GetElementbyId("attackresults").InnerHtml += "<a href=\"" + str + "\">Display Defense</a>"; } else { doc.GetElementbyId("attackresults").InnerHtml += str + "<br>"; } } doc.GetElementbyId("attackresults").InnerHtml += " </ p > "; } foreach (SpellToCast castSpell in c.CombatStuff.spellResultsForDisplay) { doc.GetElementbyId("attackresults").InnerHtml += "\r\n<p>SPELL<br>"; foreach (Effect eff in castSpell.effectResult.Keys) { doc.GetElementbyId("attackresults").InnerHtml += eff.getDisplayString() + "<br>"; } doc.GetElementbyId("attackresults").InnerHtml += " </ p > "; } String lastAttackExp = "\r\n<p style =\"white-space: pre-line;\">\nLast Attack Explanation\n"; lastAttackExp += c.CombatStuff.AttackNotes.DisplayResults() + "<br></p>"; doc.GetElementbyId("attackresults").InnerHtml += lastAttackExp; String lastDefenceExp = "\r\n<p style =\"white-space: pre-line;\">\nLast Defence Explanation\n"; lastDefenceExp += c.CombatStuff.DefendNotes.DisplayResults() + "<br></p>"; doc.GetElementbyId("attackresults").InnerHtml += lastDefenceExp; //nodename.Attributes["value"].Value = c.Name; // < option > thief var bleh = doc.DocumentNode.OuterHtml; return(bleh); /* * ret += wItemName + "<br>\n"; * ret += w.Description + "<br>\n"; * foreach (Utilities.DamageType dt in w.DamageTypes.Keys) * { * ret += dt.ToString() + " " + w.DamageTypes[dt] + "<br>\n"; * } * ret += EndBit();*/ }