Beispiel #1
0
        internal void switchCanAttack(MonsterCard toSwitch)
        {
            IList <MonsterCard> toSet = m_meReadOnly.getFaceUpMonstersInMonsterZone();
            int index = toSet.IndexOf(toSwitch);

            toSwitch.setCanAttack(false);
            toSet[index] = toSwitch;
            m_meReadOnly.setFaceUpMonstersInMonsterZone(toSet);
        }
Beispiel #2
0
 internal Result RequestAttackOnFaceDownCard(int idOfAttacker, MonsterCard attackingCard, Mode m)
 {
     if (player1.id == idOfAttacker && playerWhosTurnItIs == 1)
     {
         IList <MonsterCard> p2cards  = player2.getFaceDownCardsInMonsterZone();
         MonsterCard         toAttack = null;
         int i = 0;
         while (toAttack == null && i < p2cards.Count)
         {
             if (p2cards[i].getBattlePosition() == m)
             {
                 toAttack = p2cards[i];
             }
         }
         if (toAttack != null)
         {
             return(RequestAttack(idOfAttacker, attackingCard, toAttack));
         }
         else
         {
             return(Result.InvalidMove);
         }
     }
     else if (player1.id == idOfAttacker && playerWhosTurnItIs == 2)
     {
         return(Result.NotYourTurn);
     }
     else if (player2.id == idOfAttacker && playerWhosTurnItIs == 2)
     {
         IList <MonsterCard> p1cards  = player1.getFaceDownCardsInMonsterZone();
         MonsterCard         toAttack = null;
         int i = 0;
         while (toAttack == null && i < p1cards.Count)
         {
             if (p1cards[i].getBattlePosition() == m)
             {
                 toAttack = p1cards[i];
             }
         }
         if (toAttack != null)
         {
             return(RequestAttack(idOfAttacker, attackingCard, toAttack));
         }
         else
         {
             return(Result.InvalidMove);
         }
     }
     else if (player2.id == idOfAttacker && playerWhosTurnItIs == 1)
     {
         return(Result.NotYourTurn);
     }
     else
     {
         return(Result.InvalidMove);
     }
 }
Beispiel #3
0
 internal void switchFaceDownToFaceUp(MonsterCard toSwitch)
 {
     if (faceDownCardsInMonsterZone.Contains(toSwitch))
     {
         faceDownCardsInMonsterZone.Remove(toSwitch);
         IList <MonsterCard> toSet = m_meReadOnly.getFaceUpMonstersInMonsterZone();
         toSet.Add(toSwitch);
         m_meReadOnly.setFaceUpMonstersInMonsterZone(toSet);
         m_meReadOnly.setNumberOfFaceDownCardsInMonsterZone(m_meReadOnly.getNumberOfFaceDownCardsInMonsterZone() - 1);
     }
 }
Beispiel #4
0
        public string TryEquip(Object EquipableCard, string nameOfCardToEquipTo)
        {
            bool found = false;

            if (hand.Contains(EquipableCard))
            {
                for (int i = 0; i < faceDownCardsInMonsterZone.Count && !found; i++)
                {
                    if (faceDownCardsInMonsterZone[i].getName().Equals(nameOfCardToEquipTo))
                    {
                        MonsterCard equippingTo = faceDownCardsInMonsterZone[i];
                        found = true;
                        Game.Result r = myCurrentGame.RequestEquip(id, EquipableCard, ref equippingTo);
                        if (r == Game.Result.Success)
                        {
                            faceDownCardsInMonsterZone[i] = equippingTo;
                            SendToGraveYard(EquipableCard, Zone.Hand);
                            return("");
                        }
                        else
                        {
                            return(r.ToString());
                        }
                    }
                }
                IList <MonsterCard> faceUpMonsters = m_meReadOnly.getFaceUpMonstersInMonsterZone();
                for (int i = 0; i < faceUpMonsters.Count && !found; i++)
                {
                    if (faceUpMonsters[i].getName().Equals(nameOfCardToEquipTo))
                    {
                        found = true;
                        MonsterCard equippingTo = faceUpMonsters[i];
                        Game.Result r           = myCurrentGame.RequestEquip(id, EquipableCard, ref equippingTo);
                        if (r == Game.Result.Success)
                        {
                            faceUpMonsters[i] = equippingTo;
                            m_meReadOnly.setFaceUpMonstersInMonsterZone(faceUpMonsters);
                            SendToGraveYard(EquipableCard, Zone.Hand);
                            return("");
                        }
                        else
                        {
                            return(r.ToString());
                        }
                    }
                }
                return("Failed to find card");
            }
            else
            {
                return("Equipable Card not in hand anymore.");
            }
        }
Beispiel #5
0
 public string Sacrifice(MonsterCard toSacrifice)
 {
     Game.Result r = myCurrentGame.RequestSacrifice(id, toSacrifice);
     if (r.Equals(Game.Result.Success))
     {
         return("");
     }
     else
     {
         return(r.ToString());
     }
 }
Beispiel #6
0
 public string AttackFaceUpOpponent(MonsterCard attackingCard, MonsterCard defendingCard)
 {
     Game.Result r = myCurrentGame.RequestAttack(id, attackingCard, defendingCard);
     if (r.Equals(Game.Result.Success))
     {
         return("");
     }
     else
     {
         return(r.ToString());
     }
 }
Beispiel #7
0
 public string AttackFaceDownOpponent(MonsterCard attackingCard, Mode faceDownCardsMode)
 {
     Game.Result r = myCurrentGame.RequestAttackOnFaceDownCard(id, attackingCard, faceDownCardsMode);
     if (r.Equals(Game.Result.Success))
     {
         return("");
     }
     else
     {
         return(r.ToString());
     }
 }
