예제 #1
0
    private IEnumerator Attack()
    {
        int fireShieldCastedCount  = 0;
        int smokeScreenCastedCount = 0;

        while (enemyCharacter.GetMana() >= Mathf.Min(fireBreathManaCost, fireShieldManaCost, smokeScreenManaCost))
        {
            yield return(new WaitForSeconds(1));

            for (int i = 0; i < spells.Count; i++)
            {
                spellPriority[i] = Random.Range(0, 100);
            }
            if (enemyCharacter.HasElementalShield())
            {
                spellPriority[1] -= (50 + (-50 * fireShieldCastedCount));
            }
            if (playerCharacter.IsBlinded())
            {
                spellPriority[2] -= (50 + (-50 * smokeScreenCastedCount));
            }
            int         spellToCastIndex = System.Array.IndexOf(spellPriority, spellPriority.Max());
            IEnemySpell spellToCast      = spells[spellToCastIndex];
            while (spellToCast.ManaCost > enemyCharacter.GetMana())
            {
                spellPriority[spellToCastIndex] = -100;
                spellToCastIndex = System.Array.IndexOf(spellPriority, spellPriority.Max());
                spellToCast      = spells[spellToCastIndex];
            }
            spellToCast.DoSpellEffect(enemy, playerCharacter);
            enemyCharacter.DecreaseMana(spellToCast.ManaCost);
            if (spellToCast is EnemyElementalShield)
            {
                fireShieldCastedCount++;
            }
            else if (spellToCast is EnemySmokeScreen)
            {
                smokeScreenCastedCount++;
            }
        }
        enemy.EndTurn();
    }
예제 #2
0
    private IEnumerator Attack()
    {
        int darkShieldCastedCount = 0;

        while (enemyCharacter.GetMana() >= Mathf.Min(lifeStealManaCost, mindBlowManaCost, empowerManaCost))
        {
            yield return(new WaitForSeconds(1));

            for (int i = 0; i < spells.Count; i++)
            {
                spellPriority[i] = Random.Range(0, 100);
            }
            if (enemyCharacter.HasElementalShield())
            {
                spellPriority[1] -= (50 + (-50 * darkShieldCastedCount));
            }
            if (enemyCharacter.GetEmpoweredDamage() > 0)
            {
                spellPriority[2] -= 100;
            }
            int         spellToCastIndex = System.Array.IndexOf(spellPriority, spellPriority.Max());
            IEnemySpell spellToCast      = spells[spellToCastIndex];
            while (spellToCast.ManaCost > enemyCharacter.GetMana())
            {
                spellPriority[spellToCastIndex] = -100;
                spellToCastIndex = System.Array.IndexOf(spellPriority, spellPriority.Max());
                spellToCast      = spells[spellToCastIndex];
            }
            spellToCast.DoSpellEffect(enemy, playerCharacter);
            enemyCharacter.DecreaseMana(spellToCast.ManaCost);
            if (spellToCast is EnemyElementalShield)
            {
                darkShieldCastedCount++;
            }
        }
        enemy.EndTurn();
    }