Example #1
0
        public void AssignNameBonuses_IgnoresCaseOfFighterName([Values("upper", "lower")] string nameCase)
        {
            string danteName   = "Dante";
            string arrokohName = "Arrokoh";

            danteName   = nameCase == "upper" ? danteName.ToUpperInvariant() : danteName.ToLowerInvariant();
            arrokohName = nameCase == "upper" ? arrokohName.ToUpperInvariant() : arrokohName.ToLowerInvariant();

            HumanFighter dante   = (HumanFighter)FighterFactory.GetFighter(FighterType.HumanControlledPlayer, 1, danteName);
            HumanFighter arrokoh = (HumanFighter)FighterFactory.GetFighter(FighterType.HumanControlledPlayer, 1, arrokohName);

            int arrokohPreBonusStrength = arrokoh.Strength;
            int dantePreBonusSpeed      = dante.Speed;

            _decisionManager.AssignNameBonuses(dante, arrokoh);

            int arrokohPostBonusStrength = arrokoh.Strength;
            int dantePostBonusSpeed      = dante.Speed;

            int arrokohStrengthBonus = arrokohPostBonusStrength - arrokohPreBonusStrength;

            Assert.Greater(arrokohStrengthBonus, 0);

            int danteSpeedBonus = dantePostBonusSpeed - dantePreBonusSpeed;

            Assert.Greater(danteSpeedBonus, 0);
        }
 public void ApplyBonuses(HumanFighter fighter, GodRelationshipManager relationshipManager)
 {
     foreach (DecisionBonus bonus in Bonuses)
     {
         bonus.ApplyBonus(fighter, relationshipManager);
     }
 }
 public void InitializeForFighter(HumanFighter fighter)
 {
     if (!FighterGodRelationships.Exists(fgr => fgr.Fighter == fighter))
     {
         FighterGodRelationships.Add(new FighterGodRelationship(fighter));
     }
 }
        public void AssignNameBonuses(HumanFighter fighter1, HumanFighter fighter2)
        {
            List <HumanFighter> fighterList = new List <HumanFighter> {
                fighter1, fighter2
            };

            foreach (Tuple <NameBonuses, NameBonuses> namePairBonus in NamePairBonuses)
            {
                string firstName  = namePairBonus.Item1.Name.Replace(" ", "");
                string secondName = namePairBonus.Item2.Name.Replace(" ", "");

                HumanFighter firstFighter  = fighterList.FirstOrDefault(f => string.Equals(f.BaseName, firstName, StringComparison.InvariantCultureIgnoreCase));
                HumanFighter secondFighter = fighterList.FirstOrDefault(f => string.Equals(f.BaseName, secondName, StringComparison.InvariantCultureIgnoreCase));

                if (firstFighter != null && secondFighter != null)
                {
                    _output.WriteLine("Congratulations! The given names were recognized, and shall be given bonuses!");
                    _input.WaitAndClear(_output);
                    namePairBonus.Item1.ApplyBonuses(firstFighter, _relationshipManager);
                    _input.WaitAndClear(_output);
                    namePairBonus.Item2.ApplyBonuses(secondFighter, _relationshipManager);
                    _input.WaitAndClear(_output);
                }
            }
        }
Example #5
0
        public void Setup()
        {
            _logger = new EventLogger();

            _fighter = (HumanFighter)TestFighterFactory.GetFighter(TestFighterType.HumanControlledPlayer, 1, "Ted");
            _logger.SubscribeAll(_fighter);
        }
Example #6
0
        public void FighterFactory_AutoInitializesHumanFighters_GodRelationshipManagerSet()
        {
            FighterFactory.SetGodRelationshipManager(_relationshipManager);
            _fighter = (HumanFighter)FighterFactory.GetFighter(FighterType.HumanControlledPlayer, 1);

            Assert.DoesNotThrow(() => _relationshipManager.GetFighterRelationshipValue(_fighter, GodEnum.MachineGod));
        }
Example #7
0
        public void SetUp()
        {
            _relationshipManager = new GodRelationshipManager();
            _allGodValues        = EnumHelperMethods.GetAllValuesForEnum <GodEnum>();

            FighterFactory.SetGodRelationshipManager(_relationshipManager);
            _fighter = (HumanFighter)FighterFactory.GetFighter(FighterType.HumanControlledPlayer, 1);
        }
