示例#1
0
        /// <summary>
        /// Constructor for Place_Serialised.
        /// For use when serialising.
        /// </summary>
        /// <param name="k">Kingdom object to be used as source</param>
        public Place_Serialised(Kingdom k = null, Province p = null, Fief f = null)
        {
            Place placeToUse = null;

            if (k != null)
            {
                placeToUse = k;
            }
            else if (p != null)
            {
                placeToUse = p;
            }
            else if (f != null)
            {
                placeToUse = f;
            }

            if (placeToUse != null)
            {
                this.id          = placeToUse.id;
                this.name        = placeToUse.name;
                this.owner       = placeToUse.owner.charID;
                this.titleHolder = placeToUse.titleHolder;
                this.rank        = placeToUse.rank.id;
            }
        }
示例#2
0
 /// <summary>
 /// Constructor for Province using Province_Serialised object.
 /// For use when de-serialising.
 /// </summary>
 /// <param name="ps">Province_Serialised object to use as source</param>
 public Province(Province_Serialised ps)
     : base(ps: ps)
 {
     this.taxRate = ps.taxRate;
     // kingdom to be inserted later
     this.kingdom = null;
 }
示例#3
0
        /// <summary>
        /// Gets the province's rightful kingdom (i.e. the kingdom that it traditionally belongs to)
        /// </summary>
        /// <returns>The kingdom</returns>
        public Kingdom GetRightfulKingdom()
        {
            Kingdom thisKingdom = null;

            if (this.kingdom != null)
            {
                thisKingdom = this.kingdom;
            }

            return(thisKingdom);
        }
示例#4
0
        /// <summary>
        /// Constructor for Province
        /// </summary>
        /// <param name="otax">Double holding province tax rate</param>
        /// <param name="king">Province's Kingdom object</param>
        public Province(String id, String nam, Double otax, String tiHo = null, PlayerCharacter own = null, Kingdom king = null, Rank r = null)
            : base(id, nam, tiHo, own, r)
        {
            // VALIDATION

            // OTAX
            if (!Utility_Methods.ValidatePercentage(otax))
            {
                throw new InvalidDataException("Province taxrate must be a double between 0 and 100");
            }

            this.taxRate = otax;
            this.kingdom = king;
        }
示例#5
0
        /// <summary>
        /// Gets the Kingdom associated with the position
        /// </summary>
        /// <returns>The Kingdom</returns>
        public Kingdom GetKingdom()
        {
            Kingdom thisKingdom = null;

            foreach (KeyValuePair <string, Kingdom> kingdomEntry in Globals_Game.kingdomMasterList)
            {
                if (kingdomEntry.Value.nationality == this.nationality)
                {
                    thisKingdom = kingdomEntry.Value;
                    break;
                }
            }

            return(thisKingdom);
        }
示例#6
0
 /// <summary>
 /// Constructor for Kingdom_Serialised.
 /// For use when serialising.
 /// </summary>
 /// <param name="king">Kingdom object to be used as source</param>
 public Kingdom_Serialised(Kingdom king)
     : base(k: king)
 {
     this.nationality = king.nationality.natID;
 }