示例#1
0
    public override void enemyAI(baseStats attacker)
    {
        int ran = Random.Range(0, attacker.b.charStats.Count);

        attacker.b.battleTarget = attacker.b.charStats[ran];
        int attack = 0;
        List <GameObject> weakList = new List <GameObject>();

        foreach (baseStats charac in attacker.b.stats)
        {
            if (charac.gameObject.tag == "enemy")
            {
                weakList.Add(charac.gameObject);
            }
        }
        for (int i = 0; i < weakList.Count; i++)
        {
            float lessHalf = weakList[i].GetComponent <baseStats>().ogHP / 2;
            if (weakList[i].GetComponent <baseStats>().HP < lessHalf && attacker.SP > 0)
            {
                attacker.b.battleTarget = attacker.b.lists.enemies[i];
                StatusSpecialAttack1(attacker.character.spec.statusName1, attacker, attacker.b.lists.enemies[i].GetComponent <baseStats>());
            }
            else
            {
                attack += 1;
            }
        }
        if (attack == weakList.Count)
        {
            attacker.StartCoroutine(attacker.b.enemyAttack(attacker.b.battleTarget));
        }
    }
示例#2
0
    public override void enemyAI(baseStats attacker)
    {
        List <GameObject> weakList = new List <GameObject>();

        foreach (baseStats charac in attacker.b.stats)
        {
            if (charac.gameObject.tag == "Player")
            {
                weakList.Add(charac.gameObject);
            }
        }
        int ran = Random.Range(0, weakList.Count);

        attacker.b.battleTarget = weakList[ran];

        float lessHalf = attacker.ogHP / 2;

        if (attacker.HP < lessHalf)
        {
            weakList = weakList.OrderBy(c => c.gameObject.GetComponent <baseStats>().HP).ToList();
            attacker.b.battleTarget = weakList[0];
            SpecialAttack1(attacker.character.spec.physicalName1, attacker, attacker.b.battleTarget.GetComponent <baseStats>());
        }
        else
        {
            attacker.StartCoroutine(attacker.b.enemyAttack(attacker.b.battleTarget));
        }
    }
示例#3
0
 void UseSA(baseStats target)
 {
     if (SAnum == 1)
     {
         SA(attacker.character.spec.physicalName1, attacker, target);
     }
     else if (SAnum == 2)
     {
         SA(attacker.character.spec.physicalName2, attacker, target);
     }
     else if (SAnum == 3)
     {
         SA(attacker.character.spec.physicalName3, attacker, target);
     }
     else if (SAnum == 4)
     {
         SA(attacker.character.spec.statusName1, attacker, target);
     }
     else if (SAnum == 5)
     {
         SA(attacker.character.spec.statusName2, attacker, target);
     }
     else if (SAnum == 6)
     {
         SA(attacker.character.spec.statusName3, attacker, target);
     }
 }
示例#4
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 SpecialAttack1(string name, baseStats attacker, baseStats target)
    {
        attacker.StartCoroutine(SA());
        IEnumerator SA()
        {
            attacker.b.battleText.text = attacker.name + " uses " + name;
            foreach (GameObject button in attacker.b.lists.buttons)
            {
                button.GetComponent <Button>().interactable = false;
            }
            attacker.SP -= 5;
            float upAttack  = attacker.attack * .50f;
            float supAttack = attacker.attack + upAttack;
            float damage    = supAttack - target.def;

            if (damage < 1)
            {
                damage = 1;
            }
            target.HP   -= damage;
            attacker.HP -= upAttack;
            if (target.GetComponent <baseStats>().HP < 1)
            {
                attacker.StartCoroutine(attacker.b.Die(target.GetComponent <baseStats>()));
            }
            else
            {
                attacker.b.TurnOrder();
            }
            yield break;
        }
    }
