Ejemplo n.º 1
0
        public bool Hit(Battler u, Battler t, double effectMagnitude = 1.0)
        {
            double toolAcc = Accuracy * (u.SelectedWeapon != null ? u.SelectedWeapon.Accuracy : 100) / 10000.0;
            double def     = t.Spd() * t.Eva();
            double result  = 95 * toolAcc * u.Tec() * u.Acc() / (def != 0 ? def : 0.01) * effectMagnitude;

            return(Chance((int)result));
        }
Ejemplo n.º 2
0
        public int CriticalHitRatio(Battler u, Battler t, double effectMagnitude = 1.0)
        {
            if (effectMagnitude < 0.5)
            {
                return(1);
            }
            double toolCrt = CritcalRate * (u.SelectedWeapon != null ? u.SelectedWeapon.CritcalRate : 100) / 10000.0;
            double def     = t.Tec() * t.Cev();
            double result  = 2 * Math.Pow(u.Tec() * toolCrt, 1.1) * u.Crt() / (def != 0 ? def : 0.01) * effectMagnitude;

            return(Chance((int)result) ? 3 : 1);
        }
Ejemplo n.º 3
0
        public int GetToolFormula(Battler u, Battler t, double effectMagnitude = 1.0)
        {
            double total = 0;
            double power = Power * (u.SelectedWeapon != null ? u.SelectedWeapon.Power : 10) / 100.0;
            double rates = power * u.CriticalHitRatio * (t.ElementRates[Element] + 100) / 100.0;

            switch (Formula)
            {
            case 1: total = (1.5 * u.Atk() - 1.25 * t.Def()) * rates; break;                                 // Physical standard

            case 2: total = (1.5 * u.Map() - 1.25 * t.Mar()) * rates; break;                                 // Magical standard

            case 3: total = (1.5 * (u.Atk() + u.Map()) / 2 - 1.25 * (t.Def() + t.Mar()) / 2) * rates; break; // Mixed standard

            case 4: total = (1.5 * (u.Atk() / 4 + u.Tec() * 3 / 4) - 1.25 * t.Def()) * rates; break;         // Physical gun

            case 5: total = (1.5 * (u.Map() / 4 + u.Tec() * 3 / 4) - 1.25 * t.Mar()) * rates; break;         // Magical gun
            }
            int intTotal     = (int)(total * effectMagnitude);
            int variance     = Conversion.NaturalNumber(intTotal) / 10;
            int formulaValue = intTotal + RandInt(-variance, variance);

            return(Formula > 0 ? Conversion.NaturalNumber(formulaValue) : formulaValue);
        }