示例#1
0
 public override void ApplyBonus(HumanFighter fighter, GodRelationshipManager relationshipManager, bool isSecretBonus = false)
 {
     relationshipManager.UpdateRelationship(fighter, _god, BonusAmount);
 }
示例#2
0
        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);
        }