Beispiel #8
0
 public string AttackLifePoints(MonsterCard attackingCard)
 {
     Game.Result r = myCurrentGame.RequestAttackLifePoints(id, attackingCard);
     if (r.Equals(Game.Result.Success))
     {
         return("");
     }
     else
     {
         return(r.ToString());
     }
 }
Beispiel #9
0
 /// <summary>
 /// Asks the game to change the mode of the card (to attack mode or defense mode).
 /// </summary>
 /// <param name="toChangeModeOf">to change to attack mode or defense mode</param>
 /// <returns>"" if successful. Error message if Error</returns>
 public string ChangeModeOfCard(MonsterCard toChangeModeOf)
 {
     Game.Result r = myCurrentGame.RequestChangeModeOfCard(id, toChangeModeOf);
     if (r.Equals(Game.Result.Success))
     {
         return("");
     }
     else
     {
         return(r.ToString());
     }
 }
Beispiel #10
0
 internal Result RequestFissure(int id)
 {
     if (player1.id == id && playerWhosTurnItIs == 1)
     {
         int                 lowestAttack   = int.MaxValue;
         MonsterCard         toDestroy      = null;
         IList <MonsterCard> faceUpMonsters = player2.getFaceUpMonstersInMonsterZone();
         foreach (MonsterCard c in faceUpMonsters)
         {
             if (c.getAttackPoints() < lowestAttack)
             {
                 lowestAttack = c.getAttackPoints();
                 toDestroy    = c;
             }
         }
         if (toDestroy != null)
         {
             player2.SendToGraveYard(toDestroy, Zone.Monster);
         }
         return(Result.Success);
     }
     else if (player1.id == id && playerWhosTurnItIs == 2)
     {
         return(Result.NotYourTurn);
     }
     else if (player2.id == id && playerWhosTurnItIs == 2)
     {
         int                 lowestAttack   = int.MaxValue;
         MonsterCard         toDestroy      = null;
         IList <MonsterCard> faceUpMonsters = player1.getFaceUpMonstersInMonsterZone();
         foreach (MonsterCard c in faceUpMonsters)
         {
             if (c.getAttackPoints() < lowestAttack)
             {
                 lowestAttack = c.getAttackPoints();
                 toDestroy    = c;
             }
         }
         if (toDestroy != null)
         {
             player1.SendToGraveYard(toDestroy, Zone.Monster);
         }
         return(Result.Success);
     }
     else if (player2.id == id && playerWhosTurnItIs == 1)
     {
         return(Result.NotYourTurn);
     }
     else
     {
         return(Result.InvalidMove);
     }
 }
Beispiel #11
0
 /// <summary>
 /// Called by the Game class to actually change the mode of the card (to attack mode or defense mode).
 /// </summary>
 /// <param name="toChangeModeOf">to change to attack mode or defense mode</param>
 internal void GameChangeModeOfCard(MonsterCard toChangeModeOf)
 {
     if (faceDownCardsInMonsterZone.Contains(toChangeModeOf))
     {
         int index = faceDownCardsInMonsterZone.IndexOf(toChangeModeOf);
         toChangeModeOf.ChangeBattlePosition();
         faceDownCardsInMonsterZone[index] = toChangeModeOf;
     }
     else if (m_meReadOnly.getFaceUpMonstersInMonsterZone().Contains(toChangeModeOf))
     {
         IList <MonsterCard> faceUps = m_meReadOnly.getFaceUpMonstersInMonsterZone();
         int index = faceUps.IndexOf(toChangeModeOf);
         toChangeModeOf.ChangeBattlePosition();
         faceUps[index] = toChangeModeOf;
         m_meReadOnly.setFaceUpMonstersInMonsterZone(faceUps);
     }
 }
Beispiel #12
0
 internal Result RequestSacrifice(int idOfAttacker, MonsterCard toSacrifice)
 {
     if (player1.id == idOfAttacker && playerWhosTurnItIs == 1)
     {
         player1.SendToGraveYard(toSacrifice, Zone.Monster);
         if (sacrifices == 0)
         {
             sacrifices = 2;
         }
         else
         {
             sacrifices = 10;
         }
         return(Result.Success);
     }
     else if (player1.id == idOfAttacker && playerWhosTurnItIs == 2)
     {
         return(Result.NotYourTurn);
     }
     else if (player2.id == idOfAttacker && playerWhosTurnItIs == 2)
     {
         player2.SendToGraveYard(toSacrifice, Zone.Monster);
         if (sacrifices == 0)
         {
             sacrifices = 2;
         }
         else
         {
             sacrifices = 10;
         }
         return(Result.Success);
     }
     else if (player2.id == idOfAttacker && playerWhosTurnItIs == 1)
     {
         return(Result.NotYourTurn);
     }
     else
     {
         return(Result.InvalidMove);
     }
 }
