public override Elemental attackElemental(Elemental targetElem) //attacca la creatura passata modifica lo stato dell'attaccante e del target e ritorn il target modificato.
 {
    //modifica stato Attaccante.
     if(!this.buff.Contains(Enums.Buff.Shield)) // controllo che non abbia shield, se no mi limito a rimuovere shield.
     {
         if (targetElem.properties.Contains(Enums.Properties.Thorns)) // controlla se il target ha Thorns.
         {
             foreach (Enums.Properties thorn in targetElem.properties)
                 if (thorn.Equals(Enums.Properties.Thorns))
                 {
                     if (this.properties.Contains(Enums.Properties.Armor) && !targetElem.properties.Contains(Enums.Properties.Penetrate))
                         this.properties.Remove(Enums.Properties.Armor);
                     else
                         this.hp -= 1;
                 } 
         }
         for (int dmg = 0; dmg < targetElem.strength; dmg++) // controlla se attaccante e target hanno armor. Se ce l'hanno scalano prima quella poi gli hp. 
             if (this.properties.Contains(Enums.Properties.Armor) && !targetElem.properties.Contains(Enums.Properties.Penetrate))
                 this.properties.Remove(Enums.Properties.Armor);
             else
                 this.hp -= 1;
     }   
     else
     {
         this.buff.Remove(Enums.Buff.Shield);
     }
     // modifica stato Target.
     if (!targetElem.buff.Contains(Enums.Buff.Shield)) // controllo che non abbia shield, altrimenti tolgo shield e ritorno il target.
     {
             for (int dmg = 0; dmg < this.strength; dmg++)
         {
             if (targetElem.properties.Contains(Enums.Properties.Armor) || targetElem.buff.Contains(Enums.Buff.Thunderborn) && !this.properties.Contains(Enums.Properties.Penetrate))
                 targetElem.properties.Remove(Enums.Properties.Armor);
             else
                 targetElem.hp -= 1;
         }
         if (this.properties.Contains(Enums.Properties.Thunderborn) && this.hasAttackedThunderborn == false)//controlla se l'attaccante ha Thunderborn e ne cambia il flag;
             this.hasAttackedThunderborn = true;
         else
             this.hasAttacked = true;
         return targetElem;
     }
     else
     {
         targetElem.buff.Remove(Enums.Buff.Shield);
         if (this.properties.Contains(Enums.Properties.Thunderborn) && this.hasAttackedThunderborn == false)
             this.hasAttackedThunderborn = true;
         else
             this.hasAttacked = true;
         return targetElem;
     }              
 }
Beispiel #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 override bool canAttackElem(Elemental targetElem, Player controller)
 {
     if (this.hasAttacked == false && !this.debuff.Contains(Enums.Debuff.Asleep)) // check se ha già attaccato o se è addormentato
     {
         if (this.properties.Contains(Enums.Properties.Quickness) || this.hasWeakness == false) //check se ha debolezza da evocazione o Quickness
         {
             if (!targetElem.properties.Contains(Enums.Properties.Guardian)) // se il target non ha Guardian, check su tutti gli elementali dell'opponent, per vedere se hanno Guardian.
                 foreach (Elemental elemTemp in controller.cardsOnBoard)
                 {
                     if (elemTemp.properties.Contains(Enums.Properties.Guardian))
                         return false;
                 }
             return true;
         }
     }
     return false;
 }
 public bool canUsePower(Elemental elemTemp)
 {
     return true;
 }
Beispiel #5
0
 public virtual bool canAttackElem(Elemental targetElem, Player controller)
 {
     return false;
 }
Beispiel #6
0
 public virtual Elemental attackElemental(Elemental targetElem)
 {
     return null;
 }
 public override bool canAttackElem(Elemental targetElem, Player controller)
 {
     if(this.canAttack())
     {
         if (!targetElem.properties.Contains(Enums.Properties.Guardian)) // se il target non ha Guardian, check su tutti gli elementali dell'opponent, per vedere se hanno Guardian.
             foreach (Elemental elemTemp in controller.cardsOnBoard)
                 {
                     if (elemTemp.properties.Contains(Enums.Properties.Guardian))
                         return false;
                 }
             return true;
     }
     return false;
 }
 public static void UpdateCommElemental(Elemental elemTemp) // incapsula UpdCommElem. (accessibilità)
 {
     Game.getInstance().comm.UpdateElemental(elemTemp);
 }
        public void UpdateElemental(Elemental ele)
        {
            int indShaman = 0;
            int indOppo = 0;
            foreach (Elemental eleTemp in shaman.cardsOnBoard)
            {
                if (eleTemp.id == ele.id)
                {
                    shaman.cardsOnBoard.RemoveAt(indShaman);
                    shaman.cardsOnBoard.Insert(0, ele);
                    break;
                }
                indShaman += 1;

            }
            foreach (Elemental eleTemp in opponent.cardsOnBoard)
            {
                if (eleTemp.id == ele.id)
                {
                    opponent.cardsOnBoard.RemoveAt(indOppo);
                    opponent.cardsOnBoard.Insert(0, ele);
                    break;
                }
                indOppo += 1;
            }


            //Da ricontrollare se va' bene qui
            if (ele.hp < 1)
                RemoveCardById(ele.id);

        }
        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;
        }