示例#6
0
    public void enemyChoose(bool SA)
    {
        List <baseStats> enemyList = new List <baseStats>();

        foreach (baseStats stat in stats)
        {
            if (stat.gameObject.tag == "enemy")
            {
                enemyList.Add(stat);
            }
        }
        enemyList = enemyList.OrderBy(c => c.GetComponent <baseStats>().importance).ToList();
        if (SA == true)
        {
            currentAction = "SAenemyChoose";
        }
        else
        {
            currentAction = "enemyChoose";
        }

        if (atk == "normal")
        {
            for (int i = 0; i < enemyList.Count; i++)
            {
                int gaming = i + 1;
                lists.buttons[i].GetComponentInChildren <Text>().text = enemyList[i].nameChar + "(" + gaming + ")";
                lists.buttons[i].GetComponent <Button>().interactable = true;
                GameObject enemy = enemyList[i].gameObject;
                lists.buttons[i].GetComponent <Button>().onClick.RemoveAllListeners();
                lists.buttons[i].GetComponent <Button>().onClick.AddListener(() => StartCoroutine(Attack(enemy)));
                lists.buttons[i + 1].GetComponentInChildren <Text>().text = "";
                lists.buttons[i + 1].GetComponent <Button>().interactable = false;
            }
        }
        else if (atk == "special")
        {
            for (int i = 0; i < enemyList.Count; i++)
            {
                int gaming = i + 1;
                lists.buttons[i].GetComponentInChildren <Text>().text = enemyList[i].nameChar + "(" + gaming + ")";
                lists.buttons[i].GetComponent <Button>().interactable = true;
                baseStats enemy = enemyList[i];
                lists.buttons[i].GetComponent <Button>().onClick.RemoveAllListeners();
                lists.buttons[i].GetComponent <Button>().onClick.AddListener(() => UseSA(enemy));
                lists.buttons[i + 1].GetComponentInChildren <Text>().text = "";
                lists.buttons[i + 1].GetComponent <Button>().interactable = false;
            }
        }
        if (enemyList.Count < 2)
        {
            lists.buttons[2].GetComponentInChildren <Text>().text = "";
            lists.buttons[2].GetComponent <Button>().interactable = false;
        }
        lists.buttons[3].GetComponentInChildren <Text>().text = "Back";
        lists.buttons[3].GetComponent <Button>().interactable = true;
        lists.buttons[3].GetComponent <Button>().onClick.RemoveAllListeners();
        lists.buttons[3].GetComponent <Button>().onClick.AddListener(Back);
    }
示例#7
0
 public override void Act(baseStats attacker)
 {
     attacker.HP += heal;
     if (attacker.HP > attacker.ogHP)
     {
         attacker.HP = attacker.ogHP;
     }
 }
示例#8
0
 public override void Act(baseStats attacker)
 {
     attacker.SP += heal;
     if (attacker.SP > attacker.ogSP)
     {
         attacker.SP = attacker.ogSP;
     }
 }
示例#9
0
    public override void SpecialAttack2(string name, baseStats attacker, baseStats target)
    {
        attacker.StartCoroutine(SA());
        IEnumerator SA()
        {
            if (attacker.SP > 3)
            {
                foreach (GameObject button in attacker.b.lists.buttons)
                {
                    button.GetComponent <Button>().interactable = false;
                }
                attacker.b.battleText.text = attacker.nameChar + " uses " + name;
                attacker.gameObject.GetComponent <Animator>().SetBool("attack", true);


                attacker.slash = SAPrefab2;
                attacker.SP   -= 4;
                yield return(new WaitForSeconds(1.2f));

                attacker.gameObject.GetComponent <Animator>().SetBool("attack", false);
                yield return(new WaitForSeconds(1.5f));

                if (target.status == "")
                {
                    target.status = "Sleep";
                    Color c = Color.gray;

                    target.transform.GetChild(0).GetComponent <SpriteRenderer>().color = Color.gray;
                    //Debug.Log(target.gameObject.GetComponentInChildren<SpriteRenderer>().color);
                    target.statusDuration = 2;
                }
                float attackUp = attacker.attack * 2f;
                float damage   = attackUp - target.GetComponent <baseStats>().def;
                if (damage < 1)
                {
                    damage = 1;
                }
                target.GetComponent <baseStats>().HP -= damage;
                target.GetComponent <baseStats>().damageText.GetComponent <Text>().text = damage.ToString();
                target.GetComponent <baseStats>().damageText.GetComponent <DamageTextEffect>().DamageStartFloating();

                if (target.GetComponent <baseStats>().HP < 1)
                {
                    attacker.StartCoroutine(attacker.b.Die(target.GetComponent <baseStats>()));
                }
                else
                {
                    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));
            }
        }
    }
示例#10
0
 public baseStats mainChar;     //this will be accessible to inspector now.
 void Start()
 {
     // This will always create a new instance of baseStats that overrides the values
     // set in inspector.  Remove this line if you want the values set in the
     // inspector to remain.
     mainChar = new baseStats {
         Example = 12
     };
 }
示例#11
0
    public override void SpecialAttack2(string name, baseStats attacker, baseStats target)
    {
        attacker.StartCoroutine(SA());
        IEnumerator SA()
        {
            if (attacker.SP > 1)
            {
                foreach (GameObject button in attacker.b.lists.buttons)
                {
                    button.GetComponent <Button>().interactable = false;
                }
                attacker.b.battleTarget = target.gameObject;
                attacker.slash          = SAPrefab1;
                attacker.SP            -= 2;
                float upAttack = attacker.attack + 2;
                float damage   = upAttack - target.def;
                if (damage < 1)
                {
                    damage = 1;
                }
                attacker.b.battleText.text = attacker.gameObject.name + " uses " + name;
                attacker.gameObject.GetComponent <Animator>().SetBool("attack", true);
                yield return(new WaitForSeconds(1.2f));

                if (target.status == "")
                {
                    target.status = "Confused";

                    target.statusDuration = 4;
                }
                attacker.gameObject.GetComponent <Animator>().SetBool("attack", false);
                yield return(new WaitForSeconds(1.5f));

                target.HP -= damage;
                target.damageText.GetComponent <Text>().text = damage.ToString();
                target.damageText.GetComponent <DamageTextEffect>().DamageStartFloating();

                if (target.GetComponent <baseStats>().HP < 1)
                {
                    attacker.StartCoroutine(attacker.b.Die(target.GetComponent <baseStats>()));
                }
                else
                {
                    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));
            }
        }
    }
示例#12
0
 void partyChoose()
 {
     for (int i = 0; i < GlobalManager.instance.currentParty.Count; i++)
     {
         itemButtons[i].interactable = true;
         itemButtons[i].GetComponent <Image>().enabled          = true;
         itemButtons[i].GetComponentInChildren <Text>().enabled = true;
         itemButtons[i].GetComponentInChildren <Text>().text    = GlobalManager.instance.currentParty[i].nameChar;
         itemButtons[i].onClick.RemoveAllListeners();
         baseStats target = GlobalManager.instance.currentParty[i];
         itemButtons[i].onClick.AddListener(() => itemUse(target));
     }
 }
示例#13
0
    public override void SpecialAttack1(string name, baseStats attacker, baseStats target)
    {
        attacker.StartCoroutine(SA());
        IEnumerator SA()
        {
            if (attacker.SP > 2)
            {
                attacker.SP -= 3;
                foreach (GameObject button in attacker.b.lists.buttons)
                {
                    button.GetComponent <Button>().interactable = false;
                }
                attacker.b.battleText.text = attacker.nameChar + " uses " + name;
                attacker.gameObject.GetComponent <Animator>().SetBool("attack", true);
                attacker.slash = SAPrefab1;
                attacker.gameObject.GetComponent <enemyDeath>().multi = true;
                yield return(new WaitForSeconds(1.2f));

                attacker.gameObject.GetComponent <Animator>().SetBool("attack", false);
                yield return(new WaitForSeconds(1.5f));

                float attackUp = attacker.attack * 2f;
                foreach (GameObject hero in attacker.b.charStats)
                {
                    float damage = attackUp - hero.GetComponent <baseStats>().def;
                    if (damage < 1)
                    {
                        damage = 1;
                    }
                    hero.GetComponent <baseStats>().HP -= damage;
                    hero.GetComponent <baseStats>().damageText.GetComponent <Text>().text = damage.ToString();
                    hero.GetComponent <baseStats>().damageText.GetComponent <DamageTextEffect>().DamageStartFloating();
                }
                if (target.GetComponent <baseStats>().HP < 1)
                {
                    attacker.StartCoroutine(attacker.b.Die(target.GetComponent <baseStats>()));
                }
                else
                {
                    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 static void Sleep(baseStats target, battleSystem bat)
    {
        bat.StartCoroutine(sleep());
        IEnumerator sleep()
        {
            if (target.statusDuration > 0)
            {
                bat.battleText.text = target.nameChar + " is sleeping...";
                target.transform.GetChild(1).GetComponent <Animator>().SetBool("sleeping", true);
                yield return(new WaitForSeconds(.5f));

                target.transform.GetChild(1).GetComponent <Animator>().SetBool("sleeping", false);
                bat.StartCoroutine(bat.sleep());
                target.statusDuration -= 1;
            }
            else
            {
                bat.battleText.text = target.nameChar + " woke up!";
                target.transform.GetChild(0).GetComponent <SpriteRenderer>().color = Color.white;
                target.status = null;
                yield return(new WaitForSeconds(1f));

                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();
                }
            }
        }
    }
示例#15
0
    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;
                }
            }
        }
    }
示例#16
0
    public override void SpecialAttack1(string name, baseStats attacker, baseStats target)
    {
        attacker.StartCoroutine(SA1());
        IEnumerator SA1()
        {
            if (attacker.SP > 3)
            {
                foreach (GameObject button in attacker.b.lists.buttons)
                {
                    button.GetComponent <Button>().interactable = false;
                }
                attacker.b.battleTarget = target.gameObject;
                attacker.slash          = SAPrefab1;
                attacker.SP            -= 3;
                float upAttack = attacker.attack * 2;
                float damage   = upAttack - target.def;
                attacker.b.battleText.text = attacker.name + " uses " + name;
                attacker.gameObject.GetComponent <Animator>().SetBool("attack", true);
                yield return(new WaitForSeconds(1.2f));

                attacker.gameObject.GetComponent <Animator>().SetBool("attack", false);
                yield return(new WaitForSeconds(1f));

                target.HP -= damage;
                if (damage < 1)
                {
                    damage = 1;
                }
                target.damageText.GetComponent <Text>().text = damage.ToString();
                target.damageText.GetComponent <DamageTextEffect>().DamageStartFloating();
                if (target.GetComponent <baseStats>().HP < 1)
                {
                    attacker.StartCoroutine(attacker.b.Die(target.GetComponent <baseStats>()));
                }
                else
                {
                    attacker.b.TurnOrder();
                }
            }
            else
            {
                attacker.skip = true;
            }
        }
    }
 // Update is called once per frame
 public static void CheckStatus(baseStats target, battleSystem battle)
 {
     if (target.status == "Poison")
     {
         Poison(target, battle);
     }
     else if (target.status == "Sleep")
     {
         Sleep(target, battle);
     }
     else if (target.status == "Confused")
     {
         Confuse(target, battle, battle);
     }
     else if (target.status == "Depressed")
     {
         Depression(target, battle, battle);
     }
 }
示例#18
0
    public IEnumerator Revive(baseStats stat)
    {
        stats.Add(stat);
        foreach (GameObject button in lists.buttons)
        {
            button.GetComponent <Button>().interactable = false;
        }

        if (stat.gameObject.tag == "enemy")
        {
            battleText.text = "The " + stat.nameChar + " came back from the dead!";
            stat.gameObject.GetComponent <Animator>().SetBool("dead", false);
            yield return(new WaitForSeconds(1f));

            sortedStats = stats.OrderBy(s => s.speed).ToList();

            sortedStats.Reverse();
            foreach (baseStats state in sortedStats)
            {
                state.turn = false;
            }
            currentActor = 0;
            TurnOrder();
        }
        else if (stat.gameObject.tag == "Player")
        {
            battleText.text = stat.nameChar + " is revived!";
            stat.gameObject.GetComponent <Animator>().SetBool("fainted", false);
            stat.status = "";
            yield return(new WaitForSeconds(1f));

            sortedStats = stats.OrderBy(s => s.speed).ToList();

            sortedStats.Reverse();
            foreach (baseStats state in sortedStats)
            {
                state.turn = false;
            }
            currentActor = 0;
            TurnOrder();
        }
    }
