예제 #1
0
    IEnumerator EnemyDoesAttack(GameObject enemy, CharacterStatus EStatus, GameObject player, CharacterStatus target, int who)
    {
        // Animate attack
        //enemy.GetComponent<Animator>().SetTrigger("Attack");
        //yield return new WaitForSeconds(1);

        StartCoroutine(MoveOverSeconds(flyingBall, enemy.transform.position, player.transform.position, 0.5f, debugSetShader(statusDict[battleState].fuseName)));
        yield return(new WaitForSeconds(0.5f));

        float acc    = 1;
        int   damage = Mathf.CeilToInt(1.5f * acc *
                                       ((EStatus.attack + EStatus.boostATK) * UnityEngine.Random.Range(0.7f, 1f) /
                                        Mathf.Ceil(0.1f * target.defense)));

        playerStatusHUD.LoseHP(who, target, damage, Color.white);
        yield return(new WaitForSeconds(1f));

        yield return(StartCoroutine(IsPlayerDead()));
    }
예제 #2
0
    IEnumerator E1Turn()
    {
        yield return(new WaitForSeconds(0.5f)); SetSidePanel(false, false, false, false, false, false, false);

        int DMG = statusDict[battleState].updateStatuses();

        if (DMG > 0)
        {
            enemyStatusHUD.LoseHP(0, statusDict[battleState], DMG, new Color(1, 0.7f, 0, 1));
            yield return(new WaitForSeconds(0.6f));

            if (statusDict[battleState].currHealth <= 0)
            {
                yield return(StartCoroutine(IsMainEnemyDead()));

                yield break;
            }
        }

        if (statusDict[battleState].DoT_Turns > 0)
        {
            enemyStatusHUD.Debuff(statusDict[battleState].placement, true);
        }
        else
        {
            enemyStatusHUD.Debuff(statusDict[battleState].placement, false);
        }

        float chance = UnityEngine.Random.Range(0f, 1f);

        //Additional check to determine if the enemy can use a special move
        if ((statusDict[BattleState.P2TURN] != null || statusDict[BattleState.P3TURN] != null) &&
            statusDict[battleState].currEnergy >= 20 &&
            chance <= 0.3f)
        {
            enemyStatusHUD.LoseEN(statusDict[battleState].placement, statusDict[battleState], 20);
            yield return(StartCoroutine(EnemyDoesAttackAll(enemy1Debug, E1Status)));
        }
        else
        {
            (CharacterStatus, int, GameObject)toAttack = EChooseTarget();
            yield return(StartCoroutine(EnemyDoesAttack(enemy1Debug, E1Status, toAttack.Item3, toAttack.Item1, toAttack.Item2)));
        }
    }