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