public DamageOverTime(StatSet ss, double BaseDmg, StatType DmgType, bool snapshotStats) { var asdfg = new StatSet(); asdfg.AddSubSet(ss); new AdditionMod(DmgType, BaseDmg).Affect(asdfg); if (snapshotStats) { Damages = new StatSet(); var DamageTypes = StatTypeStuff.DamageTypes .Select(asgf => asgf | StatType.DamageOverTime); foreach (var dmgt in DamageTypes) { var dmg = asdfg[dmgt]; if (dmg != 0) { new AdditionMod(dmgt, asdfg[dmgt]) .Affect(Damages); StatType pen = dmgt.AsPenetration(); new AdditionMod(pen, asdfg[pen]) .Affect(Damages); } } } else { Damages = asdfg; } }
public Damage(Being defender, StatSet damages) { var statdmg = new List <StatDamage>(); double total = 0.0; foreach (StatType dmgType in StatTypeStuff.DirectDamageTypeApplicationTypes) { double dmg = damages.GetStat(dmgType).Value; if (dmg != 0) { double resist = defender[dmgType.AsResistance()].Value; double penetration = damages[dmgType.AsPenetration()]; double threshold = defender[dmgType.AsThreshold()].Value; dmg *= (1 - (resist - penetration)); if (Math.Abs(dmg) < threshold) { dmg = 0; //don't negate more than absolute damage } else { dmg -= (dmg < 0 ? -1 : 1) * threshold; //negate flat amount regardless of negative or positive damage } ConsoleLoggerHandlerOrWhatever.Log(dmg + " " + dmgType); statdmg.Add(new StatDamage(dmg, dmgType)); total += dmg; } } Value = (int)(total + 0.5); }
public StatusEffect(Being target, DamageOverTime DoT, StatSet ss) : this( target, new List <Mod>(), new List <DamageOverTime>() { DoT }, ss ) { }
public StatusEffect(Being target, IEnumerable <Mod> mods, StatSet ss) : this( target, mods, new List <DamageOverTime>(), ss ) { }
public Stat(StatType statType, StatSet owner) { StatType = statType; Owner = owner; Owner.AddStat(this); if (ValueUpdated != null) { ValueUpdated(this, new ValueUpdatedEventArgs(StatType)); } }
public void CreateCopy(StatSet newOwner) { var that = new Stat(this.StatType, newOwner); that.Base = this.Base; that.AdditiveMultipliers = this.AdditiveMultipliers; foreach (var m in this.Multipliers) { that.AddMultiplier(m); } that.Converters = this.Converters.ToList(); }
public Stat this[StatType st] { get { if (Stats == null) { Stats = new StatSet(); foreach (var m in Mods) { m.Affect(Stats); } } return(Stats.GetStat(st)); } }
public ChannelingInstance(Battle battle, IEnumerable <Mod> mods, Skill skill, Tile place, Func <Tile> targetSelector) { Stats = new StatSet(); SkillUsageStats = new Dictionary <object, StatSet>(); Battle = battle; Battle.Add(this); Skill = skill; Place = place; TargetSelector = targetSelector; foreach (var m in mods) { m.Affect(Stats); } TurnFinished += (s, e) => Battle.Remove(this); TurnStarted += OnTurnStarted; }
public TimedStatusEffect(Battle battle, Being target, IEnumerable <Mod> mods, StatSet ss, int EffectTime) : base(target, mods, ss) { _Battle = battle; initStuff(EffectTime); }
public StatusEffect(Being target, IEnumerable <Mod> mods, IEnumerable <DamageOverTime> dots, StatSet ss) { Target = target; _mods.AddRange(mods); _dots.AddRange(dots); }
public DamageOverTime(StatSet ss, double BaseDmg, StatType DmgType) : this(ss, BaseDmg, DmgType, true) { }
public TimedStatusEffect(Battle battle, Being target, Mod mod, StatSet ss, int EffectTime) : this(battle, target, new Mod[] { mod }, ss, EffectTime) { }
public override void Unaffect(StatSet statD) { SourceMod.Unaffect(statD); base.Unaffect(statD); }
public override void Affect(StatSet statD) { SourceMod.Affect(statD); base.Affect(statD); }
public virtual void Unaffect(StatSet statD) { UnAffect(statD.GetStat(TargetStatType)); }
public TimedStatusEffect(Battle battle, Being target, DamageOverTime DoT, StatSet ss, int EffectTime) : base(target, DoT, ss) { _Battle = battle; initStuff(EffectTime); }
public void AddSubSet(StatSet ss) { SubSets.Add(ss); ss.ValueUpdated += this.ValueUpdated; }