Example #8
0
        public void Print(IInput input, IOutput output, HumanFighter fighter1, HumanFighter fighter2)
        {
            foreach (ColorString line in Lines)
            {
                output.WriteLine(line);
            }

            input.WaitAndClear(output);
        }
        public void SetUp()
        {
            _fighter = (HumanFighter)FighterFactory.GetFighter(FighterType.HumanControlledPlayer, 1);

            _output  = new MockOutput();
            _printer = new EventHandlerPrinter(_output);

            _printer.Subscribe(_fighter);
        }
Example #10
0
 public void SubscribeAll(HumanFighter fighter)
 {
     fighter.ExpGained         += _logExpGained;
     fighter.LeveledUp         += _logLeveledUp;
     fighter.SpellsLearned     += _logSpellLearned;
     fighter.MoveLearned       += _logMoveLearned;
     fighter.StatBonusApplied  += _logStatBonusApplied;
     fighter.MagicBonusApplied += _logMagicBonusApplied;
     SubscribeAll(fighter as IFighter);
 }
Example #11
0
        public void AssignNameBonuses_CorrectlySetsPersonalityFlag()
        {
            HumanFighter poopyCarrots = (HumanFighter)FighterFactory.GetFighter(FighterType.HumanControlledPlayer, 1, "PoopyCarrots");
            HumanFighter chesterton   = (HumanFighter)FighterFactory.GetFighter(FighterType.HumanControlledPlayer, 1, "Chesterton");

            _decisionManager.AssignNameBonuses(poopyCarrots, chesterton);

            Assert.Contains(PersonalityFlag.Heroic, poopyCarrots.PersonalityFlags);
            Assert.Contains(PersonalityFlag.MorallyFlexible, chesterton.PersonalityFlags);
        }
Example #12
0
        private void BuildMenu(IMenu menu, List <TerrainInteractable> terrainInteractables = null)
        {
            _player = (HumanFighter)FighterFactory.GetFighter(FighterType.HumanControlledPlayer, 1);
            var playerTeam = new Team(_menuManager, _player);

            _enemy = (EnemyFighter)FighterFactory.GetFighter(FighterType.Goblin, 1);
            var enemyTeam = new Team(_menuManager, _enemy);

            menu.Build(_player, playerTeam, enemyTeam, terrainInteractables ?? new List <TerrainInteractable>());
        }
Example #13
0
        public void AssignNameBonuses_CorrectlySetsGodRelationship()
        {
            HumanFighter poopyCarrots = (HumanFighter)FighterFactory.GetFighter(FighterType.HumanControlledPlayer, 1, "PoopyCarrots");
            HumanFighter chesterton   = (HumanFighter)FighterFactory.GetFighter(FighterType.HumanControlledPlayer, 1, "Chesterton");

            _decisionManager.AssignNameBonuses(poopyCarrots, chesterton);

            Assert.AreEqual(1, _relationshipManager.GetFighterRelationshipValue(poopyCarrots, GodEnum.MercyGod));
            Assert.AreEqual(1, _relationshipManager.GetFighterRelationshipValue(chesterton, GodEnum.MalevolentGod));
        }
Example #14
0
        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}");
            }
        }
Example #15
0
        public void InitializeForBattle_CorrectlyInitializes()
        {
            _fighter = new HumanFighter("Dante", 1);
            _relationshipManager.InitializeForFighter(_fighter);

            foreach (GodEnum god in _allGodValues)
            {
                int relationshipValue = _relationshipManager.GetFighterRelationshipValue(_fighter, god);
                Assert.AreEqual(0, relationshipValue);
            }
        }
            public FighterGodRelationship(HumanFighter fighter)
            {
                Fighter = fighter;
                _values = new Dictionary <GodEnum, int>();

                IEnumerable <GodEnum> godValues = EnumHelperMethods.GetAllValuesForEnum <GodEnum>();

                foreach (GodEnum god in godValues)
                {
                    _values[god] = 0;
                }
            }
