Example #1
0
        public static Card GetCard(int cardId, int ownerIndex)
        {
            CardModel behaviourModel = ModelDatabase.Find(x => x.Id == cardId);

            if (behaviourModel == null)
            {
                throw new BehaviourNotFoundException();
            }

            Card toInstantiate;

            if (!behaviourModel.IsSpell)
            {
                toInstantiate = new Card(
                    behaviourModel.Id,
                    behaviourModel.Health,
                    behaviourModel.Attack,
                    behaviourModel.Mana,
                    behaviourModel.IsTaunt,
                    behaviourModel.GetBattlecry(),
                    behaviourModel.GetDeathrattle(),
                    behaviourModel.PlayRequirements
                    );
            }
            else
            {
                toInstantiate = new Card(
                    behaviourModel.Id,
                    behaviourModel.Mana,
                    behaviourModel.GetBattlecry(),
                    behaviourModel.PlayRequirements
                    );
            }

            toInstantiate.AssignCard(ownerIndex);

            return(toInstantiate);
        }