/// <summary> /// Constructor /// </summary> /// <param name="otherside">Name of the other side of this Wonder. Kind of useless</param> /// <param name="name">Name of the active side of the Wonder (e.g. "Giza (B)")</param> /// <param name="effect">This is the starting resource or effect that the Wonder Board provides</param> /// <param name="nStages">The number of stages this wonder has (1, 2, 3, 4)</param> public Board(ExpansionSet e, Wonder otherside, string name, CardId cardId, Effect boardEffect, int nStages) { this.expansionSet = e; this.otherSide = otherside; this.name = name; this.startingResourceCard = new Card(cardId, name, boardEffect); this.numOfStages = nStages; inPlay = false; }
public Card(string[] createParams) { expansion = (ExpansionSet)Enum.Parse(typeof(ExpansionSet), createParams[0]); strName = createParams[1]; structureType = (StructureType)Enum.Parse(typeof(StructureType), createParams[2]); if (structureType != StructureType.WonderStage) { age = int.Parse(createParams[3]); for (int i = 0, j = 6; i < numAvailableByNumPlayers.Length; ++i, ++j) numAvailableByNumPlayers[i] = int.Parse(createParams[j]); wonderStage = 0; } else { age = 0; wonderStage = int.Parse(createParams[22]); } Id = CardNameFromStringName(strName, wonderStage); description = createParams[4]; iconName = createParams[5]; cost = new Cost(createParams[11]); // Structure cost /* int.TryParse(createParams[11], out cost.coin); int.TryParse(createParams[12], out cost.wood); int.TryParse(createParams[13], out cost.stone); int.TryParse(createParams[14], out cost.clay); int.TryParse(createParams[15], out cost.ore); int.TryParse(createParams[16], out cost.cloth); int.TryParse(createParams[17], out cost.glass); int.TryParse(createParams[18], out cost.papyrus); */ // build chains (Cards that can be built for free in the following age) chain[0] = createParams[12]; chain[1] = createParams[13]; if (createParams[14] != string.Empty) { var effectType = (Effect.Type)Enum.Parse(typeof(Effect.Type), createParams[14]); switch (effectType) { case Effect.Type.Military: effect = new MilitaryEffect(int.Parse(createParams[15])); break; case Effect.Type.Resource: effect = new ResourceEffect(structureType == StructureType.RawMaterial || structureType == StructureType.Goods, createParams[16]); break; case Effect.Type.Science: effect = new ScienceEffect(createParams[17]); break; case Effect.Type.Commerce: effect = new CommercialDiscountEffect(); break; case Effect.Type.CoinsPoints: CoinsAndPointsEffect.CardsConsidered cardsConsidered = (CoinsAndPointsEffect.CardsConsidered) Enum.Parse(typeof(CoinsAndPointsEffect.CardsConsidered), createParams[18]); StructureType classConsidered = (StructureType)Enum.Parse(typeof(StructureType), createParams[19]); int coinsGranted = 0; int.TryParse(createParams[20], out coinsGranted); int pointsAwarded = 0; int.TryParse(createParams[21], out pointsAwarded); effect = new CoinsAndPointsEffect(cardsConsidered, classConsidered, coinsGranted, pointsAwarded); break; case Effect.Type.ScienceWild: effect = new ScienceWildEffect(); break; case Effect.Type.PlayACardForFreeOncePerAge: effect = new PlayACardForFreeOncePerAgeEffect(); break; // From the Leaders expansion pack case Effect.Type.FreeLeaders: // Roma (A) board effect: Maecenas effect effect = new FreeLeadersEffect(); break; case Effect.Type.StructureDiscount: effect = new StructureDiscountEffect((StructureType)Enum.Parse(typeof(StructureType), createParams[23])); break; // From the Cities expansion pack case Effect.Type.CopyScienceSymbolFromNeighbor: effect = new CopyScienceSymbolFromNeighborEffect(); break; case Effect.Type.LossOfCoins: LossOfCoinsEffect.LossCounter lc = (LossOfCoinsEffect.LossCounter)Enum.Parse(typeof(LossOfCoinsEffect.LossCounter), createParams[19]); effect = new LossOfCoinsEffect(lc, int.Parse(createParams[20]), int.Parse(createParams[21])); break; case Effect.Type.Diplomacy: effect = new DiplomacyEffect(int.Parse(createParams[21])); break; default: throw new Exception(string.Format("No effect class for this effect: {0}", effectType.ToString())); } } }