Exemplo n.º 1
0
        public void CastSpell_CorrectlyDoesNotReflectsSpells_ReflectStatus_DoesNotMatchAttackingType(
            [Values(MagicType.Fire, MagicType.Ice, MagicType.Lightning)] MagicType spellType,
            [Values(MagicType.Wind, MagicType.Earth, MagicType.Water)] MagicType reflectType)
        {
            const int spellCost  = 5;
            const int spellPower = 5;
            const int expectedRemainingHealth = 100 - spellPower;

            Spell         spell       = new Spell("foo", spellType, SpellType.Attack, TargetType.SingleEnemy, spellCost, spellPower);
            BattleMove    runawayMove = MoveFactory.Get(BattleMoveType.Runaway);
            ReflectStatus status      = new ReflectStatus(1, reflectType);

            _human.SetHealth(100);
            _human.SetMana(spellCost);
            _human.SetMagicStrength(0);
            _human.SetMagicBonus(spellType, 0);
            _human.SetMagicResistance(0);
            _human.SetResistanceBonus(spellType, 0);
            _human.AddSpell(spell);
            _human.SetMove(spell, 1);
            _human.SetMove(runawayMove);
            _human.SetMoveTarget(_enemy);

            _enemy.AddStatus(status);
            _enemy.SetHealth(100);

            _battleManager.Battle(_humanTeam, _enemyTeam);

            Assert.AreEqual(_human.MaxHealth, _human.CurrentHealth, "human should still have full health, the spell should not have been reflected!");
            Assert.AreEqual(expectedRemainingHealth, _enemy.CurrentHealth, "the enemy should have lost 5 health from being hit by the spell!");
        }
Exemplo n.º 2
0
        public void CastSpell_CorrectlyReflectsSpells_WithCorrectMultiplier([Values(MagicType.Water, MagicType.Earth, MagicType.Wind)] MagicType spellType,
                                                                            [Values(true, false)] bool reflectAll)
        {
            const int spellCost  = 5;
            const int spellPower = 5;
            const int expectedRemainingHealth = 100 - (spellPower * 2);

            Spell      spell       = new Spell("foo", spellType, SpellType.Attack, TargetType.SingleEnemy, spellCost, spellPower);
            BattleMove runawayMove = MoveFactory.Get(BattleMoveType.Runaway);

            MagicType     reflectType = reflectAll ? MagicType.All : spellType;
            ReflectStatus status      = new ReflectStatus(1, reflectType, 2);

            _human.SetHealth(100);
            _human.SetMana(spellCost);
            _human.AddSpell(spell);
            _human.SetMove(spell, 1);
            _human.SetMove(runawayMove);
            _human.SetMoveTarget(_enemy);

            _enemy.AddStatus(status);
            _enemy.SetHealth(100);

            _battleManager.Battle(_humanTeam, _enemyTeam);

            Assert.AreEqual(_enemy.MaxHealth, _enemy.CurrentHealth, "enemy should still have full health, the spell should have been reflected!");
            Assert.AreEqual(expectedRemainingHealth, _human.CurrentHealth, $"the human should have lost {spellPower * 2} health from being hit by their own spell reflected at double the power!");
        }
Exemplo n.º 3
0
        static void processor()
        {
            Console.Write(Directory.GetCurrentDirectory()+">");
            string input = Console.ReadLine();
            Factory factory;
            CommandExcute ce;
            if(input.ToLower().StartsWith("cd"))
            {
                factory = new CDFactory();
                ce = factory.CreateFactory();
                ce.Excute(input);
            }
            else
            {
                string command = input.ToLower().Split(' ')[0];
                switch (command)
                {
                    case "copy":
                        factory = new CopyFactory();
                        ce = factory.CreateFactory();
                        ce.Excute(input);
                        break;
                    case "dir":
                        factory = new DirFactory();
                        ce = factory.CreateFactory();
                        ce.Excute(input);
                        break;
                    case "md":
                        factory = new MakeDirectoryFactory();
                        ce = factory.CreateFactory();
                        ce.Excute(input);
                        break;
                    case "rd":
                        factory = new RemoveDirectoryFactory();
                        ce = factory.CreateFactory();
                        ce.Excute(input);
                        break;
                    case "move":
                        factory = new MoveFactory();
                        ce = factory.CreateFactory();
                        ce.Excute(input);
                        break;
                    case "del":
                        factory = new DeletesFileFactory();
                        ce = factory.CreateFactory();
                        ce.Excute(input);
                        break;
                    case "rename":
                        factory = new RenameFileFactory();
                        ce = factory.CreateFactory();
                        ce.Excute(input);
                        break;
                    default:

                        break;
                }
            }

            processor();
        }