示例#19
0
    public override void enemyAI(baseStats attacker)
    {
        int ran = Random.Range(0, attacker.b.charStats.Count);

        attacker.b.battleTarget = attacker.b.charStats[ran];
        if (attacker.SP > 1)
        {
            //int ran2 = Random.Range(1, 3);
            //if (ran2 == 1)
            //{
            SpecialAttack1(attacker.character.spec.physicalName1, attacker, attacker.b.battleTarget.GetComponent <baseStats>());
            //} else if (ran2 == 2)
            //{
            //SpecialAttack2(attacker.character.spec.physicalName2, attacker, attacker.b.battleTarget.GetComponent<baseStats>());
            //}
        }
        else
        {
            attacker.StartCoroutine(attacker.b.enemyAttack(attacker.b.battleTarget));
        }
    }
示例#20
0
    public IEnumerator Die(baseStats stat)
    {
        stats.Remove(stat);
        sortedStats.Remove(stat);
        stat.gameObject.GetComponent <Animator>().SetBool("fainted", true);
        stat.HP = 0;
        if (stat.gameObject.tag == "enemy")
        {
            battleText.text = "The " + stat.nameChar + " is destroyed!";

            yield return(new WaitForSeconds(1f));

            sortedStats = stats.OrderBy(s => s.speed).ToList();

            sortedStats.Reverse();
            foreach (baseStats state in sortedStats)
            {
                state.turn = false;
            }
            currentActor = 0;
            TurnOrder();
        }
        else if (stat.gameObject.tag == "Player")
        {
            battleText.text = stat.nameChar + " faints!";

            stat.status = "Fainted";
            yield return(new WaitForSeconds(1f));

            sortedStats = stats.OrderBy(s => s.speed).ToList();

            sortedStats.Reverse();
            foreach (baseStats state in sortedStats)
            {
                state.turn = false;
            }
            currentActor = 0;
            TurnOrder();
        }
    }
 public static void CheckBuff(baseStats target)
 {
     if (target.buffDuration > 0)
     {
         if (target.buffedStat == "attack")
         {
             BuffDebuff(target, target.attack);
         }
         else if (target.buffedStat == "defence")
         {
             BuffDebuff(target, target.def);
         }
         else if (target.buffedStat == "speed")
         {
             BuffDebuff(target, target.speed);
         }
     }
     else
     {
         if (target.buffedStat == "attack")
         {
             target.attack    -= target.buff;
             target.buffedStat = "";
             target.buff       = 0;
         }
         else if (target.buffedStat == "defence")
         {
             target.def       -= target.buff;
             target.buffedStat = "";
             target.buff       = 0;
         }
         else if (target.buffedStat == "speed")
         {
             target.speed     -= target.buff;
             target.buffedStat = "";
             target.buff       = 0;
         }
     }
 }
    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;
            }
        }
    }
