ajout commande

This commit is contained in:
marc barbier
2021-01-06 20:15:36 +01:00
parent 7749eb6d24
commit bd6e6911da
6 changed files with 25 additions and 2 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
+2
View File
@@ -30,6 +30,8 @@ public final class Command {
public static final String SET_HP = "sethp"; public static final String SET_HP = "sethp";
public static final String SET_CARD_HP = "setcardhp"; public static final String SET_CARD_HP = "setcardhp";
public static final String SET_ADV_CARD_HP = "setadvcardhp"; public static final String SET_ADV_CARD_HP = "setadvcardhp";
public static final String SET_CARD_ATK = "setcardatk";
public static final String SET_ADV_CARD_ATK = "setadvcardatk";
} }
+22 -1
View File
@@ -467,6 +467,25 @@ public class Joueur {
this.getComs().send(zone+""); this.getComs().send(zone+"");
this.getComs().send(cardToUpDate.getHealth()); this.getComs().send(cardToUpDate.getHealth());
} }
/**
* met a jorus les hp d'une carte tout ce passe du poin de vue du joueur
* @param cardToUpDate
* @param adversaire
* @throws IOException
*/
private void updateCardAtk(Card cardToUpDate,Joueur adversaire) throws IOException
{
int zone = board.getZoneOf(cardToUpDate);
if(zone == -1)return;
adversaire.getComs().send(Command.SET_ADV_CARD_ATK);
adversaire.getComs().send(zone+"");
adversaire.getComs().send(cardToUpDate.getAttack());
this.getComs().send(Command.SET_CARD_ATK);
this.getComs().send(zone+"");
this.getComs().send(cardToUpDate.getAttack());
}
private Board getBoard() { private Board getBoard() {
return board; return board;
@@ -485,7 +504,7 @@ public class Joueur {
} }
public void onTurnStart() { public void onTurnStart(Joueur adversaire) throws IOException {
Iterator<Card> it = board.getIterator(); Iterator<Card> it = board.getIterator();
while(it.hasNext()) while(it.hasNext())
{ {
@@ -493,6 +512,8 @@ public class Joueur {
if(c != null) if(c != null)
{ {
c.onTurnStart(); c.onTurnStart();
updateCardHp(c, adversaire);
updateCardAtk(c, adversaire);
} }
} }
+1 -1
View File
@@ -117,7 +117,7 @@ public class Match extends Thread {
//et on dit au joueur oposé que ce n'est pas le tien //et on dit au joueur oposé que ce n'est pas le tien
enemy.debutTourEnemie(); enemy.debutTourEnemie();
joueur.onTurnStart(); joueur.onTurnStart(enemy);
joueur.mainPhase1(enemy); //Joue autant de carte qu'il veut/peut joueur.mainPhase1(enemy); //Joue autant de carte qu'il veut/peut
joueur.battlePhase(enemy);//lance des attaques à son adversaire qui peut répliquer joueur.battlePhase(enemy);//lance des attaques à son adversaire qui peut répliquer
//cette phases ne serira surment pas car nous manquon de temps pour implrementer les fonctionnalité specifique de certaine cartes //cette phases ne serira surment pas car nous manquon de temps pour implrementer les fonctionnalité specifique de certaine cartes