Exemplo n.º 4
0
        public override List <MenuAction> GetInteractableMenuActions(IInput input = null, IOutput output = null)
        {
            IMenu offerBloodTargetMenu = MenuFactory.GetMenu(MenuType.ChooseTargetMenu, input, output);
            IMenu offerBloodSubMenu    = MenuFactory.GetMenu(MenuType.KeysOffOwnerNumberInputMenu, input, output, prompt: "how much HP shall you offer?", subMenu: offerBloodTargetMenu);

            IMenu  praySubMenu   = MenuFactory.GetMenu(MenuType.ChooseTargetMenu, input, output);
            string bellType      = BellType.ToString().ToLower();
            string bloodShortcut = $"blood {bellType}";
            string prayShortcut  = $"pray {bellType}";

            return(new List <MenuAction>
            {
                new MenuAction($"offer blood to {DisplayName} ('{bloodShortcut}')",
                               altText: bloodShortcut,
                               move: MoveFactory.Get(BellMoveType.ControlMove),
                               moveExecutor: this,
                               subMenu: offerBloodSubMenu),

                new MenuAction($"pray to {DisplayName} ('{prayShortcut}')",
                               altText: prayShortcut,
                               move: MoveFactory.Get(BellMoveType.SealMove),
                               moveExecutor: this,
                               subMenu: praySubMenu)
            });
        }
Exemplo n.º 5
0
        public void CastSpell_SpellsVanishIfReflectedTwice([Values(MagicType.Fire, MagicType.Ice, MagicType.Lightning)] MagicType spellType,
                                                           [Values(true, false)] bool reflectAll)
        {
            const int spellCost  = 5;
            const int spellPower = 5;

            Spell      spell       = new Spell("foo", spellType, SpellType.Attack, TargetType.SingleEnemy, spellCost, spellPower);
            BattleMove runawayMove = MoveFactory.Get(BattleMoveType.Runaway);

            MagicType     reflectType = reflectAll ? MagicType.All : spellType;
            ReflectStatus status      = new ReflectStatus(1, reflectType);

            _human.SetHealth(100);
            _human.SetMana(spellCost);
            _human.AddStatus(status);
            _human.AddSpell(spell);
            _human.SetMove(spell, 1);
            _human.SetMove(runawayMove);
            _human.SetMoveTarget(_enemy);

            _enemy.AddStatus(status);
            _enemy.SetHealth(100);

            _battleManager.Battle(_humanTeam, _enemyTeam);

            Assert.AreEqual(_enemy.MaxHealth, _enemy.CurrentHealth, "enemy should still have full health, the spell should have disappeared without hurting anyone!");
            Assert.AreEqual(_human.MaxHealth, _human.CurrentHealth, "the human should still have full health, the spell should have disappeared without hurting anyone");
        }
Exemplo n.º 6
0
        /// <summary>
        ///     Conducts the OpenSauce & HAC2 data backup routines.
        /// </summary>
        /// <param name="backupDir">
        ///     Backup directory to use for backing up OpenSauce & HAC2 data.
        /// </param>
        private void CommitBackups(string backupDir)
        {
            Directory.CreateDirectory(backupDir);
            var OSIDEbackupDir = Path.Combine(backupDir, OpenSauceDeveloper);

            new List <Move>
            {
                MoveFactory.Get(MoveFactory.Type.BackupOsFiles, _path, backupDir),
                MoveFactory.Get(MoveFactory.Type.BackupOsDirectories, _path, backupDir),
                MoveFactory.Get(MoveFactory.Type.BackupHac2Files, _path, backupDir)
            }.ForEach(move => move.Commit());

            if (Directory.Exists(Paths.KStudios))
            {
                Copy.All(Paths.KStudios, OSIDEbackupDir);
                try
                {
                    Directory.Delete(Paths.KStudios, true);
                }
                catch (UnauthorizedAccessException)
                {
                    /// <see cref="https://stackoverflow.com/a/31363010/14894786"/>
                    /// <seealso cref="https://stackoverflow.com/a/8055390/14894786"/>
                    var batPath = Path.Combine(Paths.Temp, "AdminDelKorn.bat");
                    var batText = "del /s /q \"Kornner Studios\" && rmdir /s /q \"Kornner Studios\"";
                    File.WriteAllText(batPath, batText);
                    new System.Diagnostics.ProcessStartInfo
                    {
                        FileName         = batPath,
                        Verb             = "RunAs",
                        WorkingDirectory = Paths.ProgData
                    };
                }
            }
        }
