Exemplo n.º 1
0
        public override Error Execute()
        {
            IBarbarianTribe barbarianTribe;

            if (!gameObjectLocator.TryGetObjects(barbarianTribeId, out barbarianTribe))
            {
                return(Error.ObjectNotFound);
            }

            world.Add(barbarianTribe.Battle);
            dbManager.Save(barbarianTribe.Battle);

            //Add local troop
            ISimpleStub simpleStub;
            int         upkeep;
            byte        unitLevel;

            formula.BarbarianTribeUpkeep(barbarianTribe.Lvl, out upkeep, out unitLevel);
            simpleStubGenerator.Generate(barbarianTribe.Lvl, upkeep, unitLevel, Config.barbarian_tribes_npc_randomness, (int)barbarianTribe.ObjectId + barbarianTribe.CampRemains, out simpleStub);

            var combatGroup = barbarianTribeBattleProcedure.AddBarbarianTribeUnitsToBattle(barbarianTribe.Battle,
                                                                                           barbarianTribe,
                                                                                           simpleStub.ToUnitList(FormationType.Normal));

            localGroupId = combatGroup.Id;

            beginTime = SystemClock.Now;
            endTime   = SystemClock.Now.Add(formula.GetBattleDelayStartInterval());

            return(Error.Ok);
        }
Exemplo n.º 2
0
        public IEnumerable <Unit> GenerateNeutralStub(IStronghold stronghold)
        {
            ISimpleStub simpleStub;
            int         upkeep;
            byte        unitLevel;

            formula.StrongholdUpkeep(stronghold.Lvl, out upkeep, out unitLevel);
            simpleStubGenerator.Generate(stronghold.Lvl,
                                         upkeep,
                                         unitLevel,
                                         Config.stronghold_npc_randomness,
                                         (int)stronghold.ObjectId,
                                         out simpleStub);
            return(simpleStub.ToUnitList(FormationType.Normal));
        }