Пример #1
0
    public void defend(int attackValue)
    {
        int dDefense;

        defenseLeft      = attackValue;
        defendSuccessful = false;
        //defenseValue = getDiceValue(getDice(), Side.valueTypes.DEFENSE); Die[] sDice = getDice(); Array.Sort(sDice);
        //defenseValue = DieLogic.getDiceValue(GameLogic.instance.gameLayout.getDiceInZoneNext("zoneSummoned"), Side.eValueTypes.DEFENSE);

        Die[] dice = GameLogic.instance.gameLayout.getDiceInZoneNext("zoneSummoned");

        if (dice.Length > 0)
        {
            foreach (Die die in dice)
            {
                dDefense = DieLogic.getDieValue(die, Side.eValueTypes.DEFENSE);
                if (dDefense > attackValue)
                {
                    //defenseLeft = 0;
                    defendSuccessful = true;
                    break;
                }
            }

            if (defendSuccessful)
            {
                Debug.Log(nextPlayer().getPlayerName() + " can fully defend against " + attackValue + " damage!");
            }
        }
        else
        {
            defendSuccessful = true;
            Debug.Log(nextPlayer().getPlayerName() + " has noone to use to defend");
        }
    }
Пример #2
0
    public void defendAttack(Die die)
    {
        int dDefense = DieLogic.getDieValue(die, Side.eValueTypes.DEFENSE);

        defenseLeft -= dDefense;

        if (defenseLeft <= 0 || GameLogic.instance.gameLayout.getDiceInZoneNext("zoneSummoned").Length == 0)
        {
            defendSuccessful = true;
        }
    }