Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- public class Program
- {
- // variables
- // you can use https://leagueoflegends.fandom.com/wiki/Kayle as a reference for base stats
- const double frequencyOfAbilityDamage = 0.60; // how often are you using your abilities to deal damage?
- const double frequencyOfAutoAttackDamage = 0.40; // how often are you using auto attacks to deal damage?
- const int level = 5; // what level are you?
- const double basedmg = 61.3; // what's your base damage (from leveling up/runes)?
- const int averageExaltedStacks = 2; // on average, how many stacks of exalted do you have?
- const double speedLevelModifier = 0.062; // what is your bonus attack speed percentage (from leveling up/runes)?
- const double opponentarmor = 54; // what is your opponent's armor likely to be by this level?
- const double opponentmr = 44; // what is your opponent's mr likely to be by this level?
- const double opponenthealth = 998; // what is your opponent's health likely to be by this level?
- const double resistanceshredfrequency = 0.75; // how often are you landing your Q? multiply that by the percentage of damage you think you're dealing while the Q's shred is in effect.
- const int ptsInQ = 2; // how many points have you put in Q?
- const int ptsInW = 1; // how many points have you put in W?
- const int ptsInE = 2; // how many points have you put in E?
- const int ptsInR = 0; // how many points have you put in R?
- const bool isSupport = false; // are you playing the support role?
- public static void Main()
- {
- Dictionary<string, double> costOf = new Dictionary<string, double>()
- {
- { "dmg", 35.0 },
- { "speed", 25.0 },
- { "power", 21.75 },
- { "crit", 40.0 },
- { "cdr", 26.7 }
- };
- double speedLimit = 1.1512; // Kayle gets a lot of natural bonus attack speed, this amount would make her hit cap at level 18.
- double critLimit = 1.0; // duh
- double cdrLimit = 0.40; // this is the max cdr in league
- // find the max total damage and report what values were at that damage
- double maxtotal = 0.0;
- double aaAtMax = 0.0;
- double abAtMax = 0.0;
- double maxdmg = 0.0;
- double maxspeed = 0.0;
- double maxpower = 0.0;
- double maxcrit = 0.0;
- double maxcdr = 0.0;
- int gold = 2000; // your gold earned at level 5
- for (int dmgGold = 0; dmgGold < gold; dmgGold += 100)
- {
- double dmg = dmgGold / costOf["dmg"];
- for (int speedGold = 0; speedGold < gold - dmgGold; speedGold += 100)
- {
- double speed = (speedGold / costOf["speed"]) / 100; // divide by 100 to make it by decimal instead of percentage
- if (speed >= speedLimit)
- break;
- for (int powerGold = 0; powerGold < gold - dmgGold - speedGold; powerGold += 100)
- {
- double power = powerGold / costOf["power"];
- for (int critGold = 0; critGold < gold - dmgGold - speedGold - powerGold; critGold += 100)
- {
- double crit = (critGold / costOf["crit"]) / 100; // divide by 100 to make it by decimal instead of percentage
- if (crit >= critLimit)
- break;
- for (int cdrGold = 0; cdrGold < gold - dmgGold - speedGold - powerGold - critGold; cdrGold += 100)
- {
- double cdr = (cdrGold / costOf["cdr"]) / 100; // divide by 100 to make it by decimal instead of percentage
- if (cdr >= cdrLimit)
- break;
- // calculation
- double aadmg = frequencyOfAutoAttackDamage * CalculateAutoAttackDamage(dmg, speed, power, crit, cdr);
- double abdmg = frequencyOfAbilityDamage * CalculateAbilityDamage(dmg, power, cdr);
- double totaldmg = aadmg + abdmg;
- if (totaldmg > maxtotal)
- {
- maxtotal = totaldmg;
- aaAtMax = aadmg;
- abAtMax = abdmg;
- maxdmg = dmg;
- maxspeed = speed;
- maxpower = power;
- maxcrit = crit;
- maxcdr = cdr;
- }
- }
- }
- }
- }
- }
- Console.WriteLine("Max total damage per second calculated to be: " + maxtotal);
- Console.WriteLine("Auto attack damage at max calculated to be: " + aaAtMax);
- Console.WriteLine("Ability damage at max calculated to be: " + abAtMax);
- Console.WriteLine();
- Console.WriteLine("Bonus AD at this point was " + maxdmg.ToString());
- Console.WriteLine("Bonus Attack Speed at this point was " + (maxspeed * 100).ToString() + "%");
- Console.WriteLine("Bonus AP at this point was " + maxpower.ToString());
- Console.WriteLine("Bonus Crit Chance at this point was " + (maxcrit * 100).ToString() + "%");
- Console.WriteLine("Bonus CDR at this point was " + (maxcdr * 100).ToString() + "%");
- Console.WriteLine();
- Console.WriteLine("Total default dps: " + CalculateTotalDamagePerSecond(0.0, 0.0, 0.0, 0.0, 0.0).ToString());
- Console.WriteLine();
- // first partial item options
- Console.WriteLine("Total dps with Caulfield's Warhammer: " + CalculateTotalDamagePerSecond(25, 0.0, 0.0, 0.0, 0.10).ToString());
- Console.WriteLine("Total dps with Zeal: " + CalculateTotalDamagePerSecond(0.0, 0.15, 0.0, 0.15, 0.0).ToString());
- Console.WriteLine("Total dps with Stinger: " + CalculateTotalDamagePerSecond(0.0, 0.35, 0.0, 0.0, 0.10).ToString());
- Console.WriteLine("Total dps with Fiendish Codex: " + CalculateTotalDamagePerSecond(0.0, 0.0, 35, 0.0, 0.10).ToString());
- Console.WriteLine("Total dps with Hextech Revolver: " + CalculateTotalDamagePerSecond(0.0, 0.0, 40, 0.0, 0.0).ToString());
- Console.WriteLine();
- // first full item options
- Console.WriteLine("Total dps with Nashor's Tooth (not counting passive): " + CalculateTotalDamagePerSecond(0.0, 0.5, 80, 0.0, 0.20).ToString());
- Console.WriteLine("Total dps with Hextech Gunblade (not counting passive): " + CalculateTotalDamagePerSecond(40, 0.0, 80, 0.0, 0.0).ToString());
- Console.WriteLine("Total dps with Guinsoo's Rageblade (not counting some passives): " + CalculateTotalDamagePerSecond(25, 0.25 + 0.24,25, 0.0, 0.0).ToString());
- Console.WriteLine("Total dps with Essence Reaver: " + CalculateTotalDamagePerSecond(65, 0.0, 0.0, 0.25, 0.0 + 0.20).ToString());
- Console.WriteLine("Total dps with Blade of the Ruined King (not counting lifesteal): " + CalculateTotalDamagePerSecond(40, 0.25, 0.0, 0.0, 0.0).ToString());
- Console.WriteLine();
- // full builds
- Console.WriteLine("Total dps with Nashor's Tooth + Essence Reaver + Infinity Edge + Runaan's Hurricane + Hextech Gunblade: " +
- CalculateTotalDamagePerSecond(65 + 80 + 40, 0.50 + 0.40, 80 + 80, 0.25 + 0.25 + 0.25, 0.20 + 0.20).ToString());
- Console.WriteLine("Total dps with Nashor's Tooth + Essence Reaver + Infinity Edge + Runaan's Hurricane + Guinsoo's Rageblade: " +
- CalculateTotalDamagePerSecond(65 + 80 + 25, 0.50 + 0.40 + 0.25, 80 + 25, 0.25 + 0.25 + 0.25, 0.20 + 0.20).ToString());
- Console.WriteLine("Total dps with Nashor's Tooth + Guinsoo's Rageblade + Hextech Gunblade + Lich Bane + Zhonya's Hourglass: " +
- CalculateTotalDamagePerSecond(25 + 40, 0.50 + 0.25, 80 + 25 + 80 + 80 + 75, 0.0, 0.20 + 0.10 + 0.10).ToString());
- }
- public static double CalculateTotalDamagePerSecond(double dmg, double speed, double power, double crit, double cdr)
- {
- // calculation
- return (frequencyOfAutoAttackDamage * CalculateAutoAttackDamage(dmg, speed, power, crit, cdr)) + (frequencyOfAbilityDamage * CalculateAbilityDamage(dmg, power, cdr));
- }
- public static double CalculateAutoAttackDamage(double dmg, double speed, double power, double crit, double cdr)
- {
- // calculations of damage per second
- double exaltedspeed = 0.695 * averageExaltedStacks * (level > 10 ? 0.10 : 0.06);
- double basespeed = 0.695 + (0.695 * speedLevelModifier) + exaltedspeed + 0.07;
- double armormodifier = 100 / (100 + (opponentarmor - (resistanceshredfrequency * opponentarmor * 0.20)));
- double mrmodifier = 100 / (100 + (opponentmr - (resistanceshredfrequency * opponentmr * 0.20)));
- double rateOfAttack = basespeed + (0.695 * speed); // attacks per second
- double baseautoattackdps = (rateOfAttack * ((armormodifier * (basedmg + dmg)) * (1 + (2 * crit))));
- double spellbladeDamage = ((5 + (5 * ptsInE) + (0.10 * (basedmg + dmg)) + (0.20 * power)) * mrmodifier);
- double spellbladedps = spellbladeDamage * rateOfAttack;
- double cleaveRate = (double)averageExaltedStacks / 6;
- double cleavedamage = level < 16 ? spellbladeDamage : (spellbladeDamage / mrmodifier);
- double cleavedps = cleaveRate * (spellbladeDamage * (1 + crit)) * rateOfAttack;
- double totalAutoAttackDps = baseautoattackdps + spellbladedps + (level > 5 ? cleavedps : 0);
- int ultRank = level / 6;
- double ultRate = (double)1 / ((200 - (ultRank * 40)) * (1 - cdr));
- double damageLostToUlt = totalAutoAttackDps * 1.5 * ultRate;
- // TODO: recalculate after removing crit chance from basic attacks after an E activation
- return totalAutoAttackDps - damageLostToUlt;
- }
- public static double CalculateAbilityDamage(double dmg, double power, double cdr)
- {
- // calculations of damage per second
- double mrmodifierWithShred = 100 / (100 + (opponentmr - (resistanceshredfrequency * opponentmr * 0.20)));
- double mrmodifierWithoutShred = 100 / (100 + opponentmr);
- double qActivationsPerSecond = 1 / ((13 - ptsInQ) * (1 - cdr));
- double wActivationsPerSecond = 1 / (15 * (1 - cdr));
- double eActivationsPerSecond = 1 / (8 * (1 - cdr));
- double rActivationsPerSecond = 1 / ((200 - (ptsInR * 40)) * (1 - cdr));
- double q = (qActivationsPerSecond * ((25 + (45 * ptsInQ)) + (0.6 * (basedmg + dmg)) + (0.5 * power)) * mrmodifierWithoutShred);
- double w = (wActivationsPerSecond * ((30 + (30 * ptsInW)) + (0.3 * power)));
- w = isSupport ? w * 2 : w;
- double e = (eActivationsPerSecond * ((5 + (5 * ptsInE)) + ((0.075 + (0.025 * ptsInE)) * (opponenthealth / 2))) * mrmodifierWithShred);
- double r = (rActivationsPerSecond * (50 + (150 * ptsInR) + dmg + (0.80 * power)));
- return q + w + e + (ptsInR > 0 ? r : 0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement