private void AttackBtn_Click(object sender, EventArgs e) { PowerAttackForm powerAttackForm = new PowerAttackForm(this.fAttack.Attack, false, 0, null); if (powerAttackForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.fAttack.Attack = powerAttackForm.Attack; this.AttackBtn.Text = this.fAttack.Attack.ToString(); } }
private void AttackBtn_Click(object sender, EventArgs e) { PowerAttackForm dlg = new PowerAttackForm(fAttack.Attack, false, 0, null); if (dlg.ShowDialog() == DialogResult.OK) { fAttack.Attack = dlg.Attack; AttackBtn.Text = fAttack.Attack.ToString(); } }
private void AttackBtn_Click(object sender, EventArgs e) { PowerAttack attack = this.fPower.Attack ?? new PowerAttack(); PowerAttackForm powerAttackForm = new PowerAttackForm(attack, this.fFunctionalTemplate, 0, null); if (powerAttackForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.fPower.Attack = powerAttackForm.Attack; this.update_attack(); this.update_advice(); } }
private void AttackBtn_Click(object sender, EventArgs e) { PowerAttack pa = fPower.Attack; if (pa == null) { pa = new PowerAttack(); } PowerAttackForm dlg = new PowerAttackForm(pa, fFunctionalTemplate, 0, null); if (dlg.ShowDialog() == DialogResult.OK) { fPower.Attack = dlg.Attack; update_attack(); update_advice(); } }
public PowerAttackForm(PowerAttack attack, bool functional_template, int level, IRole role) { this.InitializeComponent(); foreach (DefenceType value in Enum.GetValues(typeof(DefenceType))) { this.DefenceBox.Items.Add(value); } Application.Idle += new EventHandler(this.Application_Idle); this.fAttack = attack.Copy(); this.fFunctionalTemplate = functional_template; this.fLevel = level; this.fRole = role; this.BonusBox.Value = this.fAttack.Bonus; this.DefenceBox.SelectedItem = this.fAttack.Defence; this.set_suggestion(); if (!this.fFunctionalTemplate) { this.InfoLbl.Visible = false; PowerAttackForm height = this; height.Height = height.Height - this.InfoLbl.Height; } }
private void Browser_Navigating(object sender, WebBrowserNavigatingEventArgs e) { IRole role; if (e.Url.Scheme == "power") { if (e.Url.LocalPath == "info") { e.Cancel = true; PowerInfoForm powerInfoForm = new PowerInfoForm(this.fPower); if (powerInfoForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.fPower.Name = powerInfoForm.PowerName; this.fPower.Keywords = powerInfoForm.PowerKeywords; this.update_statblock(); } } if (e.Url.LocalPath == "action") { e.Cancel = true; PowerActionForm powerActionForm = new PowerActionForm(this.fPower.Action); if (powerActionForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.fPower.Action = powerActionForm.Action; this.refresh_examples(); this.update_statblock(); } } if (e.Url.LocalPath == "prerequisite") { e.Cancel = true; DetailsForm detailsForm = new DetailsForm(this.fPower.Condition, "Power Prerequisite", null); if (detailsForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.fPower.Condition = detailsForm.Details; this.update_statblock(); } } if (e.Url.LocalPath == "range") { e.Cancel = true; PowerRangeForm powerRangeForm = new PowerRangeForm(this.fPower); if (powerRangeForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.fPower.Range = powerRangeForm.PowerRange; this.update_statblock(); } } if (e.Url.LocalPath == "attack") { e.Cancel = true; PowerAttack attack = this.fPower.Attack ?? new PowerAttack(); int num = (this.fCreature != null ? this.fCreature.Level : 0); if (this.fCreature != null) { role = this.fCreature.Role; } else { role = null; } PowerAttackForm powerAttackForm = new PowerAttackForm(attack, this.fFromFunctionalTemplate, num, role); if (powerAttackForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.fPower.Attack = powerAttackForm.Attack; this.refresh_examples(); this.update_statblock(); } } if (e.Url.LocalPath == "clearattack") { e.Cancel = true; this.fPower.Attack = null; this.refresh_examples(); this.update_statblock(); } if (e.Url.LocalPath == "details") { e.Cancel = true; PowerDetailsForm powerDetailsForm = new PowerDetailsForm(this.fPower.Details, this.fCreature); if (powerDetailsForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.fPower.Details = powerDetailsForm.Details; this.update_statblock(); } } if (e.Url.LocalPath == "desc") { e.Cancel = true; DetailsForm detailsForm1 = new DetailsForm(this.fPower.Description, "Power Description", null); if (detailsForm1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.fPower.Description = detailsForm1.Details; this.update_statblock(); } } } if (e.Url.Scheme == "details") { if (e.Url.LocalPath == "refresh") { e.Cancel = true; this.refresh_examples(); this.update_statblock(); } try { int num1 = int.Parse(e.Url.LocalPath); e.Cancel = true; this.fPower.Details = this.fExamples[num1]; this.fExamples.RemoveAt(num1); if (this.fExamples.Count == 0) { this.refresh_examples(); } this.update_statblock(); } catch { } } }
private void Browser_Navigating(object sender, WebBrowserNavigatingEventArgs e) { if (e.Url.Scheme == "build") { if (e.Url.LocalPath == "profile") { e.Cancel = true; TrapProfileForm dlg = new TrapProfileForm(fTrap); if (dlg.ShowDialog() == DialogResult.OK) { fTrap.Name = dlg.Trap.Name; fTrap.Type = dlg.Trap.Type; fTrap.Level = dlg.Trap.Level; fTrap.Role = dlg.Trap.Role; fTrap.Initiative = dlg.Trap.Initiative; update_statblock(); } } if (e.Url.LocalPath == "readaloud") { e.Cancel = true; DetailsForm dlg = new DetailsForm(fTrap.ReadAloud, "Read-Aloud Text", null); if (dlg.ShowDialog() == DialogResult.OK) { fTrap.ReadAloud = dlg.Details; update_statblock(); } } if (e.Url.LocalPath == "desc") { e.Cancel = true; DetailsForm dlg = new DetailsForm(fTrap.Description, "Description", null); if (dlg.ShowDialog() == DialogResult.OK) { fTrap.Description = dlg.Details; update_statblock(); } } if (e.Url.LocalPath == "details") { e.Cancel = true; DetailsForm dlg = new DetailsForm(fTrap.Details, "Details", null); if (dlg.ShowDialog() == DialogResult.OK) { fTrap.Details = dlg.Details; update_statblock(); } } if (e.Url.LocalPath == "addskill") { e.Cancel = true; TrapSkillData tsd = new TrapSkillData(); tsd.SkillName = "Perception"; tsd.DC = AI.GetSkillDC(Difficulty.Moderate, fTrap.Level); TrapSkillForm dlg = new TrapSkillForm(tsd, fTrap.Level); if (dlg.ShowDialog() == DialogResult.OK) { fTrap.Skills.Add(dlg.SkillData); update_statblock(); } } if (e.Url.LocalPath == "addattack") { e.Cancel = true; TrapAttack ta = new TrapAttack(); ta.Name = "Attack"; fTrap.Attacks.Add(ta); update_statblock(); } if (e.Url.LocalPath == "addcm") { e.Cancel = true; string cm = ""; TrapCountermeasureForm dlg = new TrapCountermeasureForm(cm, fTrap.Level); if (dlg.ShowDialog() == DialogResult.OK) { fTrap.Countermeasures.Add(dlg.Countermeasure); update_statblock(); } } if (e.Url.LocalPath == "trigger") { e.Cancel = true; DetailsForm dlg = new DetailsForm(fTrap.Trigger, "Trigger", null); if (dlg.ShowDialog() == DialogResult.OK) { fTrap.Trigger = dlg.Details; update_statblock(); } } } if (e.Url.Scheme == "attackaction") { e.Cancel = true; Guid id = new Guid(e.Url.LocalPath); TrapAttack attack = fTrap.FindAttack(id); if (attack != null) { TrapActionForm dlg = new TrapActionForm(attack); if (dlg.ShowDialog() == DialogResult.OK) { attack.Name = dlg.Attack.Name; attack.Action = dlg.Attack.Action; attack.Range = dlg.Attack.Range; attack.Target = dlg.Attack.Target; update_statblock(); } } } if (e.Url.Scheme == "attackremove") { e.Cancel = true; Guid id = new Guid(e.Url.LocalPath); TrapAttack attack = fTrap.FindAttack(id); if (attack != null) { fTrap.Attacks.Remove(attack); update_statblock(); } } if (e.Url.Scheme == "attackattack") { e.Cancel = true; Guid id = new Guid(e.Url.LocalPath); TrapAttack attack = fTrap.FindAttack(id); if (attack != null) { PowerAttackForm dlg = new PowerAttackForm(attack.Attack, false, fTrap.Level, fTrap.Role); if (dlg.ShowDialog() == DialogResult.OK) { attack.Attack = dlg.Attack; update_statblock(); } } } if (e.Url.Scheme == "attackhit") { e.Cancel = true; Guid id = new Guid(e.Url.LocalPath); TrapAttack attack = fTrap.FindAttack(id); if (attack != null) { DetailsForm dlg = new DetailsForm(attack.OnHit, "On Hit", null); if (dlg.ShowDialog() == DialogResult.OK) { attack.OnHit = dlg.Details; update_statblock(); } } } if (e.Url.Scheme == "attackmiss") { e.Cancel = true; Guid id = new Guid(e.Url.LocalPath); TrapAttack attack = fTrap.FindAttack(id); if (attack != null) { DetailsForm dlg = new DetailsForm(attack.OnMiss, "On Miss", null); if (dlg.ShowDialog() == DialogResult.OK) { attack.OnMiss = dlg.Details; update_statblock(); } } } if (e.Url.Scheme == "attackeffect") { e.Cancel = true; Guid id = new Guid(e.Url.LocalPath); TrapAttack attack = fTrap.FindAttack(id); if (attack != null) { DetailsForm dlg = new DetailsForm(attack.Effect, "Effect", null); if (dlg.ShowDialog() == DialogResult.OK) { attack.Effect = dlg.Details; update_statblock(); } } } if (e.Url.Scheme == "attacknotes") { e.Cancel = true; Guid id = new Guid(e.Url.LocalPath); TrapAttack attack = fTrap.FindAttack(id); if (attack != null) { DetailsForm dlg = new DetailsForm(attack.Notes, "Notes", null); if (dlg.ShowDialog() == DialogResult.OK) { attack.Notes = dlg.Details; update_statblock(); } } } if (e.Url.Scheme == "skill") { e.Cancel = true; Guid id = new Guid(e.Url.LocalPath); TrapSkillData tsd = fTrap.FindSkill(id); if (tsd != null) { int index = fTrap.Skills.IndexOf(tsd); TrapSkillForm dlg = new TrapSkillForm(tsd, fTrap.Level); if (dlg.ShowDialog() == DialogResult.OK) { fTrap.Skills[index] = dlg.SkillData; update_statblock(); } } } if (e.Url.Scheme == "skillremove") { e.Cancel = true; Guid id = new Guid(e.Url.LocalPath); TrapSkillData tsd = fTrap.FindSkill(id); if (tsd != null) { fTrap.Skills.Remove(tsd); update_statblock(); } } if (e.Url.Scheme == "cm") { e.Cancel = true; int index = int.Parse(e.Url.LocalPath); string cm = fTrap.Countermeasures[index]; TrapCountermeasureForm dlg = new TrapCountermeasureForm(cm, fTrap.Level); if (dlg.ShowDialog() == DialogResult.OK) { fTrap.Countermeasures[index] = dlg.Countermeasure; update_statblock(); } } }
private void Browser_Navigating(object sender, WebBrowserNavigatingEventArgs e) { if (e.Url.Scheme == "build") { if (e.Url.LocalPath == "profile") { e.Cancel = true; TrapProfileForm trapProfileForm = new TrapProfileForm(this.fTrap); if (trapProfileForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.fTrap.Name = trapProfileForm.Trap.Name; this.fTrap.Type = trapProfileForm.Trap.Type; this.fTrap.Level = trapProfileForm.Trap.Level; this.fTrap.Role = trapProfileForm.Trap.Role; this.fTrap.Initiative = trapProfileForm.Trap.Initiative; this.update_statblock(); } } if (e.Url.LocalPath == "readaloud") { e.Cancel = true; DetailsForm detailsForm = new DetailsForm(this.fTrap.ReadAloud, "Read-Aloud Text", null); if (detailsForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.fTrap.ReadAloud = detailsForm.Details; this.update_statblock(); } } if (e.Url.LocalPath == "desc") { e.Cancel = true; DetailsForm detailsForm1 = new DetailsForm(this.fTrap.Description, "Description", null); if (detailsForm1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.fTrap.Description = detailsForm1.Details; this.update_statblock(); } } if (e.Url.LocalPath == "details") { e.Cancel = true; DetailsForm detailsForm2 = new DetailsForm(this.fTrap.Details, "Details", null); if (detailsForm2.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.fTrap.Details = detailsForm2.Details; this.update_statblock(); } } if (e.Url.LocalPath == "addskill") { e.Cancel = true; TrapSkillData trapSkillDatum = new TrapSkillData() { SkillName = "Perception", DC = AI.GetSkillDC(Difficulty.Moderate, this.fTrap.Level) }; TrapSkillForm trapSkillForm = new TrapSkillForm(trapSkillDatum, this.fTrap.Level); if (trapSkillForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.fTrap.Skills.Add(trapSkillForm.SkillData); this.update_statblock(); } } if (e.Url.LocalPath == "addattack") { e.Cancel = true; TrapAttack trapAttack = new TrapAttack() { Name = "Attack" }; this.fTrap.Attacks.Add(trapAttack); this.update_statblock(); } if (e.Url.LocalPath == "addcm") { e.Cancel = true; TrapCountermeasureForm trapCountermeasureForm = new TrapCountermeasureForm("", this.fTrap.Level); if (trapCountermeasureForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.fTrap.Countermeasures.Add(trapCountermeasureForm.Countermeasure); this.update_statblock(); } } if (e.Url.LocalPath == "trigger") { e.Cancel = true; DetailsForm detailsForm3 = new DetailsForm(this.fTrap.Trigger, "Trigger", null); if (detailsForm3.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.fTrap.Trigger = detailsForm3.Details; this.update_statblock(); } } } if (e.Url.Scheme == "attackaction") { e.Cancel = true; Guid guid = new Guid(e.Url.LocalPath); TrapAttack name = this.fTrap.FindAttack(guid); if (name != null) { TrapActionForm trapActionForm = new TrapActionForm(name); if (trapActionForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { name.Name = trapActionForm.Attack.Name; name.Action = trapActionForm.Attack.Action; name.Range = trapActionForm.Attack.Range; name.Target = trapActionForm.Attack.Target; this.update_statblock(); } } } if (e.Url.Scheme == "attackremove") { e.Cancel = true; Guid guid1 = new Guid(e.Url.LocalPath); TrapAttack trapAttack1 = this.fTrap.FindAttack(guid1); if (trapAttack1 != null) { this.fTrap.Attacks.Remove(trapAttack1); this.update_statblock(); } } if (e.Url.Scheme == "attackattack") { e.Cancel = true; Guid guid2 = new Guid(e.Url.LocalPath); TrapAttack attack = this.fTrap.FindAttack(guid2); if (attack != null) { PowerAttackForm powerAttackForm = new PowerAttackForm(attack.Attack, false, this.fTrap.Level, this.fTrap.Role); if (powerAttackForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { attack.Attack = powerAttackForm.Attack; this.update_statblock(); } } } if (e.Url.Scheme == "attackhit") { e.Cancel = true; Guid guid3 = new Guid(e.Url.LocalPath); TrapAttack details = this.fTrap.FindAttack(guid3); if (details != null) { DetailsForm detailsForm4 = new DetailsForm(details.OnHit, "On Hit", null); if (detailsForm4.ShowDialog() == System.Windows.Forms.DialogResult.OK) { details.OnHit = detailsForm4.Details; this.update_statblock(); } } } if (e.Url.Scheme == "attackmiss") { e.Cancel = true; Guid guid4 = new Guid(e.Url.LocalPath); TrapAttack details1 = this.fTrap.FindAttack(guid4); if (details1 != null) { DetailsForm detailsForm5 = new DetailsForm(details1.OnMiss, "On Miss", null); if (detailsForm5.ShowDialog() == System.Windows.Forms.DialogResult.OK) { details1.OnMiss = detailsForm5.Details; this.update_statblock(); } } } if (e.Url.Scheme == "attackeffect") { e.Cancel = true; Guid guid5 = new Guid(e.Url.LocalPath); TrapAttack details2 = this.fTrap.FindAttack(guid5); if (details2 != null) { DetailsForm detailsForm6 = new DetailsForm(details2.Effect, "Effect", null); if (detailsForm6.ShowDialog() == System.Windows.Forms.DialogResult.OK) { details2.Effect = detailsForm6.Details; this.update_statblock(); } } } if (e.Url.Scheme == "attacknotes") { e.Cancel = true; Guid guid6 = new Guid(e.Url.LocalPath); TrapAttack trapAttack2 = this.fTrap.FindAttack(guid6); if (trapAttack2 != null) { DetailsForm detailsForm7 = new DetailsForm(trapAttack2.Notes, "Notes", null); if (detailsForm7.ShowDialog() == System.Windows.Forms.DialogResult.OK) { trapAttack2.Notes = detailsForm7.Details; this.update_statblock(); } } } if (e.Url.Scheme == "skill") { e.Cancel = true; Guid guid7 = new Guid(e.Url.LocalPath); TrapSkillData trapSkillDatum1 = this.fTrap.FindSkill(guid7); if (trapSkillDatum1 != null) { int skillData = this.fTrap.Skills.IndexOf(trapSkillDatum1); TrapSkillForm trapSkillForm1 = new TrapSkillForm(trapSkillDatum1, this.fTrap.Level); if (trapSkillForm1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.fTrap.Skills[skillData] = trapSkillForm1.SkillData; this.update_statblock(); } } } if (e.Url.Scheme == "skillremove") { e.Cancel = true; Guid guid8 = new Guid(e.Url.LocalPath); TrapSkillData trapSkillDatum2 = this.fTrap.FindSkill(guid8); if (trapSkillDatum2 != null) { this.fTrap.Skills.Remove(trapSkillDatum2); this.update_statblock(); } } if (e.Url.Scheme == "cm") { e.Cancel = true; int countermeasure = int.Parse(e.Url.LocalPath); string item = this.fTrap.Countermeasures[countermeasure]; TrapCountermeasureForm trapCountermeasureForm1 = new TrapCountermeasureForm(item, this.fTrap.Level); if (trapCountermeasureForm1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.fTrap.Countermeasures[countermeasure] = trapCountermeasureForm1.Countermeasure; this.update_statblock(); } } }
private void Browser_Navigating(object sender, WebBrowserNavigatingEventArgs e) { if (e.Url.Scheme == "power") { if (e.Url.LocalPath == "info") { e.Cancel = true; PowerInfoForm dlg = new PowerInfoForm(fPower); if (dlg.ShowDialog() == DialogResult.OK) { fPower.Name = dlg.PowerName; fPower.Keywords = dlg.PowerKeywords; update_statblock(); } } if (e.Url.LocalPath == "action") { e.Cancel = true; PowerAction action = fPower.Action; PowerActionForm dlg = new PowerActionForm(action); if (dlg.ShowDialog() == DialogResult.OK) { fPower.Action = dlg.Action; refresh_examples(); update_statblock(); } } if (e.Url.LocalPath == "prerequisite") { e.Cancel = true; DetailsForm dlg = new DetailsForm(fPower.Condition, "Power Prerequisite", null); if (dlg.ShowDialog() == DialogResult.OK) { fPower.Condition = dlg.Details; update_statblock(); } } if (e.Url.LocalPath == "range") { e.Cancel = true; PowerRangeForm dlg = new PowerRangeForm(fPower); if (dlg.ShowDialog() == DialogResult.OK) { fPower.Range = dlg.PowerRange; update_statblock(); } } if (e.Url.LocalPath == "attack") { e.Cancel = true; PowerAttack attack = fPower.Attack; if (attack == null) { attack = new PowerAttack(); } int level = (fCreature != null) ? fCreature.Level : 0; IRole role = (fCreature != null) ? fCreature.Role : null; PowerAttackForm dlg = new PowerAttackForm(attack, fFromFunctionalTemplate, level, role); if (dlg.ShowDialog() == DialogResult.OK) { fPower.Attack = dlg.Attack; refresh_examples(); update_statblock(); } } if (e.Url.LocalPath == "clearattack") { e.Cancel = true; fPower.Attack = null; refresh_examples(); update_statblock(); } if (e.Url.LocalPath == "details") { e.Cancel = true; PowerDetailsForm dlg = new PowerDetailsForm(fPower.Details, fCreature); if (dlg.ShowDialog() == DialogResult.OK) { fPower.Details = dlg.Details; update_statblock(); } } if (e.Url.LocalPath == "desc") { e.Cancel = true; DetailsForm dlg = new DetailsForm(fPower.Description, "Power Description", null); if (dlg.ShowDialog() == DialogResult.OK) { fPower.Description = dlg.Details; update_statblock(); } } } if (e.Url.Scheme == "details") { if (e.Url.LocalPath == "refresh") { e.Cancel = true; refresh_examples(); update_statblock(); } try { int index = int.Parse(e.Url.LocalPath); e.Cancel = true; fPower.Details = fExamples[index]; fExamples.RemoveAt(index); if (fExamples.Count == 0) { refresh_examples(); } update_statblock(); } catch { // Not a number } } }