示例#1
0
    public void MageSuperpower()
    {
        hasflippedDie = true;

        int          smallestdie = 6;
        regularDices dieToFlip   = Fighter.lastHeroToRoll.rd[0];

        foreach (regularDices rd in Fighter.lastHeroToRoll.rd)
        {
            //Debug.Log("the smallest die is : " + smallestdie + " and the actual one rn is : "+ rd.finalSide);
            if ((rd.finalSide <= smallestdie) && rd.gameObject.activeSelf)
            {
                //Debug.Log("switched!");
                smallestdie = rd.finalSide;
                dieToFlip   = rd;
            }
        }

        dieToFlip.FlipTheDie();
        LockFlipBtn();


        if (Fighter.lastHeroToRoll.gameObject.name.Equals("Archer"))
        {
            Fighter.lastHeroToRoll.rollBtn.interactable = false;
            Fighter.lastHeroToRoll.lastRoll             = dieToFlip.finalSide;
            fight.getHeroesScore();
            return;
        }

        regularDices[] activeDice = new regularDices[Fighter.lastHeroToRoll.hero.Dices[Fighter.lastHeroToRoll.hero.Willpower]];
        int            maxDie;
        int            i = 0;

        foreach (regularDices rd in Fighter.lastHeroToRoll.rd)
        {
            if (rd.gameObject.activeSelf)
            {
                activeDice[i] = rd;
                i++;
            }
        }

        maxDie = Fighter.getMaxValue(activeDice);
        Fighter.lastHeroToRoll.lastRoll = maxDie;
        fight.getHeroesScore();
    }
示例#2
0
    public int RollDice()
    {
        foreach (Fighter f in fight.fighters)
        {
            if (f.rollCount > 0 && f != this)
            {
                f.rollBtn.interactable = false;
                f.potion.interactable  = false;
                f.helm.interactable    = false;
            }
        }

        if (rollCount >= maxRollCount)
        {
            return(lastRoll);
        }

        // First to roll, unlock flip btn
        if (lastHeroToRoll == null)
        {
            MageFighter.UnlockFlipBtn();
        }

        fight.remainingRolls -= 1;
        lastHeroToRoll        = this;
        doubleRank            = -1;

        regularDices[] activeDice = new regularDices[maxDices];
        for (int i = 0; i < maxDices; i++)
        {
            rd[i].RollTheDice();
            activeDice[i] = rd[i];
        }
        lastRoll = getMaxValue(activeDice);

        if (maxDices >= 2)
        {
            for (int i = 0; i < activeDice.Length; i++)
            {
                for (int j = i + 1; j < activeDice.Length; j++)
                {
                    if (activeDice[i].getFinalSide() == activeDice[j].getFinalSide() && activeDice[i].getFinalSide() > doubleRank)
                    {
                        doubleRank = activeDice[i].getFinalSide();
                    }
                }
            }
        }

        if (this.hasSpecialDie)
        {
            sd.RollTheDice();
            if (sd.finalSide >= lastRoll)
            {
                lastRoll = sd.finalSide;
            }
        }

        rollCount++;
        if (rollCount >= maxRollCount)
        {
            rollBtn.interactable = false;
        }

        if (fight.remainingRolls == 0)
        {
            fight.attackBtn.interactable = true;
        }

        fight.getHeroesScore();

        if (potionToken != null)
        {
            potion.interactable = true;
        }
        if (hasHelm && doubleRank > -1 && doubleRank * 2 > lastRoll)
        {
            helm.interactable = true;
        }

        return(lastRoll);
    }