Esempio n. 1
0
 /// <summary>
 /// Tests the resolution of combat.
 /// </summary>
 public void TestCombatEnd()
 {
     Debug.Log("TestCombatEnd() Called!");
     if (CombatMgr._instance != null)
     {
         //This test case assumes Party one was the victor so use their scene as the return point
         CombatEndData d = new CombatEndData(GameConstants.CombatEndType.Party1Win, CombatMgr._instance.PartyOneReturnScene, CombatMgr._instance.FoundItems, 5, "You won, hoo hoo rayyy!");
         CombatMgr._instance.EndCombat(d);
     }
     else
     {
         Debug.LogError("No combat manager found!");
     }
 }
Esempio n. 2
0
    /// <summary>
    /// Handle cleanup and resolution of data on combat end.
    /// </summary>
    public void EndCombat(CombatEndData endData)
    {
        //Clear enemy list
        EnemyPartyData.Clear();
        /*Need to display combat end screen and give player confirmation prompt*/

        //Save data used for resolving end of combat
        this.EndData = endData;
        //Change menu state
        CombatUIManager._instance.MenuLevel = GameConstants.CombatMenuPage.EndScreen;
        //Create list of items as strings
        List <string> itemsText = new List <string>();

        foreach (InventoryItemScript i in endData.FoundItems)
        {
            itemsText.Add(i.ThisItem.ItemName);
        }

        //Call UIMgr to display relevant info
        CombatUIManager._instance.DisplayEndScreen(endData.EndMessage, endData.XP.ToString(), itemsText);
        //Trigger flag to wait for player input
        this._waitForPlayer = true;
    }
Esempio n. 3
0
    public void EndCombatTurn()
    {
        Debug.LogWarning("End Combat Turn Called! Ending: " + CombatMgr._instance.currentTurnChar.stats.CharName + "'s turn!!");
        /*Check victory and loss conditions - If either is met then end combat in the appropriate fashion*/

        //If all player party is down then trigger combat ending as a loss for party 1 and game over reset if vs. ai
        if (PlayerParty.FindAll(x => x.stats.Status != GameConstants.StatusType.Downed).Count == 0)
        {
            //TODO:Handle player loss
            Debug.Log("Player Loss! End Combat");
        } //If all enemy party is down then trigger combat ending for party 2 as a loss for party 2 and loading the passed in scene if vs. ai
        else if (EnemyParty.FindAll(x => x.stats.Status != GameConstants.StatusType.Downed).Count == 0)
        {
            //TODO:Calculate xp from enemy party by adding up the exp from enemy party or some other format
            int winXp = 0;
            foreach (CharMgrScript c in EnemyParty)
            {
                winXp += c.stats.XP;
            }

            //TODO: Determine retrieved items based off enemy party script
            string battleEndMessage = "Victory!!";

            //Party one was the victor so use their scene as the return point
            CombatEndData d = new CombatEndData(GameConstants.CombatEndType.Party1Win, this.PartyOneReturnScene, FoundItems, winXp, battleEndMessage);
            //Handle procedures for end of combat : displaying UI messages, etc.
            EndCombat(d);
        }
        else
        {
            //Reset button active state using the stored action menu index
            GameConstants.ActionOptionIndices index = (GameConstants.ActionOptionIndices)CombatUIManager._instance.actMenuScript.CurrIndex;
            //Reset menu selected state
            CombatUIManager._instance.actMenuScript.SetSelectedState(index, false);
            //Update menu status - if player didn't win
            CombatUIManager._instance.MenuLevel = GameConstants.CombatMenuPage.Action;
            //Wipe list of current targets from Combat UI mgr
            CombatUIManager._instance.currTargets.Clear();
            //Wipe list of possible targets from Combat UI mgr
            CombatUIManager._instance.possibleTargets.Clear();
            //Flag the current chracter as having acted this round - NOTE: May need to add additional initiative logic here for multiple actors, etc.
            this.currentTurnChar.ActedThisRound = true;

            //add the lists of both parties together to get a list of total combatants
//            List<CharMgrScript> currCombatants = this.PlayerParty;
//            foreach (CharMgrScript enemyChar in this.EnemyParty)
//            {
//                currCombatants.Add(enemyChar);
//            }

            //If all NON-DOWNED characters have moved this round, then reset their flags
            if (this.PlayerParty.FindAll(x => x.ActedThisRound == false && x.stats.Status != GameConstants.StatusType.Downed).Count == 0 &&
                this.EnemyParty.FindAll(x => x.ActedThisRound == false && x.stats.Status != GameConstants.StatusType.Downed).Count == 0)
            {
                foreach (CharMgrScript c in this.PlayerParty)
                {
                    c.ActedThisRound = false;
                }

                foreach (CharMgrScript e in this.EnemyParty)
                {
                    e.ActedThisRound = false;
                }

                Debug.Log("All characters acted this round! resetting characters to act again!");
            }
            //Turn off highlighting showing it's this character's turn
            this.currentTurnChar.UITurnEmphasisStatus(false);

            //Reset flags for which team is taking its turn - In a PVE encounter, either payer party or NPC party
            this._waitForNPC    = false;
            this._waitForPlayer = false;
            /* **Reset flag so that next player can take their turn** */
            this._turnStarted = false;
        }
    }