//Constructor function for this class
    public PartySaveData(PartyGroup groupToSave_)
    {
        this.combatDist = groupToSave_.combatDistance;

        TileColRow tileLocation = TileMapManager.globalReference.GetTileCoords(groupToSave_.GetComponent <WASDOverworldMovement>().currentTile);

        this.tileCol = tileLocation.col;
        this.tileRow = tileLocation.row;

        //Looping through all of the characters in the given party and getting their save data
        this.partyCharacters = new List <global::CharacterSaveData>();
        for (int c = 0; c < groupToSave_.charactersInParty.Count; ++c)
        {
            //If the current character isn't null, we save it's data
            if (groupToSave_.charactersInParty[c] != null)
            {
                CharacterSaveData charData = new CharacterSaveData(groupToSave_.charactersInParty[c]);
                this.partyCharacters.Add(charData);
            }
            //If the current character slot is null, we add the empty slot
            else
            {
                this.partyCharacters.Add(null);
            }
        }

        //Looping through all of the party inventory items to save their object references
        this.inventorySlots = new List <string>();
        this.stackedItems   = new List <string>();
        for (int i = 0; i < groupToSave_.inventory.itemSlots.Count; ++i)
        {
            //Making sure the current inventory object isn't null
            if (groupToSave_.inventory.itemSlots[i] != null)
            {
                //Reference to the item's IDTag component
                IDTag itemTag = groupToSave_.inventory.itemSlots[i].GetComponent <IDTag>();

                //Saving the IDTag info
                this.inventorySlots.Add(JsonUtility.ToJson(new PrefabIDTagData(itemTag)));

                //If the current item is a stack
                if (groupToSave_.inventory.itemSlots[i].currentStackSize > 1)
                {
                    //Creating a new InventoryItemStackData class to store the item stack
                    InventoryItemStackData stack = new InventoryItemStackData(i, itemTag, groupToSave_.inventory.itemSlots[i].currentStackSize);
                    //Adding a serialized version of the stack data to our list of stacked items
                    this.stackedItems.Add(JsonUtility.ToJson(stack));
                }
            }
            //If the current item is null, we set a null slot to keep the empty space
            else
            {
                this.inventorySlots.Add("");
            }
        }
    }
    //Function called from InitializeCharactersForCombat to set each character's tile position
    private void SetCharacterTilePositions(GroupCombatDistance partyDistance_, EnemyEncounter encounter_)
    {
        //The number of columns the player party is shifted
        int playerColShift = 0;

        //The number of columns the front half of the enemy encounter is shifted
        int enemyColShift0 = 0;
        int enemyColShift1 = 1;
        int enemyColShift2 = 2;
        int enemyColShift3 = 3;

        //Determine if we use the default enemy position or the ambush position
        EnemyCombatPosition encounterPos = encounter_.defaultPosition;

        //Rolling to see if this encounter will ambush the player
        float ambushRoll = Random.Range(0f, 1f);

        //If the enemies are able to ambush players, their encounter position is set to the ambush position
        if (ambushRoll < encounter_.ambushChance)
        {
            encounterPos = encounter_.ambushPosition;
        }

        //Determining which kind of enemy encounter the player's will be facing
        switch (encounterPos)
        {
        //If the enemy is in melee range
        case EnemyCombatPosition.MeleeFront:
        {
            //Setting the player positions between col 0 - 6
            switch (partyDistance_)
            {
            case GroupCombatDistance.Far:            //0-2
                playerColShift = 0;
                break;

            case GroupCombatDistance.Medium:            //2-4
                playerColShift = 2;
                break;

            case GroupCombatDistance.Close:            //4-6
                playerColShift = 4;
                break;
            }

            //Setting the enemy positions between col 7-10
            enemyColShift0 += 7;
            enemyColShift1 += 7;
            enemyColShift2 += 7;
            enemyColShift3 += 7;
        }
        break;

        case EnemyCombatPosition.MeleeFlanking:
        {
            //Setting the player positions between col 6-8 regardless of their preferred distance
            playerColShift = 6;

            //Setting the enemy positions so that they're split between cols 4-5 and 9-10
            enemyColShift0 += 4;        //Col 5
            enemyColShift1 += 8;        //Col 9
            enemyColShift2 += 1;        //Col 4
            enemyColShift3 += 7;        //Col 10
        }
        break;

        case EnemyCombatPosition.MeleeBehind:
        {
            //Setting the player positions between col 7-13
            switch (partyDistance_)
            {
            case GroupCombatDistance.Far:            //7-9
                playerColShift = 7;
                break;

            case GroupCombatDistance.Medium:            //9-11
                playerColShift = 9;
                break;

            case GroupCombatDistance.Close:            //11-13
                playerColShift = 11;
                break;
            }

            //Setting the enemy positions between col 3-6 but in reverse order
            enemyColShift0 += 6;
            enemyColShift1 += 4;
            enemyColShift2 += 2;
            enemyColShift3 += 0;
        }
        break;

        //If the enemy is in middle range
        case EnemyCombatPosition.MiddleFront:
        {
            //Setting the player positions between col 0 - 6
            switch (partyDistance_)
            {
            case GroupCombatDistance.Far:            //0-2
                playerColShift = 0;
                break;

            case GroupCombatDistance.Medium:            //2-4
                playerColShift = 2;
                break;

            case GroupCombatDistance.Close:            //4-6
                playerColShift = 4;
                break;
            }

            //Setting the enemy positions between col 9-12
            enemyColShift0 += 9;
            enemyColShift1 += 9;
            enemyColShift2 += 9;
            enemyColShift3 += 9;
        }
        break;

        case EnemyCombatPosition.MiddleFlanking:
        {
            //Setting the player positions between col 5-8
            switch (partyDistance_)
            {
            case GroupCombatDistance.Far:            //5-7
                playerColShift = 5;
                break;

            case GroupCombatDistance.Medium:            //6-8
                playerColShift = 6;
                break;

            case GroupCombatDistance.Close:            //6-8
                playerColShift = 6;
                break;
            }

            //Setting the enemy positions split between cols 2-3 and cols 10-11
            enemyColShift0 += 3;        //Col 3
            enemyColShift1 += 9;        //Col 10
            enemyColShift2 += 0;        //Col 2
            enemyColShift3 += 8;        //Col 11
        }
        break;

        case EnemyCombatPosition.MiddleBehind:
        {
            //Setting the player positions between col 7-13
            switch (partyDistance_)
            {
            case GroupCombatDistance.Far:            //7-9
                playerColShift = 7;
                break;

            case GroupCombatDistance.Medium:            //9-11
                playerColShift = 9;
                break;

            case GroupCombatDistance.Close:            //11-13
                playerColShift = 11;
                break;
            }

            //Setting the enemy positions between col 1-4 but in reverse order
            enemyColShift0 += 4;
            enemyColShift1 += 2;
            enemyColShift2 += 0;
            enemyColShift3 += -2;
        }
        break;

        //If the enemy is in a far range
        case EnemyCombatPosition.RangedFront:
        {
            //Setting the player positions between col 0 - 6
            switch (partyDistance_)
            {
            case GroupCombatDistance.Far:            //0-2
                playerColShift = 0;
                break;

            case GroupCombatDistance.Medium:            //2-4
                playerColShift = 2;
                break;

            case GroupCombatDistance.Close:            //4-6
                playerColShift = 4;
                break;
            }

            //Setting the enemy positions between col 10-13
            enemyColShift0 += 10;
            enemyColShift1 += 10;
            enemyColShift2 += 10;
            enemyColShift3 += 10;
        }
        break;

        case EnemyCombatPosition.RangedFlanking:
        {
            //Setting the player positions between col 5-8
            switch (partyDistance_)
            {
            case GroupCombatDistance.Far:            //5-7
                playerColShift = 5;
                break;

            case GroupCombatDistance.Medium:            //6-8
                playerColShift = 6;
                break;

            case GroupCombatDistance.Close:            //6-8
                playerColShift = 6;
                break;
            }

            //Setting the enemy positions split between cols 0-1 and cols 12-13
            enemyColShift0 += 1;        //Col 1
            enemyColShift1 += 3;        //Col 12
            enemyColShift2 += -2;       //Col 0
            enemyColShift3 += 10;       //Col 13
        }
        break;

        case EnemyCombatPosition.RangedBehind:
        {
            //Setting the player positions between col 7-11
            switch (partyDistance_)
            {
            case GroupCombatDistance.Far:            //7-9
                playerColShift = 7;
                break;

            case GroupCombatDistance.Medium:            //9-11
                playerColShift = 9;
                break;

            case GroupCombatDistance.Close:            //11-13
                playerColShift = 11;
                break;
            }

            //Setting the enemy positions between col 0-3, so no change
        }
        break;
        }

        //After we've found the column shifts, we loop through and set the player positions
        foreach (Character playerChar in this.playerCharacters)
        {
            //Offsetting the player position column from the starting position
            playerChar.charCombatStats.gridPositionCol = playerChar.charCombatStats.startingPositionCol + playerColShift;
            playerChar.charCombatStats.gridPositionRow = playerChar.charCombatStats.startingPositionRow;
        }

        //Now we set the enemy positions based on the column shifts
        for (int e = 0; e < this.enemyCharacters.Count; e++)
        {
            //If this enemy's column position is random
            if (encounter_.enemies[e].randomCol)
            {
                this.enemyCharacters[e].charCombatStats.gridPositionCol = Random.Range(0, 3);
            }
            //If this enemy's column position isn't random
            else
            {
                this.enemyCharacters[e].charCombatStats.gridPositionCol = encounter_.enemies[e].specificCol;
            }

            //If this enemy's row position is random
            if (encounter_.enemies[e].randomRow)
            {
                this.enemyCharacters[e].charCombatStats.gridPositionRow = Random.Range(0, 4);
            }
            //If this enemy's row position isn't random
            else
            {
                this.enemyCharacters[e].charCombatStats.gridPositionRow = encounter_.enemies[e].specificRow;
            }

            //offsetting the enemy column position based on what their default position is
            switch (this.enemyCharacters[e].charCombatStats.gridPositionCol)
            {
            case 0:
                this.enemyCharacters[e].charCombatStats.gridPositionCol = enemyColShift0;
                break;

            case 1:
                this.enemyCharacters[e].charCombatStats.gridPositionCol = enemyColShift1;
                break;

            case 2:
                this.enemyCharacters[e].charCombatStats.gridPositionCol = enemyColShift2;
                break;

            case 3:
                this.enemyCharacters[e].charCombatStats.gridPositionCol = enemyColShift3;
                break;

            default:
                //This case SHOULDN'T happen, but if it does, we treat it like the character's col is 0
                this.enemyCharacters[e].charCombatStats.gridPositionCol = enemyColShift0;
                break;
            }

            //Looping through all of the enemies created so far
            for (int i = 0; i < this.enemyCharacters.Count - 1; ++i)
            {
                //If the enemy we've just added shares the same combat row and column as another enemy
                if (this.enemyCharacters[e].charCombatStats.gameObject != this.enemyCharacters[i].gameObject &&
                    this.enemyCharacters[e].charCombatStats.gridPositionCol == this.enemyCharacters[i].charCombatStats.gridPositionCol &&
                    this.enemyCharacters[e].charCombatStats.gridPositionRow == this.enemyCharacters[i].charCombatStats.gridPositionRow)
                {
                    //The column shift amount for each column loop
                    int cShift = 0;

                    //Looping through all of the combat positions characters can be in
                    for (int c = 0; c < 4; ++c)
                    {
                        //Setting the column shift for this loop
                        if (c == 0)
                        {
                            cShift = enemyColShift0;
                        }
                        else if (c == 1)
                        {
                            cShift = enemyColShift1;
                        }
                        else if (c == 2)
                        {
                            cShift = enemyColShift2;
                        }
                        else if (c == 3)
                        {
                            cShift = enemyColShift3;
                        }

                        for (int r = 0; r < 8; ++r)
                        {
                            //Bool to track if the current position is empty
                            bool emptyPos = true;

                            //Looping through each enemy in the combat
                            foreach (Character ec in this.enemyCharacters)
                            {
                                //Making sure the enemy isn't somehow null or the enemy we've just created
                                if (ec != null && ec.gameObject != this.enemyCharacters[e].charCombatStats.gameObject)
                                {
                                    //If the tile isn't empty, we break out of this foreach loop
                                    if (ec.charCombatStats.gridPositionCol == cShift &&
                                        ec.charCombatStats.gridPositionRow == r)
                                    {
                                        emptyPos = false;
                                        break;
                                    }
                                }
                            }

                            //If we make it through all of the enemies without finding an overlap
                            if (emptyPos)
                            {
                                //Setting this enemy's position col and row to the empty position
                                this.enemyCharacters[e].charCombatStats.gridPositionCol = cShift;
                                this.enemyCharacters[e].charCombatStats.gridPositionRow = r;

                                //Breaking the row loop, col loop, and loop for checking other enemy positions
                                c = 10;
                                i = this.enemyCharacters.Count + 1;
                                break;
                            }
                        }
                    }
                }
            }
        }
    }