Esempio n. 1
0
        private BattleEndStatus BattleThroughRegion(Region region, BattleManager manager, Team playerTeam)
        {
            bool            continuer       = true;
            BattleEndStatus battleEndStatus = BattleEndStatus.None;

            foreach (HumanFighter fighter in playerTeam.Fighters.OfType <HumanFighter>())
            {
                foreach (BattleMove regionMove in region.MovesUnlockedUponEnteringRegion)
                {
                    fighter.AddMove(regionMove);
                }
            }

            AreaMap <SubRegion, WorldSubRegion> subRegionalMap = _mapManager.GetSubRegionalMap(region.AreaId, region.SubRegions);

            while (continuer)
            {
                SubRegion subRegion = subRegionalMap.CurrentArea;
                subRegion.Fooed += PleaseDeleteMeIAmTerribleCode;
                _playerTeam      = playerTeam;

                ColorString introString = new ColorString($"You have entered the {subRegion.AreaId} sub region");

                if (!string.IsNullOrWhiteSpace(subRegion.RegionIntro?.GetFullString()))
                {
                    introString = subRegion.RegionIntro;
                }

                _output.WriteLine(introString);

                battleEndStatus = BattleThroughSubRegion(subRegion, manager, playerTeam);

                if (battleEndStatus != BattleEndStatus.Victory)
                {
                    continuer        = false;
                    subRegion.Fooed += PleaseDeleteMeIAmTerribleCode;
                }
                else
                {
                    List <HumanFighter> fighters = playerTeam.GetHumanFighters().ToList();
                    subRegion.ExecuteCutscene(_input, _output, fighters[0], fighters[1]);

                    subRegion.Fooed += PleaseDeleteMeIAmTerribleCode;

                    subRegion = subRegionalMap.Advance(_decisionManager, playerTeam);

                    if (subRegion == null)
                    {
                        continuer = false;
                    }
                }
            }

            return(battleEndStatus);
        }
Esempio n. 2
0
        /*public Team GetEnemies(SubRegion region, int round)
         * {
         *  Team ret = round < region.NumberRegularBattles ?
         *       :
         *
         *
         *  return ret;
         * }*/

        public BattleManagerBattleConfiguration GetBattleConfiguration(SubRegion subRegion, int round)
        {
            if (subRegion.AreaId == WorldSubRegion.DesertIntro && round == subRegion.NumberRegularBattles)
            {
                return(new BattleManagerBattleConfiguration
                {
                    SpecialBattleFlag = BattleConfigurationSpecialFlag.FirstBarbarianBattle
                });
            }
            else
            {
                return(new BattleManagerBattleConfiguration());
            }
        }
Esempio n. 3
0
        private BattleEndStatus BattleThroughSubRegion(SubRegion subRegion, BattleManager manager, Team playerTeam)
        {
            bool            continuer       = true;
            BattleEndStatus battleEndStatus = BattleEndStatus.None;

            int numberRegularBattles = subRegion.NumberRegularBattles;

            for (var i = 0; i <= numberRegularBattles && continuer; ++i)
            {
                //var enemyTeam = GetEnemies(subRegion, i);
                BattleFieldInfo battlefiendInfo = GetBattleFieldInfo(subRegion, i);

                BattleManagerBattleConfiguration config = GetBattleConfiguration(subRegion, i);

                if (i == numberRegularBattles)
                {
                    PrintBossIntro(subRegion.AreaId);
                }

                battleEndStatus = manager.Battle(playerTeam, battlefiendInfo.EnemyTeam, battlefiendInfo.TerrainInteractables.ToList(), config);

                if (battleEndStatus != BattleEndStatus.Victory)
                {
                    continuer = false;
                }
                else
                {
                    foreach (IFighter player in playerTeam.Fighters)
                    {
                        if (!player.IsAlive())
                        {
                            player.Revive(1);
                        }
                        player.Heal(player.MaxHealth);
                        player.RestoreMana(player.MaxMana);
                    }

                    _output.WriteLine("HP and Mana fully restored!");
                    _input.WaitAndClear(_output);
                }
            }

            return(battleEndStatus);
        }
Esempio n. 4
0
        private static SubRegion GetSubRegion(WorldSubRegion subRegion)
        {
            //SubRegion ret = new SubRegion(subRegion,
            //    4, GetNumberEnemyFighterChancesForRegion(subRegion),
            //    GetFighterTypesForRegion(subRegion),
            //    GetBossConfigurationForBossRegion(subRegion),
            //    GetRegionIntro(subRegion),
            //    GetCutsceneForRegion(subRegion));

            SubRegion ret = new SubRegion(subRegion,
                                          GetNumberEnemiesBeforeBoss(subRegion),
                                          GetNumberEnemyFighterChancesForRegion(subRegion),
                                          GetFighterTypesForRegion(subRegion),
                                          GetBossConfigurationForBossRegion(subRegion),
                                          GetScriptedBattlefieldConfigurationsForRegion(subRegion),
                                          GetRegionIntro(subRegion),
                                          GetCutsceneForRegion(subRegion));

            return(ret);
        }
Esempio n. 5
0
        public TArea Advance(IDecisionManager decisionManager, Team advancingTeam)
        {
            TArea newArea;

            if (typeof(TArea) == typeof(Region))
            {
                Region currentRegion = CurrentArea as Region;

                RegionCompletedEventArgs e = new RegionCompletedEventArgs(currentRegion);
                currentRegion?.OnRegionCompleted(e);
            }
            if (typeof(TArea) == typeof(SubRegion))
            {
                SubRegion currentSubRegion = CurrentArea as SubRegion;

                SubRegionCompletedEventArgs e = new SubRegionCompletedEventArgs(currentSubRegion);
                currentSubRegion?.OnSubRegionCompleted(e);
            }

            MapPath <TArea, TAreaId> currentPath = MapPaths.First(p => p.From.Equals(CurrentArea));

            List <TArea> availableAreas = currentPath.To.GetAvaialableAreas().ToList();

            if (availableAreas.Count == 0)
            {
                newArea = null;
            }
            else if (availableAreas.Count == 1)
            {
                newArea = availableAreas[0];
            }
            else
            {
                newArea = decisionManager.PickNextArea(currentPath.To, advancingTeam);
            }

            CurrentArea = newArea;
            return(newArea);
        }
Esempio n. 6
0
        /// <summary>
        /// Each region has its own unique boss. This returns the appropriate boss for a region.
        /// If, later, certain bosses appear with side kicks, those will also be generated
        /// </summary>
        /// <param name="subRegion"></param>
        /// <returns></returns>
        public Team GetBossTeamForRegion(SubRegion subRegion)
        {
            List <IFighter> bossFighters = new List <IFighter>();

            switch (subRegion.AreaId)
            {
            case WorldSubRegion.Fields:
                MegaChicken chicken = (MegaChicken)FighterFactory.GetFighter(FighterType.MegaChicken, 1);
                bossFighters.Add(chicken);
                break;

            case WorldSubRegion.DesertIntro:
                Barbarian barbarian = (Barbarian)FighterFactory.GetFighter(FighterType.Barbarian, 1);
                bossFighters.Add(barbarian);
                break;

            default:
                throw new NotImplementedException($"Main.GetBossTeamForRegion() is not yet built to handle sub region value {subRegion.AreaId}");
            }

            Team ret = new Team(new MenuManager(_input, _output, _menuFactory), bossFighters);

            return(ret);
        }