Exemple #1
0
    public void MeleeAttack(EnemyClass _enemyScript)
    {
        enemyScript = _enemyScript;
        int toHitDice = Random.Range(1, 20);

        Debug.Log((toHitDice + mAttack) + " to hit the goblin.");
        if (toHitDice == 20)
        {
            bool hit = enemyScript.toHit(toHitDice + mAttack);

            if (hit)
            {
                enemyScript.DealDamage((Random.Range(1, 8) + strenghtMod) * 2);
            }
            else
            {
                enemyScript.DealDamage(Random.Range(1, 8) + strenghtMod);
            }
        }

        else if (toHitDice == 1)
        {
            //FAIL
        }

        else
        {
            bool hit = enemyScript.toHit(toHitDice + mAttack);

            if (hit)
            {
                enemyScript.DealDamage(Random.Range(1, 8) + strenghtMod);
            }
        }
    }