Beispiel #13
0
 internal Result RequestChangeModeOfCard(int idOfAttacker, MonsterCard toChangeModeOf)
 {
     if (toChangeModeOf.CanAttack())
     {
         if (player1.id == idOfAttacker && playerWhosTurnItIs == 1)
         {
             if (playerTwoTrapHoleEnabled && !toChangeModeOf.getIsFlipped() && toChangeModeOf.getAttackPoints() > 999)
             {
                 player1.SendToGraveYard(toChangeModeOf, Zone.Monster);
                 IList <SpellAndTrapCard> spellsAndTrapsP2 = player2.getFaceDownCardsInSpellAndTrapZone();
                 for (int i = 0; i < spellsAndTrapsP2.Count; i++)
                 {
                     if (spellsAndTrapsP2[i].getName().ToUpper() == "TRAP HOLE")
                     {
                         SpellAndTrapCard stc = spellsAndTrapsP2[i];
                         player2.SendToGraveYard(stc, Zone.SpellTrap);
                         break;
                     }
                 }
             }
             else
             {
                 player1.GameChangeModeOfCard(toChangeModeOf);
             }
             return(Result.Success);
         }
         else if (player1.id == idOfAttacker && playerWhosTurnItIs == 2)
         {
             return(Result.NotYourTurn);
         }
         else if (player2.id == idOfAttacker && playerWhosTurnItIs == 2)
         {
             if (playerOneTrapHoleEnabled && !toChangeModeOf.getIsFlipped() && toChangeModeOf.getAttackPoints() > 999)
             {
                 player2.SendToGraveYard(toChangeModeOf, Zone.Monster);
                 IList <SpellAndTrapCard> spellsAndTrapsP1 = player1.getFaceDownCardsInSpellAndTrapZone();
                 for (int i = 0; i < spellsAndTrapsP1.Count; i++)
                 {
                     if (spellsAndTrapsP1[i].getName().ToUpper() == "TRAP HOLE")
                     {
                         SpellAndTrapCard stc = spellsAndTrapsP1[i];
                         player1.SendToGraveYard(stc, Zone.SpellTrap);
                         break;
                     }
                 }
             }
             else
             {
                 player2.GameChangeModeOfCard(toChangeModeOf);
             }
             return(Result.Success);
         }
         else if (player2.id == idOfAttacker && playerWhosTurnItIs == 1)
         {
             return(Result.NotYourTurn);
         }
         else
         {
             return(Result.InvalidMove);
         }
     }
     else
     {
         return(Result.CantAttackBcAlreadyAttackedOrFirstTurnPlayed);
     }
 }
Beispiel #14
0
 internal Result RequestAttackLifePoints(int idOfAttacker, MonsterCard attackingCard)
 {
     if (player1.id == idOfAttacker && playerWhosTurnItIs == 1)
     {
         if (attackingCard.CanAttack())
         {
             if (player2.getFaceDownCardsInMonsterZone().Count == 0 && player2.getFaceUpCardsInSpellAndTrapZone().Count == 0)
             {
                 if (player1.getFaceUpMonstersInMonsterZone().Contains(attackingCard) || player1.getFaceDownCardsInMonsterZone().Contains(attackingCard))
                 {
                     player1.switchFaceDownToFaceUp(attackingCard);
                     player2.setLifePoints(player2.getLifePoints() - attackingCard.getAttackPoints());
                     return(Result.Success);
                 }
                 else
                 {
                     return(Result.OneOrMoreCardsAreNoLongerOnField);
                 }
             }
             else
             {
                 return(Result.OpponentHasMonstersSoCannotTargetLifePoints);
             }
         }
         else
         {
             return(Result.CantAttackBcAlreadyAttackedOrFirstTurnPlayed);
         }
     }
     else if (player1.id == idOfAttacker && playerWhosTurnItIs == 2)
     {
         return(Result.NotYourTurn);
     }
     else if (player2.id == idOfAttacker && playerWhosTurnItIs == 2)
     {
         if (attackingCard.CanAttack())
         {
             if (player1.getFaceDownCardsInMonsterZone().Count == 0 && player1.getFaceUpCardsInSpellAndTrapZone().Count == 0)
             {
                 if (player2.getFaceUpMonstersInMonsterZone().Contains(attackingCard) || player2.getFaceDownCardsInMonsterZone().Contains(attackingCard))
                 {
                     player2.switchFaceDownToFaceUp(attackingCard);
                     player1.setLifePoints(player1.getLifePoints() - attackingCard.getAttackPoints());
                     return(Result.Success);
                 }
                 else
                 {
                     return(Result.OneOrMoreCardsAreNoLongerOnField);
                 }
             }
             else
             {
                 return(Result.OpponentHasMonstersSoCannotTargetLifePoints);
             }
         }
         else
         {
             return(Result.CantAttackBcAlreadyAttackedOrFirstTurnPlayed);
         }
     }
     else if (player2.id == idOfAttacker && playerWhosTurnItIs == 1)
     {
         return(Result.NotYourTurn);
     }
     else
     {
         return(Result.InvalidMove);
     }
 }
