Пример #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()));
        }
        private void UpdateActionAvailability()
        {
            this.IsMessengerAvailable = MessengerManager.CanSendMessengerWithCost(Faction2Leader.Hero, DiplomacyCostCalculator.DetermineCostForSendingMessenger());
            this.IsOptionAvailable    = MakePeaceConditions.Instance.CanApplyExceptions(this, true).IsEmpty();
            string makePeaceException = MakePeaceConditions.Instance.CanApplyExceptions(this, true).FirstOrDefault()?.ToString();

            this.ActionHint = makePeaceException != null ? new HintViewModel(makePeaceException) : new HintViewModel();
        }
 private void UpdateIsMessengerAvailable()
 {
     IsMessengerAvailable = MessengerManager.CanSendMessengerWithCost(this._hero, _sendMessengerCost);
 }