From bd6e6911dae6bbe2aebca86e5ff6771b5b5e3e9d Mon Sep 17 00:00:00 2001 From: marc barbier Date: Wed, 6 Jan 2021 20:15:36 +0100 Subject: [PATCH] ajout commande --- bin/game/Command.class | Bin 1236 -> 1337 bytes bin/game/Joueur.class | Bin 9748 -> 10089 bytes bin/game/Match.class | Bin 2754 -> 2755 bytes src/game/Command.java | 2 ++ src/game/Joueur.java | 23 ++++++++++++++++++++++- src/game/Match.java | 2 +- 6 files changed, 25 insertions(+), 2 deletions(-) diff --git a/bin/game/Command.class b/bin/game/Command.class index 5dd74be83f04f0d6d249f893dfdd910619577aa7..72f25dfe1a9e15360dcb69bbb30f6e1de77f890b 100644 GIT binary patch delta 235 zcmcb@xs!|Q)W2Q(7#JAL84@;f)iEXW1iOaBJ39us#5;y~b1(!lGH?~AmLw+@r6iVQ zGcpK(q#a$tkd%ZlGVlVGB&L+XRk7J*=4F=HF)}b~XofK|usG+Zq;fGZGeq(*gffIp zUdEKdD7BfJxsfqLlEI&Wje(JY9q0rmh5!ahh9D$b$;1#309Laq0{{R3 delta 114 zcmdnVb%m4b)W2Q(7#JAL8KO3F)iF&z%Ot@T%){W%5HR^QQwpQR<^bkKMh`{?CXf&V xBSRoitv--u1k$Wp+Zlp30vSvUAwZH1EXctS3S{#@6flG_gadhu3=v>ekpQN{5b&6*&IVKZTo0kdRTOW8Y`pMW_8vhESzT8HD7#M;kf8n%X)S0Zq<)m-JP|4uPP{rWJP{R<& tP|IKqlvjYLVz6Pb1@eIE8KyI^F)%WSGgwca%O%CF3S`d&iZe0H0s!f+5dHuF delta 96 zcmX>sdPsDG8Y`pFW_8vhESzT;m>8HD7#IR4f8n&4tjp!3Z_QB2;J{GD;L1?L5WrB& rU=5U2fT&@xVXy`AfT|g$Gq5o*GKe!+O`gXk#jOHl&jgAyG0Xx0x#JL# diff --git a/src/game/Command.java b/src/game/Command.java index b62f96c..c66f19e 100644 --- a/src/game/Command.java +++ b/src/game/Command.java @@ -30,6 +30,8 @@ public final class Command { public static final String SET_HP = "sethp"; public static final String SET_CARD_HP = "setcardhp"; 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"; } diff --git a/src/game/Joueur.java b/src/game/Joueur.java index e898677..5bc35f7 100644 --- a/src/game/Joueur.java +++ b/src/game/Joueur.java @@ -467,6 +467,25 @@ public class Joueur { this.getComs().send(zone+""); 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() { return board; @@ -485,7 +504,7 @@ public class Joueur { } - public void onTurnStart() { + public void onTurnStart(Joueur adversaire) throws IOException { Iterator it = board.getIterator(); while(it.hasNext()) { @@ -493,6 +512,8 @@ public class Joueur { if(c != null) { c.onTurnStart(); + updateCardHp(c, adversaire); + updateCardAtk(c, adversaire); } } diff --git a/src/game/Match.java b/src/game/Match.java index 7d810d4..2f43ed9 100644 --- a/src/game/Match.java +++ b/src/game/Match.java @@ -117,7 +117,7 @@ public class Match extends Thread { //et on dit au joueur oposé que ce n'est pas le tien enemy.debutTourEnemie(); - joueur.onTurnStart(); + joueur.onTurnStart(enemy); joueur.mainPhase1(enemy); //Joue autant de carte qu'il veut/peut 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