public Bibliotheca(LinkedList<string> xmlInvocations)
 {
     Invocations = new LinkedList<Invocation>();
     foreach (string xmlInvocation in xmlInvocations)
     {
         XmlDocument xmlDoc = new XmlDocument();
         xmlDoc.LoadXml(xmlInvocation);
         Invocation invocation = new Invocation(xmlDoc);
         Invocations.AddLast(invocation);
     }
 }
Example #2
0
 public Card initFromInvocation(Invocation InvTemp)
 {
     this.name = InvTemp.name;
     this.manaCost = InvTemp.manaCost;
     this.type = InvTemp.type[0];
     this.subtype = InvTemp.subType[0];
     this.powers = InvTemp.powers;
     this.castLimit = InvTemp.castLimit;
     this.card = InvTemp.getCard();
     if (this.type == Enums.Type.Elemental)
     {
         Elemental ElemTemp = new Elemental(this.name);
         ElemTemp = (Elemental)this;
         ElemTemp.strength = InvTemp.strength;
         ElemTemp.constitution = InvTemp.constitution;
         ElemTemp.hp = ElemTemp.constitution;
         ElemTemp.rank = InvTemp.rank;
         if (ElemTemp.rank > 0)
             ElemTemp.from = InvTemp.from;
         ElemTemp.role = InvTemp.role;
         ElemTemp.properties = InvTemp.properties;
         ElemTemp.onAppear = InvTemp.onAppear;
         ElemTemp.onDeath = InvTemp.onDeath;
         return ElemTemp;
     }
     if (this.type == Enums.Type.Spirit)
     {
         Spirit SpiritTemp = new Spirit(this.name);
         SpiritTemp = (Spirit)this;
         SpiritTemp.essence = InvTemp.essence;
         SpiritTemp.onAppear = InvTemp.onAppear;
         SpiritTemp.onDeath = InvTemp.onDeath;
         return SpiritTemp;
     }
     return this;
 }     
        public bool hasWeakness = true; // debolezza da evocazione.
        

        
        

        public Elemental initFromInv(Invocation invTemp)
        {
            Card cardTemp = base.initFromInvocation(invTemp);
            return (Elemental)cardTemp;
        }
 public Spirit initFromInv(Invocation invTemp)
 {
     Card cardTemp = base.initFromInvocation(invTemp);
     return (Spirit)cardTemp;
 }
 private bool containsType(Invocation inv,Enums.Filter param)
 {
     if (Enum.IsDefined(typeof(Enums.Type), param.ToString()))
         if (inv.type.Contains((Enums.Type)Enum.Parse(typeof(Enums.Type), param.ToString())))
             return true;
         return false;
 }
        public Card initFromInvocation(Invocation InvTemp)
        {
            if (InvTemp.type[0] == Enums.Type.Elemental)
            {
                Elemental card = new Elemental(InvTemp.name);
                card.name = (string)InvTemp.name.Clone();
                card.manaCost = new Dictionary<Enums.Mana, int>(InvTemp.manaCost);
                card.type = InvTemp.type[0];
                card.subtype = InvTemp.subType[0];
                card.powers = new List<Power>(InvTemp.powers);
                card.castLimit = InvTemp.castLimit;
                card.card = (string)InvTemp.getCard().Clone();

                card.strength = InvTemp.strength;
                card.constitution = InvTemp.constitution;
                card.hp = card.constitution;
                card.rank = InvTemp.rank;
                if (card.rank > 0)
                    card.from = (string)InvTemp.from.Clone();
                card.role = InvTemp.role;
                card.properties = new List<Enums.Properties>(InvTemp.properties);
                card.onAppear = new List<string>(InvTemp.onAppear);
                card.onDeath = new List<string>(InvTemp.onDeath);
                return card;
            }

            if (InvTemp.type[0] == Enums.Type.Ritual)
            {
                Ritual card = new Ritual(InvTemp.name);
                card.name = (string)InvTemp.name.Clone();
                card.manaCost = new Dictionary<Enums.Mana, int>(InvTemp.manaCost);
                card.type = InvTemp.type[0];
                card.subtype = InvTemp.subType[0];
                card.powers = new List<Power>(InvTemp.powers);
                card.castLimit = InvTemp.castLimit;
                card.card = (string)InvTemp.getCard().Clone();

                return card;
            }

            if (InvTemp.type[0] == Enums.Type.Spirit)
            {
                Spirit card = new Spirit(InvTemp.name);
                card.name = (string)InvTemp.name.Clone();
                card.manaCost = new Dictionary<Enums.Mana, int>(InvTemp.manaCost);
                card.type = InvTemp.type[0];
                card.subtype = InvTemp.subType[0];
                card.powers = new List<Power>(InvTemp.powers);
                card.castLimit = InvTemp.castLimit;
                card.card = (string)InvTemp.getCard().Clone();
                Spirit SpiritTemp = new Spirit(this.name);
                SpiritTemp.name = (string)InvTemp.name.Clone();
                SpiritTemp.manaCost = new Dictionary<Enums.Mana, int>(InvTemp.manaCost);
                SpiritTemp.type = InvTemp.type[0];
                SpiritTemp.subtype = InvTemp.subType[0];
                SpiritTemp.powers = new List<Power>(InvTemp.powers);
                SpiritTemp.castLimit = InvTemp.castLimit;
                SpiritTemp.card = InvTemp.getCard();
                SpiritTemp.essence = InvTemp.essence;
                SpiritTemp.onAppear = new List<string>(InvTemp.onAppear);
                SpiritTemp.onDeath = new List<string>(InvTemp.onDeath);
                return card;
            }

            return null;
        }