コード例 #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);
        }
コード例 #2
0
        public void TestUpkeepAndUnitLevel(int level, int expectedUnitLevel, int expectedUpkeep, Formula formula)
        {
            byte unitLevel;
            int  upkeep;

            formula.BarbarianTribeUpkeep((byte)level, out upkeep, out unitLevel);

            upkeep.Should().Be(expectedUpkeep);
            unitLevel.Should().Be((byte)expectedUnitLevel);
        }