Example #17
0
        public void ExecuteCutscene(IInput input, IOutput output, HumanFighter fighter1, HumanFighter fighter2)
        {
            foreach (CutsceneComponent component in AllScenes)
            {
                (component as SingleScene)?.Print(input, output, fighter1, fighter2);

                DecisionScene decisionScene = component as DecisionScene;

                if (decisionScene != null)
                {
                    decisionScene.Fooed += PropagateFooEvent;
                    decisionScene.Decide();
                }
            }
        }
        public void Setup()
        {
            _input             = new MockInput();
            _output            = new MockOutput();
            _menuManager       = new TestMenuManager(_input, _output);
            _mockChanceService = new MockChanceService();
            TestFighterFactory.SetChanceService(_mockChanceService);

            _fighter = (TestEnemyFighter)TestFighterFactory.GetFighter(TestFighterType.TestEnemy, 1, "hero");
            _enemy1  = (HumanFighter)FighterFactory.GetFighter(FighterType.HumanControlledPlayer, 1, "enemy");
            _enemy2  = (HumanFighter)FighterFactory.GetFighter(FighterType.HumanControlledPlayer, 1, "enemy");

            _ownTeam         = new Team(_menuManager, _fighter);
            _singleEnemyTeam = new Team(_menuManager, _enemy1);
            _doubleEnemyTeam = new Team(_menuManager, _enemy1, _enemy2);
        }
Example #19
0
        public void AssignNameBonuses_CorrectlyAssignsBonuses()
        {
            HumanFighter dante   = (HumanFighter)FighterFactory.GetFighter(FighterType.HumanControlledPlayer, 1, "Dante");
            HumanFighter arrokoh = (HumanFighter)FighterFactory.GetFighter(FighterType.HumanControlledPlayer, 1, "Arrokoh");

            int dantePreBonusSpeed          = dante.Speed;
            int dantePreBonusFirePower      = dante.MagicStrengthBonuses[MagicType.Fire];
            int dantePreBonusFireResistance = dante.MagicResistanceBonuses[MagicType.Fire];

            int arrokohPreBonusStrength            = arrokoh.Strength;
            int arrokohPreBonusLightningPower      = dante.MagicStrengthBonuses[MagicType.Lightning];
            int arrokohPreBonusLightningResistance = dante.MagicResistanceBonuses[MagicType.Lightning];

            _decisionManager.AssignNameBonuses(dante, arrokoh);

            int dantePostBonusSpeed          = dante.Speed;
            int dantePostBonusFirePower      = dante.MagicStrengthBonuses[MagicType.Fire];
            int dantePostBonusFireResistance = dante.MagicResistanceBonuses[MagicType.Fire];

            int danteSpeedBonus = dantePostBonusSpeed - dantePreBonusSpeed;

            Assert.Greater(danteSpeedBonus, 0);

            int danteFireStrengthBonus = dantePostBonusFirePower - dantePreBonusFirePower;

            Assert.Greater(danteFireStrengthBonus, 0);

            int danteFireResistanceBonus = dantePostBonusFireResistance - dantePreBonusFireResistance;

            Assert.Greater(danteFireResistanceBonus, 0);

            int arrokohPostBonusStrength            = arrokoh.Strength;
            int arrokohPostBonusLightningPower      = arrokoh.MagicStrengthBonuses[MagicType.Lightning];
            int arrokohPostBonusLightningResistance = arrokoh.MagicResistanceBonuses[MagicType.Lightning];

            int arrokohStrengthBonus = arrokohPostBonusStrength - arrokohPreBonusStrength;

            Assert.Greater(arrokohStrengthBonus, 0);

            int arrokohLightningStrengthBonus = arrokohPostBonusLightningPower - arrokohPreBonusLightningPower;

            Assert.Greater(arrokohLightningStrengthBonus, 0);

            int arrokohLightningResistanceBonus = arrokohPostBonusLightningResistance - arrokohPreBonusLightningResistance;

            Assert.Greater(arrokohLightningResistanceBonus, 0);
        }
Example #20
0
        public void PersonalityQuiz_ManualEntry_CorrectlyHandlesNeitherOption()
        {
            HumanFighter dante   = (HumanFighter)FighterFactory.GetFighter(FighterType.HumanControlledPlayer, 1, "Dante");
            HumanFighter arrokoh = (HumanFighter)FighterFactory.GetFighter(FighterType.HumanControlledPlayer, 1, "Arrokoh");

            for (var i = 0; i < 8; ++i)
            {
                _input.Push(i == 5 ? "neither" : "1");
            }

            _decisionManager.PersonalityQuiz(dante, arrokoh);

            Assert.AreEqual(0, _relationshipManager.GetFighterRelationshipValue(dante, GodEnum.MalevolentGod), "sixth question should not raise malevolent god relationship for either fighters for 'neither' result");
            Assert.AreEqual(0, _relationshipManager.GetFighterRelationshipValue(arrokoh, GodEnum.MalevolentGod), "sixth question should not raise malevolent god relationship for either fighters for 'neither' result");
            Assert.AreEqual(1, _relationshipManager.GetFighterRelationshipValue(dante, GodEnum.MercyGod), "sixth question should raise mercy god relationship for both fighters for 'neither' result");
            Assert.AreEqual(1, _relationshipManager.GetFighterRelationshipValue(arrokoh, GodEnum.MercyGod), "sixth question should raise mercy god relationship for both fighters for 'neither' result");
        }
