Exemple #1
0
    public void SetUpBattle()
    {
        mapGrid.gameObject.SetActive(false);
        // Set this to 0 so it doesn't carry over from battle to battle if unconsumed
        character.SetExtraDamageMultiplier(0);

        SetBackgroundImage();
        playerHand = FindObjectOfType <PlayerHand>();
        deck       = FindObjectOfType <Deck>();
        discard    = FindObjectOfType <Discard>();

        // square will only be null when testing battles directly, so we just set it to a default enemy
        if (!enemyLoaded)
        {
            SetUpEnemy(0);
        }
        else
        {
            SetUpEnemy(enemyId);
        }
        DealMapDamageToEnemy();
        enemy.BattleSetup(setupTimeInSeconds);

        configData = FindObjectOfType <ConfigData>();
        configData.SetupStatusEffectHolders();

        character.BattleSetup(setupTimeInSeconds);

        List <int> deckCardIds = new List <int>();

        if (trapType == MapObject.TrapTypes.ParalysisAgent)
        {
            // Paralysis Agent Trap: Blocks arm and leg mods
            List <Item.ItemTypes> blockedItemTypes = new List <Item.ItemTypes> {
                Item.ItemTypes.Arm, Item.ItemTypes.Leg
            };
            deckCardIds.AddRange(character.GetLoadout().GetAllCardIds(blockedItemTypes));
        }
        else if (trapType == MapObject.TrapTypes.ConcussiveBlast)
        {
            List <Item.ItemTypes> blockedItemTypes = new List <Item.ItemTypes> {
                Item.ItemTypes.Head, Item.ItemTypes.Exoskeleton
            };
            deckCardIds.AddRange(character.GetLoadout().GetAllCardIds(blockedItemTypes));
        }
        else
        {
            deckCardIds.AddRange(character.GetLoadout().GetAllCardIds());
        }

        // Do not load hacker cards if triggered a Faraday Cage trap
        if (trapType != MapObject.TrapTypes.FaradayCage)
        {
            deckCardIds.AddRange(hacker.GetHackerLoadout().GetCardIds());
        }

        deckCardIds.AddRange(temporaryCardIds);

        deck.SetupDeck(deckCardIds);

        playerHand.DrawStartingHand(character.GetStartingHandSize(), setupTimeInSeconds);

        SetupStartingBuffs();
        PlayerStartTurnChecks();

        StartCoroutine(EnablePlayAfterSetup());
    }