示例#23
0
    public void partyChoose(bool revive)
    {
        if (currentAction == "SAStatus")
        {
            currentAction = "SAPartyChoose";
            if (revive == true)
            {
                List <baseStats> heroList = new List <baseStats>();
                foreach (GameObject charac in lists.chars)
                {
                    if (charac.tag == "Player" && charac.GetComponent <baseStats>().status == "Fainted")
                    {
                        heroList.Add(charac.GetComponent <baseStats>());
                    }
                }
                if (heroList.Count < 1)
                {
                    attacker.skip = true;
                }
                else
                {
                    for (int i = 0; i < heroList.Count; i++)
                    {
                        lists.buttons[i].GetComponentInChildren <Text>().text = heroList[i].nameChar;
                        lists.buttons[i].GetComponent <Button>().interactable = true;
                        baseStats hero = heroList[i];
                        lists.buttons[i].GetComponent <Button>().onClick.RemoveAllListeners();
                        lists.buttons[i].GetComponent <Button>().onClick.AddListener(() => UseSA(hero));
                        lists.buttons[i + 1].GetComponentInChildren <Text>().text = "";
                        lists.buttons[i + 1].GetComponent <Button>().interactable = false;
                    }
                    if (heroList.Count < 2)
                    {
                        lists.buttons[2].GetComponentInChildren <Text>().text = "";
                        lists.buttons[2].GetComponent <Button>().interactable = false;
                    }
                    lists.buttons[3].GetComponentInChildren <Text>().text = "Back";
                    lists.buttons[3].GetComponent <Button>().interactable = true;
                    lists.buttons[3].GetComponent <Button>().onClick.RemoveAllListeners();
                    lists.buttons[3].GetComponent <Button>().onClick.AddListener(Back);
                }
            }
            else
            {
                List <baseStats> heroList = new List <baseStats>();
                foreach (baseStats stat in stats)
                {
                    if (stat.gameObject.tag == "Player")
                    {
                        heroList.Add(stat);
                    }
                }

                for (int i = 0; i < heroList.Count; i++)
                {
                    lists.buttons[i].GetComponentInChildren <Text>().text = heroList[i].nameChar;
                    lists.buttons[i].GetComponent <Button>().interactable = true;
                    baseStats hero = heroList[i];
                    lists.buttons[i].GetComponent <Button>().onClick.RemoveAllListeners();
                    lists.buttons[i].GetComponent <Button>().onClick.AddListener(() => UseSA(hero));
                    lists.buttons[i + 1].GetComponentInChildren <Text>().text = "";
                    lists.buttons[i + 1].GetComponent <Button>().interactable = false;
                }
                if (heroList.Count < 2)
                {
                    lists.buttons[2].GetComponentInChildren <Text>().text = "";
                    lists.buttons[2].GetComponent <Button>().interactable = false;
                }
                lists.buttons[3].GetComponentInChildren <Text>().text = "Back";
                lists.buttons[3].GetComponent <Button>().interactable = true;
                lists.buttons[3].GetComponent <Button>().onClick.RemoveAllListeners();
                lists.buttons[3].GetComponent <Button>().onClick.AddListener(Back);
            }
        }
        else if (currentAction == "items")
        {
            List <baseStats> heroList = new List <baseStats>();
            foreach (baseStats stat in stats)
            {
                if (stat.gameObject.tag == "Player")
                {
                    heroList.Add(stat);
                }
            }
            for (int i = 0; i < heroList.Count; i++)
            {
                lists.buttons[i].GetComponentInChildren <Text>().text = heroList[i].nameChar;
                lists.buttons[i].GetComponent <Button>().interactable = true;

                lists.buttons[i].GetComponent <Button>().onClick.RemoveAllListeners();
                lists.buttons[i].GetComponent <Button>().onClick.AddListener(() => itemUse(attacker));
                lists.buttons[i + 1].GetComponentInChildren <Text>().text = "";
                lists.buttons[i + 1].GetComponent <Button>().interactable = false;
            }
            if (heroList.Count < 2)
            {
                lists.buttons[2].GetComponentInChildren <Text>().text = "";
                lists.buttons[2].GetComponent <Button>().interactable = false;
            }
            lists.buttons[3].GetComponentInChildren <Text>().text = "Back";
            lists.buttons[3].GetComponent <Button>().interactable = true;
            lists.buttons[3].GetComponent <Button>().onClick.RemoveAllListeners();
            lists.buttons[3].GetComponent <Button>().onClick.AddListener(Back);
        }
    }
