ajout de 3 effet de caret
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -10,6 +10,7 @@ import game.PlayerTesteur;
|
|||||||
|
|
||||||
public class Serveur {
|
public class Serveur {
|
||||||
|
|
||||||
|
@SuppressWarnings("resource")
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
final String host = "localhost";
|
final String host = "localhost";
|
||||||
final int port = 10430;
|
final int port = 10430;
|
||||||
|
|||||||
+40
-3
@@ -5,6 +5,8 @@ import java.util.Iterator;
|
|||||||
|
|
||||||
import game.cards.Card;
|
import game.cards.Card;
|
||||||
import game.cards.CardRegistery;
|
import game.cards.CardRegistery;
|
||||||
|
import game.cards.SpecialCard.ICanDoge;
|
||||||
|
import game.cards.SpecialCard.IToxic;
|
||||||
import game.deck.Deck;
|
import game.deck.Deck;
|
||||||
import game.deck.DeckRegistery;
|
import game.deck.DeckRegistery;
|
||||||
|
|
||||||
@@ -329,7 +331,7 @@ public class Joueur {
|
|||||||
attackingCard.hasAttacked();
|
attackingCard.hasAttacked();
|
||||||
} else {
|
} else {
|
||||||
if (!attackingCard.hasAlreadyAttacked()) {
|
if (!attackingCard.hasAlreadyAttacked()) {
|
||||||
handleAttackAgainstCard(attackingCard, carteCible, adversaire);
|
handleAttackAgainstCard(carteAttaquante, carteCible, adversaire);
|
||||||
attackingCard.hasAttacked();
|
attackingCard.hasAttacked();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -362,8 +364,10 @@ public class Joueur {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleAttackAgainstCard(Card attackingCard, String carteCible, Joueur adversaire) throws IOException {
|
private void handleAttackAgainstCard(String carteAttaquante, String carteCible, Joueur adversaire) throws IOException {
|
||||||
Card attackedCard = adversaire.getBoard().getCardInZone(Integer.parseInt(carteCible));
|
Card attackedCard = adversaire.getBoard().getCardInZone(Integer.parseInt(carteCible));
|
||||||
|
Card attackingCard = board.getCardInZone(Integer.parseInt(carteAttaquante));
|
||||||
|
|
||||||
|
|
||||||
if (attackedCard == null) {
|
if (attackedCard == null) {
|
||||||
throw new RuntimeException(
|
throw new RuntimeException(
|
||||||
@@ -371,7 +375,7 @@ public class Joueur {
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean isDestroyed = attackedCard.takeDamage(attackingCard.getAttack());
|
boolean isDestroyed = attackedCard.takeDamage(attackingCard.getAttack());
|
||||||
if (isDestroyed) {
|
if (isDestroyed || attackingCard instanceof IToxic) {
|
||||||
// on suprime la carte du terrain
|
// on suprime la carte du terrain
|
||||||
board.setCard(Integer.parseInt(carteCible), null);
|
board.setCard(Integer.parseInt(carteCible), null);
|
||||||
|
|
||||||
@@ -394,6 +398,39 @@ public class Joueur {
|
|||||||
this.getComs().send(Command.SET_ADV_CARD_HP);
|
this.getComs().send(Command.SET_ADV_CARD_HP);
|
||||||
this.getComs().send(carteCible);
|
this.getComs().send(carteCible);
|
||||||
this.getComs().send(attackedCard.getHealth());
|
this.getComs().send(attackedCard.getHealth());
|
||||||
|
|
||||||
|
|
||||||
|
//cette partie est le fightback C.A.D quand tu attaque une carte si elle survit elle te frape a son tour
|
||||||
|
if(attackedCard.getAttack() > 0 && !(attackingCard instanceof ICanDoge))
|
||||||
|
{
|
||||||
|
isDestroyed = attackingCard.takeDamage(attackedCard.getAttack());
|
||||||
|
if(isDestroyed)
|
||||||
|
{
|
||||||
|
// on suprime la carte du terrain
|
||||||
|
adversaire.board.setCard(Integer.parseInt(carteAttaquante), null);
|
||||||
|
|
||||||
|
// demande a l'adversaire de retirer la carte de son terrain
|
||||||
|
adversaire.getComs().send(Command.DESTROY_ADV_CARD);
|
||||||
|
adversaire.getComs().send(carteAttaquante);
|
||||||
|
|
||||||
|
// retire la carte au terrain adverse
|
||||||
|
this.getComs().send(Command.DESTROY_CARD);
|
||||||
|
this.getComs().send(carteAttaquante);
|
||||||
|
|
||||||
|
// appelle les effet de quand la carte est détruite
|
||||||
|
// NOTE : non implémenter dans les cartes individuelles par manque de temps
|
||||||
|
attackedCard.onCardDestroyed();
|
||||||
|
}else {
|
||||||
|
adversaire.getComs().send(Command.SET_CARD_HP);
|
||||||
|
adversaire.getComs().send(carteAttaquante);
|
||||||
|
adversaire.getComs().send(attackingCard.getHealth());
|
||||||
|
|
||||||
|
this.getComs().send(Command.SET_ADV_CARD_HP);
|
||||||
|
this.getComs().send(carteAttaquante);
|
||||||
|
this.getComs().send(attackingCard.getHealth());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package game.cards.MoyenAge;
|
package game.cards.MoyenAge;
|
||||||
|
|
||||||
import game.cards.Card;
|
import game.cards.SpecialCard.HasteCard;
|
||||||
|
|
||||||
public class Moyen_Age_Ferré extends Card{
|
public class Moyen_Age_Ferré extends HasteCard{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* retourne un entier coresspondant a l'attaque de la carte
|
* retourne un entier coresspondant a l'attaque de la carte
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package game.cards.SpecialCard;
|
||||||
|
|
||||||
|
import game.cards.Card;
|
||||||
|
|
||||||
|
public abstract class HasteCard extends Card{
|
||||||
|
public HasteCard()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
resetAttack();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package game.cards.SpecialCard;
|
||||||
|
|
||||||
|
public interface ICanDoge {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package game.cards.SpecialCard;
|
||||||
|
|
||||||
|
public interface IToxic {
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user