Esempio n. 1
0
 //Lets the player select an item for the party member to use
 public void ButtonItemOption()
 {
     if (state == BattleStateWL.PARTYONESEL)
     {
         choiceOne         = ActionChoiceWL.ITEM;
         state             = BattleStateWL.PARTYTWOSEL;
         dialogueText.text = partyTwoUnit.unitName + "'s Action";
         ButtonAttackBack();
     }
     else if (state == BattleStateWL.PARTYTWOSEL)
     {
         choiceTwo         = ActionChoiceWL.ITEM;
         state             = BattleStateWL.PARTYTHREESEL;
         dialogueText.text = partyThreeUnit.unitName + "'s Action";
         ButtonAttackBack();
     }
     else if (state == BattleStateWL.PARTYTHREESEL)
     {
         choiceThree       = ActionChoiceWL.ITEM;
         state             = BattleStateWL.PARTYFOURSEL;
         dialogueText.text = partyFourUnit.unitName + "'s Action";
         ButtonAttackBack();
     }
     else if (state == BattleStateWL.PARTYFOURSEL)
     {
         choiceFour = ActionChoiceWL.ITEM;
         Debug.Log("Party Four Option Comp");
         actionPanel.SetActive(false);
         attackPanel.SetActive(false);
         dialogueText.text = " ... ";
         Debug.Log("Party Four Option Comp");
         StartCoroutine(PlayerCombatTurn());
     }
 }
Esempio n. 2
0
    //Runs during attack phase if passed unit selected basic attack
    IEnumerator PartyBasicAtk(UnitWLevelling unit)
    {
        bool isDead = false;

        if (!unit.unitIsMagic)
        {
            isDead            = enemyUnit.TakeRegDamage(unit, false);
            dialogueText.text = unit.unitName + " does " + (unit.unitAttack - enemyUnit.unitDef) + " damage!";
        }
        else if (unit.unitIsMagic)
        {
            isDead            = enemyUnit.TakeMagDamage(unit, false);
            dialogueText.text = unit.unitName + " does " + (unit.unitAttack - enemyUnit.unitRes) + " damage!";
        }

        unit.gameObject.GetComponent <Animator>().SetBool("isHit", true);
        yield return(new WaitForSeconds(1f));

        StartCoroutine(HitParticleSystem(enemyPlatform));
        enemyHUD.HPFiddling(enemyUnit.unitCurrentHP);

        yield return(new WaitForSeconds(2f));

        if (isDead)
        {
            state = BattleStateWL.WON;
            StartCoroutine(BattleEnd());
        }
        Debug.Log(unit.unitName + " B-ATK COMP");
    }
Esempio n. 3
0
    //Runs through functions for the enemy's attack turn
    IEnumerator EnemyTurn()
    {
        if (turnTick < 4)
        {
            Debug.Log("Enemy Basic Attack");
            AttackTargetingBasic();
        }
        else if (turnTick == 4)
        {
            Debug.Log("Enemy Special Attack");
            AttackTargetingSpecial();
        }


        yield return(new WaitForSeconds(2f));

        if (deadCheck == 4)
        {
            state = BattleStateWL.LOST;
            StartCoroutine(BattleEnd());
        }
        else
        {
            if (state != BattleStateWL.LOST || state != BattleStateWL.WON || state != BattleStateWL.ESCAPE)
            {
                state     = BattleStateWL.PARTYONESEL;
                turnTick += 1;
                MpRegen(partyOneUnit, pOneHUD);
                MpRegen(partyTwoUnit, pTwoHUD);
                MpRegen(partyThreeUnit, pThreeHUD);
                MpRegen(partyFourUnit, pFourHUD);
                MpRegen(enemyUnit, enemyHUD);

                PartyPhaseBegin();
            }
        }

        partyOneUnit.unitCurrentMP += 10;
        if (partyOneUnit.unitCurrentMP == partyOneUnit.unitMaxMP)
        {
            partyOneUnit.unitCurrentMP = partyOneUnit.unitMaxMP;
        }
        partyTwoUnit.unitCurrentMP += 10;
        if (partyTwoUnit.unitCurrentMP == partyTwoUnit.unitMaxMP)
        {
            partyTwoUnit.unitCurrentMP = partyTwoUnit.unitMaxMP;
        }
        partyThreeUnit.unitCurrentMP += 10;
        if (partyThreeUnit.unitCurrentMP == partyThreeUnit.unitMaxMP)
        {
            partyThreeUnit.unitCurrentMP = partyThreeUnit.unitMaxMP;
        }
        partyFourUnit.unitCurrentMP += 10;
        if (partyFourUnit.unitCurrentMP == partyFourUnit.unitMaxMP)
        {
            partyFourUnit.unitCurrentMP = partyFourUnit.unitMaxMP;
        }
    }
