public static void LoadMonsterConditions() { if (!MonsterConditionsLoaded) { int success = 0; int failure = 0; foreach (Monster monster in Monster.Monsters) { if (monster.SpecialAbilitiesList != null) { foreach (SpecialAbility sa in monster.SpecialAbilitiesList) { if (sa.Name == "Disease" || sa.Name == "Poison") { Affliction a = Affliction.FromSpecialAbility(monster, sa); if (a == null) { failure++; //System.Diagnostics.Debug.WriteLine(monster.Name + " - " + sa.Name); } else { success++; Condition c = new Condition(); c.Name = a.Name; c.Affliction = a; if (sa.Name == "Disease") { c.Image = "disease"; } else { c.Image = "poison"; } Conditions.Add(c); monster.UsableConditions.Add(c); } } } } } if (failure > 0) { System.Diagnostics.Debug.WriteLine("Afflictions: Succeeded: " + success + " Failed: " + failure); } _MonsterConditionsLoaded = true; } }
public Condition(Condition c) { _Name = c._Name; _Text = c._Text; _Image = c._Image; _Spell = c._Spell; _Custom = c._Custom; if (c._Bonus != null) { _Bonus = new ConditionBonus(c._Bonus); } if (c._Affliction != null) { _Affliction = (Affliction)c._Affliction.Clone(); } }
public static string AfflictionHtml(Affliction af) { StringBuilder blocks = new StringBuilder(); blocks.CreateHtmlHeader(); blocks.AppendEscapedTag("p", "bolded", af.Name); blocks.AppendOpenTag("p"); blocks.AppendHtml(af.Text); blocks.AppendCloseTag("p"); blocks.CreateHtmlFooter(); return(blocks.ToString()); }
public Affliction(Affliction a) { _Name = a._Name; _Type = a._Type; _Cause = a._Cause; _SaveType = a._SaveType; _Save = a._Save; if (a._Onset != null) { _Onset = (DieRoll)a._Onset.Clone(); } _OnsetUnit = a._OnsetUnit; _Immediate = a._Immediate; _Frequency = a._Frequency; _FrequencyUnit = a._FrequencyUnit; _Limit = a._Limit; _LimitUnit = a._LimitUnit; _Once = a._Once; if (a._DamageDie != null) { _DamageDie = (DieRoll)a._DamageDie.Clone(); } _DamageType = a._DamageType; _IsDamageDrain = a.IsDamageDrain; if (a._SecondaryDamageDie != null) { _SecondaryDamageDie = (DieRoll)a._SecondaryDamageDie.Clone(); } _SecondaryDamageType = a._SecondaryDamageType; _IsSecondaryDamageDrain = a._IsSecondaryDamageDrain; _DamageExtra = a._DamageExtra; _SpecialEffectName = a._SpecialEffectName; if (a._SpecialEffectTime != null) { _SpecialEffectTime = (DieRoll)a._SpecialEffectTime.Clone(); } _SpecialEffectUnit = a._SpecialEffectUnit; _OtherEffect = a.OtherEffect; _Cure = a._Cure; _Details = a._Details; _Cost = a._Cost; }
public static Affliction FromSpecialAbility(Monster monster, SpecialAbility sa) { Affliction a = null; Regex reg = new Regex(RegexString, RegexOptions.IgnoreCase); Match m = reg.Match(sa.Text); if (m.Success) { a = new Affliction(); a.Type = sa.Name; if (m.Groups["afflictionname"].Success && m.Groups["afflictionname"].Value.Trim().Length > 0) { a.Name = m.Groups["afflictionname"].Value.Trim(); a.Name = a.Name.Capitalize(); if (a.Name == "Filth Fever") { a.Name += " - " + monster.Name; } } else { a.Name = monster.Name + " " + a.Type; } if (m.Groups["cause"].Success) { a.Cause = m.Groups["cause"].Value.Trim(); } a.SaveType = m.Groups["savetype"].Value; a.Save = int.Parse(m.Groups["savedc"].Value); if (m.Groups["onset"].Success) { if (m.Groups["immediateonset"].Success) { a.Immediate = true; } else { a.Onset = GetDie(m.Groups["onsetdie"].Value); a.OnsetUnit = m.Groups["onsetunit"].Value; } } if (m.Groups["once"].Success) { a.Once = true; } else { a.Frequency = int.Parse(m.Groups["frequencycount"].Value); a.FrequencyUnit = m.Groups["frequencyunit"].Value; if (m.Groups["Limit"].Success) { a.Limit = int.Parse(m.Groups["limitcount"].Value); a.LimitUnit = m.Groups["limittype"].Value; } } if (m.Groups["damageeffect"].Success) { a.DamageDie = GetDie(m.Groups["damagedie"].Value); a.DamageType = m.Groups["damagetype"].Value; if (m.Groups["secondarydamagedie"].Success) { a.SecondaryDamageDie = GetDie(m.Groups["secondarydamagedie"].Value); a.SecondaryDamageType = m.Groups["secondarydamagetype"].Value; } } else if (m.Groups["specialeffect"].Success) { a.SpecialEffectTime = GetDie(m.Groups["specialeffectdie"].Value); a.SpecialEffectName = m.Groups["specialeffectname"].Value; a.SpecialEffectUnit = m.Groups["specialeffectunit"].Value; } else if (m.Groups["othereffect"].Success) { a.OtherEffect = m.Groups["othereffect"].Value.Trim(); } a.Cure = m.Groups["cure"].Value; if (m.Groups["details"].Success) { a.Details = m.Groups["details"].Value.Trim(); } } return(a); }