correction de la limitation d'une carte pour jouer

This commit is contained in:
clement
2021-01-06 18:09:08 +01:00
parent a8fde43596
commit 1bd6eeb7b8
6 changed files with 28 additions and 3 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
+4
View File
@@ -28,4 +28,8 @@ public class Board {
return board[zone]; return board[zone];
} }
public int getNumberCardInZone() {
return board.length;
}
} }
+11 -3
View File
@@ -219,7 +219,12 @@ public class Joueur {
* cette methode a pour but d'executé les evenement de fin de trous des cartes * cette methode a pour but d'executé les evenement de fin de trous des cartes
*/ */
public void endPhase() { 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() { public ComsJoueur getComs() {
@@ -312,14 +317,17 @@ public class Joueur {
if (attackingCard == null) { if (attackingCard == null) {
throw new RuntimeException("invalid attack"); throw new RuntimeException("invalid attack");
} else { } else {
if (carteCible.equals("100")) { if (carteCible.equals("100") && attackingCard.alreadyAttack()) {
boolean isadvDead = handleAttackAgainstPlayer(attackingCard, adversaire); boolean isadvDead = handleAttackAgainstPlayer(attackingCard, adversaire);
if(isadvDead) if(isadvDead)
{ {
phaseActive = false; phaseActive = false;
} }
} else { } else {
handleAttackAgainstCard(attackingCard, carteCible, adversaire); if (attackingCard.alreadyAttack()) {
handleAttackAgainstCard(attackingCard, carteCible, adversaire);
attackingCard.haveAttack();
}
} }
} }
break; break;
+13
View File
@@ -4,6 +4,7 @@ public abstract class Card{
private int attack; private int attack;
private int health; private int health;
private boolean notPlay=true;
public Card() { public Card() {
attack = getDefaultAttack(); attack = getDefaultAttack();
@@ -76,5 +77,17 @@ public abstract class Card{
} }
return health == 0; return health == 0;
} }
public boolean alreadyAttack() {
return notPlay;
}
public void haveAttack() {
notPlay = false;
}
public void resetAttack() {
notPlay=true;
}
} }