Commit acad943f authored by Alexandre DESMONTILS's avatar Alexandre DESMONTILS
Browse files

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	not-alone-server/src/main/java/fr/univnantes/alma/player/PlayerProxy.java
#	not-alone-server/src/main/java/fr/univnantes/alma/player/Traque.java
parents bda6db50 134739a3
......@@ -11,16 +11,14 @@ service PlayerService {
void recupLieuxFromDefausse()
void askCardSurvie()
void askCarteSurvie()
void askCardLieux()
void askCartesLieu()
list<i32> getLieuxDefausse()
void perdrePionsVolonte(i32 nbPerdus)
void recupLieuFromDefausse(list<i32> cartes)
void lacherPrise(i32 gameId)
void resister(i32 gameId, list<i32> cartes)
......
......@@ -104,12 +104,11 @@ class Traque.ts {
gameProxy: GameProxy
volonte: number
recupLieuxFromDefausse(): void | Promise<void>
askCardSurvie(): void | Promise<void>
askCardLieux(): void | Promise<void>
askCarteSurvie(): void | Promise<void>
askCartesLieux(): void | Promise<void>
getLieuxDefausse(): Array<number>
perdrePionsVolonte(): void | Promise<void>
recupLieuFromDefausse(Array<number>): void | Promise<void>
recupLieuxFromDefausse(Array<number>): void | Promise<void>
lacherPrise(): void | Promise<void>
resister(Array<number>): void | Promise<void>
}
......
......@@ -16,13 +16,11 @@ export class PlayerService implements IHandler<any> {
yourRole(role: string): void {}
// methodes des traqués
recupLieuxFromDefausse(): void {
}
askCardSurvie(): void {}
askCardLieux(): void {}
recupLieuxFromDefausse(): void {}
askCarteSurvie(): void {}
askCartesLieu(): void {}
getLieuxDefausse(): Array<number> {return []; }
perdrePionsVolonte(nbPerdus: number ): void {}
recupLieuFromDefausse(cartes: Array<number>): void {}
lacherPrise(gameId: number): void {}
resister(gameId: number, cartes: Array<number>): void {}
......
......@@ -13,20 +13,11 @@ export class Traque {
this.mainSurvie = [];
}
public recupLieuxFromDefausse(gameId: number): void | Promise<void> {
let i = 0;
while (i < this.defausse.length) {
this.main.push(this.defausse[i]);
i++;
}
this.defausse = [];
}
public askCardSurvie(gameId: number): void | Promise<void> {
public askCarteSurvie(gameId: number): void | Promise<void> {
}
public askCardLieux(gameId: number): void | Promise<void> {
public askCartesLieu(gameId: number): void | Promise<void> {
}
......@@ -39,8 +30,7 @@ export class Traque {
}
public recupLieuFromDefausse(cartes: Array<number>): void | Promise<void> {
if (cartes.length === 2 || cartes.length === 4) {
public recupLieuxFromDefausse(cartes: Array<number>): void | Promise<void> {
let i = 0;
const tab: Array<number> = [];
while (this.defausse.includes(cartes[i])) {
......@@ -62,23 +52,24 @@ export class Traque {
i++;
}
}
}
}
public lacherPrise(gameId: number): void | Promise<void> {
this.recupLieuxFromDefausse(gameId);
this.recupLieuxFromDefausse(this.defausse);
this.gameProxy.avancerAssimilation(gameId);
this.volonte = 3;
}
public resister(gameId: number, cartes: Array<number>): void | Promise<void> {
this.recupLieuFromDefausse(cartes);
if (cartes.length === 4) {
if (cartes.length === 4 || cartes.length === 2) {
this.recupLieuxFromDefausse(cartes);
if (cartes.length === 4) {
this.perdrePionsVolonte();
}
this.perdrePionsVolonte();
}
this.perdrePionsVolonte();
if (this.volonte <= 0) {
this.lacherPrise(gameId);
if (this.volonte <= 0) {
this.lacherPrise(gameId);
}
}
}
}
......@@ -119,7 +119,7 @@ public class PlayerProxy implements PlayerInterface, Creature, Traque {
}
@Override
public void askCardSurvie() {
public void askCarteSurvie() {
if (mainSurvie.size() > 0) {
gameController.setCarteSurvie(this.idGame, this.id, this.mainSurvie.get(0));
if (this.mainSurvie.get(0).getName().equals("Cavale")) {
......@@ -137,7 +137,7 @@ public class PlayerProxy implements PlayerInterface, Creature, Traque {
}
@Override
public void askCardLieux() {
public void askCartesLieu() {
if (mainLieu.size() > 0) {
gameController.setLieu(this.idGame, this.id, mainLieu.get(0));
this.defausseLieu.add(this.mainLieu.get(0));
......@@ -146,13 +146,13 @@ public class PlayerProxy implements PlayerInterface, Creature, Traque {
if (this.pv == 1) {
this.lacherPrise();
gameController.avancerAssimilation(this.idGame);
askCardLieux();
askCartesLieu();
} else {
if (pv > 1) {
List<Integer> liste = new ArrayList<>();
liste.add(2, 3);
this.resister(liste);
this.askCardLieux();
this.askCartesLieu();
}
}
}
......
......@@ -7,9 +7,9 @@ import java.util.List;
public interface Traque extends PlayerInterface{
void recupLieuxFromDefausse();
void askCardSurvie();
void askCarteSurvie();
void askCardLieux();
public void askCartesLieu();
List<Lieu> getLieuxDefausse();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment