public SubEffect(SubEffect toCopy) { Amount = string.Copy(toCopy.Amount); Category = toCopy.Category; Type = string.Copy(toCopy.Type); Duration = string.Copy(toCopy.Duration); Stacks = string.Copy(toCopy.Stacks); Additional = string.Copy(toCopy.Additional); }
private static StringBuilder GenerateReplace(SubEffectInformation effect, SubEffect subEffect, Attack baseAttack) { // Syntax: <span class="TAGValue">VALUE</span> var replace = new StringBuilder(); var HTMLClass = SubEffect.GetHTMLClass(subEffect.Name); //// Put both total and damage per hit. if (effect.amount > -1) { // All amounts need clientside formatting. // Add information as data values so it can be recalculated in the browser when enemy level changes. replace.Append("<span class=\"").Append(HTMLClass).Append("\" data-effect=\"").Append(effect.name); if (effect.name.Equals("confusion")) replace.Append("1"); replace.Append("\" data-amount=\"").Append(effect.totalAmount).Append("\" data-weapon=\"").Append(baseAttack.Weapon).Append("\"></span>"); replace.Append(" ").Append(effect.suffix); } if (effect.totalDuration > 0) { if (effect.amount > -1) replace.Append(" over "); replace.Append(effect.totalDuration).Append(" second"); if (effect.totalDuration != 1.0) replace.Append("s"); } replace.Append(HitLengthStr(effect.totalLength)); if (effect.hitCount > 1 && (effect.amount > -1 || effect.duration > 0)) { // Same as above but for a single hit. replace.Append("<span class=\"secondary-info\"> ("); if (effect.amount > -1) { replace.Append("<span class=\"").Append(HTMLClass).Append("\" data-effect=\"").Append(effect.name); if (effect.name.Equals("confusion")) replace.Append("1"); replace.Append("\" data-amount=\"").Append(effect.amount).Append("\"></span>"); replace.Append(" ").Append(effect.suffix); } if (effect.duration > 0) { if (effect.amount > -1) replace.Append(" over "); replace.Append(effect.duration).Append(" second"); if (effect.totalDuration != 1.0) replace.Append("s"); } replace.Append(" per hit)</span>"); } if (effect.name.Equals("confusion")) { effect.suffix = "damage per skill usage"; replace.Append(". "); if (effect.amount > -1) { replace.Append("<span class=\"").Append(HTMLClass).Append("\" data-effect=\"").Append(effect.name).Append("2"); replace.Append("\" data-amount=\"").Append(effect.totalAmount).Append("\"></span>"); replace.Append(" ").Append(effect.suffix); } if (effect.duration > 0) { if (effect.amount > -1) replace.Append(" over "); replace.Append(effect.totalLength).Append(" second"); if (effect.totalLength != 1.0) replace.Append("s"); } replace.Append(HitLengthStr(effect.hitLength)); if (effect.hitCount > 1) { replace.Append("<span class=\"secondary-info\"> ("); if (effect.amount > -1) { replace.Append("<span class=\"").Append(HTMLClass).Append("\" data-effect=\"").Append(effect.name).Append("2"); if (effect.name.Equals("confusion")) replace.Append("1"); replace.Append("\" data-amount=\"").Append(effect.amount).Append("\"></span>"); replace.Append(" ").Append(effect.suffix); } if (effect.duration > 0) { if (effect.amount > -1) replace.Append(" over "); replace.Append(effect.duration).Append(" second"); if (effect.duration != 1.0) replace.Append("s"); } replace.Append(" per hit)</span>"); } } // Some effects can have variable or unknown hit count. Just add " per hit" in those cases. if (effect.variableHitCount) replace.Append(" per hit"); if (effect.hitFrequency > 0.01) { replace.Append(" every ").Append(effect.hitFrequency).Append(" second"); if (effect.hitFrequency != 1.0) replace.Append("s"); } if (subEffect.Name == EffectType.Buff) { // Add the buff name because people probably don't recognize all icons. replace.Append(" (").Append(effect.buff.Replace('_', ' ')).Append(")"); } return replace; }
private static SubEffectInformation HandleStackingRules(SubEffectInformation effectInformation, SubEffect subEffect) { if (subEffect.StacksDuration) { effectInformation.totalAmount = effectInformation.hitCount * effectInformation.amount * effectInformation.stacks; effectInformation.totalDuration = effectInformation.hitCount * effectInformation.duration * effectInformation.stacks; effectInformation.totalLength = effectInformation.hitLength; // 3 different values makes the effect very confusing so just remove the hit length. if (effectInformation.totalAmount > 0 && effectInformation.totalDuration > 0) effectInformation.totalLength = 0; effectInformation.stacks = 0; } else { effectInformation.amount = effectInformation.amount * effectInformation.stacks; effectInformation.totalAmount = effectInformation.hitCount * effectInformation.amount; effectInformation.totalDuration = 0; effectInformation.totalLength = effectInformation.hitLength + effectInformation.duration; // Without damage don't do "over X seconds". Instead, just add the duration (makes control work properly). if (effectInformation.amount == 0) { effectInformation.totalDuration = effectInformation.duration; effectInformation.duration = 0; } effectInformation.stacks = effectInformation.hitCount * effectInformation.stacks; } return effectInformation; }
private static SubEffectInformation ExtractInformation(SubEffectInformation effect, SubEffect subEffect, TagData text, Attack baseAttack, Enemy baseEnemy) { var effectType = subEffect.Name; var effectData = text.Data.Split(':'); effect.name = text.Tag.ToLower(); effect.amount = -1; effect.duration = 0.0; effect.stacks = 1; effect.buff = ""; effect.icon = effect.name; effect.suffix = "damage"; if (effectType == EffectType.Damage || effectType == EffectType.DamageFixed || effectType == EffectType.DamagePercent) { if (effectData[0].Equals("-")) effect.amount = baseAttack.Coefficient; else if (effectData[0].Equals("?")) effect.amount = -1; else effect.amount = Helper.ParseD(effectData[0]); effect.icon = "damage"; effect.stacks = 1; } else if (effectType == EffectType.Healing || effectType == EffectType.HealingPercent) { if (effectData[0].Equals("-")) effect.amount = baseAttack.Coefficient; else if (effectData[0].Equals("?")) effect.amount = -1; else effect.amount = Helper.ParseD(effectData[0]); effect.suffix = "healing"; effect.icon = "healing"; effect.stacks = 1; } if (effectType == EffectType.Boon || effectType == EffectType.Condition || effectType == EffectType.Control) { baseEnemy.Tags.Add(effect.name); } if (effectType == EffectType.Agony || effectType == EffectType.Boon || effectType == EffectType.Condition) { if (effectData[0].Equals("-")) effect.duration = baseAttack.Coefficient; else if (effectData[0].Equals("?")) effect.duration = -1; else effect.duration = Helper.ParseD(effectData[0]); if (effectType == EffectType.Agony || effect.name.Equals("bleeding") || effect.name.Equals("torment") || effect.name.Equals("burning") || effect.name.Equals("poison") || effect.name.Equals("confusion") || effect.name.Equals("regeneration") || effect.name.Equals("might")) effect.amount = effect.duration; if (effectData.Length > 1) effect.stacks = Helper.ParseI(effectData[1]); if (subEffect.StacksDuration || effectType == EffectType.Boon) effect.suffix = "seconds"; if (effect.name.Equals("regeneration")) effect.suffix = "healing"; if (effect.name.Equals("retaliation")) effect.suffix = "damage per hit"; if (effect.name.Equals("might")) effect.suffix = "more damage"; if (effect.name.Equals("retaliation") || effect.name.Equals("might")) effect.amount = 1; } if (effectType == EffectType.Control) { if (effectData[0].Equals("?")) effect.duration = 0; else effect.duration = Helper.ParseD(effectData[0]); if (effectData.Length > 1) effect.stacks = Helper.ParseI(effectData[1]); } if (effectType == EffectType.Buff) { effect.buff = effectData[0]; effect.icon = effect.buff; if (effectData.Length > 1 && effectData[1].Length > 0) effect.duration = Helper.ParseD(effectData[1]); if (effectData.Length > 2 && effectData[2].Length > 0) effect.stacks = Helper.ParseI(effectData[2]); if (effectData.Length > 3 && effectData[3].Length > 0) effect.icon = effectData[3]; if (effectData.Length > 4) subEffect.StacksDuration = Helper.ParseI(effectData[4]) > 0 ? true : false; } return effect; }