public CharacterTurn(BaseCharacter bs, MapZone zone, List <BasicTile> bt, TurnSet parent)
        {
            characterAP = bs.trueSTATChart().currentPassiveStats[(int)STATChart.PASSIVESTATS.AP];
            parentTS    = parent;
            character   = bs;
            turns.Clear();
            characterArea.Clear();
            int temp     = bs.trueSTATChart().currentPassiveStats[(int)STATChart.PASSIVESTATS.AP];
            int maxMoves = bs.trueSTATChart().currentPassiveStats[(int)STATChart.PASSIVESTATS.MOB];

            for (int i = 1; i < temp + 1; i++)
            {
                turns.Add(new TurnInfo(maxMoves));
                //     characterArea.Add(MapListUtility.returnMapRadius((i - 1) * maxMoves, i * maxMoves, bt, bs));
                if (i > 1)
                {
                    for (int j = 1; j < 2; j++)
                    {
                        List <BasicTile> list = MapListUtility.returnValidMapRadius((i - 1) * maxMoves + maxMoves, bt, bs.position).Except(characterArea[i - 1 - j]).ToList();
                        characterArea.Add(list);
                    }
                }
                else
                {
                    characterArea.Add(MapListUtility.returnValidMapRadius((i - 1) * maxMoves + maxMoves, bt, bs.position));
                }
            }
        }
        private static void RoundStartLogic(TurnSet turnSet)
        {
            for (int i = 0; i < dangerTiles.Count; i++)
            {
                dangerTiles[i].Tick(currentGroupIndex);
            }

            foreach (var character in turnSet.charactersInGroup)
            {
                if (character.CCC == null)
                {
                    Console.WriteLine("ERROR: Missing CCC in " + character);
                    character.ReloadFromDatabase(GameProcessor.gcDB);
                }
                character.ProcessTurn();
            }

            if (turnSet.bIsPlayerTurnSet)
            {
            }
            else if (turnSet.bIsEnemyTurnSet)
            {
            }

            ClearDeathChars();
        }
 internal MindControlInfo(CharacterTurn ct, TurnSet ogFrom, TurnSet currentlyIn)
 {
     this.ct          = ct;
     this.ogFrom      = ogFrom;
     this.currentlyIn = currentlyIn;
 }
        internal void UpdateEnemyLogic(CharacterTurn gts)
        {
            if (!PathMoveHandler.bIsBusy)
            {
                PathMoveHandler.SkipPathMovement();
            }
            if (gts != null && !LUA.LuaExecutionList.DemandOverride() && !PathMoveHandler.bIsBusy && !bTest && BattleGUI.TurnEffectsList.Find(te => te.bMustShow) == null)
            {
                if (bPlayerTurnEnemyOverriden)
                {
                    gts = currentEnemy;
                }

                if (GameProcessor.cameraFollowTarget != gts.character)
                {
                    GameProcessor.cameraFollowTarget = gts.character;
                }

                bTest = true;
                //randomEnemy = GamePlayUtility.Randomize(0, CombatProcessor.heroCharacters.Count - 1);
                selectedCharTurn = null;
                currentEnemy     = gts;
                AIUtility.AIPreCalculate(gts.returnCompleteArea(), gts);
                //AIUtility.Report(AIBehaviour.ProcessBehaviour(currentEnemy.character,AIUtility.possibleAITargets));
                BaseCharacter target = null;
                var           temp   = AIBehaviour.ProcessBehaviour(currentEnemy.character, AIUtility.possibleAITargets);
                if (temp.Count != 0)
                {
                    target = AIUtility.SelectTargetBasedOnBehaviour(temp);
                }

                var playableMap = GameProcessor.loadedMap.possibleTilesGameZoneForEnemy(CombatProcessor.zoneTiles, currentEnemy.character);

                var beep = new KeyValuePair <List <List <BasicTile> >, List <BasicAbility> >();
                if (target != null)
                {
                    // var beep = AIUtility.returnTilesToAttackFrom(CombatProcessor.zoneTiles,gts.character,target);
                    beep = AIUtility.returnTilesToAttackFrom(gts.returnCompleteArea(), playableMap, gts.character, target);

                    while (beep.Key.Count == 0 && beep.Value.Count == 0 && AIUtility.possibleAITargets.Count - 1 > 0)
                    {
                        AIUtility.possibleAITargets.Remove(target);
                        target = AIUtility.SelectTargetBasedOnBehaviour(AIBehaviour.ProcessBehaviour(currentEnemy.character, AIUtility.possibleAITargets));
                        beep   = AIUtility.returnTilesToAttackFrom(playableMap, playableMap, gts.character, target);
                    }
                }

                if (target != null && beep.Key.Count == 0 && beep.Value.Count == 0)
                {
                    target = null;
                }

                gts.ReGenerateTurn(playableMap);

                List <Node> allPossibleNodes;
                if (target != null)
                {
                    //allPossibleNodes = PathFinder.NewPathSearch(gts.character.position, target.position + new Vector2(64, 0), playableMap);
                    var enemyFavor = AIUtility.returnFavoredAttackAndPosition(beep, gts.character, target);
                    if (enemyFavor.Key != null)
                    {
                        allPossibleNodes = PathFinder.NewPathSearch(gts.character.position, enemyFavor.Key.mapPosition.Location.ToVector2(), playableMap);
                    }
                    else
                    {
                        allPossibleNodes = null;
                    }
                    AITarget = target;
                    AIbtba   = enemyFavor;
                }
                else
                {
                    List <int>   amountOfCharsForEachGroup = new List <int>();
                    List <float> percentagesForEachGroup   = new List <float>();
                    int          totalChars = 0;
                    foreach (var item in gts.parentTS.targetGroups)
                    {
                        int tempCount = item.charactersInGroup.FindAll(c => c.IsAlive()).Count;
                        totalChars += tempCount;
                        amountOfCharsForEachGroup.Add(tempCount);
                    }

                    foreach (var item in amountOfCharsForEachGroup)
                    {
                        percentagesForEachGroup.Add(((float)item / (float)totalChars) * 100);
                    }

                    TurnSet targetGroup = null;
                    int     tempIndex   = 0;
                    while (targetGroup == null)
                    {
                        int randomNumber = GamePlayUtility.Randomize(0, 100);
                        if (percentagesForEachGroup[tempIndex] >= randomNumber)
                        {
                            targetGroup = targetGroups[tempIndex];
                        }
                        tempIndex++;
                        if (tempIndex > percentagesForEachGroup.Count)
                        {
                            targetGroup = targetGroups[0];
                        }
                    }

                    BaseCharacter randomCharacter = targetGroup.charactersInGroup.FindAll(c => c.IsAlive())[GamePlayUtility.Randomize(0, targetGroup.charactersInGroup.FindAll(c => c.IsAlive()).Count)];

                    allPossibleNodes = PathFinder.NewPathSearch(gts.character.position, randomCharacter.position + new Vector2(64, 0), playableMap);
                }
                if (allPossibleNodes != null)
                {
                    CombatProcessor.what = new List <Node>(allPossibleNodes);
                    var NodesWithinRange = MapListUtility.findEqualNodesToTileList(allPossibleNodes, gts.returnCompleteArea());
                    PathMoveHandler.Start(gts.character, NodesWithinRange);
                }

                //FinalizeEnemyRound();
            }

            if (gts != null && !PathMoveHandler.bIsBusy && bTest && !GameProcessor.bStartCombatZoom)
            {
                //THIS IS THE VERY LAST LINE BEFORE AN ENEMY HAS IT'S TURN COMPLETED
                if (!AIbtba.Equals(default(KeyValuePair <BasicTile, BasicAbility>)))
                {
                    if ((AIbtba.Key == null || AIbtba.Key.mapPosition.Location.ToVector2() == gts.character.position) && AIbtba.Value.abilityCanHitTargetInRange(gts.character, AITarget) && AIbtba.Value.IsAbilityAvailable(gts.character.trueSTATChart()))
                    {
                        FaceCharacterInCorrectDirection(gts.character, AITarget);

                        GameProcessor.StartBattleSoon(gts.character, AITarget, gts.character.AbilityList().IndexOf(AIbtba.Value));
                        //GameProcessor.StartBattleSoon(gts.character, AITarget, gts.character.AbilityList().IndexOf(gts.character.AbilityList().Find(ba => ba.abilityName.Equals(AIbtba.Value.abilityName))));
                    }
                    else
                    {
                        if (!currentEnemy.character.attackedAsAI)
                        {
                            LastDitchEffortAttack();
                        }
                        else
                        {
                            FinalizeEnemyRound();
                        }
                    }
                }
                else
                {
                    if (!currentEnemy.character.attackedAsAI)
                    {
                        LastDitchEffortAttack();
                    }
                    else
                    {
                        FinalizeEnemyRound();
                    }
                }
                //
            }
            else if (gts == null)
            {
                if (bPlayerTurnEnemyOverriden)
                {
                    bPlayerTurnEnemyOverriden = false;
                }
            }
        }
 private static void RoundEndLogic(TurnSet turnSet)
 {
 }