Exemplo n.º 7
0
        public void MimicMove(Move mimicItself, BattlePokemon opponent)
        {
            Move moveToCopy = opponent.LastMoveUsed;

            if (moveToCopy == null) //failsafe for using mimic on first turn before a last move used is even initialized
            {
                moveToCopy = opponent.Move1;
            }

            OnMimic(moveToCopy, opponent);
            Move mimicedMove = MoveFactory.Create(moveToCopy.Index);

            int moveIndex = 0;

            if (Move1 == mimicItself)
            {
                moveIndex = 1;
            }
            else if (Move2 == mimicItself)
            {
                moveIndex = 2;
            }
            else if (Move3 == mimicItself)
            {
                moveIndex = 3;
            }
            else if (Move4 == mimicItself)
            {
                moveIndex = 4;
            }

            mimic.Activate(mimicedMove, moveIndex);
        }
Exemplo n.º 8
0
        public void FactoryReturnsPaper()
        {
            var move         = "P";
            var moveReturned = MoveFactory.GetMoveFor(move);

            Assert.IsType(typeof(Paper), moveReturned);
        }
Exemplo n.º 9
0
        public void Factory_Returns_Scissors()
        {
            var move         = "S";
            var moveReturned = MoveFactory.GetMoveFor(move);

            Assert.IsType(typeof(Scissors), moveReturned);
        }
Exemplo n.º 10
0
        public void Factory_Returns_Rock()
        {
            var move         = "R";
            var moveReturned = MoveFactory.GetMoveFor(move);

            Assert.IsType(typeof(Rock), moveReturned);
        }
Exemplo n.º 11
0
        private Move TranslateCommand(String command)
        {
            Move result = null;

            switch (command.Trim())
            {
            case Moves.C_MP:
                result = MoveFactory.C_MP();
                // this.log.Write(LogLevel.TRACE, LogType.CONSOLE, "Crouching MP");
                //   this.marshaller.executeMove(MoveFactory.C_MP());
                break;

            case Moves.C_HP:
                result = MoveFactory.C_HP();
                // this.log.Write(LogLevel.TRACE, LogType.CONSOLE, "Crouching HP");
                // this.marshaller.executeMove(MoveFactory.C_HP());
                break;

            case Moves.C_MK:
                result = MoveFactory.C_MK();
                break;

            case Moves.S_MP:
                result = MoveFactory.S_MP();
                break;
            }

            return(result);
        }
Exemplo n.º 12
0
        public void MoveFactory_SmokeTest()
        {
            BattleMove ret = null;

            Assert.DoesNotThrow(() => ret = MoveFactory.Get(BattleMoveType.ShieldBuster));
            Assert.NotNull(ret);
        }
Exemplo n.º 13
0
    List <Move> _GetMoves(Piece.pieceWork color)
    {
        List <Move> turnMove = new List <Move>();
        List <Tile> pieces   = new List <Tile>();

        if (color == Piece.pieceWork.BWORK)
        {
            pieces = _blackPieces;
        }
        else if (color == Piece.pieceWork.WWORK)
        {
            pieces = _whitePieces;
        }

        foreach (Tile tile in pieces)
        {
            MoveFactory factory    = new MoveFactory(_board);
            List <Move> pieceMoves = factory.GetMoves(tile.CurrentPiece, tile.Position);

            foreach (Move move in pieceMoves)
            {
                Move newMove = _CreateMove(move.firstPosition, move.secondPosition);
                turnMove.Add(newMove);
            }
        }
        return(turnMove);
    }
