コード例 #1
0
        public bool StoreGuarantee()
        {
            var propMetal   = ProposingFactionGuarantee ?? 0;
            var acceptMetal = AcceptingFactionGuarantee ?? 0;

            if (FactionByProposingFactionID.Metal >= propMetal && FactionByAcceptingFactionID.Metal >= acceptMetal)
            {
                FactionByProposingFactionID.SpendMetal(propMetal);
                FactionByAcceptingFactionID.SpendMetal(acceptMetal);
                return(true);
            }

            return(false);
        }
コード例 #2
0
        public void CancelTreaty(Faction faction)
        {
            bool wasAccepted = TreatyState == TreatyState.Accepted;

            TreatyState = TreatyState.Cancelled;

            if (wasAccepted)
            {
                if (faction?.FactionID == AcceptingFactionID)
                {
                    FactionByProposingFactionID.ProduceMetal(AcceptingFactionGuarantee ?? 0);
                    FactionByProposingFactionID.ProduceMetal(ProposingFactionGuarantee ?? 0);
                }
                else
                {
                    FactionByAcceptingFactionID.ProduceMetal(AcceptingFactionGuarantee ?? 0);
                    FactionByAcceptingFactionID.ProduceMetal(ProposingFactionGuarantee ?? 0);
                }
            }
        }