public void Fight()
    {
        int botIdx = 0;
        int kagotchiIdx = 0;

        while(kagotchi.Hitpoints > 0 && bot.Hitpoints > 0)
        {
            var attackTurn = new csTurn();
            attackTurn.Turn = FightTurn;
            var kagotchiPlan = kagotchiFightPlan[kagotchiIdx];
            var botPlan = botFightPlan[botIdx];

            //Kagotchi turn
            attackTurn = ProcessAttack(kagotchiPlan, botPlan, kagotchi, bot, kagotchiIdx, attackTurn);
            kagotchiIdx = attackTurn.Idx;
            //Bot turn
            attackTurn = ProcessAttack(botPlan, kagotchiPlan, bot, kagotchi, botIdx, attackTurn);
            botIdx = attackTurn.Idx;

            TurnList.Add(attackTurn);

            FightTurn++;
            
        }

        if(kagotchi.Hitpoints > 0 && bot.Hitpoints <= 0)
        {
            Winner = kagotchi.Name;
            Loser = bot.Name;
            txtPlayerResult.text = "WINNER";
            txtPlayerResult.color = new Color(50.0f / 255, 167.0f / 255, 50.0f / 255);
            txtBotResult.text = "LOSER";
            txtBotResult.color = new Color(238.0f / 255, 50.0f / 255, 52.0f / 255);
            kagotchi.Experience += bot.Level * ENEMY_EXP_FACTOR;
            kagotchi.Fame += bot.Level * FAME_FACTOR;
            kagotchi.Money += bot.Level * ENEMY_MONEY_FACTOR;
            txtFame.text = kagotchi.Fame.ToString();
            txtExperience.text = kagotchi.Experience.ToString();
            txtMoney.text = kagotchi.Money.ToString();
            kagotchi.Wins += 1;
        }
        else if (kagotchi.Hitpoints <= 0 && bot.Hitpoints > 0)
        {
            Winner = bot.Name;
            Loser = kagotchi.Name;
            txtPlayerResult.text = "LOSER";
            txtPlayerResult.color = new Color(238.0f / 255, 50.0f / 255, 52.0f / 255);
            txtBotResult.text = "WINNER" ;
            txtBotResult.color = new Color(50.0f / 255, 167.0f / 255, 50.0f / 255);
            kagotchi.Fame -= bot.Level * FAME_FACTOR / 2;
            txtFame.text = kagotchi.Fame.ToString();
            kagotchi.Losses += 1;
        }
        else if (kagotchi.Hitpoints <= 0 && bot.Hitpoints <= 0)
        {
            Winner = kagotchi.Name;
            Loser = bot.Name;
            txtPlayerResult.text = "DRAW";
            txtPlayerResult.color = new Color(188.0f / 255, 183.0f / 255, 19.0f / 255);
            txtBotResult.text = "DRAW";
            txtBotResult.color = new Color(188.0f / 255, 183.0f / 255, 19.0f / 255);
            kagotchi.Experience += bot.Level * ENEMY_EXP_FACTOR / 2;
            kagotchi.Fame += bot.Level * FAME_FACTOR / 2;
            kagotchi.Money += bot.Level * ENEMY_MONEY_FACTOR / 2;
            txtFame.text = kagotchi.Fame.ToString();
            txtExperience.text = kagotchi.Experience.ToString();
            txtMoney.text = kagotchi.Money.ToString();
            kagotchi.Draws += 1;
        }

        kagotchi.Knowledge.AddRange(knowledgeList);

        txtPlayerHit.text = TurnList[TurnList.Count - 1].Kagotchi.Hitpoints;
        txtPlayerSta.text = TurnList[TurnList.Count - 1].Kagotchi.Stamina;
        txtPlayerMan.text = TurnList[TurnList.Count - 1].Kagotchi.Mana;
        txtBotHit.text = TurnList[TurnList.Count - 1].Bot.Hitpoints;
        txtBotSta.text = TurnList[TurnList.Count - 1].Bot.Stamina;
        txtBotMan.text = TurnList[TurnList.Count - 1].Bot.Mana;

        var turnGrid = GameObject.Find("TurnGrid");
        GameObject prefab = (GameObject)Resources.Load("Prefabs/UI/Turn");
        if (prefab != null)
        {
            foreach(var turn in TurnList)
            {
                var clone = (GameObject)Instantiate(prefab);
                clone.name = prefab.name;
                var turnPrefab = clone.GetComponent<csTurnPrefab>();
                turnPrefab.Turn = turn.Turn.ToString();
                turnPrefab.Description = turn.Description;
                turnPrefab.PlayerHits = turn.Kagotchi.Hitpoints;
                turnPrefab.PlayerMana = turn.Kagotchi.Mana;
                turnPrefab.PlayerStamina = turn.Kagotchi.Stamina;
                turnPrefab.BotHits = turn.Bot.Hitpoints;
                turnPrefab.BotMana = turn.Bot.Mana;
                turnPrefab.BotStamina = turn.Bot.Stamina;

                clone.transform.SetParent(turnGrid.transform, false);
            }
        }
    }
    private csTurn ProcessAttack(csFightPlanElement attackerPlan, csFightPlanElement defenderPlan, csIFighter attacker, csIFighter defender, int idx, csTurn turn)
    {
        float damage = 0.0f;

        if (attackerPlan.MagicalPower != null)
        {
            var meditation = attacker.PassivePower.First(s => s.Name == "Meditation");
            if (attacker.Mana < 0 || attacker.Mana < attackerPlan.MagicalPower.Mana)
                meditation.IsInUse = true;

            if (meditation.IsInUse == true)
            {
                var meditationValue = meditation.Use();
                if (meditationValue < 1.0f)
                    meditationValue = 1.0f;

                turn.Description += attacker.Name + " used " + meditation.Name + System.Environment.NewLine;

                if(meditation.Increase())
                {
                    turn.Description += attacker.Name + "'s " + meditation.Name + " increased by " + meditation.Factor + " it's now " + meditation.Value + System.Environment.NewLine;
                }

                attacker.Mana += Mathf.RoundToInt(meditationValue);

                if (attacker.Mana > attacker.Intelligence)
                    attacker.Mana = attacker.Intelligence;

                if (attacker.Mana >= attacker.Intelligence)
                    meditation.IsInUse = false;

                if (attacker is csKagotchi)
                {
                    if (idx == kagotchiFightPlan.Count - 1)
                        idx = 0;
                    else
                        idx++;

                    var kagotchiStats = new csFighterStatsText();
                    kagotchiStats.Hitpoints = attacker.Hitpoints.ToString();
                    kagotchiStats.Stamina = attacker.Stamina.ToString();
                    kagotchiStats.Mana = attacker.Mana.ToString();

                    var botStats = new csFighterStatsText();
                    botStats.Hitpoints = defender.Hitpoints.ToString();
                    botStats.Stamina = defender.Stamina.ToString();
                    botStats.Mana = defender.Mana.ToString();

                    turn.Kagotchi = kagotchiStats;
                    turn.Bot = botStats;
                }
                else if (attacker is csBot)
                {
                    if (idx == botFightPlan.Count - 1)
                        idx = 0;
                    else
                        idx++;

                    var kagotchiStats = new csFighterStatsText();
                    kagotchiStats.Hitpoints = defender.Hitpoints.ToString();
                    kagotchiStats.Stamina = defender.Stamina.ToString();
                    kagotchiStats.Mana = defender.Mana.ToString();

                    var botStats = new csFighterStatsText();
                    botStats.Hitpoints = attacker.Hitpoints.ToString();
                    botStats.Stamina = attacker.Stamina.ToString();
                    botStats.Mana = attacker.Mana.ToString();

                    turn.Kagotchi = kagotchiStats;
                    turn.Bot = botStats;
                }

                turn.Idx = idx;

                return turn;
            }

            foreach (var weakness in defender.Weaknesses)
            {
                if (attackerPlan.MagicalPower.Core == weakness.Weakness)
                {
                    attackerPlan.MagicalPower.IsStrongAgainst = true;
                    attackerPlan.MagicalPower.WeaknessMultiplier = weakness.Multiplier;
                    turn.Description += defender.Name + " has a weakness against " + attackerPlan.MagicalPower.Name + " x" + weakness.Multiplier + System.Environment.NewLine;
                }
                    
            }

            if(attacker.Mana >= attackerPlan.MagicalPower.Mana)
            {
                if (attackerPlan.MagicalPower.Core == defenderPlan.MagicalDefense.DefenseType && defender.Mana > 0)
                {
                    damage = attackerPlan.MagicalPower.CastSpell() * DEFENSE_FACTOR;
                    turn.Description += attacker.Name + " used " + attackerPlan.MagicalPower.Name + " and only gave " + damage.ToString() + " damage points." + System.Environment.NewLine;
                    turn.Description += defender.Name + " blocked your " + attackerPlan.MagicalPower.Name + " attack." + System.Environment.NewLine;
                }
                else
                {
                    damage = attackerPlan.MagicalPower.CastSpell();
                    turn.Description += attacker.Name + " used " + attackerPlan.MagicalPower.Name + " and gave " + damage.ToString() + " damage points." + System.Environment.NewLine;

                    if(defender is csKagotchi)
                    {
                        if (!defender.MagicalDefense.Any(s => s.DefenseType == attackerPlan.MagicalPower.Core) && !knowledgeList.Any(s => s.DefenseType == attackerPlan.MagicalPower.Core))
                        {
                            var defense = defender.AllMagicalDefenses.FirstOrDefault(s => s.DefenseType == attackerPlan.MagicalPower.Core);
                            knowledgeList.Add(defense);
                            txtNewKnowledge.text += "-" + defense.Name + " Level:" + defense.Level + System.Environment.NewLine;
                        }
                        else
                        {
                            var defense = defender.MagicalDefense.FirstOrDefault(s => s.DefenseType == attackerPlan.MagicalPower.Core);
                            if(defense != null && defense.Level < attackerPlan.MagicalPower.Level)
                            {
                                defense.Level++;
                                knowledgeList.Add(defense);
                                txtNewKnowledge.text += "-" + defense.Name + " Level:" + defense.Level + System.Environment.NewLine;
                            }
                            var defenseKnowledge = knowledgeList.FirstOrDefault(s => s.DefenseType == attackerPlan.MagicalPower.Core);
                            if (defenseKnowledge != null && defenseKnowledge.Level < attackerPlan.MagicalPower.Level)
                            {
                                defense.Level++;
                                knowledgeList.Add(defense);
                                txtNewKnowledge.text += "-" + defense.Name + " Level:" + defense.Level + System.Environment.NewLine;
                            }
                        }
                    }
                }


                if (attackerPlan.MagicalPower.Increase())
                {
                    turn.Description += attacker.Name + "'s " + attackerPlan.MagicalPower.Name + " increased by " + attackerPlan.MagicalPower.Factor + " it's now " + attackerPlan.MagicalPower.Value + System.Environment.NewLine;
                }

                defender.Hitpoints -= Mathf.RoundToInt(damage);
                if (defender.Hitpoints < 0)
                    defender.Hitpoints = 0;
                attacker.Mana -= Mathf.RoundToInt(attackerPlan.MagicalPower.Mana);
            }

            if (attacker is csKagotchi)
            {
                if (idx == kagotchiFightPlan.Count - 1)
                    idx = 0;
                else
                    idx++;

                var kagotchiStats = new csFighterStatsText();
                kagotchiStats.Hitpoints = attacker.Hitpoints.ToString();
                kagotchiStats.Stamina = attacker.Stamina.ToString();
                kagotchiStats.Mana = attacker.Mana.ToString();

                var botStats = new csFighterStatsText();
                botStats.Hitpoints = defender.Hitpoints.ToString();
                botStats.Stamina = defender.Stamina.ToString();
                botStats.Mana = defender.Mana.ToString();

                turn.Kagotchi = kagotchiStats;
                turn.Bot = botStats;
            }
            else if (attacker is csBot)
            {
                if (idx == botFightPlan.Count - 1)
                    idx = 0;
                else
                    idx++;

                var kagotchiStats = new csFighterStatsText();
                kagotchiStats.Hitpoints = defender.Hitpoints.ToString();
                kagotchiStats.Stamina = defender.Stamina.ToString();
                kagotchiStats.Mana = defender.Mana.ToString();

                var botStats = new csFighterStatsText();
                botStats.Hitpoints = attacker.Hitpoints.ToString();
                botStats.Stamina = attacker.Stamina.ToString();
                botStats.Mana = attacker.Mana.ToString();

                turn.Kagotchi = kagotchiStats;
                turn.Bot = botStats;
            }
        }

        if (attackerPlan.PhysicalPower != null)
        {
            var meditation = attacker.PassivePower.First(s => s.Name == "Meditation");
            if (attacker.Stamina < 0 || attacker.Stamina < attackerPlan.PhysicalPower.Stamina)
                meditation.IsInUse = true;

            if (meditation.IsInUse == true)
            {
                var meditationValue = meditation.Use();
                if (meditationValue < 1.0f)
                    meditationValue = 1.0f;

                if (meditation.Increase())
                {
                    turn.Description += attacker.Name + "'s " + meditation.Name + " increased by " + meditation.Factor + " it's now " + meditation.Value + System.Environment.NewLine;
                }

                attacker.Stamina += Mathf.RoundToInt(meditationValue);

                if (attacker.Stamina > attacker.Dexterity)
                    attacker.Stamina = attacker.Dexterity;

                if (attacker.Stamina >= attacker.Dexterity)
                    meditation.IsInUse = false;

                if(attacker is csKagotchi)
                {
                    if (idx == kagotchiFightPlan.Count - 1)
                        idx = 0;
                    else
                        idx++;

                    var kagotchiStats = new csFighterStatsText();
                    kagotchiStats.Hitpoints = attacker.Hitpoints.ToString();
                    kagotchiStats.Stamina = attacker.Stamina.ToString();
                    kagotchiStats.Mana = attacker.Mana.ToString();

                    var botStats = new csFighterStatsText();
                    botStats.Hitpoints = defender.Hitpoints.ToString();
                    botStats.Stamina = defender.Stamina.ToString();
                    botStats.Mana = defender.Mana.ToString();

                    turn.Kagotchi = kagotchiStats;
                    turn.Bot = botStats;
                }
                else if(attacker is csBot)
                {
                    if (idx == botFightPlan.Count - 1)
                        idx = 0;
                    else
                        idx++;

                    var kagotchiStats = new csFighterStatsText();
                    kagotchiStats.Hitpoints = defender.Hitpoints.ToString();
                    kagotchiStats.Stamina = defender.Stamina.ToString();
                    kagotchiStats.Mana = defender.Mana.ToString();

                    var botStats = new csFighterStatsText();
                    botStats.Hitpoints = attacker.Hitpoints.ToString();
                    botStats.Stamina = attacker.Stamina.ToString();
                    botStats.Mana = attacker.Mana.ToString();

                    turn.Kagotchi = kagotchiStats;
                    turn.Bot = botStats;
                }

                turn.Idx = idx;
                return turn;
            }

            if (attacker.Stamina >= attackerPlan.PhysicalPower.Stamina)
            {
                if (attackerPlan.PhysicalPower.AttackType == defenderPlan.PhysicalDefense.DefenseType && defender.Stamina > 0)
                {
                    damage = attackerPlan.PhysicalPower.Attack() * DEFENSE_FACTOR;
                    turn.Description += attacker.Name + " used " + attackerPlan.PhysicalPower.Name + " and only gave " + damage.ToString() + " damage points." + System.Environment.NewLine;
                    turn.Description += defender.Name + " blocked your " + attackerPlan.PhysicalPower.Name + " attack." + System.Environment.NewLine;
                }
                else
                {
                    damage = attackerPlan.PhysicalPower.Attack();
                    turn.Description += attacker.Name + " used " + attackerPlan.PhysicalPower.Name + " and gave " + damage.ToString() + " damage points." + System.Environment.NewLine;
                }

                if (attackerPlan.PhysicalPower.Increase())
                {
                    turn.Description += attacker.Name + "'s " + attackerPlan.PhysicalPower.Name + " increased by " + attackerPlan.PhysicalPower.Factor + " it's now " + attackerPlan.PhysicalPower.Value + System.Environment.NewLine;
                }

                defender.Hitpoints -= Mathf.RoundToInt(damage);
                if (defender.Hitpoints < 0)
                    defender.Hitpoints = 0;
                attacker.Stamina -= Mathf.RoundToInt(attackerPlan.PhysicalPower.Stamina);
            }

            if(attacker is csKagotchi)
            {
                if (idx == kagotchiFightPlan.Count - 1)
                    idx = 0;
                else
                    idx++;

                var kagotchiStats = new csFighterStatsText();
                kagotchiStats.Hitpoints = attacker.Hitpoints.ToString();
                kagotchiStats.Stamina = attacker.Stamina.ToString();
                kagotchiStats.Mana = attacker.Mana.ToString();

                var botStats = new csFighterStatsText();
                botStats.Hitpoints = defender.Hitpoints.ToString();
                botStats.Stamina = defender.Stamina.ToString();
                botStats.Mana = defender.Mana.ToString();

                turn.Kagotchi = kagotchiStats;
                turn.Bot = botStats;
            }
            else if(attacker is csBot)
            {
                if (idx == botFightPlan.Count - 1)
                    idx = 0;
                else
                    idx++;

                var kagotchiStats = new csFighterStatsText();
                kagotchiStats.Hitpoints = defender.Hitpoints.ToString();
                kagotchiStats.Stamina = defender.Stamina.ToString();
                kagotchiStats.Mana = defender.Mana.ToString();

                var botStats = new csFighterStatsText();
                botStats.Hitpoints = attacker.Hitpoints.ToString();
                botStats.Stamina = attacker.Stamina.ToString();
                botStats.Mana = attacker.Mana.ToString();

                turn.Kagotchi = kagotchiStats;
                turn.Bot = botStats;
            }
            
        }

        turn.Idx = idx;
        return turn;
    }