Esempio n. 4
0
    //Initialises Battle
    public IEnumerator BattleInit()
    {
        turnTick = 0;
        GameObject partyOneGO = Instantiate(partyMemOne, partyOnePlatform);

        partyOneUnit = partyOneGO.GetComponent <UnitWLevelling>();
        GameObject partyTwoGO = Instantiate(partyMemTwo, partyTwoPlatform);

        partyTwoUnit = partyTwoGO.GetComponent <UnitWLevelling>();
        GameObject partyThreeGO = Instantiate(partyMemThree, partyThreePlatform);

        partyThreeUnit = partyThreeGO.GetComponent <UnitWLevelling>();
        GameObject partyFourGO = Instantiate(partyMemFour, partyFourPlatform);

        partyFourUnit = partyFourGO.GetComponent <UnitWLevelling>();
        GameObject enemyGO = Instantiate(enemyObj, enemyPlatform);

        enemyUnit = enemyGO.GetComponent <UnitWLevelling>();
        UnitInit(overOne, partyOneUnit);
        UnitInit(overTwo, partyTwoUnit);
        UnitInit(overThree, partyThreeUnit);
        UnitInit(overFour, partyFourUnit);
        UnitInit(overEnemy, enemyUnit);

        battleCanvas.SetActive(true);
        actionPanel.SetActive(false);
        attackPanel.SetActive(false);

        overworldMusicEGO.SetActive(false);
        battleMusicEGO.SetActive(true);

        dialogueText      = dialogueObj.GetComponent <TextMeshProUGUI>();
        dialogueText.text = "A wild " + enemyUnit.unitName + " is committing Flibbity";

        pOneHUD.HUDFiddling(partyOneUnit);
        pTwoHUD.HUDFiddling(partyTwoUnit);
        pThreeHUD.HUDFiddling(partyThreeUnit);
        pFourHUD.HUDFiddling(partyFourUnit);
        enemyHUD.HUDFiddling(enemyUnit);

        if (tutorialScript.battleTutEnd == false)
        {
            yield return(new WaitForSeconds(1f));

            state = BattleStateWL.PARTYONESEL;
            StartCoroutine(tutorialScript.TutBattle1());
        }
        else
        {
            yield return(new WaitForSeconds(2f));

            state = BattleStateWL.PARTYONESEL;
            PartyPhaseBegin();
            Debug.Log("PartyPhaseBegun");
        }
    }
Esempio n. 5
0
    //Fills in action for Special Button
    IEnumerator CorouAttackSpecial()
    {
        if (state == BattleStateWL.PARTYONESEL)
        {
            choiceOne = ActionChoiceWL.ATTACKTWO;
            state     = BattleStateWL.PARTYTWOSEL;
            yield return(new WaitForSeconds(1f));

            ButtonAttackBack();
            dialogueText.text = partyTwoUnit.unitName + "'s Action";
            Debug.Log("Party One Option Comp");
        }
        else if (state == BattleStateWL.PARTYTWOSEL)
        {
            choiceTwo = ActionChoiceWL.ATTACKTWO;
            state     = BattleStateWL.PARTYTHREESEL;
            yield return(new WaitForSeconds(1f));

            ButtonAttackBack();
            dialogueText.text = partyThreeUnit.unitName + "'s Action";
            Debug.Log("Party Two Option Comp");
        }
        else if (state == BattleStateWL.PARTYTHREESEL)
        {
            choiceThree = ActionChoiceWL.ATTACKTWO;
            state       = BattleStateWL.PARTYFOURSEL;
            yield return(new WaitForSeconds(1f));

            ButtonAttackBack();
            dialogueText.text = partyFourUnit.unitName + "'s Action";
            Debug.Log("Party Three Option Comp");
        }
        else if (state == BattleStateWL.PARTYFOURSEL)
        {
            choiceFour = ActionChoiceWL.ATTACKTWO;
            state      = BattleStateWL.ATTACKTURN;
            yield return(new WaitForSeconds(1f));

            actionPanel.SetActive(false);
            attackPanel.SetActive(false);
            dialogueText.text = " ... ";
            Debug.Log("Party Four Option Comp");
            StartCoroutine(PlayerCombatTurn());
        }
    }