Example #21
0
        public void SetUp()
        {
            _menuInput   = new MockInput();
            _menuOutput  = new MockOutput();
            _menuManager = new TestMenuManager(_menuInput, _menuOutput);

            _player = (HumanFighter)FighterFactory.GetFighter(FighterType.HumanControlledPlayer, 1);
            _ally1  = FighterFactory.GetFighter(FighterType.Fairy, 1);
            _ally2  = FighterFactory.GetFighter(FighterType.Goblin, 1);

            _playerTeamNoAllies   = new Team(_menuManager, _player);
            _playerTeamWithAllies = new Team(_menuManager, _player, _ally1, _ally2);

            _enemyTeam = CreateEnemyTeam();

            _menu = (TargetMenu)Globals.MenuFactory.GetMenu(MenuType.ChooseTargetMenu, _menuInput, _menuOutput);
            _menu.Build(_player, _playerTeamNoAllies, _enemyTeam, null);
        }
Example #22
0
        /// <summary>
        /// Handles player names and personality quiz stuff
        /// </summary>
        /// <param name="playerOne"></param>
        /// <param name="playerTwo"></param>
        /// <param name="printer"></param>
        private static void SetupPlayers(out HumanFighter playerOne, out HumanFighter playerTwo, EventHandlerPrinter printer)
        {
            string playerOneName = GetName(1);
            string playerTwoName = GetName(2, playerOneName);

            playerOne = (HumanFighter)FighterFactory.GetFighter(FighterType.HumanControlledPlayer, 1, playerOneName);
            playerTwo = (HumanFighter)FighterFactory.GetFighter(FighterType.HumanControlledPlayer, 1, playerTwoName);
            Globals.Output.ClearScreen();

            printer.Subscribe(playerOne, playerTwo);

            Globals.DecisionManager.AssignNameBonuses(playerOne, playerTwo);

            ConfirmationMenu takePersonalityQuizConfirmationMenu = new ConfirmationMenu(false, "To better get to know your characters, would you like to fill out a short personality questionaire?\n(if you decline, the answers will be asigned randomly)\n", Globals.Input, Globals.Output);
            MenuSelection    takePersonalityQuizSelection        = takePersonalityQuizConfirmationMenu.GetInput();

            Globals.DecisionManager.PersonalityQuiz(playerOne, playerTwo, takePersonalityQuizSelection.Description == "no", Globals.ChanceService);
        }
        public void LevelInitializater_CorrectlyInitializesStatsBasedOnLevel([Values(1, 2, 5)] int level)
        {
            var fighter = new HumanFighter("Foo the Magnificent", level);

            Assert.AreEqual(level, fighter.Level);
            Assert.AreEqual(LevelUpManager.GetHealthByLevel(level), fighter.CurrentHealth);
            Assert.AreEqual(LevelUpManager.GetHealthByLevel(level), fighter.MaxHealth);
            Assert.AreEqual(LevelUpManager.GetManaByLevel(level), fighter.CurrentMana);
            Assert.AreEqual(LevelUpManager.GetManaByLevel(level), fighter.MaxMana);
            Assert.AreEqual(LevelUpManager.GetStrengthByLevel(level), fighter.Strength);
            Assert.AreEqual(LevelUpManager.GetDefenseByLevel(level), fighter.Defense);
            Assert.AreEqual(LevelUpManager.GetSpeedByLevel(level), fighter.Speed);
            Assert.AreEqual(LevelUpManager.GetEvadeByLevel(level), fighter.Evade);
            Assert.AreEqual(LevelUpManager.GetLuckByLevel(level), fighter.Luck);
            var spells = GetSpellsByLevel(level);

            Assert.AreEqual(spells.Count, fighter.Spells.Count);
            Assert.IsTrue(spells.TrueForAll(s => fighter.Spells.SingleOrDefault(fs => fs.Description == s.Description) != null));
        }
