public override void SyncData(IDataStore dataStore) { dataStore.SyncData("_warExhaustionManager", ref _warExhaustionManager); if (dataStore.IsLoading) { if (_warExhaustionManager == null) { this._warExhaustionManager = new WarExhaustionManager(); } this._warExhaustionManager.Sync(); } }
public bool ApplyCondition(Kingdom kingdom, Kingdom otherKingdom, out TextObject textObject, bool forcePlayerCharacterCosts = false, bool bypassCosts = false) { textObject = null; bool hasDeclareWarCooldown = CooldownManager.HasDeclareWarCooldown(kingdom, otherKingdom, out float elapsedTime); bool hasLowWarExhaustion = true; if (Settings.Instance.EnableWarExhaustion) { hasLowWarExhaustion = WarExhaustionManager.Instance.HasLowWarExhaustion(kingdom, otherKingdom); } if (!hasLowWarExhaustion) { int lowWarExhaustionThreshold = (int)WarExhaustionManager.GetLowWarExhaustion(); textObject = new TextObject(WAR_EXHAUSTION_TOO_HIGH); textObject.SetTextVariable("LOW_WAR_EXHAUSTION_THRESHOLD", lowWarExhaustionThreshold); textObject.SetTextVariable("CURRENT_WAR_EXHAUSTION", (int)Math.Ceiling(WarExhaustionManager.Instance.GetWarExhaustion(kingdom, otherKingdom))); } return(hasLowWarExhaustion); }
public WarExhaustionBehavior() { _warExhaustionManager = new WarExhaustionManager(); }