Esempio n. 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;
        }
Esempio n. 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);
        }
Esempio n. 3
0
        public IBattleManager CreateStrongholdGateBattleManager(BattleLocation battleLocation,
                                                                BattleOwner battleOwner,
                                                                IStronghold stronghold)
        {
            var battleId = BattleReport.BattleIdGenerator.GetNext();

            return(CreateStrongholdGateBattleManager(battleId, battleLocation, battleOwner, stronghold));
        }
Esempio n. 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)
 {
 }
Esempio n. 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;
 }
Esempio n. 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);
        }
Esempio n. 7
0
        public IBattleManager CreateBarbarianBattleManager(BattleLocation battleLocation, BattleOwner battleOwner, IBarbarianTribe barbarianTribe)
        {
            var battleId = BattleReport.BattleIdGenerator.GetNext();

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

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