source: 2015/26/MikkoL/JRPG/JRPG/JRPG/Battle/Algorithms.cs @ 6401

Revision 6401, 1.1 KB checked in by mijoliim, 5 years ago (diff)
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using Jypeli;
6
7public static class BattleAlgorithms
8{
9    public static int DamageFromBasicAttack(double BaseDamage, int Defence)
10    {
11        return (int)Math.Max((Math.Round(BaseDamage + BaseDamage / Defence - Defence) * RandomGen.NextDouble(0.9, 1.1)), 1);
12    }
13
14    public static int DamageFromCriticalHit(double BaseDamage, int Defence)
15    {
16        return (int)Math.Max((Math.Round(BaseDamage * 2 - Defence / 2) * RandomGen.NextDouble(0.9, 1.1)), 1);
17    }
18
19    public static int DamageFromSkillAttack(double BaseDamage, int Resistance)
20    {
21        return (int)Math.Round(BaseDamage - Resistance) + 1;
22    }
23
24    public static int CriticalRate(int Luck)
25    {
26        return (int)Math.Round((double)Luck);
27    }
28
29    public static double WaitTime(double BaseWaitTime, int Speed)
30    {
31        return BaseWaitTime - Speed / 100;
32    }
33
34    public static int FleePercent(EnemyGroup Group)
35    {
36        int totalPercent = Group.Sum(G => G.FleePercent);
37        return totalPercent / Group.Count;
38    }
39}
Note: See TracBrowser for help on using the repository browser.