diff --git a/README.md b/README.md index aaf58ba..ffcbfc6 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,10 @@ A mod for Mount&Blade Bannerlord that provides more powerful custom battle. ## Current Version -v1.1.6 +v1.2.8 ## Mod File +[Release v1.2.8](https://github.com/cookgreen/EnhancedBattleTest/releases/tag/ebt-v1.2.8) [Release v1.1.6](https://github.com/cookgreen/EnhancedBattleTest/releases/tag/ebt-v1.1.6) [Release v1.0.2](https://github.com/cookgreen/EnhancedBattleTest/releases/tag/ebt-v1.0.2) diff --git a/source/EnhancedBattleTest/src/Config/TeamConfig.cs b/source/EnhancedBattleTest/src/Config/TeamConfig.cs index fb7b68c..7afd20b 100644 --- a/source/EnhancedBattleTest/src/Config/TeamConfig.cs +++ b/source/EnhancedBattleTest/src/Config/TeamConfig.cs @@ -50,7 +50,7 @@ public Banner GetPreviewBanner() ? new Banner(BannerKey) : (HasGeneral ? (Generals.Troops[0].Character.CharacterObject as CharacterObject).HeroObject?.ClanBanner - : null) ?? CampaignData.NeutralFaction.Banner; + : null) ?? null; } public TeamConfig() diff --git a/source/EnhancedBattleTest/src/Data/MissionData/AtmosphereModel.cs b/source/EnhancedBattleTest/src/Data/MissionData/AtmosphereModel.cs index 09c0ead..77268f3 100644 --- a/source/EnhancedBattleTest/src/Data/MissionData/AtmosphereModel.cs +++ b/source/EnhancedBattleTest/src/Data/MissionData/AtmosphereModel.cs @@ -47,7 +47,7 @@ public static AtmosphereInfo CreateAtmosphereInfoForMission(string seasonString string atmosphereTypeName = isInSettlement ? "empire" : "field_battle"; return new AtmosphereInfo() { - AtmosphereTypeName = atmosphereTypeName, + //AtmosphereTypeName = atmosphereTypeName, AtmosphereName = atmosphereName, TimeInfo = new TimeInformation { diff --git a/source/EnhancedBattleTest/src/GameMode/EnhancedBattleTestGameManager.cs b/source/EnhancedBattleTest/src/GameMode/EnhancedBattleTestGameManager.cs index 2515b53..5d84f7b 100644 --- a/source/EnhancedBattleTest/src/GameMode/EnhancedBattleTestGameManager.cs +++ b/source/EnhancedBattleTest/src/GameMode/EnhancedBattleTestGameManager.cs @@ -57,5 +57,9 @@ public override void OnLoadFinished() base.OnLoadFinished(); TaleWorlds.Core.Game.Current.GameStateManager.CleanAndPushState(TaleWorlds.Core.Game.Current.GameStateManager.CreateState()); } - } + + public override void OnAfterCampaignStart(Game game) + { + } + } } \ No newline at end of file diff --git a/source/EnhancedBattleTest/src/GameMode/EnhancedBattleTestSingleplayerGameManager.cs b/source/EnhancedBattleTest/src/GameMode/EnhancedBattleTestSingleplayerGameManager.cs index 4d76a8d..9d8fdba 100644 --- a/source/EnhancedBattleTest/src/GameMode/EnhancedBattleTestSingleplayerGameManager.cs +++ b/source/EnhancedBattleTest/src/GameMode/EnhancedBattleTestSingleplayerGameManager.cs @@ -74,15 +74,21 @@ public override void OnGameEnd(TaleWorlds.Core.Game game) public override void OnLoadFinished() { - if (CampaignSiegeTestStatic.IsSiegeTestBuild) - CampaignSiegeTestStatic.DisableSiegeTest(); + //if (CampaignSiegeTestStatic.IsSiegeTestBuild) + // CampaignSiegeTestStatic.DisableSiegeTest(); + Game.Current.GameStateManager.OnSavedGameLoadFinished(); Game.Current.GameStateManager.CleanAndPushState((GameState)Game.Current.GameStateManager.CreateState()); - PartyBase.MainParty.Visuals?.SetMapIconAsDirty(); - TaleWorlds.CampaignSystem.Campaign.Current.CampaignInformationManager.OnGameLoaded(); + PartyBase.MainParty.SetVisualAsDirty(); + TaleWorlds.CampaignSystem.Campaign.Current.CampaignInformationManager.OnGameLoaded(); + foreach (Settlement settlement in Settlement.All) - settlement.Party.Visuals.RefreshLevelMask(settlement.Party); + { + settlement.Party.OnLevelMaskUpdated(); + } + CampaignEventDispatcher.Instance.OnGameLoadFinished(); + if (Game.Current.GameStateManager.ActiveState is MapState activeState) activeState.OnLoadingFinished(); diff --git a/source/EnhancedBattleTest/src/GameMode/MultiplayerGame.cs b/source/EnhancedBattleTest/src/GameMode/MultiplayerGame.cs index e526e56..7b28073 100644 --- a/source/EnhancedBattleTest/src/GameMode/MultiplayerGame.cs +++ b/source/EnhancedBattleTest/src/GameMode/MultiplayerGame.cs @@ -52,7 +52,7 @@ private void InitializeGameModels(IGameStarter gameStarter) gameStarter.AddModel(new MultiplayerApplyWeatherEffectsModel()); //gameStarter.AddModel(new MultiplayerAgentApplyDamageModel()); gameStarter.AddModel(new DefaultRidingModel()); - gameStarter.AddModel(new MultiplayerStrikeMagnitudeModel()); + //gameStarter.AddModel(new MultiplayerStrikeMagnitudeModel()); gameStarter.AddModel(new MultiplayerBattleMoraleModel()); } diff --git a/source/EnhancedBattleTest/src/Patch/Patch_Initializer.cs b/source/EnhancedBattleTest/src/Patch/Patch_Initializer.cs index a0d52f7..2a359e9 100644 --- a/source/EnhancedBattleTest/src/Patch/Patch_Initializer.cs +++ b/source/EnhancedBattleTest/src/Patch/Patch_Initializer.cs @@ -44,19 +44,19 @@ public static bool Patch() public static void Init(AtmosphereInfo atmosphere, float timeOfDay) { - Atmosphere = atmosphere; + Atmosphere = atmosphere; TimeOfDay = timeOfDay; } public static void Reset() - { - Atmosphere = null; - TimeOfDay = null; + { + Atmosphere.AtmosphereName = null; + TimeOfDay = null; } public static void Postfix_CreateSandBoxMissionInitializerRecord(ref MissionInitializerRecord __result) { - if (BattleStarter.IsEnhancedBattleTestBattle && Atmosphere != null && TimeOfDay != null) + if (BattleStarter.IsEnhancedBattleTestBattle && Atmosphere.IsValid && TimeOfDay != null) { __result.AtmosphereOnCampaign = Atmosphere; __result.TimeOfDay = (float)TimeOfDay; diff --git a/source/EnhancedBattleTest/src/Patch/Patch_MissionAgentSpawnLogic.cs b/source/EnhancedBattleTest/src/Patch/Patch_MissionAgentSpawnLogic.cs index c6fab1f..2fdaae2 100644 --- a/source/EnhancedBattleTest/src/Patch/Patch_MissionAgentSpawnLogic.cs +++ b/source/EnhancedBattleTest/src/Patch/Patch_MissionAgentSpawnLogic.cs @@ -75,7 +75,7 @@ public class Patch_MissionAgentSpawnLogic if (formation != null && !formation.HasBeenPositioned) { formation.BeginSpawn(count, isMounted && ____spawnWithHorses); - Mission.Current.SpawnFormation(formation); + Mission.Current.SetFormationPositioningFromDeploymentPlan(formation); ____spawnedFormations.Add(formation); } agentOriginBase.SpawnTroop(____side, true, ____spawnWithHorses, isReinforcement, diff --git a/source/EnhancedBattleTest/src/SinglePlayer/BattleStarter.cs b/source/EnhancedBattleTest/src/SinglePlayer/BattleStarter.cs index c8dc9fd..c38eece 100644 --- a/source/EnhancedBattleTest/src/SinglePlayer/BattleStarter.cs +++ b/source/EnhancedBattleTest/src/SinglePlayer/BattleStarter.cs @@ -302,7 +302,7 @@ public static void MissionEnded() _originalParties.Clear(); _originalSettlements.Clear(); _bannerSave.Clear(); - Campaign.Current.MainParty.Party.Visuals?.SetMapIconAsDirty(); + Campaign.Current.MainParty.Party.SetVisualAsDirty(); IsEnhancedBattleTestBattle = false; } catch (Exception e) @@ -326,7 +326,7 @@ private static Clan GetSettlementClan(BattleConfig config) } } - return CampaignData.NeutralFaction; + return null; } private static void ResetMapEventSide(PartyBase partyBase) @@ -357,10 +357,10 @@ private static MissionInitializerRecord CreateMissionInitializerRecord(BattleCon rec.PlayingInCampaignMode = true; rec.RandomTerrainSeed = MBRandom.RandomInt(10000); rec.AtmosphereOnCampaign = AtmosphereModel.CreateAtmosphereInfoForMission(config.MapConfig.Season, config.MapConfig.TimeOfDay, true); - rec.AtlasGroup = 2; + rec.DecalAtlasGroup = 2; if (config.BattleTypeConfig.BattleType == BattleType.Field && !config.MapConfig.OverridesPlayerPosition) { - rec.AtmosphereOnCampaign = Campaign.Current.Models.MapWeatherModel.GetAtmosphereModel(CampaignTime.Now, MobileParty.MainParty.GetLogicalPosition()); + rec.AtmosphereOnCampaign = Campaign.Current.Models.MapWeatherModel.GetAtmosphereModel(/*CampaignTime.Now, */MobileParty.MainParty.GetLogicalPosition()); float num = Campaign.CurrentTime % 24f; if (Campaign.Current != null) rec.TimeOfDay = num; diff --git a/source/EnhancedBattleTest/src/UI/EnhancedBattleTestVM.cs b/source/EnhancedBattleTest/src/UI/EnhancedBattleTestVM.cs index b510f88..67f86e3 100644 --- a/source/EnhancedBattleTest/src/UI/EnhancedBattleTestVM.cs +++ b/source/EnhancedBattleTest/src/UI/EnhancedBattleTestVM.cs @@ -441,7 +441,8 @@ private void OnMeleeMachineSelection(CustomBattleSiegeMachineVM selectedSlot) }; foreach (SiegeEngineType attackerMeleeMachine in GetAllAttackerMeleeMachines()) inquiryElements.Add(new InquiryElement(attackerMeleeMachine, attackerMeleeMachine.Name.ToString(), null)); - MBInformationManager.ShowMultiSelectionInquiry(new MultiSelectionInquiryData(new TextObject("{=MVOWsP48}Select a Melee Machine").ToString(), string.Empty, inquiryElements, false, 1, GameTexts.FindText("str_done").ToString(), "", selectedElements => selectedSlot.SetMachineType(selectedElements.First().Identifier as SiegeEngineType), null)); + MBInformationManager.ShowMultiSelectionInquiry( + new MultiSelectionInquiryData("{=MVOWsP48}Select a Melee Machine", string.Empty, inquiryElements, false, 1, inquiryElements.Count, GameTexts.FindText("str_done").ToString(), string.Empty, (selectedElements) => selectedSlot.SetMachineType(selectedElements.First().Identifier as SiegeEngineType), null)); } private void OnAttackerRangedMachineSelection(CustomBattleSiegeMachineVM selectedSlot) @@ -452,7 +453,7 @@ private void OnAttackerRangedMachineSelection(CustomBattleSiegeMachineVM selecte }; foreach (SiegeEngineType attackerRangedMachine in GetAllAttackerRangedMachines()) inquiryElements.Add(new InquiryElement(attackerRangedMachine, attackerRangedMachine.Name.ToString(), null)); - MBInformationManager.ShowMultiSelectionInquiry(new MultiSelectionInquiryData(new TextObject("{=SLZzfNPr}Select a Ranged Machine").ToString(), string.Empty, inquiryElements, false, 1, GameTexts.FindText("str_done").ToString(), "", selectedElements => selectedSlot.SetMachineType(selectedElements[0].Identifier as SiegeEngineType), null)); + MBInformationManager.ShowMultiSelectionInquiry(new MultiSelectionInquiryData(new TextObject("{=SLZzfNPr}Select a Ranged Machine").ToString(), string.Empty, inquiryElements, false, 1, inquiryElements.Count, GameTexts.FindText("str_done").ToString(), "", selectedElements => selectedSlot.SetMachineType(selectedElements[0].Identifier as SiegeEngineType), null)); } private void OnDefenderRangedMachineSelection(CustomBattleSiegeMachineVM selectedSlot) @@ -463,7 +464,7 @@ private void OnDefenderRangedMachineSelection(CustomBattleSiegeMachineVM selecte }; foreach (SiegeEngineType defenderRangedMachine in GetAllDefenderRangedMachines()) inquiryElements.Add(new InquiryElement(defenderRangedMachine, defenderRangedMachine.Name.ToString(), null)); - MBInformationManager.ShowMultiSelectionInquiry(new MultiSelectionInquiryData(new TextObject("{=SLZzfNPr}Select a Ranged Machine").ToString(), string.Empty, inquiryElements, false, 1, GameTexts.FindText("str_done").ToString(), "", selectedElements => selectedSlot.SetMachineType(selectedElements[0].Identifier as SiegeEngineType), null)); + MBInformationManager.ShowMultiSelectionInquiry(new MultiSelectionInquiryData(new TextObject("{=SLZzfNPr}Select a Ranged Machine").ToString(), string.Empty, inquiryElements, false, 1, inquiryElements.Count, GameTexts.FindText("str_done").ToString(), "", selectedElements => selectedSlot.SetMachineType(selectedElements[0].Identifier as SiegeEngineType), null)); } private void OnResetMachineSelection(CustomBattleSiegeMachineVM selectedSlot) => selectedSlot.SetMachineType((SiegeEngineType)null); } diff --git a/source/EnhancedBattleTest/src/Utility.cs b/source/EnhancedBattleTest/src/Utility.cs index c7405a4..24a5a9a 100644 --- a/source/EnhancedBattleTest/src/Utility.cs +++ b/source/EnhancedBattleTest/src/Utility.cs @@ -306,7 +306,7 @@ public static void SetMapEvents(PartyBase attacker, PartyBase defender, BattleTy } } - Campaign.Current.MapEventManager.StartBattleMapEvent(attacker, defender); + Campaign.Current.MapEventManager.StartSallyOutMapEvent(attacker, defender); } catch (Exception e) {