Example #24
0
        public void PersonalityQuiz_RandomizedEntries_CorrectlyHandlesNeitherOption()
        {
            HumanFighter dante   = (HumanFighter)FighterFactory.GetFighter(FighterType.HumanControlledPlayer, 1, "Dante");
            HumanFighter arrokoh = (HumanFighter)FighterFactory.GetFighter(FighterType.HumanControlledPlayer, 1, "Arrokoh");

            MockChanceService chanceService = new MockChanceService();

            for (var i = 0; i < 8; ++i)
            {
                chanceService.PushWhichEventsOccur(i == 5 ? 3 : 0);
            }

            _decisionManager.PersonalityQuiz(dante, arrokoh, true, chanceService);

            Assert.AreEqual(0, _relationshipManager.GetFighterRelationshipValue(dante, GodEnum.MalevolentGod), "sixth question should not raise malevolent god relationship for either fighters for 'neither' result");
            Assert.AreEqual(0, _relationshipManager.GetFighterRelationshipValue(arrokoh, GodEnum.MalevolentGod), "sixth question should not raise malevolent god relationship for either fighters for 'neither' result");
            Assert.AreEqual(1, _relationshipManager.GetFighterRelationshipValue(dante, GodEnum.MercyGod), "sixth question should raise mercy god relationship for both fighters for 'neither' result");
            Assert.AreEqual(1, _relationshipManager.GetFighterRelationshipValue(arrokoh, GodEnum.MercyGod), "sixth question should raise mercy god relationship for both fighters for 'neither' result");
        }
Example #25
0
        public void Setup()
        {
            _logger        = new EventLogger();
            _input         = new MockInput();
            _output        = new MockOutput();
            _menuManager   = new TestMenuManager(_input, _output);
            _chanceService = new MockChanceService();

            TestFighterFactory.SetChanceService(_chanceService);

            _humanPlayer1 = (HumanFighter)TestFighterFactory.GetFighter(TestFighterType.HumanControlledPlayer, 1, "Ted");
            _humanPlayer2 = (HumanFighter)TestFighterFactory.GetFighter(TestFighterType.HumanControlledPlayer, 1, "Jed");
            _enemyPlayer1 = (TestEnemyFighter)TestFighterFactory.GetFighter(TestFighterType.TestEnemy, 1, DefaultEnemyName);
            _enemyPlayer2 = (TestEnemyFighter)TestFighterFactory.GetFighter(TestFighterType.TestEnemy, 1, DefaultEnemyName);

            _enemyTeam = new Team(TestMenuManager.GetTestMenuManager(), _enemyPlayer1, _enemyPlayer2);
            _humanTeam = new Team(TestMenuManager.GetTestMenuManager(), _humanPlayer1, _humanPlayer2);

            _humanTeam.InitializeForBattle(_enemyTeam, _input, _output);
        }
        public void CorrectlySubscribesToMultipleFighters()
        {
            _output = new MockOutput();
            EventHandlerPrinter printer = new EventHandlerPrinter(_output);

            HumanFighter fighter2 = (HumanFighter)FighterFactory.GetFighter(FighterType.HumanControlledPlayer, 1);
            HumanFighter fighter3 = (HumanFighter)FighterFactory.GetFighter(FighterType.HumanControlledPlayer, 1);

            printer.Subscribe(_fighter, fighter2, fighter3);

            StatBonusAppliedEventArgs e = new StatBonusAppliedEventArgs(StatType.Defense, 2, false);

            _fighter.OnStatBonusApplied(e);
            fighter2.OnStatBonusApplied(e);
            fighter3.OnStatBonusApplied(e);

            MockOutputMessage[] outputs = _output.GetOutputs();

            Assert.AreEqual(3, outputs.Length);
        }
