Exemple #1
0
 private void SwitchPlayer()
 {
     _currentPlayer.ResetActions();
     _currentPlayer = GetOpponentOf(_currentPlayer);
     LogCurrentPlayer();
     _actionExecutor = null;
 }
        public ActionExecutor(AvailableOptions[] availableOptions, DragonX dragon, GameEngine game)
        {
            _availableOptions = availableOptions;
            _dragon           = dragon;
            _game             = game;

            _nextOptionToPick = 0;
        }
Exemple #3
0
        public bool HasAValidMove(DragonX player, GameEngine game)
        {
            var dropOffLocations = _elements.Select(DetermineActionFor).Distinct().ToList();

            // TODO more accurate calculation of can execute option
            // First calculate available moves?
            return(dropOffLocations
                   .Select(action => action.GetAvailableOptions(player, game).Any())
                   .Any(x => x));
        }
Exemple #4
0
        public void Reset()
        {
            _baGuaWheel = new BaGuaWheel();

            _whiteDragon = DragonX.CreateWhite(new Location.Location(0, 6), this);
            _blackDragon = DragonX.CreateBlack(new Location.Location(6, 0), this);

            _firePool  = FirePool.Instantiate();
            _waterPool = WaterPool.Instantiate();

            _actionExecutor = null;
            _currentPlayer  = _whiteDragon;
        }
 protected ExpelElementAction(DragonX dragon, GameEngine game) : base(dragon, game)
 {
     _fullDamageLocation     = Dragon.Location + Dragon.Direction;
     _partialDamageLocations = new[]
     {
         _fullDamageLocation + Dragon.Direction,
         _fullDamageLocation + Dragon.Direction.TurnLeft(),
         _fullDamageLocation + Dragon.Direction.TurnRight(),
     };
     _noDistanceDamageLocation = _fullDamageLocation
                                 + Dragon.Direction
                                 + Dragon.Direction;
 }
 private bool CanDealFullDamageTo(DragonX target)
 {
     return(target.Occupies(_fullDamageLocation));
 }
Exemple #7
0
 public DragonAction(DragonX dragon, GameEngine game)
 {
     Dragon     = dragon;
     GameEngine = game;
 }
Exemple #8
0
 public ConsumeWaterAction(DragonX dragon, GameEngine game) : base(dragon, game)
 {
 }
 public ExpelWaterAction(DragonX dragon, GameEngine game) : base(dragon, game)
 {
 }
Exemple #10
0
        public AvailableOptions[] GetAvailableOptions(DragonX dragon, GameEngine game)
        {
            var availableOptions = GetAvailableOptions(dragon.Direction);

            return(availableOptions);
        }
Exemple #11
0
 public DragonX GetOpponentOf(DragonX dragon)
 {
     return(dragon == _whiteDragon
         ? _blackDragon
         : _whiteDragon);
 }
Exemple #12
0
 public Move(DragonX dragon, Direction direction, GameEngine game) : base(dragon, game)
 {
     Direction = direction;
     _target   = Dragon.Location + direction;
 }
Exemple #13
0
 public BiteAction(DragonX dragon, GameEngine game) : base(dragon, game)
 {
 }
Exemple #14
0
        public bool CanExecuteAction(DragonX dragon, GameEngine board)
        {
            var firstMove = GetAvailableOptions(dragon, board)[0];

            return(firstMove.For(dragon).Any());
        }
Exemple #15
0
 public void Execute(DragonX dragon)
 {
     _actionFinder(dragon).Execute();
 }
Exemple #16
0
 public bool CanExecute(DragonX dragon)
 {
     return(_actionFinder(dragon).CanExecute());
 }
Exemple #17
0
 public DoNothing(DragonX dragon, GameEngine game) : base(dragon, game)
 {
 }
 private bool CanDealPartialDamageTo(DragonX target)
 {
     return(GameEngine.IsFreeSpace(_fullDamageLocation) &&
            _partialDamageLocations.Any(location => target.Occupies(location)) ||
            target.Occupies(_noDistanceDamageLocation) && GameEngine.IsFreeSpace(_partialDamageLocations[0]));
 }
Exemple #19
0
        public void DeliverDamage(Damage damage, DragonX dragon)
        {
            var waterChange = dragon.TakeDamage(damage);

            _waterPool.Add(waterChange);
        }
 public Option[] For(DragonX dragon)
 {
     return(_options.Where(o => o.CanExecute(dragon)).ToArray());
 }
 public ExpelFireAction(DragonX dragon, GameEngine game) : base(dragon, game)
 {
 }