private CustomBattleData PrepareBattleData() { BasicCharacterObject selectedCharacter1 = this.PlayerSide.SelectedCharacter; BasicCharacterObject selectedCharacter2 = this.EnemySide.SelectedCharacter; int armySize1 = this.PlayerSide.CompositionGroup.ArmySize; int armySize2 = this.EnemySide.CompositionGroup.ArmySize; bool isPlayerAttacker = this.GameTypeSelectionGroup.SelectedPlayerSide == CustomBattlePlayerSide.Attacker; bool flag = this.GameTypeSelectionGroup.SelectedPlayerType == CustomBattlePlayerType.Commander; BasicCharacterObject playerSideGeneralCharacter = (BasicCharacterObject)null; if (!flag) { List <BasicCharacterObject> list = CustomBattleData.Characters.ToList <BasicCharacterObject>(); list.Remove(selectedCharacter1); list.Remove(selectedCharacter2); playerSideGeneralCharacter = list.GetRandomElement <BasicCharacterObject>(); --armySize1; } int[] troopCounts1 = CustomBattleMenuVM.CustomBattleHelper.GetTroopCounts(armySize1, this.PlayerSide.CompositionGroup); ArmyCompositionGroupVM compositionGroup = this.EnemySide.CompositionGroup; int[] troopCounts2 = CustomBattleMenuVM.CustomBattleHelper.GetTroopCounts(armySize2, compositionGroup); List <BasicCharacterObject>[] troopSelections1 = CustomBattleMenuVM.CustomBattleHelper.GetTroopSelections(this.PlayerSide.CompositionGroup); List <BasicCharacterObject>[] troopSelections2 = CustomBattleMenuVM.CustomBattleHelper.GetTroopSelections(this.EnemySide.CompositionGroup); BasicCultureObject selectedFaction1 = this.PlayerSide.SelectedFaction; BasicCultureObject selectedFaction2 = this.EnemySide.SelectedFaction; CustomBattleCombatant[] customBattleParties = this._customBattleState.GetCustomBattleParties(selectedCharacter1, playerSideGeneralCharacter, selectedCharacter2, selectedFaction1, troopCounts1, troopSelections1, selectedFaction2, troopCounts2, troopSelections2, isPlayerAttacker); CustomBattleData customBattleData = new CustomBattleData(); customBattleData.GameType = this.GameTypeSelectionGroup.SelectedGameType; customBattleData.SceneId = this.MapSelectionGroup.SelectedMapId; customBattleData.PlayerCharacter = selectedCharacter1; customBattleData.PlayerParty = customBattleParties[0]; customBattleData.EnemyParty = customBattleParties[1]; customBattleData.IsPlayerGeneral = flag; customBattleData.PlayerSideGeneralCharacter = playerSideGeneralCharacter; customBattleData.SeasonId = this.MapSelectionGroup.SelectedSeasonId; customBattleData.SceneLevel = ""; customBattleData.TimeOfDay = (float)this.MapSelectionGroup.SelectedTimeOfDay; if (customBattleData.GameType == CustomBattleGameType.Siege) { Dictionary <SiegeEngineType, int> machineCounts1 = new Dictionary <SiegeEngineType, int>(); Dictionary <SiegeEngineType, int> machineCounts2 = new Dictionary <SiegeEngineType, int>(); CustomBattleMenuVM.CustomBattleHelper.FillSiegeMachineCounts(machineCounts1, this._attackerMeleeMachines); CustomBattleMenuVM.CustomBattleHelper.FillSiegeMachineCounts(machineCounts1, this._attackerRangedMachines); CustomBattleMenuVM.CustomBattleHelper.FillSiegeMachineCounts(machineCounts2, this._defenderMachines); float[] hitpointPercentages = CustomBattleMenuVM.CustomBattleHelper.GetWallHitpointPercentages(this.MapSelectionGroup.SelectedWallBreachedCount); customBattleData.AttackerMachines = machineCounts1; customBattleData.DefenderMachines = machineCounts2; customBattleData.WallHitpointPercentages = hitpointPercentages; customBattleData.HasAnySiegeTower = this._attackerMeleeMachines.Any <CustomBattleSiegeMachineVM>((Func <CustomBattleSiegeMachineVM, bool>)(mm => mm.SiegeEngineType == DefaultSiegeEngineTypes.SiegeTower)); customBattleData.IsPlayerAttacker = isPlayerAttacker; customBattleData.SceneUpgradeLevel = this.MapSelectionGroup.SelectedSceneLevel; customBattleData.IsSallyOut = this.MapSelectionGroup.IsSallyOutSelected; customBattleData.IsReliefAttack = false; } return(customBattleData); }
private void ExecuteRandomizeDefenderSiegeEngines() { List <SiegeEngineType> e = new List <SiegeEngineType>(); e.AddRange(CustomBattleData.GetAllDefenderRangedMachines()); e.Add((SiegeEngineType)null); foreach (CustomBattleSiegeMachineVM defenderMachine in (Collection <CustomBattleSiegeMachineVM>) this._defenderMachines) { defenderMachine.SetMachineType(e.GetRandomElement <SiegeEngineType>()); } }
private void OnDefenderRangedMachineSelection(CustomBattleSiegeMachineVM selectedSlot) { List <InquiryElement> inquiryElements = new List <InquiryElement>(); inquiryElements.Add(new InquiryElement((object)null, GameTexts.FindText("str_empty").ToString(), (ImageIdentifier)null)); foreach (SiegeEngineType defenderRangedMachine in CustomBattleData.GetAllDefenderRangedMachines()) { inquiryElements.Add(new InquiryElement((object)defenderRangedMachine, defenderRangedMachine.Name.ToString(), (ImageIdentifier)null)); } InformationManager.ShowMultiSelectionInquiry(new MultiSelectionInquiryData(new TextObject("{=SLZzfNPr}Select a Ranged Machine").ToString(), string.Empty, inquiryElements, false, 1, GameTexts.FindText("str_done").ToString(), "", (Action <List <InquiryElement> >)(selectedElements => selectedSlot.SetMachineType(selectedElements[0].Identifier as SiegeEngineType)), (Action <List <InquiryElement> >)null)); }
private void ExecuteRandomizeAttackerSiegeEngines() { List <SiegeEngineType> e = new List <SiegeEngineType>(); e.AddRange(CustomBattleData.GetAllAttackerMeleeMachines()); e.Add((SiegeEngineType)null); foreach (CustomBattleSiegeMachineVM attackerMeleeMachine in (Collection <CustomBattleSiegeMachineVM>) this._attackerMeleeMachines) { attackerMeleeMachine.SetMachineType(e.GetRandomElement <SiegeEngineType>()); } e.Clear(); e.AddRange(CustomBattleData.GetAllAttackerRangedMachines()); e.Add((SiegeEngineType)null); foreach (CustomBattleSiegeMachineVM attackerRangedMachine in (Collection <CustomBattleSiegeMachineVM>) this._attackerRangedMachines) { attackerRangedMachine.SetMachineType(e.GetRandomElement <SiegeEngineType>()); } }
private static void Postfix(CustomBattleData __result) { playerCombatant = __result.PlayerParty; }