Пример #1
0
        public override void PerformEffect(BattleGroupEntity targetGroup, Ability abilityData, int count)
        {
            List <AssignmentGroupEntity> targetLine = new List <AssignmentGroupEntity>();

            if (!CombatManager.CheckIfLineIsDead(targetGroup.frontline))
            {
                targetLine.AddRange(targetGroup.frontline);
            }
            else if (!CombatManager.CheckIfLineIsDead(targetGroup.supportline))
            {
                targetLine.AddRange(targetGroup.supportline);
            }

            if (!CombatManager.CheckIfLineIsDead(targetGroup.backline))
            {
                targetLine.AddRange(targetGroup.backline);
            }

            if (targetLine.Count > 0)
            {
                Random r      = new Random();
                int    target = -1;
                do
                {
                    target = r.Next(0, targetLine.Count);
                } while (targetLine[target].turnStartCount == 0);
                targetLine[target].TakeDamage(abilityData.power * count);
            }
        }
Пример #2
0
        private static bool CheckIfGroupIsDead(BattleGroupEntity bge)
        {
            bool isDead = false;

            if (CheckIfLineIsDead(bge.frontline) && CheckIfLineIsDead(bge.backline) && CheckIfLineIsDead(bge.supportline))
            {
                isDead = true;
            }

            return(isDead);
        }
Пример #3
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);
            }
        }
Пример #4
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);
        }
Пример #5
0
        public override void PerformEffect(BattleGroupEntity targetGroup, Ability abilityData, int count)
        {
            List <AssignmentGroupEntity> targetLine = null;

            if (targetGroup.frontline.Count != 0)
            {
                targetLine = targetGroup.frontline;
            }
            else if (targetGroup.backline.Count != 0)
            {
                targetLine = targetGroup.backline;
            }
            else
            {
                targetLine = targetGroup.supportline;
            }

            Random r      = new Random();
            int    target = r.Next(0, targetLine.Count - 1);

            targetLine[target].TakeDamage(abilityData.power * count);
        }
Пример #6
0
        private static void TurnStartCountAdjustement(BattleGroupEntity bge)
        {
            //int totalCount = 0;

            foreach (AssignmentGroupEntity age in bge.frontline)
            {
                age.turnStartCount = age.remainingCount;
                //totalCount += age.turnStartCount;
            }

            foreach (AssignmentGroupEntity age in bge.backline)
            {
                age.turnStartCount = age.remainingCount;
                //totalCount += age.turnStartCount;
            }

            foreach (AssignmentGroupEntity age in bge.supportline)
            {
                age.turnStartCount = age.remainingCount;
                //totalCount += age.turnStartCount;
            }

            //Console.WriteLine("Turn start (" + bge.bg.id + "): " + totalCount);
        }
Пример #7
0
 private static void CalculateLinePerformance(List <AssignmentGroupEntity> attacker, BattleGroupEntity target)
 {
     foreach (AssignmentGroupEntity age in attacker)
     {
         //if (age.ability.remainingCooldown == 0) age.UseAbility(target);
         //else age.UseAttack(target);
         age.UseAttack(target);
     }
 }
Пример #8
0
 public abstract void PerformEffect(BattleGroupEntity targetGroup, Ability abilityData, int count);