Esempio n. 1
0
 public GamePhaseEvent(int volley, int exchange, FormationDistanceGraph distanceGraph)
     : base("Abstract Game Phase Start Event")
 {
     this.Volley        = volley;
     this.Exchange      = exchange;
     this.DistanceGraph = distanceGraph;
 }
Esempio n. 2
0
        public AttackEvent(FireOrder fo, GameFormationActor source, FormationDistanceGraph distanceGraph, int percentileRoll = PercentileNotRolled, int exchange = 0, int volley = 0)
            : base("Attack Event", exchange, volley)
        {
            var distance = distanceGraph.GetOrEstablishDistance(source.GetFormationId(), fo.TargetID);

            this.Description              = "Attack Event";
            this.TargetingData            = new TargetingData(source, distance, fo.Priority, fo.DiceAssigned, fo.FireType);
            this.UnitAssignmentPercentile = percentileRoll;

            // Just to avoid any confusion
            this.TargetingData.TargetUnitPercentileRoll = percentileRoll;
        }
Esempio n. 3
0
        public void InitServices()
        {
            this.services = new ServiceCollection()
                            .AddLogging()
                            .AddSingleton <IDiceUtility, MockDice>() // Always rolls sixes on d6; always rolls 99 on d100
                            .BuildServiceProvider();

            this.weapon           = new BeamBatterySystem(3, "(All arcs)");
            this.weaponAllocation = new GameUnitFireAllocation();

            this.distanceGraph = new FormationDistanceGraph();

            this.totalDummy = new TestDummyActor(this.services);
            this.phaseDummy = new TestDummyPhaseActor(this.services);

            this.engine = new EventHandlingEngine();

            this.phaseEvent  = new FiringPhaseEvent(1, 1, this.distanceGraph) as GamePhaseEvent;
            this.attackEvent = new WeaponAttackEvent(new TargetingData(), new AttackData(this.weapon, this.weaponAllocation));
        }
 public FiringPhaseEvent(int volley, int exchange, FormationDistanceGraph distanceGraph)
     : base(volley, exchange, distanceGraph)
 {
     this.GamePhase   = Constants.GamePhase.FiringPhase;
     this.Description = $"Firing Phase Begun for E{exchange} V{volley}";
 }
Esempio n. 5
0
        public AttackEvent(FireOrder fo, GameFormationActor source, GameFormationActor target, FormationDistanceGraph distanceGraph, int exchange = 0, int volley = 0, int percentileRoll = PercentileNotRolled)
            : base("Attack Event", exchange, volley)
        {
            var distance = distanceGraph.GetOrEstablishDistance(source.GetFormationId(), target.GetFormationId());

            if (target.GetFormationId() != fo.TargetID)
            {
                throw new InvalidOperationException(
                          $"FireOrder specified target formation [{fo.TargetID}]{fo.TargetFormationName} " +
                          $"but target Formation argument in AttackEvent is [{target.GetFormationId()}]{target.GetFormationName()}");
            }

            this.TargetingData            = new TargetingData(source, target, distance, fo.Priority, fo.DiceAssigned, fo.FireType);
            this.UnitAssignmentPercentile = percentileRoll;
        }