Пример #1
0
        protected virtual void UpdateActionAvailability()
        {
            this.IsMessengerAvailable = MessengerManager.CanSendMessengerWithCost(Faction2Leader.Hero, DiplomacyCostCalculator.DetermineCostForSendingMessenger());
            this.IsOptionAvailable    = DeclareWarConditions.Instance.CanApplyExceptions(this, true).IsEmpty();
            string allianceException = FormAllianceConditions.Instance.CanApplyExceptions(this, true).FirstOrDefault()?.ToString();

            this.IsAllianceAvailable = allianceException == null;
            string declareWarException = DeclareWarConditions.Instance.CanApplyExceptions(this, true).FirstOrDefault()?.ToString();

            this.ActionHint   = declareWarException != null ? new HintViewModel(declareWarException) : new HintViewModel();
            this.AllianceHint = allianceException != null ? new HintViewModel(allianceException) : new HintViewModel();
            string nonAggressionPactException = NonAggressionPactConditions.Instance.CanApplyExceptions(this, true).FirstOrDefault()?.ToString();

            this.IsNonAggressionPactAvailable = nonAggressionPactException == null;
            this.NonAggressionPactHint        = nonAggressionPactException != null ? new HintViewModel(nonAggressionPactException) : new HintViewModel();

            HybridCost allianceCost = DiplomacyCostCalculator.DetermineCostForFormingAlliance(Faction1 as Kingdom, Faction2 as Kingdom, true);

            this.AllianceInfluenceCost = (int)allianceCost.InfluenceCost.Value;
            this.AllianceGoldCost      = (int)allianceCost.GoldCost.Value;


            HybridCost nonAggressionPactCost = DiplomacyCostCalculator.DetermineCostForFormingNonAggressionPact(Faction1 as Kingdom, Faction2 as Kingdom, true);

            this.NonAggressionPactInfluenceCost = (int)nonAggressionPactCost.InfluenceCost.Value;
            this.NonAggressionPactGoldCost      = (int)nonAggressionPactCost.GoldCost.Value;


            this.AllianceScoreHint          = this.UpdateDiplomacyTooltip(AllianceScoringModel.Instance.GetScore(Faction2 as Kingdom, Faction1 as Kingdom, new StatExplainer()));
            this.NonAggressionPactScoreHint = this.UpdateDiplomacyTooltip(NonAggressionPactScoringModel.Instance.GetScore(Faction2 as Kingdom, Faction1 as Kingdom, new StatExplainer()));
        }
Пример #2
0
        protected override bool ApplyConditionInternal(Kingdom kingdom, Kingdom otherKingdom, ref TextObject?textObject, bool forcePlayerCharacterCosts = false)
        {
            var hasEnoughGold = DiplomacyCostCalculator.DetermineCostForFormingNonAggressionPact(kingdom, otherKingdom, forcePlayerCharacterCosts).GoldCost.CanPayCost();

            if (!hasEnoughGold)
            {
                textObject = FailedConditionText;
            }
            return(hasEnoughGold);
        }
 protected override void AssessCosts(Kingdom proposingKingdom, Kingdom otherKingdom, bool forcePlayerCharacterCosts)
 {
     DiplomacyCostCalculator.DetermineCostForFormingNonAggressionPact(proposingKingdom, otherKingdom, forcePlayerCharacterCosts).ApplyCost();
 }