public ArmyCompositionGroupVM(string name, bool isPlayerSide)
 {
     this._isPlayerSide = isPlayerSide;
     this.MinArmySize   = 1;
     this.MaxArmySize   = (int)Math.Round((double)BannerlordConfig.GetRealBattleSize() / 2.0);
     this._armySizeText = this.MinArmySize.ToString() + " men";
     Game.Current.ObjectManager.GetAllInstancesOfObjectType <BasicCharacterObject>(ref this._allCharacterObjects);
     this._allCharacterObjects        = this._allCharacterObjects.Where <BasicCharacterObject>((Func <BasicCharacterObject, bool>)(c => c.IsSoldier)).ToList <BasicCharacterObject>();
     this.SelectedMeleeInfantryTypes  = new List <BasicCharacterObject>();
     this.SelectedRangedInfantryTypes = new List <BasicCharacterObject>();
     this.SelectedMeleeCavalryTypes   = new List <BasicCharacterObject>();
     this.SelectedRangedCavalryTypes  = new List <BasicCharacterObject>();
     this._armySize            = 1;
     this._name                = name;
     this._values              = new int[4];
     this._values[0]           = 25;
     this._values[1]           = 25;
     this._values[2]           = 25;
     this._values[3]           = 25;
     this.ArmyComposition1Text = "%" + this._values[0].ToString();
     this.ArmyComposition2Text = "%" + this._values[1].ToString();
     this.ArmyComposition3Text = "%" + this._values[2].ToString();
     this.ArmyComposition4Text = "%" + this._values[3].ToString();
     this.RefreshValues();
 }
Exemplo n.º 2
0
        public static Mission OpenCPUBenchmarkMission(string scene)
        {
            int realBattleSize      = BannerlordConfig.GetRealBattleSize();
            int attackerInfCount    = realBattleSize / 100 * 18;
            int attackerRangedCount = realBattleSize / 100 * 10;
            int attackerCavCount    = realBattleSize / 100 * 8;
            int defenderInfCount    = realBattleSize / 100 * 59;
            int defenderCavCount    = realBattleSize / 100 * 5;

            IMissionTroopSupplier[] troopSuppliers = new IMissionTroopSupplier[2];
            BasicCultureObject      culture        = MBObjectManager.Instance.GetObject <BasicCultureObject>("empire");
            Banner banner1 = new Banner("11.4.124.4345.4345.768.768.1.0.0.163.0.5.512.512.769.764.1.0.0");
            Banner banner2 = new Banner("11.45.126.4345.4345.768.768.1.0.0.462.0.13.512.512.769.764.1.0.0");
            CustomBattleCombatant playerParty = new CustomBattleCombatant(new TextObject("{=!}Player Party"), culture, banner1);

            playerParty.Side = BattleSideEnum.Attacker;
            playerParty.AddCharacter(MBObjectManager.Instance.GetObject <BasicCharacterObject>("imperial_legionary"), attackerInfCount);
            playerParty.AddCharacter(MBObjectManager.Instance.GetObject <BasicCharacterObject>("imperial_palatine_guard"), attackerRangedCount);
            playerParty.AddCharacter(MBObjectManager.Instance.GetObject <BasicCharacterObject>("imperial_cataphract"), attackerCavCount);
            CustomBattleCombatant enemyParty = new CustomBattleCombatant(new TextObject("{=!}Enemy Party"), culture, banner2);

            enemyParty.Side = BattleSideEnum.Defender;
            enemyParty.AddCharacter(MBObjectManager.Instance.GetObject <BasicCharacterObject>("battanian_wildling"), defenderInfCount);
            enemyParty.AddCharacter(MBObjectManager.Instance.GetObject <BasicCharacterObject>("battanian_horseman"), defenderCavCount);
            CustomBattleTroopSupplier battleTroopSupplier1 = new CustomBattleTroopSupplier(playerParty, true);

            troopSuppliers[(int)playerParty.Side] = (IMissionTroopSupplier)battleTroopSupplier1;
            CustomBattleTroopSupplier battleTroopSupplier2 = new CustomBattleTroopSupplier(enemyParty, false);

            troopSuppliers[(int)enemyParty.Side] = (IMissionTroopSupplier)battleTroopSupplier2;
            return(MissionState.OpenNew("CPUBenchmarkMission", new MissionInitializerRecord(scene)
            {
                DoNotUseLoadingScreen = false,
                PlayingInCampaignMode = false
            }, (InitializeMissionBehvaioursDelegate)(missionController => (IEnumerable <MissionBehaviour>) new MissionBehaviour[10]
            {
                (MissionBehaviour) new MissionCombatantsLogic((IEnumerable <IBattleCombatant>)null, (IBattleCombatant)playerParty, (IBattleCombatant)enemyParty, (IBattleCombatant)playerParty, Mission.MissionTeamAITypeEnum.FieldBattle, false),
                (MissionBehaviour) new MissionAgentSpawnLogic(troopSuppliers, BattleSideEnum.Attacker),
                (MissionBehaviour) new CPUBenchmarkMissionSpawnHandler(enemyParty, playerParty),
                (MissionBehaviour) new CPUBenchmarkMissionLogic(attackerInfCount, attackerRangedCount, attackerCavCount, defenderInfCount, defenderCavCount),
                (MissionBehaviour) new AgentBattleAILogic(),
                (MissionBehaviour) new AgentVictoryLogic(),
                (MissionBehaviour) new MissionHardBorderPlacer(),
                (MissionBehaviour) new MissionBoundaryPlacer(),
                (MissionBehaviour) new MissionBoundaryCrossingHandler(),
                (MissionBehaviour) new AgentFadeOutLogic()
            })));
        }