// generates a new card from the internal list of prototypes public BaseCard GetNewCard(int cid) { CardData c = cardPrototypes.Find((CardData cd) => cd.cid == cid); if (c == null) { throw new CardException("Cannot find card with id = " + cid); } else { BaseCard newCard; switch (c.type.ToLower()) { case "attack": newCard = new AttackCard(c); newCard.SetCardType(CardType.Attack); return(newCard); case "defend": case "defense": newCard = new DefendCard(c); newCard.SetCardType(CardType.Defend); return(newCard); case "counter": case "effect": newCard = new EffectCard(c); newCard.SetCardType(CardType.Effect); return(newCard); case "serve": newCard = new ServeCard(c); newCard.SetCardType(CardType.Serve); return(newCard); default: throw new CardException("Unknown card type with type = " + c.type); } } }
public AbilityEntity(int abilityId, string name, BattleCard from, BattleCard to, AbilityType abilityType, EffectCard effectCard, string targetAttr = null) : this() { castCard = from; targetCard = to; this.abilityType = abilityType; this.effectCard = effectCard; this.targetAttr = targetAttr; _id = abilityId; _name = name; }
public void ApplyEffectCardToUnit(EffectCard card, Unit unit) { unit.AddOrApplyPassiveEffects(card.Effects); RefreshUnitStats(unit); }