Esempio n. 6
0
 //If clicked at any point in the action select phase, battle will end. (probably)
 public void ButtonRunOption()
 {
     state = BattleStateWL.ESCAPE;
     StartCoroutine(BattleEnd());
 }
Esempio n. 7
0
    //Runs during attack phase if passed unit selected special attack
    IEnumerator PartySpecialAtk(UnitWLevelling unit)
    {
        bool isDead = false;

        if (unit.unitCurrentMP >= 33)
        {
            if (!unit.unitIsMagic && unit.unitClass != ClassSelect.HEALER)
            {
                isDead = enemyUnit.TakeRegDamage(unit, true);
                unit.gameObject.GetComponent <Animator>().SetBool("isHit", true);
                yield return(new WaitForSeconds(1f));

                StartCoroutine(HitParticleSystem(enemyPlatform));
                dialogueText.text = unit.unitName + " does " + (unit.unitAttack * 2) + " damage!";
            }
            else if (unit.unitIsMagic && unit.unitClass != ClassSelect.HEALER)
            {
                isDead = enemyUnit.TakeMagDamage(unit, true);
                unit.gameObject.GetComponent <Animator>().SetBool("isHit", true);
                yield return(new WaitForSeconds(1f));

                StartCoroutine(HitParticleSystem(enemyPlatform));
                dialogueText.text = unit.unitName + " does " + (unit.unitAttack * 2) + " damage!";
            }
            else if (unit.unitClass == ClassSelect.HEALER)
            {
                isDead = partyFourUnit.HealDamage(partyOneUnit, partyTwoUnit, partyThreeUnit);
                pOneHUD.HPFiddling(partyOneUnit.unitCurrentHP);
                pTwoHUD.HPFiddling(partyTwoUnit.unitCurrentHP);
                pThreeHUD.HPFiddling(partyThreeUnit.unitCurrentHP);
                pFourHUD.HPFiddling(partyFourUnit.unitCurrentHP);
                pFourHUD.MPFiddling(partyFourUnit.unitCurrentMP);

                dialogueText.text = unit.unitName + " does some light first aid!";
            }
        }
        else
        {
            dialogueText.text = unit.unitName + " doesn't have enough mana!";
        }
        if (unit.unitCurrentMP <= 0)
        {
            unit.unitCurrentMP = 0;
        }

        enemyHUD.HPFiddling(enemyUnit.unitCurrentHP);
        pOneHUD.HPFiddling(partyOneUnit.unitCurrentHP);
        pTwoHUD.HPFiddling(partyTwoUnit.unitCurrentHP);
        pThreeHUD.HPFiddling(partyThreeUnit.unitCurrentHP);
        pFourHUD.HPFiddling(partyFourUnit.unitCurrentHP);
        pOneHUD.MPFiddling(partyOneUnit.unitCurrentMP);
        pTwoHUD.MPFiddling(partyTwoUnit.unitCurrentMP);
        pThreeHUD.MPFiddling(partyThreeUnit.unitCurrentMP);
        pFourHUD.MPFiddling(partyFourUnit.unitCurrentMP);


        yield return(new WaitForSeconds(2f));

        if (isDead)
        {
            state = BattleStateWL.WON;
            StartCoroutine(BattleEnd());
        }
        Debug.Log(unit.unitName + " S-ATK COMP");
    }