Пример #1
0
    private List <MultiDiceRoll> MultipleDice()
    {
        List <MultiDiceRoll> mult = new List <MultiDiceRoll>();

        for (int i = 0; i < dice_roll.Count; i++)
        {
            for (int j = i + 1; j < dice_roll.Count; j++)
            {
                if (dice_roll [i].roll_value == dice_roll [j].roll_value)
                {
                    MultiDiceRoll d_roll = mult.Find(delegate(MultiDiceRoll obj) {
                        return(obj.Face == dice_roll [i].roll_value);
                    });
                    if (d_roll != null)
                    {
                        d_roll.AddDie(dice_roll [j].ID);
                    }
                    else
                    {
                        mult.Add(new MultiDiceRoll(2, dice_roll [i].roll_value, dice_roll [i].ID, dice_roll [j].ID));
                    }
                }
            }
        }
        return(mult);
    }
Пример #2
0
    private void LocalFinal_value()
    {
        //TODO fill in for rules
        //check for multiple
        int value = 1;
        List <MultiDiceRoll> multi = MultipleDice();
        //Dice Runs (3+ kept dice only)

        //check amount kept
        MultiDiceRoll max = null;

        if (multi.Count > 0)
        {
            foreach (MultiDiceRoll d_roll in multi)
            {
                d_roll.AdjustForKept();
                if (max != null)
                {
                    if (max.value < d_roll.value)
                    {
                        max = d_roll;
                    }
                }
                else
                {
                    max = d_roll;
                }
            }
            value = max.value;
        }
        if (max != null)
        {
            if (max.Rolled < Global_Data.Global_Information.Kept_Dice())
            {
                //add more to value rolled
            }
        }
        else
        {
            LocalRoll_value();
            value = Dice_Roll_Value;
        }
        Dice_Roll_Final = value;
    }