public SpellCastComparer(SpellSelector spellSelector, SpellCategory category) { this.Category = category; this.m_spellSelector = spellSelector; this.m_comparers = new System.Collections.Generic.Dictionary <SpellCategory, Func <SpellCastInformations, SpellCastInformations, int> > { { SpellCategory.Summoning, new Func <SpellCastInformations, SpellCastInformations, int>(this.CompareSummon) }, { SpellCategory.Buff, new Func <SpellCastInformations, SpellCastInformations, int>(this.CompareBoost) }, { SpellCategory.Damages, new Func <SpellCastInformations, SpellCastInformations, int>(this.CompareDamage) }, { SpellCategory.Healing, new Func <SpellCastInformations, SpellCastInformations, int>(this.CompareHeal) }, { SpellCategory.Curse, new Func <SpellCastInformations, SpellCastInformations, int>(this.CompareCurse) } }; }
public SpellCastComparer(SpellSelector spellSelector, SpellCategory category) { Category = category; m_spellSelector = spellSelector; m_comparers = new Dictionary <SpellCategory, Func <SpellCastImpact, SpellCastImpact, int> >() { { SpellCategory.Summoning, CompareSummon }, { SpellCategory.Buff, CompareBoost }, { SpellCategory.Damages, CompareDamage }, { SpellCategory.Healing, CompareHeal }, { SpellCategory.Curse, CompareCurse }, }; }
public SpellImpactComparer(SpellSelector spellSelector, SpellCategory category) { this.Category = category; this.m_spellSelector = spellSelector; }
private void CumulEffects(EffectDice effect, ref SpellTarget spellImpact, FightActor target, Spell spell) { bool flag = this.Fighter.Team.Id == target.Team.Id; SpellTarget spellTarget = new SpellTarget(); SpellTargetType arg_2A_0 = effect.Targets; SpellCategory effectCategories = SpellIdentifier.GetEffectCategories(effect.EffectId); if (effectCategories != SpellCategory.None) { double num = 1.0; if (effect.Random > 0) { num = (double)effect.Random / 100.0; } if (target is SummonedFighter) { num /= 2.0; } uint damage = (uint)System.Math.Min(effect.DiceNum, effect.DiceFace); uint damage2 = (uint)System.Math.Max(effect.DiceNum, effect.DiceFace); if ((effectCategories & SpellCategory.DamagesNeutral) > SpellCategory.None) { SpellSelector.AdjustDamage(spellTarget, damage, damage2, SpellCategory.DamagesNeutral, num, this.Fighter.Stats.GetTotal(PlayerFields.NeutralDamageBonus) + this.Fighter.Stats.GetTotal(PlayerFields.DamageBonus) + this.Fighter.Stats.GetTotal(PlayerFields.PhysicalDamage), this.Fighter.Stats.GetTotal(PlayerFields.DamageBonusPercent) + this.Fighter.Stats.GetTotal(PlayerFields.Strength), target.Stats.GetTotal(PlayerFields.NeutralElementReduction), target.Stats.GetTotal(PlayerFields.NeutralResistPercent), flag); } if ((effectCategories & SpellCategory.DamagesFire) > SpellCategory.None) { SpellSelector.AdjustDamage(spellTarget, damage, damage2, SpellCategory.DamagesNeutral, num, this.Fighter.Stats.GetTotal(PlayerFields.FireDamageBonus) + this.Fighter.Stats.GetTotal(PlayerFields.DamageBonus) + this.Fighter.Stats.GetTotal(PlayerFields.MagicDamage), this.Fighter.Stats.GetTotal(PlayerFields.DamageBonusPercent) + this.Fighter.Stats.GetTotal(PlayerFields.Intelligence), target.Stats.GetTotal(PlayerFields.FireElementReduction), target.Stats.GetTotal(PlayerFields.FireResistPercent), flag); } if ((effectCategories & SpellCategory.DamagesAir) > SpellCategory.None) { SpellSelector.AdjustDamage(spellTarget, damage, damage2, SpellCategory.DamagesNeutral, num, this.Fighter.Stats.GetTotal(PlayerFields.AirDamageBonus) + this.Fighter.Stats.GetTotal(PlayerFields.DamageBonus) + this.Fighter.Stats.GetTotal(PlayerFields.MagicDamage), this.Fighter.Stats.GetTotal(PlayerFields.DamageBonusPercent) + this.Fighter.Stats.GetTotal(PlayerFields.Agility), target.Stats.GetTotal(PlayerFields.AirElementReduction), target.Stats.GetTotal(PlayerFields.AirResistPercent), flag); } if ((effectCategories & SpellCategory.DamagesWater) > SpellCategory.None) { SpellSelector.AdjustDamage(spellTarget, damage, damage2, SpellCategory.DamagesNeutral, num, this.Fighter.Stats.GetTotal(PlayerFields.WaterDamageBonus) + this.Fighter.Stats.GetTotal(PlayerFields.DamageBonus) + this.Fighter.Stats.GetTotal(PlayerFields.MagicDamage), this.Fighter.Stats.GetTotal(PlayerFields.DamageBonusPercent) + this.Fighter.Stats.GetTotal(PlayerFields.Chance), target.Stats.GetTotal(PlayerFields.WaterElementReduction), target.Stats.GetTotal(PlayerFields.WaterResistPercent), flag); } if ((effectCategories & SpellCategory.DamagesEarth) > SpellCategory.None) { SpellSelector.AdjustDamage(spellTarget, damage, damage2, SpellCategory.DamagesNeutral, num, this.Fighter.Stats.GetTotal(PlayerFields.EarthDamageBonus) + this.Fighter.Stats.GetTotal(PlayerFields.DamageBonus) + this.Fighter.Stats.GetTotal(PlayerFields.PhysicalDamage), this.Fighter.Stats.GetTotal(PlayerFields.DamageBonusPercent) + this.Fighter.Stats.GetTotal(PlayerFields.Strength), target.Stats.GetTotal(PlayerFields.EarthElementReduction), target.Stats.GetTotal(PlayerFields.EarthResistPercent), flag); } if ((effectCategories & SpellCategory.Healing) > SpellCategory.None) { bool flag2; if (flag2 = ((effectCategories & SpellCategory.Damages) > SpellCategory.None)) { target = this.Fighter; } uint num2 = (uint)System.Math.Max(0, target.MaxLifePoints - target.LifePoints); if (flag2) { spellTarget.MinHeal = System.Math.Min(num2, System.Math.Abs(spellTarget.MinDamage)); spellTarget.MaxHeal = System.Math.Min(num2, System.Math.Abs(spellTarget.MaxDamage)); } else { if (num2 > 0u) { SpellSelector.AdjustDamage(spellTarget, (uint)System.Math.Min((long)effect.DiceNum, (long)((ulong)num2)), (uint)System.Math.Min((long)effect.DiceFace, (long)((ulong)num2)), SpellCategory.Healing, num, this.Fighter.Stats.GetTotal(PlayerFields.HealBonus), this.Fighter.Stats.GetTotal(PlayerFields.Intelligence), 0, 0, !flag); if (spellTarget.Heal > num2) { if (flag) { spellTarget.MinHeal = (spellTarget.MaxHeal = num2); } else { spellTarget.MinHeal = (spellTarget.MaxHeal = (double)(-(double)((ulong)num2))); } } } } } if ((effectCategories & SpellCategory.Buff) > SpellCategory.None) { if (flag) { spellTarget.Boost += (double)spell.CurrentLevel * num; } else { spellTarget.Boost -= (double)spell.CurrentLevel * num; } } if ((effectCategories & SpellCategory.Curse) > SpellCategory.None) { double num3 = (double)spell.CurrentLevel * num; if (effect.EffectId == EffectsEnum.Effect_SkipTurn) { num3 = (double)(target.Level * 2) * num; } if (flag) { spellTarget.Curse -= 2.0 * num3; } else { spellTarget.Curse += num3; } } if (flag) { spellTarget.Add(spellTarget); } if (!flag && (effectCategories & SpellCategory.Damages) > SpellCategory.None && spellTarget.MinDamage > (double)target.LifePoints) { double num3 = System.Math.Max((double)target.MaxLifePoints / 2.0, (double)target.LifePoints) / spellTarget.MinDamage; spellTarget.Multiply(num3); } if (spellImpact != null) { spellImpact.Add(spellTarget); } else { spellImpact = spellTarget; } } }