コード例 #1
0
        public BattleManager(uint battleId,
                             BattleLocation location,
                             BattleOwner owner,
                             IRewardStrategy rewardStrategy,
                             IDbManager dbManager,
                             IBattleReport battleReport,
                             ICombatListFactory combatListFactory,
                             IBattleFormulas battleFormulas,
                             IBattleOrder battleOrder,
                             IBattleRandom battleRandom)
        {
            groupIdGen = new LargeIdGenerator(uint.MaxValue);
            idGen      = new LargeIdGenerator(uint.MaxValue);
            // Group id 1 is always reserved for local troop
            groupIdGen.Set(1);

            BattleId     = battleId;
            Location     = location;
            Owner        = owner;
            BattleReport = battleReport;
            Attackers    = combatListFactory.GetAttackerCombatList();
            Defenders    = combatListFactory.GetDefenderCombatList();

            this.rewardStrategy = rewardStrategy;
            this.dbManager      = dbManager;
            this.battleOrder    = battleOrder;
            this.battleFormulas = battleFormulas;
            this.battleRandom   = battleRandom;
        }
コード例 #2
0
        public IBattleManager CreateStrongholdMainBattleManager(uint battleId,
                                                                BattleLocation battleLocation,
                                                                BattleOwner battleOwner,
                                                                IStronghold stronghold)
        {
            var battleRandom = new BattleRandom(battleId);

            var bm = new StrongholdMainBattleManager(battleId,
                                                     battleLocation,
                                                     battleOwner,
                                                     kernel.Get <IRewardStrategyFactory>().CreateStrongholdRewardStrategy(stronghold),
                                                     kernel.Get <IDbManager>(),
                                                     kernel.Get <IBattleReport>(),
                                                     kernel.Get <ICombatListFactory>(),
                                                     kernel.Get <IGameObjectLocator>(),
                                                     new BattleOrder(battleRandom),
                                                     kernel.Get <IBattleFormulas>(),
                                                     battleRandom);

            // ReSharper disable once ObjectCreationAsStatement
            new BattleChannel(bm, kernel.Get <IChannel>());

            bm.BattleReport.Battle = bm;
            return(bm);
        }
コード例 #3
0
        public IBattleManager CreateStrongholdGateBattleManager(BattleLocation battleLocation,
                                                                BattleOwner battleOwner,
                                                                IStronghold stronghold)
        {
            var battleId = BattleReport.BattleIdGenerator.GetNext();

            return(CreateStrongholdGateBattleManager(battleId, battleLocation, battleOwner, stronghold));
        }
コード例 #4
0
 public PublicBattleManager(uint battleId,
                            BattleLocation location,
                            BattleOwner owner,
                            IRewardStrategy rewardStrategy,
                            IDbManager dbManager,
                            IBattleReport battleReport,
                            ICombatListFactory combatListFactory,
                            IBattleFormulas battleFormulas,
                            IBattleOrder battleOrder,
                            IBattleRandom battleRandom)
     : base(battleId, location, owner, rewardStrategy, dbManager, battleReport, combatListFactory, battleFormulas, battleOrder, battleRandom)
 {
 }
コード例 #5
0
 public StrongholdMainBattleManager(uint battleId,
                                    BattleLocation location,
                                    BattleOwner owner,
                                    IRewardStrategy rewardStrategy,
                                    IDbManager dbManager,
                                    IBattleReport battleReport,
                                    ICombatListFactory combatListFactory,
                                    IGameObjectLocator gameObjectLocator,
                                    IBattleOrder battleOrder,
                                    IBattleFormulas battleFormulas,
                                    IBattleRandom random) :
     base(battleId, location, owner, rewardStrategy, dbManager, battleReport, combatListFactory, battleFormulas, battleOrder, random)
 {
     this.gameObjectLocator = gameObjectLocator;
 }
コード例 #6
0
        public BattleManagerGate(uint battleId,
                                 IStronghold stronghold,
                                 BattleLocation location,
                                 BattleOwner owner,
                                 IRewardStrategy rewardStrategy,
                                 IDbManager dbManager,
                                 IBattleReport battleReport,
                                 ICombatListFactory combatListFactory,
                                 IBattleFormulas battleFormulas,
                                 IBattleOrder battleOrder,
                                 IBattleRandom battleRandom)
            : base(battleId, location, owner, rewardStrategy, dbManager, battleReport, combatListFactory, battleFormulas, battleOrder, battleRandom)
        {
            this.stronghold = stronghold;

            precision = 1m + (new Random((int)(owner.Id + battleId + location.Id)).Next(-20, 20) / 100m);
        }
コード例 #7
0
        public IBattleManager CreateBarbarianBattleManager(BattleLocation battleLocation, BattleOwner battleOwner, IBarbarianTribe barbarianTribe)
        {
            var battleId = BattleReport.BattleIdGenerator.GetNext();

            return(CreateBarbarianBattleManager(battleId, battleLocation, battleOwner, barbarianTribe));
        }
コード例 #8
0
        public IBattleManager CreateBattleManager(BattleLocation location, BattleOwner owner, ICity city)
        {
            var battleId = BattleReport.BattleIdGenerator.GetNext();

            return(CreateBattleManager(battleId, location, owner, city));
        }