-
-
Save carbon198/e198ffcf1021c7ad1226ffb850ebccb5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using TaleWorlds.CampaignSystem; | |
using TaleWorlds.CampaignSystem.ComponentInterfaces; | |
using TaleWorlds.CampaignSystem.GameComponents; | |
using TaleWorlds.CampaignSystem.Party; | |
using TaleWorlds.CampaignSystem.Settlements; | |
using static PartyAIControls.CampaignBehaviors.PartyAIClanPartySettingsManager; | |
namespace PartyAIControls.Models | |
{ | |
internal class PAISettlementGarrisonModel : SettlementGarrisonModel | |
{ | |
SettlementGarrisonModel _previousModel; | |
public PAISettlementGarrisonModel(SettlementGarrisonModel previousModel) | |
{ | |
_previousModel = previousModel; | |
_previousModel ??= new DefaultSettlementGarrisonModel(); | |
} | |
public override ExplainedNumber CalculateGarrisonChange(Settlement settlement, bool includeDescriptions = false) | |
{ | |
return _previousModel.CalculateGarrisonChange(settlement, includeDescriptions); | |
} | |
public override ExplainedNumber CalculateGarrisonChangeAutoRecruitment(Settlement settlement, bool includeDescriptions = false) | |
{ | |
return _previousModel.CalculateGarrisonChangeAutoRecruitment(settlement, includeDescriptions); | |
} | |
public override int FindNumberOfTroopsToLeaveToGarrison(MobileParty mobileParty, Settlement settlement) | |
{ | |
int result = _previousModel.FindNumberOfTroopsToLeaveToGarrison(mobileParty, settlement); | |
if (!SubModule.PartySettingsManager.IsHeroManageable(mobileParty.LeaderHero)) | |
{ | |
return result; | |
} | |
PartyAIClanPartySettings heroSettings = SubModule.PartySettingsManager.Settings(mobileParty.LeaderHero); | |
if (!heroSettings.AllowDonateTroops) | |
{ | |
result = 0; | |
} | |
return result; | |
} | |
public override int FindNumberOfTroopsToTakeFromGarrison(MobileParty mobileParty, Settlement settlement, float idealGarrisonStrengthPerWalledCenter = 0) | |
{ | |
return _previousModel.FindNumberOfTroopsToTakeFromGarrison(mobileParty, settlement, idealGarrisonStrengthPerWalledCenter); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment