Exemplo n.º 1
0
        public static CombatLog StartCombat(int bg1_id, int bg2_id)
        {
            if (CheckForOwnership(bg1_id, bg2_id))
            {
                BattleGroupEntity bge1 = BattlegroupManager.BuildBattleGroupEntity(bg1_id);
                BattleGroupEntity bge2 = BattlegroupManager.BuildBattleGroupEntity(bg2_id);

                CombatLog log = PerformCombat(bge1, bge2);

                return(log);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 2
0
        private static CombatLog PerformCombat(BattleGroupEntity bge1, BattleGroupEntity bge2)
        {
            CombatLog log       = new CombatLog();
            bool      combatEnd = false;

            while (!combatEnd)
            {
                //turn start
                TurnStartCountAdjustement(bge1);
                TurnStartCountAdjustement(bge2);

                //front
                CalculateLinePerformance(bge1.frontline, bge2);
                CalculateLinePerformance(bge2.frontline, bge1);

                //back
                CalculateLinePerformance(bge1.backline, bge2);
                CalculateLinePerformance(bge2.backline, bge1);

                //support
                CalculateLinePerformance(bge1.supportline, bge2);
                CalculateLinePerformance(bge2.supportline, bge1);

                if (CheckIfGroupIsDead(bge1))
                {
                    combatEnd  = true;
                    log.winner = bge2.bg;
                    log.loser  = bge1.bg;
                }
                else if (CheckIfGroupIsDead(bge2))
                {
                    combatEnd  = true;
                    log.winner = bge1.bg;
                    log.loser  = bge2.bg;
                }
            }

            log.SaveLog();
            RewardGenerator.CombatReward(log);

            return(log);
        }