public GameStateService(INotationService notationService, IPGNService pgnService, IMoveService moveService, IAttackService attackService) { _notationService = notationService; _pgnService = pgnService; _moveService = moveService; _attackService = attackService; }
public CoordinateTests() { _orthogonalService = ServiceProvider.GetService <IOrthogonalService>(); _attackService = ServiceProvider.GetService <IAttackService>(); _gameStateService = ServiceProvider.GetService <IGameStateService>(); _moveService = ServiceProvider.GetService <IMoveService>(); }
public Player(IAttackService attackService, IMoveService moveService, IDeathService deathService, UserData userData) { _attackService = attackService; _moveService = moveService; _deathService = deathService; UserData = userData; }
public PlayService(IUnitOfWork unitOfWork, IUserProvider userProvider, IVisibilityModifierFactory visibilityModifierFactory, IAttackService attackService, IMapTemplateProvider mapTemplateProvider, IRandomGen randomGen) : base(unitOfWork, userProvider, mapTemplateProvider, visibilityModifierFactory) { this.attackService = attackService; this.randomGen = randomGen; }
public void Register(IAttackService attackService) { LogCons.Inst.Write(LogLevel.Info, $"AttackServiceHandler.Register(): Service {attackService.ServiceName} registered"); // Register the service in the attack service handler this.AttackServices.Add(attackService.ServiceName, attackService); // Register the service in the GUI this.minaryInstance.RegisterAttackService(attackService.ServiceName); }
public Player(IAttackService attackService, IMoveService moveService, IDeathService deathService, string name, string passwordHash) { _attackService = attackService; _moveService = moveService; _deathService = deathService; Name = name; Password = passwordHash; Init(); }
public Bot( Game game, MapTemplate mapTemplate, IAttackService attackService, IRandomGen randomGen) { this.game = game; this.mapTemplate = mapTemplate; this.attackService = attackService; this.randomGen = randomGen; }
public Bot( ILogger log, Game game, MapTemplate mapTemplate, IAttackService attackService, IRandomGen randomGen) { this.log = log; this.game = game; this.mapTemplate = mapTemplate; this.attackService = attackService; this.randomGen = randomGen; }
public CSBot( IOptions <BotConfiguration> config, IOptions <CsConfiguration> csconfig, IExternalMessagingClient externalMessagingClient, IPathingService pathingService, ITownManagementService townManagementService, IAttackService attackService) { _config = config.Value; _externalMessagingClient = externalMessagingClient; _pathingService = pathingService; _csconfig = csconfig.Value; _townManagementService = townManagementService; _attackService = attackService; }
public void Attack( IAttackService attackService, IRandomGen randomGen, MapTemplate mapTemplate, string sourceCountryIdentifier, string destCountryIdentifier, int numberOfUnits) { this.RequireGameActive(); if (this.PlayState != PlayState.Attack) { throw new DomainException(ErrorCode.AttackingNotPossible, "Cannot attack, state incorrect"); } var sourceCountry = this.Map.GetCountry(sourceCountryIdentifier); var destCountry = this.Map.GetCountry(destCountryIdentifier); // Check connection if (!mapTemplate.AreConnected(sourceCountryIdentifier, destCountryIdentifier)) { throw new DomainException(ErrorCode.CountriesNotConnected, "There is no connection between those countries"); } // Check ownership if (sourceCountry.TeamId != this.CurrentPlayer.TeamId) { throw new DomainException(ErrorCode.OriginCountryNotOwnedByTeam, "Can only initiate actions from countries that belong to the same team"); } if (sourceCountry.PlayerId == destCountry.PlayerId) { throw new DomainException(ErrorCode.AttackOwnCountries, "Cannot attack own countries"); } if (numberOfUnits <= 0 || sourceCountry.Units - numberOfUnits < this.Options.MinUnitsPerCountry) { throw new DomainException(ErrorCode.NotEnoughUnits, "Cannot attack with that many units"); } var otherPlayer = this.GetPlayerById(destCountry.PlayerId); int attackerUnitsLost = 0; int defenderUnitsLost = 0; var result = attackService.Attack(numberOfUnits, destCountry.Units, out attackerUnitsLost, out defenderUnitsLost); if (result) { // Attack was successful destCountry.Units = numberOfUnits - attackerUnitsLost; this.Map.UpdateOwnership(otherPlayer, this.CurrentPlayer, destCountry); this.DistributeCard(randomGen); } else { // Attack failed destCountry.Units -= defenderUnitsLost; } // Reduce units in this country in any case sourceCountry.Units -= numberOfUnits; this.GameHistory.RecordAttack( this.CurrentPlayer, otherPlayer, sourceCountryIdentifier, destCountryIdentifier, numberOfUnits, attackerUnitsLost, defenderUnitsLost, result); // Reduce number of attacks left this.AttacksInCurrentTurn++; // Check for victory this.CheckForVictory(this.CurrentPlayer, otherPlayer); if (this.AttacksInCurrentTurn >= this.Options.AttacksPerTurn) { this.EndAttack(); } }
public Gun(IWriter outputWriter, IAttackService attackService) { _outputWriter = outputWriter; _attackService = attackService; }
public RookAttackTests() { _attackService = ServiceProvider.GetService <IAttackService>(); _gameStateService = ServiceProvider.GetService <IGameStateService>(); _moveService = ServiceProvider.GetService <IMoveService>(); }
public AttackController(IAttackService attackService) => _attackerService = attackService;
public PlayerController(IShipService shipService, IBoardService boardService, IAttackService attackService) { _shipService = shipService; _boardService = boardService; _attackService = attackService; }
public BoardController(IBoardService boardService, IShipService shipService, IAttackService attackService) { _boardService = boardService; _shipService = shipService; _attackService = attackService; }