Ejemplo n.º 1
0
        // Return the result of the roll of a bushido dice
        public static int BushidoDice()
        {
            // Get the value of a roll
            int res = Dices.D6();

            // Return 0 if the D6 is a 1
            return((res != 1) ? res : 0);
        }
Ejemplo n.º 2
0
        // Create a list of dice
        public DiceList(int nbDices, string typeOfDice)
        {
            Type      = typeOfDice;
            DicesList = new List <int>();
            for (int i = 0; i < nbDices; i++)
            {
                DicesList.Add(Dices.BushidoDice());
            }

            TreatList();
        }
Ejemplo n.º 3
0
        static public bool TestDices()
        {
            bool functionnal = true;

            int  d2 = 0, d6 = 0, bushidoDice = 0;
            long max = 1000000;

            for (int i = 0; i < max; i++)
            {
                d2          += Dices.D2();
                d6          += Dices.D6();
                bushidoDice += Dices.BushidoDice();
            }

            double average;

            if (Test.verbose)
            {
                Output.Print("Test Dices.D2:   ");
            }
            average      = (double)d2 / max;
            functionnal &= Test.TestInterval(1.49, 1.51, average);

            if (Test.verbose)
            {
                Output.Print("Test Dices.D6:   ");
            }
            average      = (double)d6 / max;
            functionnal &= Test.TestInterval(3.49, 3.51, average);

            if (Test.verbose)
            {
                Output.Print("Test Dices.bushidoDice:   ");
            }
            average      = (double)bushidoDice / max;
            functionnal &= Test.TestInterval(3.33, 3.34, average);

            if (Test.verbose && functionnal)
            {
                Output.PrintLine("Test Dices:  ok.");
            }
            else if (Test.verbose)
            {
                Output.PrintLine("Test Dices:  not ok.");
            }

            return(functionnal);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 5
0
        static public int DamageRoll(Profile Attacker, Profile Defender)
        {
            int roll;

            // Get the roll
            if (Attacker.Treats.Strong.Has || Attacker.Treats.Assassin.Has)
            {
                int a = Dices.D6(), b = Dices.D6(), c = Dices.D6();
                roll = a + b + c - minOf3(a, b, c);
            }
            else if (Attacker.Treats.Weak.Has)
            {
                int a = Dices.D6(), b = Dices.D6(), c = Dices.D6();
                roll = a + b + c - maxOf3(Dices.D6(), Dices.D6(), Dices.D6());
            }
            else
            {
                roll = Dices.D6() + Dices.D6();
            }

            // Apply strengh
            roll += Attacker.Treats.Strengh.Value;

            // Apply armour & armour piercing
            bool sharpOrPiercing = Attacker.Treats.ArmourPiercing.Has;

            sharpOrPiercing |= Attacker.Treats.Sharp.Has;
            if (Defender.Treats.Armour.Has && !sharpOrPiercing)
            {
                roll -= Defender.Treats.Armour.Value;
            }

            // stay between 0 and 12
            roll = Math.Min(12, roll);
            roll = Math.Max(0, roll);

            return(roll);
        }