Exemplo n.º 14
0
 public DancerBoss(FighterClass fighterClass, int level, IChanceService chanceService)
     : base("",
            level,
            LevelUpManager.GetHealthByLevel <DancerBoss>(level, fighterClass),
            LevelUpManager.GetManaByLevel <DancerBoss>(level, fighterClass),
            LevelUpManager.GetStrengthByLevel <DancerBoss>(level, fighterClass),
            LevelUpManager.GetDefenseByLevel <DancerBoss>(level, fighterClass),
            LevelUpManager.GetSpeedByLevel <DancerBoss>(level, fighterClass),
            LevelUpManager.GetEvadeByLevel <DancerBoss>(level, fighterClass),
            LevelUpManager.GetLuckByLevel <DancerBoss>(level, fighterClass),
            chanceService,
            SpellFactory.GetSpellsByLevel <DancerBoss>(level, fighterClass: fighterClass)
            , MoveFactory.GetMovesByLevel <DancerBoss>(level, fighterClass: fighterClass))
 {
     if (fighterClass == FighterClass.BossDancerKiki)
     {
         BaseName = "Kiki";
     }
     else if (fighterClass == FighterClass.BossDancerRiki)
     {
         BaseName = "Riki";
     }
     else
     {
         throw new ArgumentOutOfRangeException(nameof(fighterClass), "DancerBoss class can only be initialized with Kiki or Riki fighter class!");
     }
 }
Exemplo n.º 15
0
        public HumanFighter(string name, int level, List <Spell> spells = null, List <SpecialMove> specialMoves = null)
            : base(name
                   , level
                   , LevelUpManager.GetHealthByLevel(level)
                   , LevelUpManager.GetManaByLevel(level)
                   , LevelUpManager.GetStrengthByLevel(level)
                   , LevelUpManager.GetDefenseByLevel(level)
                   , LevelUpManager.GetSpeedByLevel(level)
                   , LevelUpManager.GetEvadeByLevel(level)
                   , LevelUpManager.GetLuckByLevel(level)
                   , SpellFactory.GetSpellsByLevel <HumanFighter>(level)
                   , MoveFactory.GetMovesByLevel <HumanFighter>(level)
                   )
        {
            if (spells != null)
            {
                Spells.AddRange(spells);
            }

            if (specialMoves != null)
            {
                SpecialMoves.AddRange(specialMoves);
            }

            _extraSpecialMoves = new List <BattleMove>();
            CurrentExp         = LevelUpManager.GetExpForLevel(level);
            _expToNextLevel    = LevelUpManager.GetExpForLevel(level + 1);
        }
Exemplo n.º 16
0
        protected EnemyFighter(string name
                               , int level
                               , int health
                               , int mana
                               , int strength
                               , int defense
                               , int speed
                               , int evade
                               , int luck
                               , IChanceService chanceService
                               , List <Spell> spells            = null
                               , List <BattleMove> specialMoves = null)
            : base(name, level, health, mana, strength, defense, speed, evade, luck, spells, specialMoves)
        {
            ChanceService    = chanceService;
            ExpGivenOnDefeat = 5 * level;

            _availableMoves = new List <BattleMove>
            {
                MoveFactory.Get(BattleMoveType.Attack)
            };

            if (spells != null)
            {
                _availableMoves.AddRange(spells);
            }

            if (specialMoves != null)
            {
                _availableMoves.AddRange(specialMoves);
            }
        }
Exemplo n.º 17
0
    List <Move_new> _GetMoves(Piece_new.playerColor color)
    {
        List <Move_new> turnMove = new List <Move_new>();
        List <Tile_new> pieces   = new List <Tile_new>();

        if (color == Piece_new.playerColor.BLACK)
        {
            pieces = _blackPieces;
        }
        else
        {
            pieces = _whitePieces;
        }

        foreach (Tile_new tile in pieces)
        {
            MoveFactory     factory    = new MoveFactory(_board);
            List <Move_new> pieceMoves = factory.GetMoves(tile.CurrentPiece, tile.Position);

            foreach (Move_new move in pieceMoves)
            {
                Move_new newMove = _CreateMove(move.firstPosition, move.secondPosition);
                turnMove.Add(newMove);
            }
        }
        return(turnMove);
    }
