Пример #1
0
        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;
            }
        }
Пример #2
0
        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);
        }
Пример #3
0
 public StatusEffect(Being target, DamageOverTime DoT, StatSet ss)
     : this(
         target,
         new List <Mod>(),
         new List <DamageOverTime>() { DoT },
         ss
         )
 {
 }
Пример #4
0
 public StatusEffect(Being target, IEnumerable <Mod> mods, StatSet ss)
     : this(
         target,
         mods,
         new List <DamageOverTime>(),
         ss
         )
 {
 }
Пример #5
0
 public Stat(StatType statType, StatSet owner)
 {
     StatType = statType;
     Owner    = owner;
     Owner.AddStat(this);
     if (ValueUpdated != null)
     {
         ValueUpdated(this, new ValueUpdatedEventArgs(StatType));
     }
 }
Пример #6
0
        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();
        }
Пример #7
0
 public Stat this[StatType st] {
     get {
         if (Stats == null)
         {
             Stats = new StatSet();
             foreach (var m in Mods)
             {
                 m.Affect(Stats);
             }
         }
         return(Stats.GetStat(st));
     }
 }
Пример #8
0
        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;
        }
Пример #9
0
 public TimedStatusEffect(Battle battle, Being target, IEnumerable <Mod> mods, StatSet ss, int EffectTime)
     : base(target, mods, ss)
 {
     _Battle = battle;
     initStuff(EffectTime);
 }
Пример #10
0
 public StatusEffect(Being target, IEnumerable <Mod> mods, IEnumerable <DamageOverTime> dots, StatSet ss)
 {
     Target = target;
     _mods.AddRange(mods);
     _dots.AddRange(dots);
 }
Пример #11
0
 public DamageOverTime(StatSet ss, double BaseDmg, StatType DmgType)
     : this(ss, BaseDmg, DmgType, true)
 {
 }
Пример #12
0
 public TimedStatusEffect(Battle battle, Being target, Mod mod, StatSet ss, int EffectTime) : this(battle, target, new Mod[] { mod }, ss, EffectTime)
 {
 }
Пример #13
0
 public override void Unaffect(StatSet statD)
 {
     SourceMod.Unaffect(statD);
     base.Unaffect(statD);
 }
Пример #14
0
 public override void Affect(StatSet statD)
 {
     SourceMod.Affect(statD);
     base.Affect(statD);
 }
Пример #15
0
 public virtual void Unaffect(StatSet statD)
 {
     UnAffect(statD.GetStat(TargetStatType));
 }
Пример #16
0
 public TimedStatusEffect(Battle battle, Being target, DamageOverTime DoT, StatSet ss, int EffectTime)
     : base(target, DoT, ss)
 {
     _Battle = battle;
     initStuff(EffectTime);
 }
Пример #17
0
 public void AddSubSet(StatSet ss)
 {
     SubSets.Add(ss);
     ss.ValueUpdated += this.ValueUpdated;
 }