Commit d02a6a10 authored by Thomas DENIS's avatar Thomas DENIS
Browse files

Merge remote-tracking branch 'origin/master'

parents 39761686 1cf68acf
......@@ -2,11 +2,10 @@ package fr.univnantes.alma.data;
import fr.univnantes.alma.data.item.User;
import fr.univnantes.alma.game.item.Phase;
import fr.univnantes.alma.game.item.card.PlaceCard;
import fr.univnantes.alma.game.item.card.SurvivalCard;
import fr.univnantes.alma.game.item.card.TrackingCard;
import fr.univnantes.alma.game.item.power.container.PowerContainer;
import fr.univnantes.alma.game.item.card.PlaceCard;
import org.atlanmod.commons.log.Log;
import fr.univnantes.alma.game.item.power.PowerType;
import java.util.ArrayList;
import java.util.HashMap;
......@@ -29,27 +28,27 @@ public class DatabaseStub implements NotAloneDatabase {
private void initializePlaceCardMap(){
placeCardMap = new HashMap<>();
placeCardMap.put("ANTRE", new PlaceCard("ANTRE", "Antre", "Lorem ipsum", new PowerContainer(), 1, "/image.png", "#4466bb"));
placeCardMap.put("NEXUS", new PlaceCard("NEXUS", "Nexus", "Lorem ipsum", new PowerContainer(), 1, "/image.png", "#4466bb"));
placeCardMap.put("JUNGLE", new PlaceCard("JUNGLE", "Jungle", "Lorem ipsum", new PowerContainer(), 2, "/image.png", "#4466bb"));
placeCardMap.put("RIVIERE", new PlaceCard("RIVIERE", "Rivière", "Lorem ipsum", new PowerContainer(), 3, "/image.png", "#4466bb"));
placeCardMap.put("DOME", new PlaceCard("DOME","Dôme", "Lorem ipsum", new PowerContainer(), 4, "/image.png", "#4466bb"));
placeCardMap.put("PLAGE", new PlaceCard("PLAGE","Plage", "Lorem ipsum", new PowerContainer(), 5, "/image.png", "#4466bb"));
placeCardMap.put("MANGROVE", new PlaceCard("MANGROVE", "Mangrove", "Lorem ipsum", new PowerContainer(), 6, "/image.png", "#4466bb"));
placeCardMap.put("ABRI", new PlaceCard("ABRI", "Abri", "Lorem ipsum", new PowerContainer(), 7, "/image.png", "#4466bb"));
placeCardMap.put("EPAVE", new PlaceCard("EPAVE", "Epave", "Lorem ipsum", new PowerContainer(), 8, "/image.png", "#4466bb"));
placeCardMap.put("FUNGI", new PlaceCard("FUNGI", "Fungi", "Lorem ipsum", new PowerContainer(), 9, "/image.png", "#4466bb"));
placeCardMap.put("PORTAIL", new PlaceCard("PORTAIL", "Portail", "Lorem ipsum", new PowerContainer(), 10, "/image.png", "#4466bb"));
placeCardMap.put("ANTRE", new PlaceCard("ANTRE", "Antre", "Lorem ipsum", PowerType.ANTRE, 1, "/image.png", "#4466bb"));
placeCardMap.put("NEXUS", new PlaceCard("NEXUS", "Nexus", "Lorem ipsum", PowerType.NEXUS, 1, "/image.png", "#4466bb"));
placeCardMap.put("JUNGLE", new PlaceCard("JUNGLE", "Jungle", "Lorem ipsum", PowerType.JUNGLE, 2, "/image.png", "#4466bb"));
placeCardMap.put("RIVIERE", new PlaceCard("RIVIERE", "Rivière", "Lorem ipsum", PowerType.RIVIERE, 3, "/image.png", "#4466bb"));
placeCardMap.put("DOME", new PlaceCard("DOME","Dôme", "Lorem ipsum", PowerType.DOME, 4, "/image.png", "#4466bb"));
placeCardMap.put("PLAGE", new PlaceCard("PLAGE","Plage", "Lorem ipsum", PowerType.PLAGE, 5, "/image.png", "#4466bb"));
placeCardMap.put("MANGROVE", new PlaceCard("MANGROVE", "Mangrove", "Lorem ipsum", PowerType.MANGROVE, 6, "/image.png", "#4466bb"));
placeCardMap.put("ABRI", new PlaceCard("ABRI", "Abri", "Lorem ipsum", PowerType.ABRI, 7, "/image.png", "#4466bb"));
placeCardMap.put("EPAVE", new PlaceCard("EPAVE", "Epave", "Lorem ipsum", PowerType.EPAVE, 8, "/image.png", "#4466bb"));
placeCardMap.put("FUNGI", new PlaceCard("FUNGI", "Fungi", "Lorem ipsum", PowerType.FUNGI, 9, "/image.png", "#4466bb"));
placeCardMap.put("PORTAIL", new PlaceCard("PORTAIL", "Portail", "Lorem ipsum", PowerType.PORTAIL, 10, "/image.png", "#4466bb"));
}
private void initializeSurvivalCardMap(){
survivalCardMap = new HashMap<>();
survivalCardMap.put("ADRENALINE", new SurvivalCard("ADRENALINE","Adrénaline", "Lorem ipsum", new PowerContainer(), Phase.PHASE_1));
survivalCardMap.put("ADRENALINE", new SurvivalCard("ADRENALINE","Adrénaline", "Lorem ipsum", PowerType.ADRENALINE, Phase.PHASE_1));
}
private void initializeTrackingCardMap(){
trackingCardMap = new HashMap<>();
trackingCardMap.put("ACHARNEMENT", new TrackingCard("ACHARNEMENT", "Acharnement", "Lorem ipsum", new PowerContainer(), Phase.PHASE_1));
trackingCardMap.put("ACHARNEMENT", new TrackingCard("ACHARNEMENT", "Acharnement", "Lorem ipsum", PowerType.ACHARNEMENT, Phase.PHASE_1));
}
......
......@@ -14,7 +14,6 @@ import fr.univnantes.alma.game.item.player.Creature;
import fr.univnantes.alma.game.item.player.Player;
import fr.univnantes.alma.game.item.player.Traque;
import fr.univnantes.alma.game.item.power.Power;
import fr.univnantes.alma.game.item.power.container.PowerContainer;
import org.atlanmod.commons.log.Log;
import java.util.ArrayList;
......@@ -26,12 +25,12 @@ public class Game implements GameInterface {
/**
* The powers activate in the current round
*/
private List<PowerContainer> currentActivatePowers;
private List<Power> currentActivatePowers;
/**
* The powers of the next round
*/
private List<PowerContainer> nextRoundPowers;
private List<Power> nextRoundPowers;
/**
* The planet
......@@ -159,11 +158,6 @@ public class Game implements GameInterface {
}
@Override
public void apply(PowerContainer powerContainer) {
}
@Override
public void playerHasFinished(int playerId, Phase phase) {
......
......@@ -5,7 +5,6 @@ import fr.univnantes.alma.game.item.action.Action;
import fr.univnantes.alma.game.item.card.Card;
import fr.univnantes.alma.game.item.jeton.PlacedJeton;
import fr.univnantes.alma.game.item.power.Power;
import fr.univnantes.alma.game.item.power.container.PowerContainer;
import java.util.List;
......@@ -23,12 +22,6 @@ public interface GameInterface {
*/
void apply(Power power);
/**
* Apply the powers of the container in the game
* @param powerContainer
*/
void apply(PowerContainer powerContainer);
/**
* Inform the game that the player has finished a phase
* @param playerId The game id of the player
......
package fr.univnantes.alma.game.item.card;
import fr.univnantes.alma.game.item.power.container.PowerContainer;
import fr.univnantes.alma.game.item.power.Power;
import fr.univnantes.alma.game.item.power.PowerType;
public abstract class Card {
public enum CardType {SURVIVAL, PLACE, TRACKING}
......@@ -8,13 +10,13 @@ public abstract class Card {
protected String name;
protected String id;
protected String description;
protected PowerContainer powers;
protected PowerType power;
public Card(String name, String id, String description, PowerContainer powers) {
public Card(String name, String id, String description, PowerType power) {
this.name = name;
this.id = id;
this.description = description;
this.powers = powers;
this.power = power;
}
public String getName() {
......@@ -29,8 +31,8 @@ public abstract class Card {
return description;
}
public PowerContainer getPowers() {
return powers;
public PowerType getPower() {
return power;
}
@Override
......
package fr.univnantes.alma.game.item.card;
import fr.univnantes.alma.game.item.power.container.PowerContainer;
import fr.univnantes.alma.game.item.power.PowerType;
public class PlaceCard extends Card {
private int number;
private String imageUrl;
private String color;
public PlaceCard(String id, String name, String description, PowerContainer powers, int number, String imageUrl, String color){
super(id, name, description, powers);
public PlaceCard(String id, String name, String description, PowerType power, int number, String imageUrl, String color){
super(id, name, description, power);
this.number = number;
this.color = color;
this.imageUrl = imageUrl;
......
package fr.univnantes.alma.game.item.card;
import fr.univnantes.alma.game.item.Phase;
import fr.univnantes.alma.game.item.power.container.PowerContainer;
import fr.univnantes.alma.game.item.power.PowerType;
public abstract class PlayerCard extends Card {
protected Phase phase;
public PlayerCard(String id, String name, String description, PowerContainer powers, Phase phase){
super(id, name, description, powers);
public PlayerCard(String id, String name, String description, PowerType power, Phase phase){
super(id, name, description, power);
this.phase = phase;
}
......
package fr.univnantes.alma.game.item.card;
import fr.univnantes.alma.game.item.Phase;
import fr.univnantes.alma.game.item.power.container.PowerContainer;
import fr.univnantes.alma.game.item.power.PowerType;
public class SurvivalCard extends PlayerCard {
public SurvivalCard(String id, String name, String description, PowerContainer powers, Phase phase){
super(id, name, description, powers, phase);
public SurvivalCard(String id, String name, String description, PowerType power, Phase phase){
super(id, name, description, power, phase);
}
@Override
......
......@@ -2,7 +2,7 @@ package fr.univnantes.alma.game.item.card;
import fr.univnantes.alma.game.item.Phase;
import fr.univnantes.alma.game.item.jeton.Jeton;
import fr.univnantes.alma.game.item.power.container.PowerContainer;
import fr.univnantes.alma.game.item.power.PowerType;
import java.util.ArrayList;
import java.util.List;
......@@ -11,13 +11,13 @@ public class TrackingCard extends PlayerCard {
private List<Jeton> jetons;
public TrackingCard(String id, String name, String description, PowerContainer powers, Phase phase){
super(id, name, description, powers, phase);
public TrackingCard(String id, String name, String description, PowerType power, Phase phase){
super(id, name, description, power, phase);
this.jetons = new ArrayList<>();
}
public TrackingCard(String id, String name, String description, PowerContainer powers, Phase phase, List<Jeton> jetons){
super(id, name, description, powers, phase);
public TrackingCard(String id, String name, String description, PowerType power, Phase phase, List<Jeton> jetons){
super(id, name, description, power, phase);
this.jetons = jetons;
}
......
package fr.univnantes.alma.game.item.jeton;
import fr.univnantes.alma.game.item.power.Power;
import fr.univnantes.alma.game.item.power.container.PowerContainer;
import fr.univnantes.alma.game.item.power.PowerType;
public abstract class Jeton {
public enum JetonType{CIBLE, ARTEMIA, CREATURE}
protected PowerContainer powers;
protected PowerType power;
//TODO Constructor
public PowerContainer getPowers() {
return powers;
public PowerType getPowers() {
return power;
}
public abstract JetonType getType();
......
package fr.univnantes.alma.game.item.planet;
import fr.univnantes.alma.game.item.power.container.PowerContainer;
import fr.univnantes.alma.game.item.power.PowerType;
public class BeaconPawn extends PlanetPawn{
......@@ -8,7 +8,7 @@ public class BeaconPawn extends PlanetPawn{
public BeaconPawn(){
//TODO Define balise powers
super(new PowerContainer());
super(PowerType.PION_BALISE);
state = false;
}
......
......@@ -2,7 +2,7 @@ package fr.univnantes.alma.game.item.planet;
import fr.univnantes.alma.game.item.card.PlaceCard;
import fr.univnantes.alma.game.item.jeton.Jeton;
import fr.univnantes.alma.game.item.power.container.PowerContainer;
import fr.univnantes.alma.game.item.power.PowerType;
import java.util.*;
......@@ -101,8 +101,8 @@ public class Planet {
return planetPawn.isActive();
}
public PowerContainer getPlanetPawnPowers(){
return planetPawn.getPowers();
public PowerType getPlanetPawnPower(){
return planetPawn.getPower();
}
}
package fr.univnantes.alma.game.item.planet;
import fr.univnantes.alma.game.item.power.container.PowerContainer;
import fr.univnantes.alma.game.item.power.PowerType;
public abstract class PlanetPawn {
protected PowerContainer powers;
protected PowerType power;
public PlanetPawn(PowerContainer powers){
this.powers = powers;
public PlanetPawn(PowerType power){
this.power = power;
}
public PowerContainer getPowers(){
return powers;
public PowerType getPower(){
return power;
}
public abstract void nextState();
......
package fr.univnantes.alma.game.item.planet;
import fr.univnantes.alma.game.item.power.container.PowerContainer;
import fr.univnantes.alma.game.item.power.PowerType;
import static fr.univnantes.alma.game.item.planet.Planet.DOME_NUMBER;
......@@ -10,7 +10,7 @@ public class ShieldPawn extends PlanetPawn{
public ShieldPawn() {
//TODO Define shield power
super(new PowerContainer());
super(PowerType.PION_BOUCLIER);
location = 1;
}
......
package fr.univnantes.alma.game.item.power;
public class Power {
}
......@@ -13,5 +13,9 @@ public enum PowerType {
ADRENALINE, ALERTE, AMPLIFICATEUR, BROUILLAGE, CAVALE, DETECTEUR, DRONE, ENTRAVE, EQUIPEMENT, ESQUIVE,
FAUSSE_PISTE, HOLOGRAMME, LEURRE, MIMETISME, NAVETTE, PLANQUES, PORTAIL_SURVIVAL, RALLIEMENT, REFUGE, REGENERATION,
RESISTANCE, RETRAITE, RIPOSTE, SACRIFICE, SECOND_SOUFFLE, SIXIEME_SENS, SYSTEME_D, TENACITE, VACCIN, VOLTE_FACE,
VORTEX
VORTEX,
//JETON
JETON_CREATURE, JETONC_CIBLE, JETON_ARTEMIA,
//PLANETE_PAWN
PION_BALISE, PION_BOUCLIER
}
package fr.univnantes.alma.game.item.card;
import fr.univnantes.alma.game.item.power.container.PowerContainer;
import fr.univnantes.alma.game.item.power.PowerType;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
class PlaceCardTest {
@Test
void testGetNumber() {
PlaceCard card = new PlaceCard("ID", "Name", "Description", new PowerContainer(), 1, "url", "rgba(255,255,255)");
PlaceCard card = new PlaceCard("ID", "Name", "Description", PowerType.ANTRE, 1, "url", "rgba(255,255,255)");
assertEquals(1, card.getNumber());
}
@Test
void testEquals() {
PlaceCard card1 = new PlaceCard("ID", "Name", "Description", new PowerContainer(), 1, "url", "rgba(255,255,255)");
PlaceCard card2 = new PlaceCard("ID", "Name", "Description", new PowerContainer(), 1, "url", "rgba(255,255,255)");
PlaceCard card1 = new PlaceCard("ID", "Name", "Description", PowerType.ANTRE, 1, "url", "rgba(255,255,255)");
PlaceCard card2 = new PlaceCard("ID", "Name", "Description", PowerType.ANTRE, 1, "url", "rgba(255,255,255)");
assertEquals(card1, card2);
}
@Test
void getType() {
PlaceCard card1 = new PlaceCard("ID", "Name", "Description", new PowerContainer(), 1, "url", "rgba(255,255,255)");
PlaceCard card1 = new PlaceCard("ID", "Name", "Description", PowerType.ANTRE, 1, "url", "rgba(255,255,255)");
assertEquals(Card.CardType.PLACE, card1.getType());
}
}
\ No newline at end of file
package fr.univnantes.alma.game.item.card;
import fr.univnantes.alma.game.item.Phase;
import fr.univnantes.alma.game.item.player.Player;
import fr.univnantes.alma.game.item.power.container.PowerContainer;
import fr.univnantes.alma.game.item.power.PowerType;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
class PlayerCardTest {
@Test
void getPhase() {
PlayerCard card = new SurvivalCard("ID", "Name", "Description", new PowerContainer(), Phase.PHASE_1);
PlayerCard card = new SurvivalCard("ID", "Name", "Description", PowerType.ACHARNEMENT, Phase.PHASE_1);
assertEquals(Phase.PHASE_1, card.getPhase());
}
}
\ No newline at end of file
package fr.univnantes.alma.game.item.card;
import fr.univnantes.alma.game.item.Phase;
import fr.univnantes.alma.game.item.power.container.PowerContainer;
import fr.univnantes.alma.game.item.power.PowerType;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
class SurvivalCardTest {
@Test
void getType() {
PlayerCard card = new SurvivalCard("ID", "Name", "Description", new PowerContainer(), Phase.PHASE_1);
PlayerCard card = new SurvivalCard("ID", "Name", "Description", PowerType.ESQUIVE, Phase.PHASE_1);
assertEquals(Card.CardType.SURVIVAL, card.getType());
}
}
\ No newline at end of file
package fr.univnantes.alma.game.item.card;
import fr.univnantes.alma.game.item.Phase;
import fr.univnantes.alma.game.item.power.container.PowerContainer;
import fr.univnantes.alma.game.item.power.PowerType;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
class TrackingCardTest {
@Test
void getType() {
PlayerCard card = new TrackingCard("ID", "Name", "Description", new PowerContainer(), Phase.PHASE_1);
PlayerCard card = new TrackingCard("ID", "Name", "Description", PowerType.DOMINATION, Phase.PHASE_1);
assertEquals(Card.CardType.TRACKING, card.getType());
}
}
\ No newline at end of file
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