diff --git a/bin/game/Board.class b/bin/game/Board.class index 3067fe9..d57af3e 100644 Binary files a/bin/game/Board.class and b/bin/game/Board.class differ diff --git a/bin/game/Joueur.class b/bin/game/Joueur.class index b37a273..d079488 100644 Binary files a/bin/game/Joueur.class and b/bin/game/Joueur.class differ diff --git a/bin/game/cards/Card.class b/bin/game/cards/Card.class index 919b78c..b74ecc7 100644 Binary files a/bin/game/cards/Card.class and b/bin/game/cards/Card.class differ diff --git a/src/game/Board.java b/src/game/Board.java index 2d1f94a..b68791e 100644 --- a/src/game/Board.java +++ b/src/game/Board.java @@ -28,4 +28,8 @@ public class Board { return board[zone]; } + public int getNumberCardInZone() { + return board.length; + } + } diff --git a/src/game/Joueur.java b/src/game/Joueur.java index b4de8e6..463effb 100644 --- a/src/game/Joueur.java +++ b/src/game/Joueur.java @@ -219,7 +219,12 @@ public class Joueur { * cette methode a pour but d'executé les evenement de fin de trous des cartes */ public void endPhase() { - // TODO Auto-generated method stub + for (int i = 0; i < board.getNumberCardInZone(); i++) { + Card c = board.getCardInZone(i); + if (c != null) { + c.resetAttack(); + } + } } public ComsJoueur getComs() { @@ -312,14 +317,17 @@ public class Joueur { if (attackingCard == null) { throw new RuntimeException("invalid attack"); } else { - if (carteCible.equals("100")) { + if (carteCible.equals("100") && attackingCard.alreadyAttack()) { boolean isadvDead = handleAttackAgainstPlayer(attackingCard, adversaire); if(isadvDead) { phaseActive = false; } } else { - handleAttackAgainstCard(attackingCard, carteCible, adversaire); + if (attackingCard.alreadyAttack()) { + handleAttackAgainstCard(attackingCard, carteCible, adversaire); + attackingCard.haveAttack(); + } } } break; diff --git a/src/game/cards/Card.java b/src/game/cards/Card.java index 5ec4396..0012454 100644 --- a/src/game/cards/Card.java +++ b/src/game/cards/Card.java @@ -4,6 +4,7 @@ public abstract class Card{ private int attack; private int health; + private boolean notPlay=true; public Card() { attack = getDefaultAttack(); @@ -76,5 +77,17 @@ public abstract class Card{ } return health == 0; } + + public boolean alreadyAttack() { + return notPlay; + } + + public void haveAttack() { + notPlay = false; + } + + public void resetAttack() { + notPlay=true; + } }