private void OKBtn_Click(object sender, EventArgs e) { List <Guid> guids = new List <Guid>(); foreach (Guid key in this.fRolls.Keys) { if (!this.fRolls.ContainsKey(key)) { continue; } int item = this.fRolls[key]; CreaturePower _power = this.get_power(key); if (_power == null || _power.Action == null || _power.Action.Recharge == "") { continue; } int _minimum = this.get_minimum(_power.Action.Recharge); if (_minimum == 0 || item < _minimum) { continue; } guids.Add(key); } foreach (Guid guid in guids) { CommandManager.GetInstance().ExecuteCommand(new UseRechargePowerCommand(this.fData, guid, UseRechargePowerCommand.RechargePowerAction.RechargePower)); } }
public PowerInfoForm(CreaturePower power) { InitializeComponent(); NameBox.Text = power.Name; KeywordBox.Text = power.Keywords; }
private void OKBtn_Click(object sender, EventArgs e) { List <Guid> obsolete = new List <Guid>(); foreach (Guid power_id in fRolls.Keys) { if (!fRolls.ContainsKey(power_id)) { continue; } int roll = fRolls[power_id]; CreaturePower power = get_power(power_id); if ((power == null) || (power.Action == null) || (power.Action.Recharge == "")) { continue; } int min = get_minimum(power.Action.Recharge); if ((min != 0) && (roll >= min)) { obsolete.Add(power_id); } } foreach (Guid power_id in obsolete) { fData.UsedPowers.Remove(power_id); } }
public PowerForm(CreaturePower power, bool functional_template, bool unused) { this.InitializeComponent(); this.Pages.TabPages.Remove(this.AdvicePage); this.RangeBox.Items.Add("Melee"); this.RangeBox.Items.Add("Melee Touch"); this.RangeBox.Items.Add("Melee Weapon"); this.RangeBox.Items.Add("Melee N"); this.RangeBox.Items.Add("Reach N"); this.RangeBox.Items.Add("Ranged N"); this.RangeBox.Items.Add("Close Blast N"); this.RangeBox.Items.Add("Close Burst N"); this.RangeBox.Items.Add("Area Burst N within N"); this.RangeBox.Items.Add("Personal"); this.fPower = power.Copy(); this.fFunctionalTemplate = functional_template; this.NameBox.Text = this.fPower.Name; this.KeywordBox.Text = this.fPower.Keywords; this.ConditionBox.Text = this.fPower.Condition; this.update_action(); this.update_attack(); this.RangeBox.Text = this.fPower.Range; this.DetailsBox.Text = this.fPower.Details; this.DescBox.Text = this.fPower.Description; }
private void ReadAttackDetailsBlock(string html, CreaturePower cp, string action) { cp.Details = CleanHtml(html); if (_regRange.IsMatch(cp.Details)) { string[] temp = cp.Details.Split(new char[] { ';' }, 2, StringSplitOptions.RemoveEmptyEntries); cp.Details = temp[1].Trim(); cp.Range = temp[0].Trim(); } if (cp.Action != null) // not a trait { cp.ExtractAttackDetails(); Match match = _regConditionsFrequency.Match(cp.Action.Trigger); if (match.Success) { // Charnel Cinderhouse Crushing Prison (free 1/round, at-will) cp.Condition = cp.Action.Trigger; cp.Action.Trigger = String.Empty; } if (action.ToLower().StartsWith("when ") && String.IsNullOrEmpty(cp.Action.Trigger)) { // Charnel Cinderhouse Crushing Prison /Charnel Pyre cp.Action.Trigger = action; cp.Action.Action = ActionType.Reaction; } } }
public PowerBuilderForm(CreaturePower power, ICreature creature, bool functional_template) { this.InitializeComponent(); this.fPower = power; this.fCreature = creature; this.fFromFunctionalTemplate = functional_template; this.refresh_examples(); this.update_statblock(); }
void add_power(CreaturePower power) { ThemePowerData tpd = new ThemePowerData(); tpd.Power = power; fTheme.Powers.Add(tpd); update_powers(); }
private void add_power(CreaturePower power) { ThemePowerData themePowerDatum = new ThemePowerData() { Power = power }; this.fTheme.Powers.Add(themePowerDatum); this.update_powers(); }
public AttackRollForm(CreaturePower power, Encounter enc) { this.InitializeComponent(); Application.Idle += new EventHandler(this.Application_Idle); this.fPower = power; this.fEncounter = enc; this.add_attack_roll(null); this.update_damage(); this.RollDamageBtn_Click(null, null); }
private void PowerDownBtn_Click(object sender, EventArgs e) { int index = fNPC.CreaturePowers.IndexOf(SelectedPower); CreaturePower tmp = fNPC.CreaturePowers[index + 1]; fNPC.CreaturePowers[index + 1] = SelectedPower; fNPC.CreaturePowers[index] = tmp; update_powers_list(); PowerList.Items[index + 1].Selected = true; }
private void PowerDisplay_Navigating(object sender, WebBrowserNavigatingEventArgs e) { if (e.Url.Scheme == "copy") { Guid guid = new Guid(e.Url.LocalPath); CreaturePower creaturePower = this.find_power(guid); if (creaturePower != null) { e.Cancel = true; this.copy_power(creaturePower); } } }
private void PowerAddBtn_Click(object sender, EventArgs e) { CreaturePower creaturePower = new CreaturePower() { Name = "New Power" }; PowerBuilderForm powerBuilderForm = new PowerBuilderForm(creaturePower, null, false); if (powerBuilderForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.add_power(powerBuilderForm.Power); } }
private void PowerAddBtn_Click(object sender, EventArgs e) { CreaturePower power = new CreaturePower(); power.Name = "New Power"; PowerBuilderForm dlg = new PowerBuilderForm(power, null, false); if (dlg.ShowDialog() == DialogResult.OK) { add_power(dlg.Power); } }
private void PowerAddBtn_Click(object sender, EventArgs e) { CreaturePower p = new CreaturePower(); p.Name = "New Power"; PowerBuilderForm dlg = new PowerBuilderForm(p, fNPC, false); if (dlg.ShowDialog() == DialogResult.OK) { fNPC.CreaturePowers.Add(dlg.Power); update_powers_list(); } }
public PowerRangeForm(CreaturePower power) { this.InitializeComponent(); this.RangeBox.Items.Add("Melee"); this.RangeBox.Items.Add("Melee Touch"); this.RangeBox.Items.Add("Melee Weapon"); this.RangeBox.Items.Add("Melee N"); this.RangeBox.Items.Add("Reach N"); this.RangeBox.Items.Add("Ranged N"); this.RangeBox.Items.Add("Close Blast N"); this.RangeBox.Items.Add("Close Burst N"); this.RangeBox.Items.Add("Area Burst N within N"); this.RangeBox.Items.Add("Personal"); this.RangeBox.Text = power.Range; }
private void copy_power(CreaturePower power) { CreaturePower creaturePower = power.Copy(); creaturePower.ID = Guid.NewGuid(); if (this.fCallback == null) { this.fSelectedPower = power; base.DialogResult = System.Windows.Forms.DialogResult.OK; base.Close(); return; } this.fCallback(creaturePower); this.fAddedPowers.Add(creaturePower.Name); this.update_powers(); }
private bool CreaturesEqual(Creature fromDDI, Creature fromMP, string MpBugPowerName) { Assert.IsNotNull(fromMP, fromDDI.Name + " not found in " + Libraries.Count + " test libraries"); if (!String.IsNullOrEmpty(MpBugPowerName)) { // Try to fix a masterplan bug CreaturePower correct = fromMP.CreaturePowers.Single(x => x.Name == MpBugPowerName); if (String.IsNullOrEmpty(correct.Details)) { correct.Details = correct.Range; Assert.IsFalse(String.IsNullOrEmpty(correct.Range)); correct.Range = String.Empty; } } return(CreaturesEqual(fromDDI, fromMP)); }
public static void UpdatePowerRange(ICreature c, CreaturePower power) { if (power.Range != null && power.Range != "") { return; } List <string> strs = new List <string>() { "close blast", "close burst", "area burst", "melee", "ranged" }; string str = ""; string details = power.Details; string[] strArrays = new string[] { ";" }; string[] strArrays1 = details.Split(strArrays, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < (int)strArrays1.Length; i++) { string str1 = strArrays1[i]; bool flag = false; foreach (string str2 in strs) { if (!str1.ToLower().Contains(str2)) { continue; } flag = true; break; } if (!flag) { if (str != "") { str = string.Concat(str, "; "); } str = string.Concat(str, str1); } else { power.Range = str1; } } power.Details = str; }
public static void UpdatePowerRange(ICreature c, CreaturePower power) { if ((power.Range != null) && (power.Range != "")) { return; } List <string> ranges = new List <string>(); ranges.Add("close blast"); ranges.Add("close burst"); ranges.Add("area burst"); ranges.Add("melee"); ranges.Add("ranged"); string details = ""; string[] clauses = power.Details.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); foreach (string clause in clauses) { bool is_range_clause = false; foreach (string range in ranges) { if (clause.ToLower().Contains(range)) { is_range_clause = true; break; } } if (is_range_clause) { power.Range = clause; } else { if (details != "") { details += "; "; } details += clause; } } power.Details = details; }
public RechargeForm(CombatData data, EncounterCard card) { this.InitializeComponent(); Application.Idle += new EventHandler(this.Application_Idle); this.fData = data; this.fCard = card; this.Text = string.Concat("Power Recharging: ", this.fData.DisplayName); foreach (Guid usedPower in this.fData.UsedPowers) { CreaturePower _power = this.get_power(usedPower); if (_power == null || _power.Action == null || _power.Action.Recharge == "") { continue; } this.fRolls[usedPower] = Session.Dice(1, 6); } this.update_list(); }
private void PowerBrowserBtn_Click(object sender, EventArgs e) { int level = (fCreature != null) ? fCreature.Level : 0; IRole role = (fCreature != null) ? fCreature.Role : null; PowerBrowserForm dlg = new PowerBrowserForm(null, level, role, null); if (dlg.ShowDialog() == DialogResult.OK) { if (dlg.SelectedPower != null) { fPower = dlg.SelectedPower.Copy(); fPower.ID = Guid.NewGuid(); update_statblock(); } } }
void copy_power(CreaturePower power) { CreaturePower cp = power.Copy(); cp.ID = Guid.NewGuid(); if (fCallback != null) { fCallback(cp); fAddedPowers.Add(cp.Name); update_powers(); } else { fSelectedPower = power; DialogResult = DialogResult.OK; Close(); } }
public static void AdjustPowerLevel(CreaturePower cp, int delta) { if (cp.Attack != null) { PowerAttack attack = cp.Attack; attack.Bonus = attack.Bonus + delta; } string str = AI.ExtractDamage(cp.Details); if (str != "") { DiceExpression diceExpression = DiceExpression.Parse(str); if (diceExpression != null) { DiceExpression diceExpression1 = diceExpression.Adjust(delta); if (diceExpression1 != null && diceExpression.ToString() != diceExpression1.ToString()) { cp.Details = cp.Details.Replace(str, string.Concat(diceExpression1, " damage")); } } } }
private void PowerBrowserBtn_Click(object sender, EventArgs e) { IRole role; int num = (this.fCreature != null ? this.fCreature.Level : 0); if (this.fCreature != null) { role = this.fCreature.Role; } else { role = null; } PowerBrowserForm powerBrowserForm = new PowerBrowserForm(null, num, role, null); if (powerBrowserForm.ShowDialog() == System.Windows.Forms.DialogResult.OK && powerBrowserForm.SelectedPower != null) { this.fPower = powerBrowserForm.SelectedPower.Copy(); this.fPower.ID = Guid.NewGuid(); this.update_statblock(); } }
public static void AdjustPowerLevel(CreaturePower cp, int delta) { if (cp.Attack != null) { cp.Attack.Bonus += delta; } // Adjust power damage string dmg_str = AI.ExtractDamage(cp.Details); if (dmg_str != "") { DiceExpression exp = DiceExpression.Parse(dmg_str); if (exp != null) { DiceExpression exp_adj = exp.Adjust(delta); if ((exp_adj != null) && (exp.ToString() != exp_adj.ToString())) { cp.Details = cp.Details.Replace(dmg_str, exp_adj + " damage"); } } } }
private CreaturePower find_power(Guid id) { CreaturePower creaturePower; List <CreaturePower> .Enumerator enumerator = this.fTemplate.CreaturePowers.GetEnumerator(); try { while (enumerator.MoveNext()) { CreaturePower current = enumerator.Current; if (current.ID != id) { continue; } creaturePower = current; return(creaturePower); } return(null); } finally { ((IDisposable)enumerator).Dispose(); } }
public RechargeForm(CombatData data, EncounterCard card) { InitializeComponent(); Application.Idle += new EventHandler(Application_Idle); fData = data; fCard = card; Text = "Power Recharging: " + fData.DisplayName; foreach (Guid power_id in fData.UsedPowers) { CreaturePower power = get_power(power_id); if ((power == null) || (power.Action == null) || (power.Action.Recharge == "")) { continue; } fRolls[power_id] = Session.Dice(1, 6); } update_list(); }
private void Browser_Navigating(object sender, WebBrowserNavigatingEventArgs e) { if (e.Url.Scheme == "build") { if (e.Url.LocalPath == "profile") { e.Cancel = true; CreatureTemplateProfileForm creatureTemplateProfileForm = new CreatureTemplateProfileForm(this.fTemplate); if (creatureTemplateProfileForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.fTemplate.Name = creatureTemplateProfileForm.Template.Name; this.fTemplate.Type = creatureTemplateProfileForm.Template.Type; this.fTemplate.Role = creatureTemplateProfileForm.Template.Role; this.fTemplate.Leader = creatureTemplateProfileForm.Template.Leader; this.update_statblock(); } } if (e.Url.LocalPath == "combat") { e.Cancel = true; CreatureTemplateStatsForm creatureTemplateStatsForm = new CreatureTemplateStatsForm(this.fTemplate); if (creatureTemplateStatsForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.fTemplate.HP = creatureTemplateStatsForm.Template.HP; this.fTemplate.Initiative = creatureTemplateStatsForm.Template.Initiative; this.fTemplate.AC = creatureTemplateStatsForm.Template.AC; this.fTemplate.Fortitude = creatureTemplateStatsForm.Template.Fortitude; this.fTemplate.Reflex = creatureTemplateStatsForm.Template.Reflex; this.fTemplate.Will = creatureTemplateStatsForm.Template.Will; this.update_statblock(); } } if (e.Url.LocalPath == "damage") { e.Cancel = true; if ((new DamageModListForm(this.fTemplate)).ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.update_statblock(); } } if (e.Url.LocalPath == "senses") { e.Cancel = true; DetailsForm detailsForm = new DetailsForm(this.fTemplate.Senses, "Senses", ""); if (detailsForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.fTemplate.Senses = detailsForm.Details; this.update_statblock(); } } if (e.Url.LocalPath == "movement") { e.Cancel = true; DetailsForm detailsForm1 = new DetailsForm(this.fTemplate.Movement, "Movement", ""); if (detailsForm1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.fTemplate.Movement = detailsForm1.Details; this.update_statblock(); } } if (e.Url.LocalPath == "tactics") { e.Cancel = true; DetailsForm detailsForm2 = new DetailsForm(this.fTemplate.Tactics, "Tactics", ""); if (detailsForm2.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.fTemplate.Tactics = detailsForm2.Details; this.update_statblock(); } } } if (e.Url.Scheme == "power") { if (e.Url.LocalPath == "addpower") { e.Cancel = true; CreaturePower creaturePower = new CreaturePower() { Name = "New Power", Action = new PowerAction() }; bool type = this.fTemplate.Type == CreatureTemplateType.Functional; PowerBuilderForm powerBuilderForm = new PowerBuilderForm(creaturePower, null, type); if (powerBuilderForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.fTemplate.CreaturePowers.Add(powerBuilderForm.Power); this.update_statblock(); } } if (e.Url.LocalPath == "addtrait") { e.Cancel = true; CreaturePower creaturePower1 = new CreaturePower() { Name = "New Trait", Action = null }; bool flag = this.fTemplate.Type == CreatureTemplateType.Functional; PowerBuilderForm powerBuilderForm1 = new PowerBuilderForm(creaturePower1, null, flag); if (powerBuilderForm1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.fTemplate.CreaturePowers.Add(powerBuilderForm1.Power); this.update_statblock(); } } if (e.Url.LocalPath == "addaura") { e.Cancel = true; Aura aura = new Aura() { Name = "New Aura", Details = "1" }; AuraForm auraForm = new AuraForm(aura); if (auraForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.fTemplate.Auras.Add(auraForm.Aura); this.update_statblock(); } } if (e.Url.LocalPath == "regenedit") { e.Cancel = true; Regeneration regeneration = this.fTemplate.Regeneration ?? new Regeneration(5, ""); RegenerationForm regenerationForm = new RegenerationForm(regeneration); if (regenerationForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.fTemplate.Regeneration = regenerationForm.Regeneration; this.update_statblock(); } } if (e.Url.LocalPath == "regenremove") { e.Cancel = true; this.fTemplate.Regeneration = null; this.update_statblock(); } } if (e.Url.Scheme == "poweredit") { CreaturePower creaturePower2 = this.find_power(new Guid(e.Url.LocalPath)); if (creaturePower2 != null) { e.Cancel = true; int power = this.fTemplate.CreaturePowers.IndexOf(creaturePower2); bool type1 = this.fTemplate.Type == CreatureTemplateType.Functional; PowerBuilderForm powerBuilderForm2 = new PowerBuilderForm(creaturePower2, null, type1); if (powerBuilderForm2.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.fTemplate.CreaturePowers[power] = powerBuilderForm2.Power; this.update_statblock(); } } } if (e.Url.Scheme == "powerremove") { CreaturePower creaturePower3 = this.find_power(new Guid(e.Url.LocalPath)); if (creaturePower3 != null) { e.Cancel = true; this.fTemplate.CreaturePowers.Remove(creaturePower3); this.update_statblock(); } } if (e.Url.Scheme == "auraedit") { Aura aura1 = this.find_aura(new Guid(e.Url.LocalPath)); if (aura1 != null) { e.Cancel = true; int num = this.fTemplate.Auras.IndexOf(aura1); AuraForm auraForm1 = new AuraForm(aura1); if (auraForm1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.fTemplate.Auras[num] = auraForm1.Aura; this.update_statblock(); } } } if (e.Url.Scheme == "auraremove") { Aura aura2 = this.find_aura(new Guid(e.Url.LocalPath)); if (aura2 != null) { e.Cancel = true; this.fTemplate.Auras.Remove(aura2); this.update_statblock(); } } }
private void add_power(CreaturePower power) { this.fTemplate.CreaturePowers.Add(power); this.update_statblock(); }
/// <summary> /// Set the recharge text, and PowerUse to Encounter /// </summary> /// <param name="html">The HTML.</param> /// <param name="cp">The cp.</param> private void CalculateRecharge(string html, CreaturePower cp, MonsterStatType version) { cp.Action.Use = PowerUseType.Encounter; //if (currentPar.InnerHtml.Contains("/images/symbol/1a.gif")) //{ // cp.Action.Recharge= //} if (html.Contains("/images/symbol/2a.gif")) { cp.Action.Recharge = "Recharges on 2-6"; return; } if (html.Contains("/images/symbol/3a.gif")) { cp.Action.Recharge = "Recharges on 3-6"; return; } if (html.Contains("/images/symbol/4a.gif")) { cp.Action.Recharge = "Recharges on 4-6"; return; } if (html.Contains("/images/symbol/5a.gif")) { cp.Action.Recharge = "Recharges on 5-6"; return; } if (html.Contains("/images/symbol/6a.gif")) { cp.Action.Recharge = "Recharges on 6"; return; } if (version == MonsterStatType.MM3) { html = html.Replace("<b>", ""); html = html.Replace("</b>", ""); cp.Action.Recharge = CleanExtraComma(GetTextUntilTag(html, null)); return; } string match = " at the end of the "; if (!html.Contains(match)) { match = " at the start "; } if (!html.Contains(match)) { match = " when "; } if (!html.Contains(match)) { match = " if "; } if (!html.Contains(match)) { match = " after "; } if (html.Contains(match)) { int pos = html.IndexOf(match); html = html.Substring(pos); cp.Action.Recharge = "Recharge " + CleanExtraComma(GetTextUntilTag(html, null)); if (cp.Action.Recharge.EndsWith(")")) { cp.Action.Recharge = cp.Action.Recharge.Substring(0, cp.Action.Recharge.Length - 1); } return; } if (html.ToLower().Contains(" , or recharge ")) // Ancien abyssal Wurm: <b>Recharge 6 , or recharge 5 while bloodied</b> { html = html.Replace("<b>", ""); cp.Action.Recharge = CleanExtraComma(GetTextUntilTag(html, null)); return; } throw new Exception("Invalid recharge value " + html); }