merge
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,5 +1,8 @@
|
||||
package game;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
|
||||
import game.cards.Card;
|
||||
|
||||
/**
|
||||
@@ -28,4 +31,8 @@ public class Board {
|
||||
return board[zone];
|
||||
}
|
||||
|
||||
public Iterator<Card> getIterator(){
|
||||
return Arrays.stream(board).iterator();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+15
-3
@@ -1,6 +1,7 @@
|
||||
package game;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
|
||||
import game.cards.Card;
|
||||
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
|
||||
*/
|
||||
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() {
|
||||
@@ -312,14 +320,18 @@ public class Joueur {
|
||||
if (attackingCard == null) {
|
||||
throw new RuntimeException("invalid attack");
|
||||
} else {
|
||||
if (carteCible.equals("100")) {
|
||||
if (carteCible.equals("100") && !attackingCard.hasAlreadyAttacked()) {
|
||||
boolean isadvDead = handleAttackAgainstPlayer(attackingCard, adversaire);
|
||||
if(isadvDead)
|
||||
{
|
||||
phaseActive = false;
|
||||
}
|
||||
attackingCard.hasAttacked();
|
||||
} else {
|
||||
handleAttackAgainstCard(attackingCard, carteCible, adversaire);
|
||||
if (!attackingCard.hasAlreadyAttacked()) {
|
||||
handleAttackAgainstCard(attackingCard, carteCible, adversaire);
|
||||
attackingCard.hasAttacked();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -4,6 +4,7 @@ public abstract class Card{
|
||||
|
||||
private int attack;
|
||||
private int health;
|
||||
private boolean hasAttacked=true;
|
||||
|
||||
public Card() {
|
||||
attack = getDefaultAttack();
|
||||
@@ -76,5 +77,17 @@ public abstract class Card{
|
||||
}
|
||||
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