merge
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,5 +1,8 @@
|
|||||||
package game;
|
package game;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
import game.cards.Card;
|
import game.cards.Card;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -28,4 +31,8 @@ public class Board {
|
|||||||
return board[zone];
|
return board[zone];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Iterator<Card> getIterator(){
|
||||||
|
return Arrays.stream(board).iterator();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+14
-2
@@ -1,6 +1,7 @@
|
|||||||
package game;
|
package game;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
import game.cards.Card;
|
import game.cards.Card;
|
||||||
import game.cards.CardRegistery;
|
import game.cards.CardRegistery;
|
||||||
@@ -219,7 +220,14 @@ 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
|
Iterator<Card> it = board.getIterator();
|
||||||
|
while(it.hasNext())
|
||||||
|
{
|
||||||
|
Card c = it.next();
|
||||||
|
if (c != null) {
|
||||||
|
c.resetAttack();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ComsJoueur getComs() {
|
public ComsJoueur getComs() {
|
||||||
@@ -312,14 +320,18 @@ 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.hasAlreadyAttacked()) {
|
||||||
boolean isadvDead = handleAttackAgainstPlayer(attackingCard, adversaire);
|
boolean isadvDead = handleAttackAgainstPlayer(attackingCard, adversaire);
|
||||||
if(isadvDead)
|
if(isadvDead)
|
||||||
{
|
{
|
||||||
phaseActive = false;
|
phaseActive = false;
|
||||||
}
|
}
|
||||||
|
attackingCard.hasAttacked();
|
||||||
} else {
|
} else {
|
||||||
|
if (!attackingCard.hasAlreadyAttacked()) {
|
||||||
handleAttackAgainstCard(attackingCard, carteCible, adversaire);
|
handleAttackAgainstCard(attackingCard, carteCible, adversaire);
|
||||||
|
attackingCard.hasAttacked();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ public abstract class Card{
|
|||||||
|
|
||||||
private int attack;
|
private int attack;
|
||||||
private int health;
|
private int health;
|
||||||
|
private boolean hasAttacked=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 hasAlreadyAttacked() {
|
||||||
|
return hasAttacked;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void hasAttacked() {
|
||||||
|
hasAttacked = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resetAttack() {
|
||||||
|
hasAttacked=false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user