Commit 2595c98b authored by Corentin Guillevic's avatar Corentin Guillevic
Browse files

Add the master changes in not-alone-web ; Add tests for the 10 first...

Add the master changes in not-alone-web ; Add tests for the 10 first PlaceCards's powers (in PowerApplicatorTest)
parent 1d00432f
......@@ -469,7 +469,7 @@ public class Game implements GameInterface {
response = traquePlayPlaceCard(traque, placeCards);
}
catch (Exception e){
response = new Response(false, "Need a place card");
response = new Response(false, "Need only place card");
}
}
else{
......@@ -1313,7 +1313,7 @@ public class Game implements GameInterface {
do{
action = askAction(idPlayer, askAction);
if(action.getActionType().equals(TARGET_PLAYER)) {
idTargetPlayer = ((ActionMovePlayer) action).getIdPlayer();
idTargetPlayer = ((ActionTargetPlayer) action).getIdPlayer();
}
} while(! playersIdList.contains(idTargetPlayer) && creature.getInGameId() == idTargetPlayer);
return idTargetPlayer;
......@@ -1358,7 +1358,7 @@ public class Game implements GameInterface {
place = actionMovePlayer.getPlace();
}
} while(! playersIdList.contains(idTargetPlayer) && creature.getInGameId() == idTargetPlayer);
return new Pair<>(idPlayer, place);
return new Pair<>(idTargetPlayer, place);
}
public Pair<JetonSymbol, JetonSymbol> swapJetons(int idPlayer) {
......
......@@ -539,22 +539,10 @@ public class PowerApplicator {
private static void applyPlaceRiviere(int idPlayer, Game game) {
List<String> powersDescription = database.findPowersDescription(RIVIERE);
Player player = game.getPlayer(idPlayer);
checkPlayerIsNotCreature(player);
Traque traque = (Traque) player;
//verify if the traque use Artefact and Riviere
List<CardName> cardNames = traque.getPlaceCardsPlayed().stream().map(card -> card.getCardName()).collect(Collectors.toList());
if(! cardNames.contains(ARTEFACT)) {
traque.takeBackPlaceCard(database.findPlaceCard(MARAIS.toString()));
int idPower = game.choosePower(idPlayer, powersDescription);
if(idPower == 0) {
Power power = new PowerModificator(idPlayer, PowerModificatorType.CHOOSABLE_PLACE_CARD, 2);
game.addPowerForNextRound(power);
}
else {
takeBackCardsFromDefausse(idPlayer, game, 1);
}
int idPower = game.choosePower(idPlayer, powersDescription);
if(idPower == 0) {
Power power = new PowerModificator(idPlayer, PowerModificatorType.CHOOSABLE_PLACE_CARD, 2);
game.addPowerForNextRound(power);
}
else {
takeBackCardsFromDefausse(idPlayer, game, 1);
......@@ -635,7 +623,7 @@ public class PowerApplicator {
int idPower = game.choosePower(idPlayer, powersDescription);
if (idPower == 0) {
planet.setEpavePowerToUsed();
game.getBoard().moveBackTraque();
game.getBoard().moveForwardTraque();
} else {
takeBackCardsFromDefausse(idPlayer, game, 1);
}
......@@ -672,7 +660,7 @@ public class PowerApplicator {
powersDescription.add("Copiez les effets d'1 carte Lieu de votre défausse.");
break;
case YELLOW:
powersDescription = Arrays.asList("Annulez les effets du jeton Artemia", "Récupérez 2 cartes Lieu de votre défausse.");
powersDescription = new ArrayList<>(Arrays.asList("Annulez les effets du jeton Artemia", "Récupérez 2 cartes Lieu de votre défausse."));
break;
}
powersDescription.add("Récupérez 1 carte de votre défausse");
......@@ -1725,7 +1713,7 @@ public class PowerApplicator {
player = game.getPlayer(pair.getKey());
checkPlayerIsNotCreature(player);
traque = (Traque) player;
placeCards = traque.getPlaceCards();
placeCards = traque.getPlaceCardsPlayed();
for(PlaceCard placeCard : placeCards) {
if(planet.isAdjacentPlaces(placeCard, pair.getValue())) {
adjacent = placeCard;
......@@ -1840,7 +1828,7 @@ public class PowerApplicator {
public static void applyBeaconPawn(Game game) {
Board board = game.getBoard();
board.moveBackTraque();
board.moveForwardTraque();
}
public static void applyShieldPawn(Game game) {
......
......@@ -101,4 +101,8 @@ public class Pioche<T extends PlayerCard>{
public List<T> getTrash() {
return trash;
}
public List<T> getCards() {
return cards;
}
}
......@@ -29,4 +29,9 @@ public class Pair <T, U> {
Pair pair = (Pair) obj;
return key.equals(pair.getKey()) && value.equals(pair.getValue());
}
@Override
public String toString() {
return "Pair( " + key + " ; " + value + " )";
}
}
This diff is collapsed.
......@@ -8,38 +8,29 @@
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"codegen": "./node_modules/.bin/thrift-typescript --sourceDir ../not-alone-core/src/main/thrift/ --outDir ./target/generated-sources/thrift/"
"codegen": "\"./node_modules/.bin/thrift-typescript\" --sourceDir \"../not-alone-core/src/main/thrift/\" --outDir \"./src/codegen/\""
},
"private": true,
"dependencies": {
"@angular/animations": "^10.1.3",
"@angular/common": "^10.1.3",
"@angular/compiler": "^10.1.3",
"@angular/core": "^10.1.3",
"@angular/forms": "^10.1.3",
"@angular/platform-browser": "^10.1.3",
"@angular/platform-browser-dynamic": "^10.1.3",
"@angular/router": "^10.1.3",
"@creditkarma/thrift-client": "^0.16.1",
"@creditkarma/thrift-server-core": "^0.16.1",
"@creditkarma/thrift-typescript": "^3.7.6",
"@ngtools/webpack": "^10.1.3",
"@ngtools/webpack": "^10.2.0",
"@types/thrift": "^0.10.10",
"core-js": "^3.6.5",
"marked": "^1.2.0",
"angular": "^1.8.2",
"core-js": "^3.8.0",
"rxjs": "~6.6.3",
"thrift": "^0.13.0",
"zone.js": "^0.11.1"
"zone.js": "^0.11.3"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.1001.3",
"@angular/cli": "~10.1.3",
"@angular/compiler-cli": "~10.1.3",
"@angular/language-service": "^10.1.3",
"@angular-devkit/build-angular": "^0.1100.2",
"@angular/cli": "^11.0.2",
"@angular/compiler-cli": "^11.0.2",
"@types/jasmine": "~3.5.14",
"@types/jasminewd2": "~2.0.8",
"@types/node": "~14.11.2",
"codelyzer": "^6.0.0",
"@types/node": "^14.14.10",
"codelyzer": "^6.0.1",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~6.0.0",
"karma": "^5.2.3",
......@@ -48,8 +39,9 @@
"karma-jasmine": "~4.0.1",
"karma-jasmine-html-reporter": "^1.5.4",
"protractor": "^7.0.0",
"shx": "^0.3.3",
"ts-node": "~9.0.0",
"tslint": "~5.20.1",
"typescript": "~4.0.3"
"typescript": "^4.1.2"
}
}
......@@ -71,5 +71,4 @@
</resources>
</build>
</project>
Supports Markdown
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