示例#24
0
    public void TurnOrder()
    {
        itemsParent.gameObject.GetComponent <Image>().enabled = false;
        foreach (InventorySlot slot in slots)
        {
            slot.gameObject.GetComponentInChildren <Button>().interactable = false;
            slot.removeButton.interactable = false;
            slot.removeButton.gameObject.GetComponent <Image>().enabled = false;

            slot.gameObject.GetComponentInChildren <Image>().enabled = false;
        }
        foreach (InventorySlot slot in slots)
        {
            slot.icon.enabled = false;
            slot.color.a      = 0;
        }
        foreach (GameObject button in lists.buttons)
        {
            button.GetComponent <Button>().interactable = false;
        }

        sortedStats = stats.OrderBy(s => s.speed).ToList();

        sortedStats.Reverse();


        for (int i = 0; i < sortedStats.Count; i++)
        {
            float lastSpeed = 0;
            if (i < 1)
            {
                lastSpeed = 0;
            }
            else
            {
                lastSpeed = sortedStats[i - 1].speed;
            }
            if (sortedStats[i].speed == lastSpeed)
            {
                sortedStats[i].speedUp = true;
                sortedStats[i].speed  += 1;
            }
            else
            {
            }
        }
        sortedStats = stats.OrderBy(s => s.speed).ToList();
        sortedStats.Reverse();
        int size = sortedStats.Count;

        stats = sortedStats;
        baseStats        currentCharTurn = sortedStats[currentActor];
        List <baseStats> enemyList       = new List <baseStats>();

        if (currentActor == 1)
        {
            stats = sortedStats;
        }
        foreach (baseStats stat in stats)
        {
            if (stat.gameObject.tag == "enemy")
            {
                enemyList.Add(stat);
            }
        }
        List <baseStats> heroList = new List <baseStats>();

        foreach (baseStats stat in stats)
        {
            if (stat.gameObject.tag == "Player")
            {
                heroList.Add(stat);
            }
        }
        // Take that turn

        if (enemyList.Count < 1)
        {
            Debug.Log("poggers");
            battleText.text = "POGGERS";
            FinishBattle();
        }
        else if (heroList.Count < 1)
        {
            Debug.Log("OmegaLOL");
            battleText.text = "OmegaLOL";
            GlobalManager.instance.GameOver();
        }
        else if (currentCharTurn.status != "")
        {
            StatusEffects.CheckStatus(currentCharTurn, this);
            StatusEffects.CheckBuff(currentCharTurn);
            attacker = currentCharTurn;
            Debug.Log("Turn:" + attacker.nameChar);
        }
        else if (currentCharTurn.gameObject.tag == "Player" && currentCharTurn.turn == false)
        {
            StatusEffects.CheckBuff(currentCharTurn);

            currentCharTurn.turn = true;
            attacker             = currentCharTurn;
            foreach (InventorySlot slot in slots)
            {
                slot.attacker = attacker;
            }
            Debug.Log("Turn:" + attacker.nameChar);
            playerTurn();
        }
        else if (currentCharTurn.gameObject.tag == "enemy" && currentCharTurn.turn == false)
        {
            StatusEffects.CheckBuff(currentCharTurn);
            currentCharTurn.turn = true;

            attacker = currentCharTurn;
            foreach (InventorySlot slot in slots)
            {
                slot.attacker = attacker;
            }
            Debug.Log("Turn:" + attacker.nameChar);
            attacker.gameObject.GetComponent <enemyDeath>().Die();
            attacker.character.spec.enemyAI(attacker);
        }

        if (size > sortedStats.Count)
        {
            sortedStats = stats.OrderBy(s => s.speed).ToList();

            sortedStats.Reverse();
            foreach (baseStats stat in sortedStats)
            {
                stat.turn = false;
            }
            currentActor = 0;
            Reset();
        }

        currentActor++;

        if (currentActor > sortedStats.Count - 1)
        {
            foreach (baseStats stat in sortedStats)
            {
                stat.turn = false;
            }
            currentActor = 0;
        }
    }
 public void UseItemm(baseStats target)
 {
     attacker = target;
     StartCoroutine(UseItem());
 }
示例#26
0
 public abstract void Act(baseStats attacker);
示例#27
0
 public override void StatusSpecialAttack3(string name, baseStats attacker, baseStats target)
 {
 }
示例#28
0
 public override void Act(baseStats attacker)
 {
     attacker.buff         = buff;
     attacker.attack      += attacker.buff;
     attacker.buffDuration = 3;
 }
示例#29
0
 public virtual void Use(baseStats attacker)
 {
     action.Act(attacker);
 }
 public override void enemyAI(baseStats attacker)
 {
 }