Beispiel #15
0
 internal Result RequestAttack(int idOfAttacker, MonsterCard attackingCard, MonsterCard defendingCard)
 {
     if (player1.id == idOfAttacker && playerWhosTurnItIs == 1)
     {
         if ((player1.getFaceDownCardsInMonsterZone().Contains(attackingCard) || player1.getFaceUpMonstersInMonsterZone().Contains(attackingCard)) && (player2.getFaceDownCardsInMonsterZone().Contains(defendingCard) || player2.getFaceUpMonstersInMonsterZone().Contains(defendingCard)))
         {
             if (attackingCard.CanAttack())
             {
                 player1.switchFaceDownToFaceUp(attackingCard);
                 player2.switchFaceDownToFaceUp(defendingCard);
                 if (attackingCard.getBattlePosition() == Mode.Attack)
                 {
                     int attackingWith = attackingCard.getAttackPoints();
                     int defendingWith = 0;
                     if (defendingCard.getBattlePosition() == Mode.Attack)
                     {
                         defendingWith = defendingCard.getAttackPoints();
                         if (attackingWith > defendingWith)
                         {
                             int toTakeOffLifePoints = attackingWith - defendingWith;
                             player2.SendToGraveYard(defendingCard as object, Zone.Monster);
                             player2.setLifePoints(player2.getLifePoints() - toTakeOffLifePoints);
                         }
                         else if (attackingWith == defendingWith)
                         {
                             player1.SendToGraveYard(attackingCard as object, Zone.Monster);
                             player2.SendToGraveYard(defendingCard as object, Zone.Monster);
                         }
                         else
                         {
                             int toTakeOffLifePoints = defendingWith - attackingWith;
                             player1.SendToGraveYard(attackingCard as object, Zone.Monster);
                             player1.setLifePoints(player1.getLifePoints() - toTakeOffLifePoints);
                         }
                         player1.switchCanAttack(attackingCard);
                         return(Result.Success);
                     }
                     else
                     {
                         defendingWith = defendingCard.getDefensePoints();
                         if (attackingWith > defendingWith)
                         {
                             player2.SendToGraveYard(defendingCard as object, Zone.Monster);
                         }
                         else if (attackingWith == defendingWith)
                         {
                         }
                         else
                         {
                             int toTakeOffLifePoints = defendingWith - attackingWith;
                             player1.setLifePoints(player1.getLifePoints() - toTakeOffLifePoints);
                         }
                         player1.switchCanAttack(attackingCard);
                         return(Result.Success);
                     }
                 }
                 else
                 {
                     RequestChangeModeOfCard(idOfAttacker, attackingCard);
                     if (player1.getFaceUpMonstersInMonsterZone().Contains(attackingCard))
                     {
                         int attackingWith = attackingCard.getAttackPoints();
                         int defendingWith = 0;
                         if (defendingCard.getBattlePosition() == Mode.Attack)
                         {
                             defendingWith = defendingCard.getAttackPoints();
                             if (attackingWith > defendingWith)
                             {
                                 int toTakeOffLifePoints = attackingWith - defendingWith;
                                 player2.SendToGraveYard(defendingCard as object, Zone.Monster);
                                 player2.setLifePoints(player2.getLifePoints() - toTakeOffLifePoints);
                             }
                             else if (attackingWith == defendingWith)
                             {
                                 player1.SendToGraveYard(attackingCard as object, Zone.Monster);
                                 player2.SendToGraveYard(defendingCard as object, Zone.Monster);
                             }
                             else
                             {
                                 int toTakeOffLifePoints = defendingWith - attackingWith;
                                 player1.SendToGraveYard(attackingCard as object, Zone.Monster);
                                 player1.setLifePoints(player1.getLifePoints() - toTakeOffLifePoints);
                             }
                             player1.switchCanAttack(attackingCard);
                             return(Result.Success);
                         }
                         else
                         {
                             defendingWith = defendingCard.getDefensePoints();
                             if (attackingWith > defendingWith)
                             {
                                 player2.SendToGraveYard(defendingCard as object, Zone.Monster);
                             }
                             else if (attackingWith == defendingWith)
                             {
                             }
                             else
                             {
                                 int toTakeOffLifePoints = defendingWith - attackingWith;
                                 player1.setLifePoints(player1.getLifePoints() - toTakeOffLifePoints);
                             }
                             player1.switchCanAttack(attackingCard);
                             return(Result.Success);
                         }
                     }
                     else
                     {
                         return(Result.OneOrMoreCardsAreNoLongerOnField);
                     }
                 }
             }
             else
             {
                 return(Result.CantAttackBcAlreadyAttackedOrFirstTurnPlayed);
             }
         }
         else
         {
             return(Result.OneOrMoreCardsAreNoLongerOnField);
         }
     }
     else if (player1.id == idOfAttacker && playerWhosTurnItIs == 2)
     {
         return(Result.NotYourTurn);
     }
     else if (player2.id == idOfAttacker && playerWhosTurnItIs == 2)
     {
         if ((player2.getFaceDownCardsInMonsterZone().Contains(attackingCard) || player2.getFaceUpMonstersInMonsterZone().Contains(attackingCard)) && (player1.getFaceDownCardsInMonsterZone().Contains(defendingCard) || player1.getFaceUpMonstersInMonsterZone().Contains(defendingCard)))
         {
             if (attackingCard.CanAttack())
             {
                 if (attackingCard.getBattlePosition() == Mode.Attack)
                 {
                     int attackingWith = attackingCard.getAttackPoints();
                     int defendingWith = 0;
                     if (defendingCard.getBattlePosition() == Mode.Attack)
                     {
                         defendingWith = defendingCard.getAttackPoints();
                         if (attackingWith > defendingWith)
                         {
                             int toTakeOffLifePoints = attackingWith - defendingWith;
                             player1.SendToGraveYard(defendingCard as object, Zone.Monster);
                             player1.setLifePoints(player1.getLifePoints() - toTakeOffLifePoints);
                         }
                         else if (attackingWith == defendingWith)
                         {
                             player2.SendToGraveYard(attackingCard as object, Zone.Monster);
                             player1.SendToGraveYard(defendingCard as object, Zone.Monster);
                         }
                         else
                         {
                             int toTakeOffLifePoints = defendingWith - attackingWith;
                             player2.SendToGraveYard(attackingCard as object, Zone.Monster);
                             player2.setLifePoints(player1.getLifePoints() - toTakeOffLifePoints);
                         }
                         player2.switchFaceDownToFaceUp(attackingCard);
                         player1.switchFaceDownToFaceUp(defendingCard);
                         return(Result.Success);
                     }
                     else
                     {
                         defendingWith = defendingCard.getDefensePoints();
                         if (attackingWith > defendingWith)
                         {
                             player1.SendToGraveYard(defendingCard as object, Zone.Monster);
                         }
                         else if (attackingWith == defendingWith)
                         {
                         }
                         else
                         {
                             int toTakeOffLifePoints = defendingWith - attackingWith;
                             player2.setLifePoints(player2.getLifePoints() - toTakeOffLifePoints);
                         }
                         player2.switchFaceDownToFaceUp(attackingCard);
                         player1.switchFaceDownToFaceUp(defendingCard);
                         return(Result.Success);
                     }
                 }
                 else
                 {
                     RequestChangeModeOfCard(idOfAttacker, attackingCard);
                     if (player1.getFaceUpMonstersInMonsterZone().Contains(attackingCard))
                     {
                         int attackingWith = attackingCard.getAttackPoints();
                         int defendingWith = 0;
                         if (defendingCard.getBattlePosition() == Mode.Attack)
                         {
                             defendingWith = defendingCard.getAttackPoints();
                             if (attackingWith > defendingWith)
                             {
                                 int toTakeOffLifePoints = attackingWith - defendingWith;
                                 player1.SendToGraveYard(defendingCard as object, Zone.Monster);
                                 player1.setLifePoints(player1.getLifePoints() - toTakeOffLifePoints);
                             }
                             else if (attackingWith == defendingWith)
                             {
                                 player2.SendToGraveYard(attackingCard as object, Zone.Monster);
                                 player1.SendToGraveYard(defendingCard as object, Zone.Monster);
                             }
                             else
                             {
                                 int toTakeOffLifePoints = defendingWith - attackingWith;
                                 player2.SendToGraveYard(attackingCard as object, Zone.Monster);
                                 player2.setLifePoints(player1.getLifePoints() - toTakeOffLifePoints);
                             }
                             player2.switchFaceDownToFaceUp(attackingCard);
                             player1.switchFaceDownToFaceUp(defendingCard);
                             return(Result.Success);
                         }
                         else
                         {
                             defendingWith = defendingCard.getDefensePoints();
                             if (attackingWith > defendingWith)
                             {
                                 player1.SendToGraveYard(defendingCard as object, Zone.Monster);
                             }
                             else if (attackingWith == defendingWith)
                             {
                             }
                             else
                             {
                                 int toTakeOffLifePoints = defendingWith - attackingWith;
                                 player2.setLifePoints(player2.getLifePoints() - toTakeOffLifePoints);
                             }
                             player2.switchFaceDownToFaceUp(attackingCard);
                             player1.switchFaceDownToFaceUp(defendingCard);
                             return(Result.Success);
                         }
                     }
                     else
                     {
                         return(Result.OneOrMoreCardsAreNoLongerOnField);
                     }
                 }
             }
             else
             {
                 return(Result.CantAttackBcAlreadyAttackedOrFirstTurnPlayed);
             }
         }
         else
         {
             return(Result.OneOrMoreCardsAreNoLongerOnField);
         }
     }
     else if (player2.id == idOfAttacker && playerWhosTurnItIs == 1)
     {
         return(Result.NotYourTurn);
     }
     else
     {
         return(Result.InvalidMove);
     }
 }