Exemplo n.º 18
0
        public void CorrectlyRenamesEnemiesIfMultipleEnemiesOfSameType()
        {
            _menuInput.Push("Goblin A");

            var ret = _menu.GetInput(MoveFactory.Get(BattleMoveType.Attack), null);

            Assert.AreEqual(_enemyTeam.Fighters[0], ret.Target);
        }
Exemplo n.º 19
0
    public void UseMove(int i)
    {
        string      _moveName = moves[i];
        MoveFactory _factory  = new MoveFactory();

        this.selectedMove = _factory.GetMove(this, enemy, _moveName);
        this.state        = CharacterState.Attacking;
    }
Exemplo n.º 20
0
        public void TargetMenu_CorrectlyHandlesBackOption()
        {
            //should result in an error
            _menuInput.Push("back");

            var ret = _menu.GetInput(MoveFactory.Get(BattleMoveType.Attack), null);

            Assert.AreEqual("back", ret.Description);
        }
Exemplo n.º 21
0
        /// <summary>
        ///     Conducts the OpenSauce & HAC2 data backup routines.
        /// </summary>
        /// <param name="backupDir">
        ///     Backup directory to use for backing up OpenSauce & HAC2 data.
        /// </param>
        private void CommitBackups(string backupDir)
        {
            Directory.CreateDirectory(backupDir);

            new List <Move>
            {
                MoveFactory.Get(MoveFactory.Type.BackupOsFiles, _path, backupDir),
                MoveFactory.Get(MoveFactory.Type.BackupOsDirectories, _path, backupDir),
                MoveFactory.Get(MoveFactory.Type.BackupHac2Files, _path, backupDir)
            }.ForEach(move => move.Commit());
        }
Exemplo n.º 22
0
        private static List <Operation> GenerateFor(List <Machine> allMachines, List <Material> allMaterials, Batch currentBatch, Job currentJob, int quantity, bool isComplexProduction)
        {
            List <Operation> AllOperations          = new List <Operation>();
            List <Machine>   CurrentCapableMachines = new List <Machine>();

            for (int OperationIndex = 0; OperationIndex < quantity; OperationIndex++)
            {
                int numberOfMaterials = RandomGenerator.MaterialsInOperation();
                Dictionary <Material, int> CurrentMaterialsDemand = new Dictionary <Material, int>();
                for (int MaterialIndex = 0; MaterialIndex < numberOfMaterials && MaterialIndex < allMaterials.Count; MaterialIndex++)
                {
                    CollectionUtils.AddUniqeElementToDictionary(CurrentMaterialsDemand, allMaterials, RandomGenerator.MaterialsDemandInOperation());
                }

                int numberOfMachines = RandomGenerator.MachinesInOperation();
                Dictionary <Machine, int> CurrentCapableMachinesWithProductionTime = new Dictionary <Machine, int>();
                for (int MachineIndex = 0; MachineIndex < numberOfMachines && MachineIndex < allMachines.Count; MachineIndex++)
                {
                    CollectionUtils.AddUniqeElementToDictionary(CurrentCapableMachinesWithProductionTime, allMachines, RandomGenerator.ProductionTimeForMachinesInOperation());
                }

                CurrentCapableMachines = new List <Machine>(CurrentCapableMachinesWithProductionTime.Keys);

                AllOperations.Add(new Operation(OperationIndex, "Operation" + OperationIndex, DateTime.MaxValue, CurrentMaterialsDemand, CurrentCapableMachinesWithProductionTime, null,
                                                MoveFactory.GenerateFor(CurrentCapableMachines), currentBatch, currentJob, RandomGenerator.ColorForChart())); // no setup times yet
            }

            foreach (Operation CurrentOperation in AllOperations)
            {
                List <SetupForBatch> CurrentSetupTimes = new List <SetupForBatch>();
                foreach (Operation PreviousOperation in AllOperations)
                {
                    foreach (Machine CurrentMachine in CurrentOperation.CapableMachinesWithProcessingTime.Keys.ToList())
                    {
                        if (CurrentOperation.Equals(PreviousOperation))
                        {
                            CurrentSetupTimes.Add(new SetupForBatch(CurrentMachine, PreviousOperation, 0));
                        }
                        else if (isComplexProduction)
                        {
                            CurrentSetupTimes.Add(SetupFactory.GenerateComplexProductionFor(CurrentMachine, PreviousOperation));
                        }
                        else
                        {
                            CurrentSetupTimes.Add(SetupFactory.GenerateSmallScaleProductionFor(CurrentMachine, PreviousOperation));
                        }
                    }
                }
                CurrentOperation.SetupTimes = CurrentSetupTimes;
            }

            return(AllOperations);
        }
