Пример #1
0
    public void Attack()
    {
        int dmg   = 0;
        int adder = 0;

        if (myTurn)
        {
            AniManager.YouAttack();
            if (myMonster.level > yourMonster.level)
            {
                adder = (myMonster.level - yourMonster.level) * 2;
            }
            else
            {
                adder = (myMonster.level - yourMonster.level);
            }
            switch (charged)
            {
            case 0:
                dmg = 3;
                break;

            case 1:
                dmg = 15 + adder;
                break;

            case 2:
                dmg = (15 + adder) * 3;
                break;

            case 3:
                dmg = (15 + adder) * 5;
                break;
            }
            yourMonster.hp    -= Mathf.Max(dmg - yourMonster.shield, 0);
            yourMonster.shield = 0;
            charged            = 0;
            AniManager.YouShieldBreak();
            if (yourMonster.hp <= 0)
            {
                Win();
            }
            else
            {
                ChangeTurn();
            }
        }
        else
        {
            AniManager.MeAttack();
            if (myMonster.level > yourMonster.level)
            {
                adder = -(myMonster.level - yourMonster.level);
            }
            else
            {
                adder = -(myMonster.level - yourMonster.level) * 2;
            }
            dmg              = 15 + adder;
            myMonster.hp    -= Mathf.Max(dmg - myMonster.shield, 0);
            myMonster.shield = 0;
            AniManager.MeShieldBreak();
            if (myMonster.hp <= 0)
            {
                Lose();
            }
            else
            {
                ChangeTurn();
            }
        }
    }