public void PickNextAreaMethod_CorrectlyReturnsEarlierResult([Range(0, 1)] int selectedSubRegionIndex) { //arrange MapGrouping <SubRegion, WorldSubRegion> firstGrouping, secondGrouping; MockMenu menu1, menu2; List <WorldSubRegion> firstGroupingSubRegions = WorldSubRegions.GetSubRegionsByGroupingId(Globals.GroupingKeys.FirstDesertGroupingId).ToList(); WorldSubRegion selectedSubRegionEnum = firstGroupingSubRegions[selectedSubRegionIndex]; PickNextArea_GroupingSetup_DesertGroupings(out firstGrouping, out secondGrouping); PickNextArea_MenuSetup_DesertGroupings(selectedSubRegionEnum, WorldSubRegion.VillageCenter, out menu1, out menu2); Team team = PickNextArea_TeamSetup_DesertGroupings(); //all sub regions must be unlocked for the Decision Manager to be called Assert.True(secondGrouping.Values.TrueForAll(grouping => !grouping.IsLocked)); MapGroupingItem <SubRegion, WorldSubRegion> selectedRegionGroupingItem = secondGrouping.Values[selectedSubRegionIndex]; _decisionManager.PickNextArea(firstGrouping, team); //will set the menus to return a different selection, and so if the returned region matches the original selection, the test has passed WorldSubRegion secondMenuSelection = firstGroupingSubRegions[selectedSubRegionIndex + 1]; menu1.SetNextSelection(new TypedMenuSelection <WorldSubRegion>(secondMenuSelection, "", null, null)); menu2.SetNextSelection(new TypedMenuSelection <WorldSubRegion>(WorldSubRegion.BeastTemple, "", null, null)); //Act SubRegion secondReturnedRegion = _decisionManager.PickNextArea(firstGrouping, team); //Assert Assert.AreEqual(selectedSubRegionEnum, secondReturnedRegion.AreaId); }
public static GodEnum GetGodEnumBySubRegion(WorldSubRegion subRegion) { GodEnum ret = GodEnum.None; switch (subRegion) { case WorldSubRegion.AncientLibrary: case WorldSubRegion.TempleOfDarkness: ret = GodEnum.IntellectGod; break; case WorldSubRegion.TavernOfHeroes: case WorldSubRegion.CliffsOfAThousandPushups: ret = GodEnum.StrengthGod; break; case WorldSubRegion.DesertCrypt: case WorldSubRegion.VillageCenter: ret = GodEnum.TricksterGod; break; case WorldSubRegion.Oasis: ret = GodEnum.MercyGod; break; case WorldSubRegion.BeastTemple: ret = GodEnum.BeastGod; break; } return(ret); }
public void PickNextAreaMethod_CorrectlySelectsThirdSubRegion_DesertGroupings([Range(0, 3)] int selectedSubRegionIndex) { //arrange MapGrouping <SubRegion, WorldSubRegion> firstGrouping, secondGrouping; List <WorldSubRegion> secondGroupingSubRegions = WorldSubRegions.GetSubRegionsByGroupingId(Globals.GroupingKeys.SecondDesertGroupingId).ToList(); WorldSubRegion selectedSubRegionEnum = secondGroupingSubRegions[selectedSubRegionIndex]; PickNextArea_GroupingSetup_DesertGroupings(out firstGrouping, out secondGrouping); PickNextArea_MenuSetup_DesertGroupings(WorldSubRegion.DesertCrypt, selectedSubRegionEnum); Team team = PickNextArea_TeamSetup_DesertGroupings(); //all sub regions must be unlocked for the Decision Manager to be called Assert.True(secondGrouping.Values.TrueForAll(grouping => !grouping.IsLocked)); MapGroupingItem <SubRegion, WorldSubRegion> selectedRegionGroupingItem = secondGrouping.Values[selectedSubRegionIndex]; //Act _decisionManager.PickNextArea(firstGrouping, team); //Assert List <MapGroupingItem <SubRegion, WorldSubRegion> > notSelectedGroupingItems = secondGrouping.Values.Where(groupingItem => groupingItem.Item.AreaId != selectedSubRegionEnum).ToList(); Assert.False(selectedRegionGroupingItem.IsLocked); Assert.True(notSelectedGroupingItems.TrueForAll(grouping => grouping.IsLocked)); }
private static string GetDisplayTextForMenu(WorldSubRegion subRegion) { string ret = ""; switch (subRegion) { case WorldSubRegion.DesertCrypt: ret = "Weaken him, with poison, perhaps (\"weaken\")"; break; case WorldSubRegion.TavernOfHeroes: ret = "Intimidate him with a show of strength (\"intimidate\")"; break; case WorldSubRegion.AncientLibrary: ret = "Draw him out of his element, get him off balance (\"off-balance\")"; break; case WorldSubRegion.CliffsOfAThousandPushups: ret = "Train, then hit him really hard (\"train\")"; break; case WorldSubRegion.TempleOfDarkness: ret = "Come up with techniques to counter his (\"techniques\")"; break; case WorldSubRegion.VillageCenter: ret = "Rally those wronged by his selfishness (\"rally\")"; break; } return(ret); }
private void PrintBossIntro(WorldSubRegion subRegion) { switch (subRegion) { case WorldSubRegion.Fields: _output.WriteLine("The land shudders in apprehension..."); _output.WriteLine("The sky is ripped asunder..."); _output.WriteLine("From an otherworldly portal appears the first boss monster..."); _output.Write("It's time to face the "); _output.WriteError("Mega Chicken"); _output.WriteLine(", Master of the poultry magical arts."); _input.WaitAndClear(_output); break; case WorldSubRegion.DesertIntro: _output.WriteLine("As the harsh sun looks upon you"); _output.WriteLine("You see a lone figure standing atop a dune"); _output.WriteLine("He looks ready for a fight, like it's been a long time since he's been hugged."); //" flanked by his flunkies"); _output.Write("It's time to face the "); _output.WriteError("Barbarian"); _output.WriteLine(", Strongest of the desert"); _input.WaitAndClear(_output); break; } }
public void UnlockSubRegion(int groupingId, WorldSubRegion subRegionEnum) { MapGrouping <SubRegion, WorldSubRegion> grouping = _subRegionGroupingsDictionary[groupingId]; MapGroupingItem <SubRegion, WorldSubRegion> subRegionGroupingItem = grouping.Values.Single(sr => sr.Item.AreaId == subRegionEnum); subRegionGroupingItem.Unlock(); }
public void PickNextAreaMethod_CorrectGodRelationshipBonusesAssigned_DesertGroupings( [Values(1, 2)] int whichPlayerGetsFlag, [Range(1, 4)] int firstMenuSelection, [Range(1, 4)] int secondMenuSelection) { MapGrouping <SubRegion, WorldSubRegion> firstGrouping, secondGrouping; MockMenu menu1, menu2; List <WorldSubRegion> firstGroupingSubRegions = WorldSubRegions.GetSubRegionsByGroupingId(Globals.GroupingKeys.FirstDesertGroupingId).ToList(); List <WorldSubRegion> secondGroupingSubRegions = WorldSubRegions.GetSubRegionsByGroupingId(Globals.GroupingKeys.SecondDesertGroupingId).ToList(); WorldSubRegion firstSubRegion = firstGroupingSubRegions[firstMenuSelection - 1]; WorldSubRegion secondSubRegion = secondGroupingSubRegions[secondMenuSelection - 1]; PickNextArea_GroupingSetup_DesertGroupings(out firstGrouping, out secondGrouping); PickNextArea_MenuSetup_DesertGroupings(firstSubRegion, secondSubRegion, out menu1, out menu2); Team team = PickNextArea_TeamSetup_DesertGroupings(whichPlayerGetsFlag, "Stan", "Bill"); List <HumanFighter> humanFighters = team.Fighters.OfType <HumanFighter>().ToList(); HumanFighter mazeSolverFighter = humanFighters.First(f => f.PersonalityFlags.Contains(PersonalityFlag.MazeSolver)); HumanFighter notMazeSolverFighter = humanFighters.First(f => !f.PersonalityFlags.Contains(PersonalityFlag.MazeSolver)); menu1.SetNextSelection(new TypedMenuSelection <WorldSubRegion>(firstSubRegion, "", null, null)); menu2.SetNextSelection(new TypedMenuSelection <WorldSubRegion>(secondSubRegion, "", null, null)); //Act _decisionManager.PickNextArea(firstGrouping, team); List <GodEnum> allGodEnums = EnumHelperMethods.GetAllValuesForEnum <GodEnum>().ToList(); GodEnum mazeSolverSelectedRelationship = WorldSubRegions.GetGodEnumBySubRegion(firstSubRegion); Assert.AreEqual(1, _relationshipManager.GetFighterRelationshipValue(mazeSolverFighter, mazeSolverSelectedRelationship)); IEnumerable <GodEnum> notSelectedGods = allGodEnums.Where(g => g != mazeSolverSelectedRelationship); foreach (GodEnum notSelectedGod in notSelectedGods) { int relationshipValue = _relationshipManager.GetFighterRelationshipValue(mazeSolverFighter, notSelectedGod); Assert.AreEqual(0, relationshipValue, $"fighter {mazeSolverFighter.DisplayName} should not have any points assigned to {notSelectedGod}"); } GodEnum notMazeSolverSelectedRelationship = WorldSubRegions.GetGodEnumBySubRegion(secondSubRegion); Assert.AreEqual(1, _relationshipManager.GetFighterRelationshipValue(notMazeSolverFighter, notMazeSolverSelectedRelationship)); notSelectedGods = allGodEnums.Where(g => g != notMazeSolverSelectedRelationship); foreach (GodEnum notSelectedGod in notSelectedGods) { int relationshipValue = _relationshipManager.GetFighterRelationshipValue(notMazeSolverFighter, notSelectedGod); Assert.AreEqual(0, relationshipValue, $"fighter {notMazeSolverFighter.DisplayName} should not have any points assigned to {notSelectedGod}"); } }
private static int GetNumberEnemiesBeforeBoss(WorldSubRegion subRegion) { int ret = 0; switch (subRegion) { case WorldSubRegion.DesertCrypt: ret = 1; break; } return(ret); }
private void PickNextArea_MenuSetup_DesertGroupings(WorldSubRegion firstMenuSelection, WorldSubRegion secondMenuSelection, out MockMenu firstMenu, out MockMenu secondMenu) { firstMenu = new MockMenu(); firstMenu.SetChanceService(_chanceService); firstMenu.SetNextSelection(new TypedMenuSelection <WorldSubRegion>(firstMenuSelection, "", null, null)); secondMenu = new MockMenu(); secondMenu.SetChanceService(_chanceService); secondMenu.SetNextSelection(new TypedMenuSelection <WorldSubRegion>(secondMenuSelection, "", null, null)); _menuFactory.SetMenu(MenuType.NonSpecificMenu, firstMenu); _menuFactory.SetMenu(MenuType.NonSpecificMenu, secondMenu); _chanceService.SetShuffleIndices(new [] { 0, 1, 2 }); _chanceService.SetShuffleIndices(new [] { 0, 1, 2 }); }
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); }
private static BattlefieldConfiguration GetBossConfigurationForBossRegion(WorldSubRegion subRegion) { TeamConfiguration teamInfo; TerrainInteractablesConfiguration fieldInfo = null; switch (subRegion) { case WorldSubRegion.Fields: //teamInfo = new TeamConfiguration(new EnemyConfiguration(FighterType.MegaChicken, 1)); teamInfo = new TeamConfiguration(new EnemyConfiguration(FighterType.Egg, 1, MagicType.Fire), new EnemyConfiguration(FighterType.Egg, 1, MagicType.Ice)); break; case WorldSubRegion.DesertIntro: //teamInfo = new TeamConfiguration(new EnemyConfiguration(FighterType.Barbarian, 1)); teamInfo = new TeamConfiguration(new EnemyConfiguration(FighterType.Egg, 1, MagicType.Fire), new EnemyConfiguration(FighterType.Egg, 1, MagicType.Ice)); break; //TODO: needs to be filled out case WorldSubRegion.DesertCrypt: case WorldSubRegion.TavernOfHeroes: case WorldSubRegion.AncientLibrary: case WorldSubRegion.Oasis: case WorldSubRegion.CliffsOfAThousandPushups: case WorldSubRegion.TempleOfDarkness: case WorldSubRegion.VillageCenter: case WorldSubRegion.BeastTemple: case WorldSubRegion.Coliseum: case WorldSubRegion.CasinoIntro: case WorldSubRegion.CavesIntro: case WorldSubRegion.DarkCastleIntro: teamInfo = new TeamConfiguration(new EnemyConfiguration(FighterType.MegaChicken, 1), new EnemyConfiguration(FighterType.ShieldGuy, 1)); break; default: throw new ArgumentOutOfRangeException(nameof(subRegion), subRegion, null); } var ret = new BattlefieldConfiguration(teamInfo, fieldInfo); return(ret); }
private static string GetCommandTextForMenu(WorldSubRegion subRegion) { string ret = ""; switch (subRegion) { case WorldSubRegion.DesertCrypt: ret = "weaken"; break; case WorldSubRegion.TavernOfHeroes: ret = "intimidate"; break; case WorldSubRegion.AncientLibrary: ret = "off-balance"; break; case WorldSubRegion.CliffsOfAThousandPushups: ret = "train"; break; case WorldSubRegion.TempleOfDarkness: ret = "techniques"; break; case WorldSubRegion.VillageCenter: ret = "rally"; break; case WorldSubRegion.Oasis: ret = "hug"; break; case WorldSubRegion.BeastTemple: ret = "transform"; break; } return(ret); }
public void CorrectlyClearsEarlierGroupingResult_WhenDesertRegionCompleted([Range(0, 1)] int selectedSubRegionIndex) { //arrange Region desertRegion; MapGrouping <SubRegion, WorldSubRegion> firstGrouping, secondGrouping; MockMenu menu1, menu2; List <WorldSubRegion> firstGroupingSubRegions = WorldSubRegions.GetSubRegionsByGroupingId(Globals.GroupingKeys.FirstDesertGroupingId).ToList(); WorldSubRegion selectedSubRegionEnum = firstGroupingSubRegions[selectedSubRegionIndex]; PickNextArea_GroupingSetup_DesertGroupings(out firstGrouping, out secondGrouping, out desertRegion); PickNextArea_MenuSetup_DesertGroupings(selectedSubRegionEnum, WorldSubRegion.VillageCenter, out menu1, out menu2); Team team = PickNextArea_TeamSetup_DesertGroupings(); //all sub regions must be unlocked for the Decision Manager to be called Assert.True(secondGrouping.Values.TrueForAll(grouping => !grouping.IsLocked)); _decisionManager.PickNextArea(firstGrouping, team); desertRegion.OnRegionCompleted(new RegionCompletedEventArgs(desertRegion)); //will set the menus to return a different selection, and so if the returned region matches the original selection, the test has failed WorldSubRegion secondMenuSelection = firstGroupingSubRegions[selectedSubRegionIndex + 1]; menu1.SetNextSelection(new TypedMenuSelection <WorldSubRegion>(secondMenuSelection, "", null, null)); menu2.SetNextSelection(new TypedMenuSelection <WorldSubRegion>(WorldSubRegion.BeastTemple, "", null, null)); _menuFactory.SetMenu(MenuType.NonSpecificMenu, menu1); _menuFactory.SetMenu(MenuType.NonSpecificMenu, menu2); firstGrouping.Unlock(s => true); secondGrouping.Unlock(s => true); //Act SubRegion secondReturnedRegion = _decisionManager.PickNextArea(firstGrouping, team); //Assert Assert.AreEqual(secondMenuSelection, secondReturnedRegion.AreaId); }
public void UnlockSubRegionMethod_CorrectlyUnlocksArea([Range(0, 3)] int regionToUnlockIndex) { Region desertRegion = _regionFactory.GetRegion(WorldRegion.Desert); AreaMap <SubRegion, WorldSubRegion> subregionalMap = _mapManager.GetSubRegionalMap(WorldRegion.Desert, desertRegion.SubRegions); MapPath <SubRegion, WorldSubRegion> pathFromDesertIntro = subregionalMap.MapPaths.First(path => path.From.AreaId == WorldSubRegion.DesertIntro); MapGrouping <SubRegion, WorldSubRegion> destinationGrouping = pathFromDesertIntro.To; Assert.True(destinationGrouping.Values.TrueForAll(groupingItem => !groupingItem.IsLocked)); MapGroupingItem <SubRegion, WorldSubRegion> regionToUnlockGroupingItem = destinationGrouping.Values[regionToUnlockIndex]; WorldSubRegion unlockedRegionEnum = regionToUnlockGroupingItem.Item.AreaId; _mapManager.UnlockSubRegion(destinationGrouping.GroupingId, unlockedRegionEnum); Assert.False(regionToUnlockGroupingItem.IsLocked); List <MapGroupingItem <SubRegion, WorldSubRegion> > stillLockedRegions = destinationGrouping.Values.Where(dgi => dgi.Item.AreaId != unlockedRegionEnum).ToList(); Assert.True(stillLockedRegions.TrueForAll(groupingItem => !groupingItem.IsLocked)); }
private static IEnumerable <ChanceEvent <FighterType> > GetFighterTypesForRegion(WorldSubRegion subRegion) { ChanceEvent <FighterType>[] ret; switch (subRegion) { case WorldSubRegion.Fields: ret = new[] { new ChanceEvent <FighterType>(FighterType.Fairy, .20), new ChanceEvent <FighterType>(FighterType.Goblin, .30), new ChanceEvent <FighterType>(FighterType.Ogre, .25), new ChanceEvent <FighterType>(FighterType.Golem, .25) }; break; case WorldSubRegion.DesertIntro: ret = new[] { new ChanceEvent <FighterType>(FighterType.ShieldGuy, .5), new ChanceEvent <FighterType>(FighterType.Warrior, .5) }; break; //TODO: needs to be filled out case WorldSubRegion.DesertCrypt: case WorldSubRegion.TavernOfHeroes: case WorldSubRegion.AncientLibrary: case WorldSubRegion.Oasis: case WorldSubRegion.CliffsOfAThousandPushups: case WorldSubRegion.TempleOfDarkness: case WorldSubRegion.VillageCenter: case WorldSubRegion.BeastTemple: case WorldSubRegion.Coliseum: case WorldSubRegion.CasinoIntro: case WorldSubRegion.CavesIntro: case WorldSubRegion.DarkCastleIntro: ret = new[] { new ChanceEvent <FighterType>(FighterType.Egg, 1) }; break; default: throw new ArgumentOutOfRangeException(nameof(subRegion), subRegion, null); } return(ret); }
private SubRegion ChooseDesertSubRegions(Team advancingTeam, MapGrouping <SubRegion, WorldSubRegion> grouping) { SubRegion ret; if (_groupingChoicesDictionary.ContainsKey(Globals.GroupingKeys.FirstDesertGroupingId)) { WorldSubRegion selectedRegion = _groupingChoicesDictionary[Globals.GroupingKeys.FirstDesertGroupingId]; ret = grouping.GetAvaialableAreas().First(sr => sr.AreaId == selectedRegion); } else { HumanFighter mazeSolver = advancingTeam.Fighters.OfType <HumanFighter>() .First(f => f.PersonalityFlags.Contains(PersonalityFlag.MazeSolver)); HumanFighter notMazeSolver = advancingTeam.Fighters.OfType <HumanFighter>() .First(f => !f.PersonalityFlags.Contains(PersonalityFlag.MazeSolver)); IEnumerable <WorldSubRegion> firstGroupingSubRegions = WorldSubRegions.GetSubRegionsByGroupingId(Globals.GroupingKeys.FirstDesertGroupingId); IEnumerable <MenuAction> firstGroupingMenuActions = firstGroupingSubRegions.Select( sr => new TypedMenuAction <WorldSubRegion>(sr, GetDisplayTextForMenu(sr), GetCommandTextForMenu(sr), isHidden: sr == WorldSubRegion.Oasis)); IMenu firstGroupingMenu = _menuFactory.GetMenu(MenuType.NonSpecificMenu, _input, _output, allowHelp: false, allowBack: false, allowStatus: false, prompt: $"{Globals.OwnerReplaceText}: We should focus on forming a strategy for our next battle, we should...", errorText: Globals.GenericErrorMessage, menuActions: firstGroupingMenuActions.ToList(), chanceService: _chanceService, shuffleOptions: true); firstGroupingMenu.Build(mazeSolver, null, null, null); TypedMenuSelection <WorldSubRegion> firstMenuSelection = firstGroupingMenu.GetInput() as TypedMenuSelection <WorldSubRegion>; if (firstMenuSelection == null) { throw new InvalidCastException( "DecisionManager.ChooseDesertSubRegions() should have generated menus that would return a TypedMenuSeleciton<WorldSubRegion> but it did not!"); } WorldSubRegion firstSelectedSubRegionEnum = firstMenuSelection.Item; grouping.Lock(sr => sr.AreaId != firstSelectedSubRegionEnum); _relationshipManager.UpdateRelationship(mazeSolver, WorldSubRegions.GetGodEnumBySubRegion(firstSelectedSubRegionEnum), 1); _groupingChoicesDictionary.Add(Globals.GroupingKeys.FirstDesertGroupingId, firstSelectedSubRegionEnum); IEnumerable <WorldSubRegion> secondGroupingSubRegions = WorldSubRegions.GetSubRegionsByGroupingId(Globals.GroupingKeys.SecondDesertGroupingId); IEnumerable <MenuAction> secondGroupingMenuActions = secondGroupingSubRegions.Select( sr => new TypedMenuAction <WorldSubRegion>(sr, GetDisplayTextForMenu(sr), GetCommandTextForMenu(sr), isHidden: sr == WorldSubRegion.BeastTemple)); IMenu secondGroupingMenu = _menuFactory.GetMenu(MenuType.NonSpecificMenu, _input, _output, allowHelp: false, allowBack: false, allowStatus: false, prompt: $"{Globals.OwnerReplaceText}: I was thinking about how we could improve, what if we...", errorText: Globals.GenericErrorMessage, menuActions: secondGroupingMenuActions.ToList(), chanceService: _chanceService, shuffleOptions: true); secondGroupingMenu.Build(notMazeSolver, null, null, null); TypedMenuSelection <WorldSubRegion> secondMenuSelection = secondGroupingMenu.GetInput() as TypedMenuSelection <WorldSubRegion>; if (secondMenuSelection == null) { throw new InvalidCastException( "DecisionManager.ChooseDesertSubRegions() should have generated menus that would return a TypedMenuSeleciton<WorldSubRegion> but it did not!"); } WorldSubRegion secondSelectedSubRegionEnum = secondMenuSelection.Item; grouping.Parent.MapPaths.First(path => path.To.GroupingId == Globals.GroupingKeys.SecondDesertGroupingId) .To.Lock(sr => sr.AreaId != secondSelectedSubRegionEnum); _relationshipManager.UpdateRelationship(notMazeSolver, WorldSubRegions.GetGodEnumBySubRegion(secondSelectedSubRegionEnum), 1); _groupingChoicesDictionary.Add(Globals.GroupingKeys.SecondDesertGroupingId, secondSelectedSubRegionEnum); ret = grouping.GetAvaialableAreas().First(sr => sr.AreaId == firstSelectedSubRegionEnum); } return(ret); }
public void UnlockSubRegion(int groupingId, WorldSubRegion subRegionEnum) { _realMapManager.UnlockSubRegion(groupingId, subRegionEnum); }
private static ColorString GetRegionIntro(WorldSubRegion subRegion) { return(null); }
public void CorrectlyMovesToNextSubRegion_MultipleNextSubRegions([Values(1, 2)] int selectedArea) { const int groupingId = 10; _decisionManager.SetGroupingChoice(selectedArea - 1); TeamConfiguration firstBossConfiguration = new TeamConfiguration(new EnemyConfiguration(FighterType.Egg, 1, MagicType.Fire)); SubRegion firstSubRegion = new SubRegion(WorldSubRegion.Fields, 0, new ChanceEvent <int> [0], new FighterType[0], new BattlefieldConfiguration(firstBossConfiguration)); FighterType bossA = FighterType.Barbarian; WorldSubRegion regionA = WorldSubRegion.DesertCrypt; TeamConfiguration secondBossConfiguration = new TeamConfiguration(new EnemyConfiguration(bossA, 1)); SubRegion subRegionA = new SubRegion(regionA, 0, new ChanceEvent <int> [0], new FighterType[0], new BattlefieldConfiguration(secondBossConfiguration)); FighterType bossB = FighterType.MegaChicken; WorldSubRegion regionB = WorldSubRegion.Oasis; TeamConfiguration thirdBossConfiguration = new TeamConfiguration(new EnemyConfiguration(bossB, 1)); SubRegion subRegionB = new SubRegion(regionB, 0, new ChanceEvent <int> [0], new FighterType[0], new BattlefieldConfiguration(thirdBossConfiguration)); SubRegion[] subRegions = { firstSubRegion, subRegionA, subRegionB }; Region fakeFieldsRegion = new Region(WorldRegion.Fields, new BattleMove[0], subRegions); _regionFactory.SetRegion(WorldRegion.Fields, fakeFieldsRegion); AreaMap <Region, WorldRegion> regionMap = new AreaMap <Region, WorldRegion>(fakeFieldsRegion, new MapPath <Region, WorldRegion>(fakeFieldsRegion)); MapGrouping <SubRegion, WorldSubRegion> grouping = new MapGrouping <SubRegion, WorldSubRegion>(groupingId, subRegionA, subRegionB); AreaMap <SubRegion, WorldSubRegion> subRegionMap = new AreaMap <SubRegion, WorldSubRegion>(firstSubRegion, new MapPath <SubRegion, WorldSubRegion>(firstSubRegion, grouping)); _mapManager.SetRegionalMap(regionMap); _mapManager.SetSubRegionalMap(WorldRegion.Fields, subRegionMap); _regionManager = GetRegionManager(); TestEnemyFighter target = (TestEnemyFighter)TestFighterFactory.GetFighter(TestFighterType.TestEnemy, 1); target.SetHealth(1, 0); _humanFighter1.SetMove(_basicAttackMove, 1); _humanFighter1.SetMove(_runawayMove, 1); _humanFighter1.SetMoveTarget(target); _humanFighter2.SetMove(_doNothingMove); _chanceService.PushAttackHitsNotCrit(); _regionManager.Battle(_battleManager, _humanTeam); List <Team> enemyTeams = _battleManager.GetAllEnemyTeams(); Assert.AreEqual(2, enemyTeams.Count); IFighter secondBoss = enemyTeams[1].Fighters[0]; FighterType selectedBossType = selectedArea == 1 ? bossA : bossB; WorldSubRegion selectedBossRegion = selectedArea == 1 ? regionA : regionB; Assert.NotNull(secondBoss); Assert.True(selectedBossType.IsCorrectType(secondBoss)); Assert.AreEqual(selectedBossRegion, subRegionMap.CurrentArea.AreaId); }
private void PickNextArea_MenuSetup_DesertGroupings(WorldSubRegion firstMenuSelection, WorldSubRegion secondMenuSelection) { MockMenu firstMenu, secondMenu; PickNextArea_MenuSetup_DesertGroupings(firstMenuSelection, secondMenuSelection, out firstMenu, out secondMenu); }
private static IEnumerable <ChanceEvent <int> > GetNumberEnemyFighterChancesForRegion(WorldSubRegion subRegion) { ChanceEvent <int>[] ret; switch (subRegion) { default: ret = new [] { new ChanceEvent <int>(2, 25), new ChanceEvent <int>(3, 65), new ChanceEvent <int>(4, 10) }; break; } return(ret); }
private static List <ScriptedBattlefieldConfiguration> GetScriptedBattlefieldConfigurationsForRegion(WorldSubRegion subRegion) { List <ScriptedBattlefieldConfiguration> generatedScriptedBattlefieldConfigurations = new List <ScriptedBattlefieldConfiguration>(); switch (subRegion) { case WorldSubRegion.DesertCrypt: BattlefieldConfiguration firstBattleConfig = new BattlefieldConfiguration(new ShadeGroupingConfiguration(3, 1), new BellTerrainConfiguration(BellType.Copper, BellType.Silver)); ScriptedBattlefieldConfiguration firstBattleScript = new ScriptedBattlefieldConfiguration(firstBattleConfig, 0); generatedScriptedBattlefieldConfigurations.Add(firstBattleScript); break; } return(generatedScriptedBattlefieldConfigurations); }
private static Cutscene GetCutsceneForRegion(WorldSubRegion subRegion) { Cutscene ret; List <ColorString[]> sceneLines = new List <ColorString[]>(); switch (subRegion) { case WorldSubRegion.Fields: sceneLines.Add(new [] { new ColorString("As you savor the sweet taste of victory, an old man approaches."), new ColorString("He has the air of wisdom about him,"), new ColorString("like he's the sort of man who has seen more than the average person,"), new ColorString("Or perhaps he was an adventurer in his youth.") }); sceneLines.Add(new[] { new ColorString("Old man: Heh, looks like you gave that nasty chicken the ole what-for."), new ColorString("Good for you! I remember a time before so many monsters plagued the world."), new ColorString("Could it be that you two wanted to make the world a better place,"), new ColorString("and thought fighting monsters was more exciting than renovating the community center?"), new ColorString("Well, I have a story to tell you! And don't worry, it won't be long or overly complicated,"), new ColorString("Some of us have Bingo tonight and I've been on quite the lucky streak these past 50 moons") }); sceneLines.Add(new[] { new ColorString("Old man: A long time ago, the gods watched over us, and the land was propserous."), new ColorString("We didn't have a monster problem, and colors were brighter, I tell you."), new ColorString("Then one day the gods went away. Some thought they were just out buying lotto tickets,"), new ColorString("but I think there's an explanation-"), new ColorString("We used to have ", new ColorString("Heroes ", ConsoleColor.Cyan), "back in the day, you know, people that served the will of the gods,"), new ColorString("mortals who were the physical instruments of divine will."), new ColorString("When their strength faded, and no new heroes arose, it weakened the power of the gods over their domain.") }); sceneLines.Add(new[] { new ColorString(new ColorString("Old man: When I look at you two, I see the "), new ColorString("seeds of the future", ConsoleColor.Cyan), ","), new ColorString("Yup, two aspiring heroes who may, with just the right encouragement, be able to revive the old gods"), new ColorString("So that's your task, then. Go out and fight the great evils that plague us,"), new ColorString("become the instruments of justice,"), new ColorString("and save the world! No pressure, of course.") }); sceneLines.Add(new[] { new ColorString( "Old man: why, I was just reading on my fancy iPad device about ", new ColorString("3", ConsoleColor.Cyan), " lands corrupted by evil."), new ColorString("Or maybe it was 'The top 3 evils that need to be vanquished right now' or some such..."), new ColorString("Eh, regardless, you should go to the following regions- and I don't think order matters:"), new ColorString(new ColorString("The desert ", ConsoleColor.Yellow), new ColorString("home of strong warriors")), new ColorString(new ColorString("The crystal caves ", ConsoleColor.Cyan), "land of strange magic ", new ColorString("(not actually implemented)", ConsoleColor.Red)), new ColorString(new ColorString("The casino ", ConsoleColor.Blue), "where luck may hold the key to your fate ", new ColorString("(not actually implemented)", ConsoleColor.Red)), new ColorString("Good luck, heroes. If you aren't murdered violently by evil forces, I'll see that they sing songs about you!") }); ret = new Cutscene(sceneLines.Select(sl => new SingleScene(sl)).Cast <CutsceneComponent>().ToArray()); break; case WorldSubRegion.DesertIntro: sceneLines.AddRange(new[] { new[] { new ColorString("As the Barbarian runs as fast as his muscular legs can carry him,"), new ColorString("your... mentor? Father figure?"), new ColorString("We certainly haven't established anything about our character's family..."), new ColorString("Regardless, the old man has returned, having witnessed your battle against the ", new ColorString("Barbarian", ConsoleColor.Red)) }, new[] { new ColorString("Old man: Surprised to see me? Bingo got out early!"), new ColorString("What a rascal that man is!"), new ColorString("Still, even though he ran, he seemed rather strong..."), new ColorString("I don't think you should just go blindly chasing after him, he might have more goons."), new ColorString("Take a moment to strategize, and remember ", new ColorString("the gods", ConsoleColor.Cyan), " are watching."), new ColorString("So... what will you do?") } }); IEnumerable <CutsceneComponent> components = sceneLines.Select(sl => new SingleScene(sl)); components = components.Concat(new [] { new DecisionScene(Globals.GroupingKeys.FirstDesertGroupingId) }); sceneLines = new List <ColorString[]> { new[] { new ColorString("Old man: Oh, so that's how you'll approach him, eh?"), new ColorString("Well then, I suggest you go to ", new ColorString("that place ", ConsoleColor.Cyan), "and ", new ColorString("that other place", ConsoleColor.Cyan)), new ColorString("Though I can't say anything will happen much."), new ColorString( "What's that? Why can't I be more specific? And you want bonuses for clearing the next two areas?"), new ColorString("Then try coming back when more of the game has been implemented! Jeez!"), new ColorString("Back in my day we were grateful for every line of code, I tell you...") } }; components = components.Concat(sceneLines.Select(sl => new SingleScene(sl))); ret = new Cutscene(components.ToArray()); break; default: ret = null; break; } return(ret); }