Exemplo n.º 23
0
 private void Awake()
 {
     if (MoveFactory.instance == null)
     {
         MoveFactory.instance = this;
         DontDestroyOnLoad(this.gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }
Exemplo n.º 24
0
        public static List <Move> lastNMoves(Board board, int N)
        {
            List <Move> moveHistory = new List <Move>();
            Move        currentMove = board.getTransitionMove();
            int         i           = 0;

            while (currentMove != MoveFactory.getNullMove() && i < N)
            {
                moveHistory.Add(currentMove);
                currentMove = currentMove.getBoard().getTransitionMove();
                i++;
            }
            return(moveHistory);
        }
Exemplo n.º 25
0
        public void TestUndoDebuffsEffect_IndividualEffect()
        {
            StatMultiplierStatus lowerAttackStatus    = new StatMultiplierStatus(3, StatType.Strength, 1.0 / 3);
            StatusMove           lowerEnemyAttackMove = new StatusMove("raise attack", TargetType.SingleEnemy, lowerAttackStatus);

            UndoDebuffsStatus undoDebuffStatus = new UndoDebuffsStatus(1);
            StatusMove        undoDebuffMove   = new StatusMove("reset stats", TargetType.SingleAlly, undoDebuffStatus);

            TestHumanFighter fighter2 = new TestHumanFighter("foo 2", 1);

            _humanTeam = new TestTeam(_humanFighter, fighter2);

            //enemy won't be killed if the status isn't assigned to _fighter2
            _enemy.SetHealth(3);
            _enemy.SetSpeed(2);
            _enemy.SetMove(lowerEnemyAttackMove);
            _chanceService.PushEventOccurs(true); //status hits
            _enemy.SetMoveTarget(fighter2);

            _humanFighter.SetSpeed(1);
            _humanFighter.SetMove(undoDebuffMove);
            _chanceService.PushEventOccurs(true); //status hits
            _humanFighter.SetMoveTarget(fighter2);
            _logger.Subscribe(EventType.StatusAdded, fighter2);
            _logger.Subscribe(EventType.StatusRemoved, fighter2);

            BattleMove attack = MoveFactory.Get(BattleMoveType.Attack);

            fighter2.SetStrength(3);
            fighter2.SetMove(attack);
            fighter2.SetMoveTarget(_enemy);
            _chanceService.PushEventOccurs(true);  //attack hits
            _chanceService.PushEventOccurs(false); //attack is not a crit

            //once Statuses are removed after battle, won't be able to
            _battleManager.Battle(_humanTeam, _enemyTeam);

            List <EventLog> logs = _logger.Logs;

            Assert.AreEqual(2, logs.Count);

            EventLog log = logs[1];

            Assert.AreEqual(EventType.StatusRemoved, log.Type);
            StatusRemovedEventArgs e = log.E as StatusRemovedEventArgs;

            Assert.NotNull(e);
            Assert.IsTrue(lowerAttackStatus.AreEqual(e.Status));
        }
Exemplo n.º 26
0
 public Ogre(int level, IChanceService chanceService)
     : base("Ogre",
            level,
            LevelUpManager.GetHealthByLevel <Ogre>(level),
            LevelUpManager.GetManaByLevel <Ogre>(level),
            LevelUpManager.GetStrengthByLevel <Ogre>(level),
            LevelUpManager.GetDefenseByLevel <Ogre>(level),
            LevelUpManager.GetSpeedByLevel <Ogre>(level),
            LevelUpManager.GetEvadeByLevel <Ogre>(level),
            LevelUpManager.GetLuckByLevel <Ogre>(level),
            chanceService,
            SpellFactory.GetSpellsByLevel <Ogre>(level)
            , MoveFactory.GetMovesByLevel <Ogre>(level))
 {
 }
Exemplo n.º 27
0
        public void SetUp()
        {
            _input         = new MockInput();
            _output        = new MockOutput();
            _menuManager   = new TestMenuManager(_input, _output);
            _chanceService = new MockChanceService();
            _battleManager = new BattleManager(_chanceService, _input, _output);

            _human     = (TestHumanFighter)TestFighterFactory.GetFighter(TestFighterType.TestHuman, 1);
            _humanTeam = new TestTeam(_menuManager, _human);

            _enemy     = (TestEnemyFighter)TestFighterFactory.GetFighter(TestFighterType.TestEnemy, 1);
            _enemyTeam = new Team(_menuManager, _enemy);

            _doNothingMove = (DoNothingMove)MoveFactory.Get(BattleMoveType.DoNothing);
        }
Exemplo n.º 28
0
 public Barbarian(int level, IChanceService chanceService, string name = null) :
     base(name ?? "Barbarian"
          , level
          , LevelUpManager.GetHealthByLevel <Barbarian>(level)
          , LevelUpManager.GetManaByLevel <Barbarian>(level)
          , LevelUpManager.GetStrengthByLevel <Barbarian>(level)
          , LevelUpManager.GetDefenseByLevel <Barbarian>(level)
          , LevelUpManager.GetSpeedByLevel <Barbarian>(level)
          , LevelUpManager.GetEvadeByLevel <Barbarian>(level)
          , LevelUpManager.GetLuckByLevel <Barbarian>(level)
          , chanceService
          , SpellFactory.GetSpellsByLevel <Barbarian>(level)
          , MoveFactory.GetMovesByLevel <Barbarian>(level))
 {
     _shieldBusterFails = 0;
 }
Exemplo n.º 29
0
        public GameResult Run()
        {
            GameResult  gameResult = new GameResult(Moves.Count);
            MoveFactory factory    = new MoveFactory();

            int counter = 0;

            foreach (var moveRow in Moves)
            {
                gameResult.ResultList.Add(Status.StillInDanger);

                foreach (MoveType moveType in moveRow)
                {
                    IMove     move         = factory.GetMove(moveType);
                    IPosition tempPosition = move.Move(Turtle.CurrentPosition);
                    gameResult.VisitedPositions.Add(new List <IPosition>(moveRow.Count));

                    if (Board.IsInBoard(tempPosition.Coordinate)) // target position must be in board
                    {
                        gameResult.VisitedPositions[counter].Add(tempPosition);
                        Turtle.CurrentPosition = tempPosition;

                        if (CheckMine(Turtle.CurrentPosition.Coordinate))
                        {
                            gameResult.ResultList[counter] = Status.MineHit;
                            break;
                        }

                        if (CheckExit(Turtle.CurrentPosition.Coordinate))
                        {
                            gameResult.ResultList[counter] = Status.Success;
                            break;
                        }
                    }
                    else
                    {
                        gameResult.ResultList[counter] = Status.OutOfBoard;
                        gameResult.VisitedPositions[counter].Add(tempPosition);
                        break;
                    }
                }
                counter++;
                Turtle.CurrentPosition = StartPosition;
            }

            return(gameResult);
        }
Exemplo n.º 30
0
        private static IEnumerable <BattleMove> GetRegionMovesForRegion(WorldRegion region)
        {
            BattleMove[] ret;

            switch (region)
            {
            case WorldRegion.Desert:
                ret = new[] { MoveFactory.Get(BattleMoveType.ShieldBuster), MoveFactory.Get(BattleMoveType.Attack, "feint") };
                break;

            default:
                ret = new BattleMove[0];
                break;
            }

            return(ret);
        }
        public void CorrectlySetsUpMenuForHumanPlayer()
        {
            BattleMove doNothing  = MoveFactory.Get(BattleMoveType.DoNothing);
            BattleMove shieldMove = MoveFactory.Get(BattleMoveType.Shield, "iron shield");

            _player.AddMove(doNothing);
            _player.AddMove(shieldMove);

            _menu.Build(_player, _playerTeam, _enemyTeam, null);

            List <MenuAction> menuActions = _menu.MenuActions;

            Assert.AreEqual(2, menuActions.Count);

            Assert.True(menuActions.Exists(ma => ma.BattleMove == doNothing));
            Assert.True(menuActions.Exists(ma => ma.BattleMove == shieldMove));
        }