Beispiel #16
0
 internal Result RequestEquip(int id, object equipableCard, ref MonsterCard monsterCard)
 {
     if (player1.id == id && playerWhosTurnItIs == 1 && equipableCard is SpellAndTrapCard)
     {
         SpellAndTrapCard stc = equipableCard as SpellAndTrapCard;
         if (stc.getName() == "Legendary Sword")
         {
             if (monsterCard.getYuGhiOhType().ToUpper().Contains("WARRIOR"))
             {
                 monsterCard.setAttackPoints(monsterCard.getAttackPoints() + 300);
                 monsterCard.setDefensePoints(monsterCard.getDefensePoints() + 300);
             }
             else
             {
                 return(Result.IneligibleMonsterType);
             }
         }
         else if (stc.getName() == "Beast Fangs")
         {
             if (monsterCard.getYuGhiOhType().ToUpper().Contains("BEAST"))
             {
                 monsterCard.setAttackPoints(monsterCard.getAttackPoints() + 300);
                 monsterCard.setDefensePoints(monsterCard.getDefensePoints() + 300);
             }
             else
             {
                 return(Result.IneligibleMonsterType);
             }
         }
         else if (stc.getName() == "Violet Crystal")
         {
             if (monsterCard.getYuGhiOhType().ToUpper().Contains("ZOMBIE"))
             {
                 monsterCard.setAttackPoints(monsterCard.getAttackPoints() + 300);
                 monsterCard.setDefensePoints(monsterCard.getDefensePoints() + 300);
             }
             else
             {
                 return(Result.IneligibleMonsterType);
             }
         }
         else if (stc.getName() == "Book of Secret Arts")
         {
             if (monsterCard.getYuGhiOhType().ToUpper().Contains("SPELLCASTER"))
             {
                 monsterCard.setAttackPoints(monsterCard.getAttackPoints() + 300);
                 monsterCard.setDefensePoints(monsterCard.getDefensePoints() + 300);
             }
             else
             {
                 return(Result.IneligibleMonsterType);
             }
         }
         else if (stc.getName() == "Power of Kaishin")
         {
             if (monsterCard.getYuGhiOhType().ToUpper().Contains("AQUA"))
             {
                 monsterCard.setAttackPoints(monsterCard.getAttackPoints() + 300);
                 monsterCard.setDefensePoints(monsterCard.getDefensePoints() + 300);
             }
             else
             {
                 return(Result.IneligibleMonsterType);
             }
         }
         else
         {
             return(Result.InvalidMove);
         }
         return(Result.Success);
     }
     else if (player1.id == id && playerWhosTurnItIs == 2)
     {
         return(Result.NotYourTurn);
     }
     else if (player2.id == id && playerWhosTurnItIs == 2)
     {
         SpellAndTrapCard stc = equipableCard as SpellAndTrapCard;
         if (stc.getName() == "Legendary Sword")
         {
             if (monsterCard.getYuGhiOhType().ToUpper().Contains("WARRIOR"))
             {
                 monsterCard.setAttackPoints(monsterCard.getAttackPoints() + 300);
                 monsterCard.setDefensePoints(monsterCard.getDefensePoints() + 300);
             }
             else
             {
                 return(Result.IneligibleMonsterType);
             }
         }
         else if (stc.getName() == "Beast Fangs")
         {
             if (monsterCard.getYuGhiOhType().ToUpper().Contains("BEAST"))
             {
                 monsterCard.setAttackPoints(monsterCard.getAttackPoints() + 300);
                 monsterCard.setDefensePoints(monsterCard.getDefensePoints() + 300);
             }
             else
             {
                 return(Result.IneligibleMonsterType);
             }
         }
         else if (stc.getName() == "Violet Crystal")
         {
             if (monsterCard.getYuGhiOhType().ToUpper().Contains("ZOMBIE"))
             {
                 monsterCard.setAttackPoints(monsterCard.getAttackPoints() + 300);
                 monsterCard.setDefensePoints(monsterCard.getDefensePoints() + 300);
             }
             else
             {
                 return(Result.IneligibleMonsterType);
             }
         }
         else if (stc.getName() == "Book of Secret Arts")
         {
             if (monsterCard.getYuGhiOhType().ToUpper().Contains("SPELLCASTER"))
             {
                 monsterCard.setAttackPoints(monsterCard.getAttackPoints() + 300);
                 monsterCard.setDefensePoints(monsterCard.getDefensePoints() + 300);
             }
             else
             {
                 return(Result.IneligibleMonsterType);
             }
         }
         else if (stc.getName() == "Power of Kaishin")
         {
             if (monsterCard.getYuGhiOhType().ToUpper().Contains("AQUA"))
             {
                 monsterCard.setAttackPoints(monsterCard.getAttackPoints() + 300);
                 monsterCard.setDefensePoints(monsterCard.getDefensePoints() + 300);
             }
             else
             {
                 return(Result.IneligibleMonsterType);
             }
         }
         else
         {
             return(Result.InvalidMove);
         }
         return(Result.Success);
     }
     else if (player2.id == id && playerWhosTurnItIs == 1)
     {
         return(Result.NotYourTurn);
     }
     else
     {
         return(Result.InvalidMove);
     }
 }
        private async Task <bool> LoadAllPossibleCardsAsync()
        {
            try
            {
                var    names        = this.GetType().GetTypeInfo().Assembly.GetManifestResourceNames();
                string databasePath = "";
                string imagePath    = "";
                foreach (string n in names)
                {
                    if (n.Contains("Database"))
                    {
                        databasePath = n;
                        break;
                    }
                }
                foreach (string n in names)
                {
                    if (n.Contains("Images"))
                    {
                        //Truncate the .jpg
                        imagePath = n.Substring(0, n.LastIndexOf("."));
                        //Truncate the actual file name we only want the path.
                        imagePath = imagePath.Substring(0, imagePath.LastIndexOf(".") + 1);
                        break;
                    }
                }
                string allLines = "";
                using (StreamReader sr = new StreamReader(this.GetType().GetTypeInfo().Assembly.GetManifestResourceStream(databasePath)))
                {
                    allLines = sr.ReadToEnd();
                }
                string[] splitIntoIndividualLines = allLines.Split('\n');
                for (int i = 1; i < splitIntoIndividualLines.Length; i++)
                {
                    string[]    split    = splitIntoIndividualLines[i].Split(',');
                    Object      c        = new Object();
                    BitmapImage bi       = new BitmapImage();
                    var         assembly = this.GetType().GetTypeInfo().Assembly;

                    using (var imageStream = assembly.GetManifestResourceStream(imagePath + split[14]))
                        using (var memStream = new MemoryStream())
                        {
                            await imageStream.CopyToAsync(memStream);

                            memStream.Position = 0;

                            using (var raStream = memStream.AsRandomAccessStream())
                            {
                                bi.SetSource(raStream);
                            }
                        }
                    if (split[2] == "Spell")
                    {
                        if (split[3] == "Continuous")
                        {
                            c = new SpellAndTrapCard(split[0], CardAttributeOrType.Spell, Icon.Continuous, split[6], long.Parse(split[7]), bi);
                        }
                        else if (split[3] == "Counter")
                        {
                            c = new SpellAndTrapCard(split[0], CardAttributeOrType.Spell, Icon.Counter, split[6], long.Parse(split[7]), bi);
                        }
                        else if (split[3] == "Equip")
                        {
                            string s  = split[0];
                            string s1 = split[6];
                            string s2 = split[7];
                            c = new SpellAndTrapCard(split[0], CardAttributeOrType.Spell, Icon.Equip, split[6], long.Parse(split[7]), bi);
                        }
                        else if (split[3] == "Field")
                        {
                            c = new SpellAndTrapCard(split[0], CardAttributeOrType.Spell, Icon.Field, split[6], long.Parse(split[7]), bi);
                        }
                        else if (split[3] == "QuickPlay")
                        {
                            c = new SpellAndTrapCard(split[0], CardAttributeOrType.Spell, Icon.QuickPlay, split[6], long.Parse(split[7]), bi);
                        }
                        else if (split[3] == "Ritual")
                        {
                            c = new SpellAndTrapCard(split[0], CardAttributeOrType.Spell, Icon.Ritual, split[6], long.Parse(split[7]), bi);
                        }
                        else
                        {
                            c = new SpellAndTrapCard(split[0], CardAttributeOrType.Spell, Icon.Normal, split[6], long.Parse(split[7]), bi);
                        }
                    }
                    else if (split[2] == "Trap")
                    {
                        if (split[3] == "Continuous")
                        {
                            c = new SpellAndTrapCard(split[0], CardAttributeOrType.Trap, Icon.Continuous, split[6], long.Parse(split[7]), bi);
                        }
                        else if (split[3] == "Counter")
                        {
                            c = new SpellAndTrapCard(split[0], CardAttributeOrType.Trap, Icon.Counter, split[6], long.Parse(split[7]), bi);
                        }
                        else if (split[3] == "Equip")
                        {
                            c = new SpellAndTrapCard(split[0], CardAttributeOrType.Trap, Icon.Equip, split[6], long.Parse(split[7]), bi);
                        }
                        else if (split[3] == "Field")
                        {
                            c = new SpellAndTrapCard(split[0], CardAttributeOrType.Trap, Icon.Field, split[6], long.Parse(split[7]), bi);
                        }
                        else if (split[3] == "QuickPlay")
                        {
                            c = new SpellAndTrapCard(split[0], CardAttributeOrType.Trap, Icon.QuickPlay, split[6], long.Parse(split[7]), bi);
                        }
                        else if (split[3] == "Ritual")
                        {
                            c = new SpellAndTrapCard(split[0], CardAttributeOrType.Trap, Icon.Ritual, split[6], long.Parse(split[7]), bi);
                        }
                        else
                        {
                            c = new SpellAndTrapCard(split[0], CardAttributeOrType.Trap, Icon.Normal, split[6], long.Parse(split[7]), bi);
                        }
                    }
                    else if (split[2] == "Dark")
                    {
                        bool isPendulum     = false;
                        bool isXyz          = false;
                        bool isSynchro      = false;
                        bool isSynchroTuner = false;
                        bool isFusion       = false;
                        bool isRitual       = false;

                        if (split[8].ToUpper() == "Y")
                        {
                            isPendulum = true;
                        }
                        if (split[9].ToUpper() == "Y")
                        {
                            isXyz = true;
                            Debug.WriteLine("Cannot have XYZ Monsters in Main Deck.");
                            //return false;
                        }
                        if (split[10].ToUpper() == "Y")
                        {
                            isSynchro = true;
                            Debug.WriteLine("Cannot have Synchro Monsters in Main Deck.");
                            //return false;
                        }
                        if (split[11].ToUpper() == "Y")
                        {
                            isSynchroTuner = true;
                        }
                        if (split[12].ToUpper() == "Y")
                        {
                            isFusion = true;
                            Debug.WriteLine("Cannot have Fusion Monsters in Main Deck.");
                            //return false;
                        }
                        if (split[13].ToUpper() == "Y")
                        {
                            isRitual = true;
                        }

                        c = new MonsterCard(split[0], int.Parse(split[1]), CardAttributeOrType.Dark, split[3], int.Parse(split[4]), int.Parse(split[5]), split[6], long.Parse(split[7]), isPendulum, isXyz, isSynchro, isSynchroTuner, isFusion, isRitual, bi);
                    }
                    else if (split[2] == "Earth")
                    {
                        bool isPendulum     = false;
                        bool isXyz          = false;
                        bool isSynchro      = false;
                        bool isSynchroTuner = false;
                        bool isFusion       = false;
                        bool isRitual       = false;

                        if (split[8].ToUpper() == "Y")
                        {
                            isPendulum = true;
                        }
                        if (split[9].ToUpper() == "Y")
                        {
                            isXyz = true;
                            Debug.WriteLine("Cannot have XYZ Monsters in Main Deck.");
                            //return false;
                        }
                        if (split[10].ToUpper() == "Y")
                        {
                            isSynchro = true;
                            Debug.WriteLine("Cannot have Synchro Monsters in Main Deck.");
                            //return false;
                        }
                        if (split[11].ToUpper() == "Y")
                        {
                            isSynchroTuner = true;
                        }
                        if (split[12].ToUpper() == "Y")
                        {
                            isFusion = true;
                            Debug.WriteLine("Cannot have Fusion Monsters in Main Deck.");
                            //return false;
                        }
                        if (split[13].ToUpper() == "Y")
                        {
                            isRitual = true;
                        }

                        c = new MonsterCard(split[0], int.Parse(split[1]), CardAttributeOrType.Earth, split[3], int.Parse(split[4]), int.Parse(split[5]), split[6], long.Parse(split[7]), isPendulum, isXyz, isSynchro, isSynchroTuner, isFusion, isRitual, bi);
                    }
                    else if (split[2] == "Fight")
                    {
                        bool isPendulum     = false;
                        bool isXyz          = false;
                        bool isSynchro      = false;
                        bool isSynchroTuner = false;
                        bool isFusion       = false;
                        bool isRitual       = false;

                        if (split[8].ToUpper() == "Y")
                        {
                            isPendulum = true;
                        }
                        if (split[9].ToUpper() == "Y")
                        {
                            isXyz = true;
                            Debug.WriteLine("Cannot have XYZ Monsters in Main Deck.");
                            // return false;
                        }
                        if (split[10].ToUpper() == "Y")
                        {
                            isSynchro = true;
                            Debug.WriteLine("Cannot have Synchro Monsters in Main Deck.");
                            // return false;
                        }
                        if (split[11].ToUpper() == "Y")
                        {
                            isSynchroTuner = true;
                        }
                        if (split[12].ToUpper() == "Y")
                        {
                            isFusion = true;
                            Debug.WriteLine("Cannot have Fusion Monsters in Main Deck.");
                            //  return false;
                        }
                        if (split[13].ToUpper() == "Y")
                        {
                            isRitual = true;
                        }

                        c = new MonsterCard(split[0], int.Parse(split[1]), CardAttributeOrType.Fight, split[3], int.Parse(split[4]), int.Parse(split[5]), split[6], long.Parse(split[7]), isPendulum, isXyz, isSynchro, isSynchroTuner, isFusion, isRitual, bi);
                    }
                    else if (split[2] == "Fire")
                    {
                        bool isPendulum     = false;
                        bool isXyz          = false;
                        bool isSynchro      = false;
                        bool isSynchroTuner = false;
                        bool isFusion       = false;
                        bool isRitual       = false;

                        if (split[8].ToUpper() == "Y")
                        {
                            isPendulum = true;
                        }
                        if (split[9].ToUpper() == "Y")
                        {
                            isXyz = true;
                            Debug.WriteLine("Cannot have XYZ Monsters in Main Deck.");
                            //  return false;
                        }
                        if (split[10].ToUpper() == "Y")
                        {
                            isSynchro = true;
                            Debug.WriteLine("Cannot have Synchro Monsters in Main Deck.");
                            //  return false;
                        }
                        if (split[11].ToUpper() == "Y")
                        {
                            isSynchroTuner = true;
                        }
                        if (split[12].ToUpper() == "Y")
                        {
                            isFusion = true;
                            Debug.WriteLine("Cannot have Fusion Monsters in Main Deck.");
                            //  return false;
                        }
                        if (split[13].ToUpper() == "Y")
                        {
                            isRitual = true;
                        }

                        c = new MonsterCard(split[0], int.Parse(split[1]), CardAttributeOrType.Fire, split[3], int.Parse(split[4]), int.Parse(split[5]), split[6], long.Parse(split[7]), isPendulum, isXyz, isSynchro, isSynchroTuner, isFusion, isRitual, bi);
                    }
                    else if (split[2] == "Water")
                    {
                        bool isPendulum     = false;
                        bool isXyz          = false;
                        bool isSynchro      = false;
                        bool isSynchroTuner = false;
                        bool isFusion       = false;
                        bool isRitual       = false;

                        if (split[8].ToUpper() == "Y")
                        {
                            isPendulum = true;
                        }
                        if (split[9].ToUpper() == "Y")
                        {
                            isXyz = true;
                            Debug.WriteLine("Cannot have XYZ Monsters in Main Deck.");
                            return(false);
                        }
                        if (split[10].ToUpper() == "Y")
                        {
                            isSynchro = true;
                            Debug.WriteLine("Cannot have Synchro Monsters in Main Deck.");
                            //  return false;
                        }
                        if (split[11].ToUpper() == "Y")
                        {
                            isSynchroTuner = true;
                        }
                        if (split[12].ToUpper() == "Y")
                        {
                            isFusion = true;
                            Debug.WriteLine("Cannot have Fusion Monsters in Main Deck.");
                            //  return false;
                        }
                        if (split[13].ToUpper() == "Y")
                        {
                            isRitual = true;
                        }

                        c = new MonsterCard(split[0], int.Parse(split[1]), CardAttributeOrType.Water, split[3], int.Parse(split[4]), int.Parse(split[5]), split[6], long.Parse(split[7]), isPendulum, isXyz, isSynchro, isSynchroTuner, isFusion, isRitual, bi);
                    }
                    else if (split[2] == "Wind")
                    {
                        bool isPendulum     = false;
                        bool isXyz          = false;
                        bool isSynchro      = false;
                        bool isSynchroTuner = false;
                        bool isFusion       = false;
                        bool isRitual       = false;

                        if (split[8].ToUpper() == "Y")
                        {
                            isPendulum = true;
                        }
                        if (split[9].ToUpper() == "Y")
                        {
                            isXyz = true;
                            Debug.WriteLine("Cannot have XYZ Monsters in Main Deck.");
                            return(false);
                        }
                        if (split[10].ToUpper() == "Y")
                        {
                            isSynchro = true;
                            Debug.WriteLine("Cannot have Synchro Monsters in Main Deck.");
                            //   return false;
                        }
                        if (split[11].ToUpper() == "Y")
                        {
                            isSynchroTuner = true;
                        }
                        if (split[12].ToUpper() == "Y")
                        {
                            isFusion = true;
                            Debug.WriteLine("Cannot have Fusion Monsters in Main Deck.");
                            //  return false;
                        }
                        if (split[13].ToUpper() == "Y")
                        {
                            isRitual = true;
                        }

                        c = new MonsterCard(split[0], int.Parse(split[1]), CardAttributeOrType.Wind, split[3], int.Parse(split[4]), int.Parse(split[5]), split[6], long.Parse(split[7]), isPendulum, isXyz, isSynchro, isSynchroTuner, isFusion, isRitual, bi);
                    }
                    else if (split[2] == "Light")
                    {
                        bool isPendulum     = false;
                        bool isXyz          = false;
                        bool isSynchro      = false;
                        bool isSynchroTuner = false;
                        bool isFusion       = false;
                        bool isRitual       = false;

                        if (split[8].ToUpper() == "Y")
                        {
                            isPendulum = true;
                        }
                        if (split[9].ToUpper() == "Y")
                        {
                            isXyz = true;
                            Debug.WriteLine("Cannot have XYZ Monsters in Main Deck.");
                            return(false);
                        }
                        if (split[10].ToUpper() == "Y")
                        {
                            isSynchro = true;
                            Debug.WriteLine("Cannot have Synchro Monsters in Main Deck.");
                            //   return false;
                        }
                        if (split[11].ToUpper() == "Y")
                        {
                            isSynchroTuner = true;
                        }
                        if (split[12].ToUpper() == "Y")
                        {
                            isFusion = true;
                            Debug.WriteLine("Cannot have Fusion Monsters in Main Deck.");
                            //  return false;
                        }
                        if (split[13].ToUpper() == "Y")
                        {
                            isRitual = true;
                        }

                        c = new MonsterCard(split[0], int.Parse(split[1]), CardAttributeOrType.Light, split[3], int.Parse(split[4]), int.Parse(split[5]), split[6], long.Parse(split[7]), isPendulum, isXyz, isSynchro, isSynchroTuner, isFusion, isRitual, bi);
                    }
                    allPossibleCards.Add(c);
                }
                return(true);
            }
            catch (Exception e)
            {
                Debug.WriteLine(e);
                return(false);
            }
        }