Esempio n. 1
0
        internal void UpdateResourceCount(ResourceType resourceType, BuildingState buildingState, bool hasBaron, bool undo)
        {
            if (buildingState == BuildingState.None)
            {
                throw new InvalidDataException("the settlement type shouldn't be None!");
            }

            if (_dictResourceCount.TryGetValue(resourceType, out ResourceCount resCount) == false)
            {
                resCount = new ResourceCount();
                _dictResourceCount[resourceType] = resCount;
            }

            int value = 0;

            if (buildingState == BuildingState.Settlement)
            {
                value = 1;
            }
            else if (buildingState == BuildingState.City)
            {
                value = 2;
            }

            if (undo)
            {
                value = -value;
            }

            if (hasBaron)
            {
                resCount.Lost    += value;
                CardsLostToBaron += value;
            }
            else
            {
                resCount.Acquired += value;
                ResourcesAcquired += value;
            }

            string s = hasBaron ? "Lost" : "Gained";

            this.TraceMessage($"{this.PlayerName} {s} {value} of {resourceType} ");
        }
Esempio n. 2
0
        internal void UpdateResourceCount(ResourceType resourceType, SettlementType settlementType, bool hasBaron)
        {
            if (settlementType == SettlementType.None)
            {
                throw new InvalidDataException("the settlement type shouldn't be None!");
            }

            ResourceCount resCount = null;

            if (_dictResourceCount.TryGetValue(resourceType, out resCount) == false)
            {
                resCount = new ResourceCount();
                _dictResourceCount[resourceType] = resCount;
            }

            int value = 0;

            if (settlementType == SettlementType.Settlement)
            {
                value = 1;
            }
            else if (settlementType == SettlementType.City)
            {
                value = 2;
            }

            if (hasBaron)
            {
                resCount.Lost     += value;
                MissedOpportunity += value;
            }
            else
            {
                resCount.Acquired += value;
                ResourceCount     += value;
            }

            string s = hasBaron ? "Lost" : "Gained";

            this.TraceMessage($"{this.PlayerName} {s} {value} of {resourceType} ");
        }