Beispiel #1
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);
     }
 }
Beispiel #2
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 #3
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 #4
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);
     }
 }