Example #27
0
        public void PersonalityQuiz_RandomizedEntries_CorrectlySetsInitializationValues([Values(0, 1)] int selectedFighterInput)
        {
            HumanFighter dante   = (HumanFighter)FighterFactory.GetFighter(FighterType.HumanControlledPlayer, 1, "Dante");
            HumanFighter arrokoh = (HumanFighter)FighterFactory.GetFighter(FighterType.HumanControlledPlayer, 1, "Arrokoh");

            HumanFighter selectedFighter    = selectedFighterInput == 0 ? dante : arrokoh;
            HumanFighter notSelectedFighter = selectedFighterInput == 0 ? arrokoh : dante;

            int luckBefore = selectedFighter.Luck;

            MockChanceService chanceService = new MockChanceService();

            for (var i = 0; i < 8; ++i)
            {
                chanceService.PushWhichEventsOccur(selectedFighterInput);
            }

            _decisionManager.PersonalityQuiz(dante, arrokoh, true, chanceService);

            int luckAfter = selectedFighter.Luck;

            //who is more enigmatic?
            Assert.Contains(PersonalityFlag.Enigmatic, selectedFighter.PersonalityFlags, "first question should assign enigmatic flag");
            //who always wins at cards?
            Assert.AreEqual(10, luckAfter - luckBefore, "second question should raise luck");
            //who is more likely to seek treasure?
            Assert.Contains(PersonalityFlag.Adventurous, selectedFighter.PersonalityFlags, "third question should assign adventurous flag");
            //who sometimes watches the stars at night?
            Assert.Contains(PersonalityFlag.Dreamer, selectedFighter.PersonalityFlags, "fourth question should assign dreamer flag");
            //who is better at solving maze puzzles?
            Assert.AreEqual(1, _relationshipManager.GetFighterRelationshipValue(selectedFighter, GodEnum.IntellectGod), "fifth question should raise IntellectGod relationship");
            Assert.Contains(PersonalityFlag.MazeSolver, selectedFighter.PersonalityFlags, "fifth quesiton should assign mazeSolver flag");
            //who would succumb to an evil gem?
            Assert.AreEqual(1, _relationshipManager.GetFighterRelationshipValue(selectedFighter, GodEnum.MalevolentGod), "sixth question should raise malevolent god relationship for selected fighter");
            Assert.AreEqual(1, _relationshipManager.GetFighterRelationshipValue(notSelectedFighter, GodEnum.MercyGod), "sixth question should raise mercy god relationship for not selected fighter");
            //who believes in ghosts?
            Assert.AreEqual(1, _relationshipManager.GetFighterRelationshipValue(notSelectedFighter, GodEnum.MachineGod), "seventh question should raise Machine God relationship for selected fighter");
            //who eats the last donut without asking?
            Assert.Contains(PersonalityFlag.SelfishDonutEater, selectedFighter.PersonalityFlags, "eigth question should assign selfishDonutEater flag");
        }
Example #28
0
        public void AssignNameBonuses_IgnoresOrderOfFighters()
        {
            HumanFighter dante   = (HumanFighter)FighterFactory.GetFighter(FighterType.HumanControlledPlayer, 1, "Dante");
            HumanFighter arrokoh = (HumanFighter)FighterFactory.GetFighter(FighterType.HumanControlledPlayer, 1, "Arrokoh");

            HumanFighter dante2   = (HumanFighter)FighterFactory.GetFighter(FighterType.HumanControlledPlayer, 1, "Dante");
            HumanFighter arrokoh2 = (HumanFighter)FighterFactory.GetFighter(FighterType.HumanControlledPlayer, 1, "Arrokoh");

            int danteSpeedBefore      = dante.Speed;
            int arrokohStrengthBefore = arrokoh.Strength;

            Assert.AreEqual(dante.Speed, dante2.Speed);
            Assert.AreEqual(arrokoh.Strength, arrokoh2.Strength);

            _decisionManager.AssignNameBonuses(dante, arrokoh);
            _decisionManager.AssignNameBonuses(arrokoh2, dante2);

            Assert.AreEqual(dante.Speed, dante2.Speed);
            Assert.AreEqual(arrokoh.Strength, arrokoh2.Strength);

            Assert.Greater(dante.Speed - danteSpeedBefore, 0);
            Assert.Greater(arrokoh.Strength - arrokohStrengthBefore, 0);
        }
Example #29
0
        public override void Build(IFighter owner, Team ownTeam, Team enemyTeam, List <TerrainInteractable> terrainInteractables)
        {
            MenuActions = new List <MenuAction>();

            HumanFighter ownerAsHuman = owner as HumanFighter;

            IEnumerable <BattleMove> moves;

            if (ownerAsHuman != null)
            {
                moves = ownerAsHuman.AllSpecialMoves;
            }
            else
            {
                moves = owner.SpecialMoves;
            }

            foreach (var move in moves)
            {
                MenuActions.Add(new MenuAction(move.Description, subMenu: _menuFactory.GetMenu(MenuType.ChooseTargetMenu, _input, _output), move: move));
            }

            base.Build(owner, ownTeam, enemyTeam, terrainInteractables);
        }
Example #30
0
 public override void ApplyBonus(HumanFighter fighter, GodRelationshipManager relationshipManager, bool isSecretBonus = false)
 {
     relationshipManager.UpdateRelationship(fighter, _god, BonusAmount);
 }