Пример #1
0
        private int GetSL_Ranged(int difficulty)
        {
            DiceList dicesA;
            int      result;

            dicesA = new DiceList(AttackDice, "ranged");
            result = dicesA.Result() - difficulty;

            // reroll 1
            // reroll 2
            // reroll 3

            result = Math.Max(-1, result);
            result = Math.Min(10, result);

            return(result);
        }
Пример #2
0
        private int GetSL_Melee(Profile Defender)
        {
            DiceList dicesA, dicesD;
            int      result;


            dicesA = new DiceList(AttackDice, "melee");
            dicesD = new DiceList(Defender.DefenceDice, "melee");
            // Careful, if you use reroll, the all process must be remade
            if (this.Treats.UnbreakableStrike.Has)
            {
                dicesD.RemoveHighestDice();
            }
            if (Defender.Treats.ImpenetrableDefence.Has)
            {
                dicesA.RemoveHighestDice();
            }

            result = dicesA.Result() - dicesD.Result();

            // brutal / parry
            if (this.Treats.Brutal.Has)
            {
                result += this.Treats.Brutal.Value;
            }
            if (Defender.Treats.Parry.Has)
            {
                result -= this.Treats.Parry.Value;
            }

            // reroll 1
            // reroll 2
            // reroll 3

            if (result == 0 && dicesA.DicesList.Count < dicesD.DicesList.Count)
            {
                result = -1;
            }

            result = Math.Max(-1, result);
            result = Math.Min(10, result);

            return(result);
        }
Пример #3
0
        private int GetSL_Opposed(Profile Defender)
        {
            DiceList dicesA, dicesB;
            int      result;

            dicesA = new DiceList(AttackDice, "opposed");
            dicesB = new DiceList(Defender.DefenceDice, "opposed");
            result = dicesA.Result() - dicesB.Result() + AttackBonus - Defender.DefenceBonus;

            if (result == 0 && dicesA.DicesList.Count < dicesB.DicesList.Count)
            {
                result = -1;
            }

            result = Math.Max(-1, result);
            result = Math.Min(10, result);

            return(result);
        }
Пример #4
0
        // Run every test
        static public bool RunTest()
        {
            bool res = true;

            res &= Dices.LocalTest();
            res &= DiceList.LocalTest();
            res &= Wound.LocalTest();

            if (res && verbose)
            {
                Output.PrintLine("Every test are correct.");
                //System.Console.Read();
            }
            if (!res)
            {
                Output.PrintLine("Recession found.");
                //System.Console.Read();
            }

            return(res);
        }
Пример #5
0
        static public bool TestMeleeDice()
        {
            bool     functionnal = true;
            DiceList dices       = new DiceList(3, "melee");

            // 2 ; 1 ; 2-3 ; 2-1 ; 6 - 2 ; 6-6 ; 5-3-2 ; 5-3-1 ; 6-6-2 ; 6-6-6-6
            // 2 / 2
            if (Test.verbose)
            {
                Output.Print("Test dices with 2:    ");
            }
            dices.DicesList = new List <int>();
            dices.DicesList.Add(2);
            dices.TreatList();
            functionnal &= Test.TestValue(2, dices.Result());
            // 3-2 / 4
            if (Test.verbose)
            {
                Output.Print("Test dices with 3-2:    ");
            }
            dices.DicesList = new List <int>();
            dices.DicesList.Add(3);
            dices.DicesList.Add(2);
            dices.TreatList();
            functionnal &= Test.TestValue(4, dices.Result());
            // 2-1 / 2
            if (Test.verbose)
            {
                Output.Print("Test dices with 2-1:    ");
            }
            dices.DicesList = new List <int>();
            dices.DicesList.Add(2);
            dices.DicesList.Add(1);
            dices.TreatList();
            functionnal &= Test.TestValue(2, dices.Result());
            // 6-2 / 7
            if (Test.verbose)
            {
                Output.Print("Test dices with 6-2:    ");
            }
            dices.DicesList = new List <int>();
            dices.DicesList.Add(6);
            dices.DicesList.Add(2);
            dices.TreatList();
            functionnal &= Test.TestValue(7, dices.Result());
            // 6-6 / 8
            if (Test.verbose)
            {
                Output.Print("Test dices with 6-6:    ");
            }
            dices.DicesList = new List <int>();
            dices.DicesList.Add(6);
            dices.DicesList.Add(6);
            dices.TreatList();
            functionnal &= Test.TestValue(8, dices.Result());
            // 5-3-2 / 7
            if (Test.verbose)
            {
                Output.Print("Test dices with 5-3-2:    ");
            }
            dices.DicesList = new List <int>();
            dices.DicesList.Add(5);
            dices.DicesList.Add(3);
            dices.DicesList.Add(2);
            dices.TreatList();
            functionnal &= Test.TestValue(7, dices.Result());
            // 5-3-1 / 6
            if (Test.verbose)
            {
                Output.Print("Test dices with 5-3-1:    ");
            }
            dices.DicesList = new List <int>();
            dices.DicesList.Add(5);
            dices.DicesList.Add(3);
            dices.DicesList.Add(1);
            dices.TreatList();
            functionnal &= Test.TestValue(6, dices.Result());
            // 6-6-2 / 8
            if (Test.verbose)
            {
                Output.Print("Test dices with 6-6-2:    ");
            }
            dices.DicesList = new List <int>();
            dices.DicesList.Add(6);
            dices.DicesList.Add(6);
            dices.DicesList.Add(2);
            dices.TreatList();
            functionnal &= Test.TestValue(9, dices.Result());
            // 6-6-6-6 / 11
            if (Test.verbose)
            {
                Output.Print("Test dices with 6-6-6-6:    ");
            }
            dices.DicesList = new List <int>();
            dices.DicesList.Add(6);
            dices.DicesList.Add(6);
            dices.DicesList.Add(6);
            dices.DicesList.Add(6);
            dices.TreatList();
            functionnal &= Test.TestValue(11, dices.Result());

            return(functionnal);
        }