示例#1
0
    public override void StatusSpecialAttack1(string name, baseStats attacker, baseStats target)
    {
        attacker.StartCoroutine(SA());
        IEnumerator SA()
        {
            if (attacker.SP > 4)
            {
                float heal = attacker.b.battleTarget.GetComponent <baseStats>().ogHP * .1f;
                attacker.SP -= 5;
                attacker.b.battleText.text = attacker.gameObject.name + " uses " + name;
                target.slash = SAPrefab4;
                target.AttackSlash1();
                yield return(new WaitForSeconds(1f));

                heal       = Mathf.Round(heal);
                target.HP += heal;
                target.damageText.GetComponent <Text>().text = heal.ToString();
                target.damageText.GetComponent <DamageTextEffect>().HealStartFloating();
                yield return(new WaitForSeconds(1f));

                attacker.b.TurnOrder();
            }
            else
            {
                int ran = Random.Range(0, attacker.b.charStats.Count);
                attacker.b.battleTarget = attacker.b.charStats[ran];
                attacker.StartCoroutine(attacker.b.enemyAttack(attacker.b.battleTarget));
            }
        }
    }
    public override void StatusSpecialAttack1(string name, baseStats attacker, baseStats target)
    {
        attacker.StartCoroutine(SSA1());
        IEnumerator SSA1()
        {
            if (attacker.SP > 2)
            {
                foreach (GameObject button in attacker.b.lists.buttons)
                {
                    button.GetComponent <Button>().interactable = false;
                }
                attacker.b.battleTarget = target.gameObject;
                target.slash            = SAPrefab4;
                attacker.SP            -= 3;
                float heal = target.ogHP * .1f;
                heal       = Mathf.Round(heal);
                target.HP += heal;
                if (target.HP > target.ogHP)
                {
                    target.HP = target.ogHP;
                }
                attacker.b.battleText.text = attacker.name + " uses " + name;
                target.AttackSlash1();
                yield return(new WaitForSeconds(1f));

                target.damageText.GetComponent <Text>().text = heal.ToString();
                target.damageText.GetComponent <DamageTextEffect>().HealStartFloating();
                yield return(new WaitForSeconds(1f));

                target.b.TurnOrder();
            }
            else
            {
                if (attacker.SP > 0)
                {
                    attacker.SP -= 1;
                    attacker.StartCoroutine(attacker.b.Revive(target));
                }
                else
                {
                    attacker.skip = true;
                }
            }
        }
    }
    public override void StatusSpecialAttack1(string name, baseStats attacker, baseStats target)
    {
        attacker.StartCoroutine(SA());
        IEnumerator SA()
        {
            foreach (GameObject button in attacker.b.lists.buttons)
            {
                button.GetComponent <Button>().interactable = false;
            }
            if (target.buffedStat == "" && attacker.SP > 1)
            {
                attacker.b.battleText.text = attacker.name + " uses " + name;
                foreach (GameObject button in attacker.b.lists.buttons)
                {
                    button.GetComponent <Button>().interactable = false;
                }
                attacker.b.battleTarget = target.gameObject;
                target.slash            = SAPrefab4;
                target.AttackSlash1();
                yield return(new WaitForSeconds(2f));

                attacker.b.battleText.text = target.name + "'s attack goes up!";
                attacker.SP        -= 2;
                target.buff         = 10;
                target.attack      += target.buff;
                target.buffDuration = 3;
                target.buffedStat   = "attack";
                yield return(new WaitForSeconds(2f));

                attacker.b.TurnOrder();
            }
            else
            {
                attacker.skip = true;
            }
        }
    }
    public static void Confuse(baseStats target, battleSystem bat, MonoBehaviour poo)
    {
        bat.StartCoroutine(confuse());
        IEnumerator confuse()
        {
            if (target.statusDuration > 0)
            {
                bat.battleText.text = target.nameChar + " is confused!";
                target.transform.GetChild(1).GetComponent <Animator>().SetBool("confused", true);
                yield return(new WaitForSeconds(.5f));

                target.transform.GetChild(1).GetComponent <Animator>().SetBool("confused", false);
                yield return(new WaitForSeconds(1.5f));

                int ran1 = Random.Range(0, 3);
                if (ran1 > 0)
                {
                    if (target.gameObject.tag == "enemy")
                    {
                        bat.attacker = target;
                        int ran = Random.Range(0, bat.lists.enemies.Count);
                        bat.battleTarget = bat.lists.enemies[ran];
                    }
                    else if (target.gameObject.tag == "Player")
                    {
                        bat.attacker = target;
                        int ran = Random.Range(0, bat.lists.chars.Count);
                        bat.battleTarget = bat.lists.chars[ran];
                    }
                    bat.damage = Mathf.Round(bat.attacker.ogHP * 0.1f);


                    yield return(new WaitForSeconds(2f));

                    bat.battleText.text = target.gameObject.name + " harms their own party!";
                    target.AttackSlash1();
                    yield return(new WaitForSeconds(1f));

                    target.GetComponent <baseStats>().HP -= bat.damage;
                    target.GetComponent <baseStats>().damageText.gameObject.GetComponent <Text>().text = bat.damage.ToString();
                    target.GetComponent <baseStats>().damageText.gameObject.GetComponent <DamageTextEffect>().DamageStartFloating();
                    bat.StartCoroutine(bat.sleep());
                }
                else if (ran1 < 1)
                {
                    if (target.gameObject.tag == "enemy")
                    {
                        target.turn = true;
                        int ran = Random.Range(0, bat.lists.chars.Count);
                        bat.battleTarget = bat.lists.chars[ran];
                        bat.attacker     = target;
                        foreach (InventorySlot slot in bat.slots)
                        {
                            slot.attacker = bat.attacker;
                        }

                        bat.StartCoroutine(bat.enemyAttack(bat.battleTarget));
                    }
                    else if (target.gameObject.tag == "Player")
                    {
                        target.turn  = true;
                        bat.attacker = target;
                        foreach (InventorySlot slot in bat.slots)
                        {
                            slot.attacker = bat.attacker;
                        }
                        bat.playerTurn();
                    }
                }
                target.statusDuration -= 1;
            }
            else
            {
                target.transform.GetChild(0).GetComponent <SpriteRenderer>().color = Color.white;
                bat.battleText.text = target.nameChar + " regained consciousness.";
                target.status       = null;
                yield return(new WaitForSeconds(1f));

                if (target.gameObject.tag == "Player")
                {
                    target.turn  = true;
                    bat.attacker = target;
                    foreach (InventorySlot slot in bat.slots)
                    {
                        slot.attacker = bat.attacker;
                    }
                    Debug.Log("Turn:" + bat.attacker.name);
                    bat.playerTurn();
                }
                else if (target.gameObject.tag == "enemy")
                {
                    target.turn = true;
                    int ran = Random.Range(0, bat.lists.chars.Count);
                    bat.battleTarget = bat.lists.chars[ran];
                    bat.attacker     = target;
                    foreach (InventorySlot slot in bat.slots)
                    {
                        slot.attacker = bat.attacker;
                    }


                    bat.StartCoroutine(bat.enemyAttack(bat.battleTarget));
                }
            }
        }
    }