//Samma som dealdamage fsat för fienden public void TakeDamage() { // main damage damageDealt = damageDealt + opponentAttack.DoDamage() + opponentChar.DoDamage(); //combo yourChar.Streak = 0; opponentChar.Streak = 1; double comboValue = Math.Pow((opponentAttack.combo * opponentChar.combo), opponentChar.Streak / 2); Console.WriteLine(opponentChar.name + "'s Combo Bonus: " + comboValue); damageDealt *= comboValue; //crit Random critGen = new Random(); int hit = critGen.Next(100); if (hit <= (opponentAttack.criticalHit + opponentChar.criticalHit) / 2) { //Sledges passive if (opponentChar.whenPassive == 1) { OpponentPassive(1); } //for basically every character else { Console.WriteLine("It's a crit!"); damageDealt *= 2; } } //taken damageDealt = damageDealt - (yourAttack.TakeDamage() + yourChar.TakeDamage()); if (damageDealt < 5) { damageDealt = 5; } //Passives Random invisGen = new Random(); int invisPas = invisGen.Next(100); if (yourChar.whenPassive == 2 && invisPas < 15) { YourPassive(2); } else { yourChar.LostHealth = damageDealt; } totalTaken += damageDealt; Console.WriteLine(opponentChar.name + " dealt " + damageDealt + " damage to " + yourChar); }
//Calculating Damage public void DealDamage() { //main damage damageDealt += yourAttack.DoDamage() + yourChar.DoDamage(); //Combo, om man vann ökar ens combo och om man förlorade blir den 0 (getset) opponentChar.Streak = 0; yourChar.Streak = 1; //Lite matteskit där jag tar attackens kombo-värde * karaktärens kombovärde upphöjt i ens streak / 2, skulle behöva mer tuning och balans double comboValue = Math.Pow((yourAttack.combo * yourChar.combo), yourChar.Streak / 2); Console.WriteLine(yourChar.name + "'s Combo Bonus: " + comboValue); damageDealt *= comboValue; //crits Random critGen = new Random(); int hit = critGen.Next(100); if (hit <= (yourAttack.criticalHit + yourChar.criticalHit) / 2) { //Sledges passive - kan inte bli crittad if (yourChar.whenPassive == 1) { YourPassive(1); } //for basically every character else { Console.WriteLine("It's a crit!"); damageDealt *= 2; } } //defense damageDealt = damageDealt - (opponentAttack.TakeDamage() + opponentChar.TakeDamage()); //minsta värdet som man kan skada om man vann är 5 if (damageDealt < 5) { damageDealt = 5; } //Passive Random invisGen = new Random(); int invisPas = invisGen.Next(100); //The Invisible kan missa skada om man slumpar rätt if (opponentChar.whenPassive == 2 && invisPas < 15) { OpponentPassive(2); } else { opponentChar.LostHealth = damageDealt; } totalDealt += damageDealt; Console.WriteLine(yourChar.name + " dealt " + damageDealt + " damage to " + opponentChar); }