Exemplo n.º 1
0
        // Effects of Cards/Wonders to be applied instantly. Other effects will be ignored
        // and left to another global function to deal with it at the end of the game.
        public static void ApplyEffect(Player p, Player east, Player west, Effect e)
        {
            // RESOURCES
            if (resourceType.ContainsKey(e.type))
                AddResource(p, resourceType[e.type], e.amount);

            // VICTORY POINTS
            else if (e.type.Equals(Effect.TypeType.VICTORY))
            {
                // NO FROM/BASIS - add to score
                if (e.from == Effect.FromType.NONE && e.basis == Effect.BasisType.NONE)
                    AddScore(p, Score.VICTORY, e.amount);

                // Adding to the Score for Blue Structures raised
                else if (e.from == Effect.FromType.NONE && e.basis.Equals(Effect.BasisType.BLUE))
                {
                    AddScore(p, Score.VICTORY_BLUE, e.amount);
                    AddScore(p, Score.VICTORY, e.amount);
                }
            }

            // COINS
            else if (e.type.Equals(Effect.TypeType.COIN))
            {
                // No FROM/BASIS - add coin
                if (e.from == Effect.FromType.NONE && e.basis == Effect.BasisType.NONE)
                    AddResource(p, Resource.COIN, e.amount);

                // FROM: PLAYER
                // BASIS: CardColour, Wonderstages
                else if (e.from.Equals(Effect.FromType.PLAYER))
                {
                    if (e.basis.Equals(Effect.BasisType.WONDER))
                        AddCoinWonder(p, e.amount);
                    else
                        AddCoinColour(p, cardType[e.basis], e.amount);
                }
                // FROM: ALL
                else if (e.from.Equals(Effect.FromType.ALL))
                    AddCoinAllColour(p, east, west, cardType[e.basis], e.amount);
            }

            // RESOURCE CHOICE
            else if (e.type.Equals(Effect.TypeType.RCHOICE))
            {
                List<Resource> choice = new List<Resource>();

                foreach (Effect.TypeType c in e.list)
                    choice.Add(resourceType[c]);

                if ((e.basis.Equals(Effect.BasisType.YELLOW) || e.basis.Equals(Effect.BasisType.WONDER)))
                    AddResourceUnPurchaseable(p, choice);
                else
                    AddResourceChoice(p, choice);
            }

            // ARMY
            else if (e.type.Equals(Effect.TypeType.ARMY))
                AddScore(p, Score.ARMY, e.amount);

            // Manufactured Resource Trade
            else if (e.type.Equals(Effect.TypeType.MCOST))
                SetManufactedTrade(p);

            // Raw Resource Trade
            else if (e.type.Equals(Effect.TypeType.RCOSTEAST))
                SetRawTradeEast(p);
            else if (e.type.Equals(Effect.TypeType.RCOSTWEST))
                SetRawTradeWest(p);

            // SCIENCE
            else if (e.type.Equals(Effect.TypeType.COMPASS) || e.type.Equals(Effect.TypeType.TABLET) || e.type.Equals(Effect.TypeType.GEAR))
                AddScore(p, scienceType[e.type], e.amount);

            // ===== WONDER SPECIFIC =====
            // FREE BUILD - not finished *wild card --> can be done at anytime during an age
            else if (e.type.Equals(Effect.TypeType.FREEBUILD))
            {

            }

            // DISCARD - End of turn the stage was built and build a card from discard pile for free
            else if (e.type.Equals(Effect.TypeType.DISCARD))
            {

            }

            // Players should know their neighbours east and west
            e.PrintEffect();
        }