Beispiel #1
0
        private Proc GetProc(string damageType, WeaponStats weaponStats, double weight, double timeBetweenTicks, double timeToLive, double baseDamagePerTick, double typeDamagePerTick, out double initialDamage)
        {
            var    timeBetweenShots = (1 / weaponStats.ShotsPerSecond);
            double weightedDamage   = 0;

            if (typeDamagePerTick > 0)
            {
                weightedDamage = (weaponStats.BaseDamage * baseDamagePerTick + weaponStats.DamageDictionary[damageType] * typeDamagePerTick)
                                 * weight
                                 * weaponStats.StatusChance
                                 * weaponStats.getAverageCritMultiplier();
            }
            else
            {
                weightedDamage = (weaponStats.BaseDamage * baseDamagePerTick)
                                 * weight
                                 * weaponStats.StatusChance
                                 * weaponStats.getAverageCritMultiplier();
            }
            initialDamage = calculateDamage(damageType, weightedDamage); //Initial Tick
            var proc = new Proc
            {
                timeLeft      = timeToLive,
                damageType    = damageType,
                damagePerShot = weightedDamage * (timeBetweenShots / timeBetweenTicks)
            };

            return(proc);
        }
Beispiel #2
0
 public Simulation(Enemy enemy, WeaponStats weaponStats)
 {
     Enemy          = enemy;
     _weaponStats   = weaponStats;
     _eventList     = new List <SimEvent>();
     _eventHistory  = new List <SimEvent>();
     _damageHistory = new List <SimHistoryEvent>();
     _eventList.Add(new SimShot(0, this));
 }
Beispiel #3
0
        public double calculateShot(WeaponStats weaponStats)
        {
            double sum = 0;

            sum += calculateExistingProcs(weaponStats);
            sum += calculateNewProcs(weaponStats);
            sum += calculateWeaponDamage(weaponStats);
            return(sum);
        }
Beispiel #4
0
        private double calculateWeaponDamage(WeaponStats weaponStats)
        {
            double sum = 0;

            foreach (KeyValuePair <string, double> kvp in weaponStats.DamageDictionary)
            {
                var dmgCrit = kvp.Value * weaponStats.getAverageCritMultiplier();
                sum += calculateDamage(kvp.Key, dmgCrit);
            }
            return(sum);
        }
Beispiel #5
0
        private double calculateExistingProcs(WeaponStats weaponStats)
        {
            double sum = 0;

            foreach (Proc proc in procList)
            {
                sum           += calculateDamage(proc.damageType, proc.damagePerShot);
                proc.timeLeft -= 1 / weaponStats.ShotsPerSecond;
            }
            procList.RemoveAll(x => x.timeLeft <= 0);
            return(sum);
        }
Beispiel #6
0
        public static DamageModel GetDamageModel(WeaponStats weaponStats, Enemy enemy)
        {
            DamageModel damageModel = new DamageModel();
            List <Proc> procList    = new List <Proc>();

            for (damageModel.ShotsToKill = 0; enemy.Health.CurrentAmount > 0; damageModel.ShotsToKill++)
            {
                damageModel.TimeToKill += 1 / weaponStats.ShotsPerSecond;
                damageModel.ShotsFired.Add(enemy.calculateShot(weaponStats));
            }
            damageModel.MagazinesToKill = damageModel.ShotsToKill / weaponStats.MagazineSize;
            damageModel.TimeToKill     += Math.Floor(damageModel.MagazinesToKill) * weaponStats.ReloadTime;
            damageModel.DamageDone      = damageModel.ShotsFired.Sum();
            damageModel.DpsToKill       = damageModel.DamageDone / damageModel.TimeToKill;
            return(damageModel);
        }
Beispiel #7
0
        private double calculateNewProcs(WeaponStats weaponStats)
        {
            double sum = 0;
            Dictionary <string, double> weightDict = weaponStats.getStatusWeights();
            double weightSum = weightDict.Sum(x => x.Value);

            foreach (var weight in weightDict)
            {
                double initialDamage = 0;
                switch (weight.Key)
                {
                case "Corrosive":
                    this.Armor.CurrentAmount -= this.Armor.CurrentAmount * (weightDict[weight.Key] / weightSum) * 0.25;
                    break;

                case "Toxin":
                    procList.Add(GetProc(damageType: weight.Key, weaponStats: weaponStats, weight: weight.Value / weightSum, timeBetweenTicks: 1, timeToLive: 8, baseDamagePerTick: 0.5, typeDamagePerTick: 0.5, initialDamage: out initialDamage));
                    break;

                case "Slash":
                    procList.Add(GetProc(damageType: "Finisher", weaponStats: weaponStats, weight: weight.Value / weightSum, timeBetweenTicks: 1, timeToLive: 6, baseDamagePerTick: 0.35, typeDamagePerTick: 0, initialDamage: out initialDamage));
                    break;

                case "Heat":
                    procList.Add(GetProc(damageType: weight.Key, weaponStats: weaponStats, weight: weight.Value / weightSum, timeBetweenTicks: 1, timeToLive: 6, baseDamagePerTick: 0.5, typeDamagePerTick: 0.5, initialDamage: out initialDamage));
                    break;

                case "Electricity":
                    var procDmg  = (weaponStats.BaseDamage + weaponStats.DamageDictionary[weight.Key]) / 2;
                    var finalDmg = procDmg * (weight.Value / weightSum) * weaponStats.StatusChance * weaponStats.getAverageCritMultiplier();
                    initialDamage = calculateDamage(weight.Key, finalDmg);
                    break;

                //case "Gas":
                //    var procDmg = (weaponStats.BaseDamage + weaponStats.DamageDictionary[weight.Key]) / 2;
                //    var finalDmg = procDmg * (weight.Value / weightSum) * weaponStats.StatusChance * weaponStats.getAverageCritMultiplier();
                //    initialDamage = calculateDamage(weight.Key, finalDmg);
                //    break;
                default:
                    break;
                }
                sum += initialDamage;
            }
            return(sum);
        }
Beispiel #8
0
        public static WeaponStats getWeaponStats()
        {
            var weaponStats = new WeaponStats
            {
                ShotsPerSecond  = 2,
                MagazineSize    = 20,
                ReloadTime      = 3,
                CritChance      = 0.1,
                CritMultiplier  = 2,
                BaseDamage      = 300,
                StatusChance    = 0.5,
                Multishot       = 0.9,
                CurrentMagazine = 2
            };

            weaponStats.DamageDictionary.Add("Slash", 100);
            weaponStats.DamageDictionary.Add("Impact", 100);
            weaponStats.DamageDictionary.Add("Puncture", 100);
            weaponStats.DamageDictionary.Add("Corrosive", 100);
            weaponStats.DamageDictionary.Add("Toxin", 100);
            weaponStats.DamageDictionary.Add("Heat", 100);
            return(weaponStats);
        }