private void ExpireNonAggressionPact(AllianceEvent obj) { if (DiplomaticAgreementManager.HasNonAggressionPact(obj.Kingdom, obj.OtherKingdom, out var pactAgreement)) { pactAgreement !.Expire(); } }
protected override void ApplyInternal(Kingdom proposingKingdom, Kingdom otherKingdom, float?customDurationInDays) { LogFactory.Get <FormNonAggressionPactAction>().LogTrace($"[{CampaignTime.Now}] {proposingKingdom.Name} secured a NAP with {otherKingdom.Name}."); DiplomaticAgreementManager.RegisterAgreement(proposingKingdom, otherKingdom, new NonAggressionPactAgreement(CampaignTime.Now, CampaignTime.DaysFromNow(customDurationInDays.HasValue ? customDurationInDays.Value : Settings.Instance !.NonAggressionPactDuration), proposingKingdom, otherKingdom)); var textObject = new TextObject("{=vB3RrMNf}The {KINGDOM} has formed a non-aggression pact with the {OTHER_KINGDOM}."); textObject.SetTextVariable("KINGDOM", proposingKingdom.Name); textObject.SetTextVariable("OTHER_KINGDOM", otherKingdom.Name); InformationManager.DisplayMessage(new InformationMessage(textObject.ToString())); }
public bool ApplyCondition(Kingdom kingdom, Kingdom otherKingdom, out TextObject?textObject, bool forcePlayerCharacterCosts = false, bool bypassCosts = false) { textObject = null; var hasNonAggressionPact = DiplomaticAgreementManager.HasNonAggressionPact(kingdom, otherKingdom, out _); if (hasNonAggressionPact) { textObject = new TextObject(HAS_NON_AGGRESSION_PACT); } return(!hasNonAggressionPact); }
public override void SyncData(IDataStore dataStore) { dataStore.SyncData("_diplomaticAgreementManager", ref _diplomaticAgreementManager); if (dataStore.IsLoading) { if (_diplomaticAgreementManager == null) { this._diplomaticAgreementManager = new DiplomaticAgreementManager(); } this._diplomaticAgreementManager.Sync(); } }
public DiplomaticAgreementBehavior() { _diplomaticAgreementManager = new DiplomaticAgreementManager(); }