protected virtual void ExecuteExecutiveAction() { float influenceCost = DiplomacyCostCalculator.DetermineInfluenceCostForDeclaringWar(Faction1 as Kingdom); DiplomacyCostManager.deductInfluenceFromPlayerClan(influenceCost); DeclareWarAction.Apply(Faction1, Faction2); }
public KingdomTruceItemVMExtensionVM(IFaction faction1, IFaction faction2, Action <KingdomDiplomacyItemVM> onSelection, Action <KingdomTruceItemVM> onAction) : base(faction1, faction2, onSelection, onAction) { this.SendMessengerActionName = new TextObject("{=cXfcwzPp}Send Messenger").ToString(); this.AllianceActionName = new TextObject("{=0WPWbx70}Form Alliance").ToString(); this.InfluenceCost = (int)DiplomacyCostCalculator.DetermineInfluenceCostForDeclaringWar(Faction1 as Kingdom); this.ActionName = GameTexts.FindText("str_kingdom_declate_war_action", null).ToString(); UpdateDiplomacyProperties(); }
public bool ApplyCondition(Kingdom kingdom, Kingdom otherKingdom, out TextObject textObject, bool forcePlayerCharacterCosts = false) { textObject = null; // Currently this cost is not assessed on AI leaders, but only through the Kingdom Diplomacy screen. if (!forcePlayerCharacterCosts) { return(true); } Hero heroPayingCosts = forcePlayerCharacterCosts ? Hero.MainHero : kingdom.Leader; bool hasEnoughInfluence = heroPayingCosts.Clan.Influence >= DiplomacyCostCalculator.DetermineInfluenceCostForDeclaringWar(kingdom); if (!hasEnoughInfluence) { textObject = new TextObject(NOT_ENOUGH_INFLUENCE); } return(hasEnoughInfluence); }