From 3dd06a2bd863aa7aee76df57ffc7cece58548ce4 Mon Sep 17 00:00:00 2001 From: Tiago Lousa <tig2468.a@gmail.com> Date: Thu, 9 Jun 2022 14:21:30 +0200 Subject: [PATCH 01/97] =?UTF-8?q?world=20limite=20faite=20avec=20magouille?= =?UTF-8?q?=20(=20=C3=A0=20refaire=20si=20une=20bonne=20m=C3=A9thode=20est?= =?UTF-8?q?=20trouve=20)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/fr/sae/terraria/modele/entities/entity/Entity.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/sae/terraria/modele/entities/entity/Entity.java b/src/main/java/fr/sae/terraria/modele/entities/entity/Entity.java index f96fd29..9a728e8 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/entity/Entity.java +++ b/src/main/java/fr/sae/terraria/modele/entities/entity/Entity.java @@ -90,7 +90,7 @@ protected Entity(int x, int y) public abstract void updates(); /** - * Permet de detectés les collisions sur la carte et de son environment. + * Permet de detecter les collisions sur la carte et de son environment. * * @param environment Permet de savoir les tailles des tiles et d'avoir la matrixe de données de la carte. * @return Il vas retourner une HashMap qui ne contiendra pas de clé ou 4 clés maximum @@ -197,7 +197,7 @@ protected boolean worldLimit(final Environment environment) double widthMap = (environment.getTileMaps().getWidth()*environment.scaleMultiplicatorWidth*TileMaps.TILE_DEFAULT_SIZE) ; boolean exceedsScreenOnLeft = offset[0] == Entity.IS_MOVING_LEFT && getX() < 0; - boolean exceedsScreenOnRight = offset[0] == Entity.IS_MOVING_RIGHT && getX() > (widthMap - getRect().getWidth()); + boolean exceedsScreenOnRight = offset[0] == Entity.IS_MOVING_RIGHT && getX()+CollideObjectType.COLLISION_TOLERANCE+velocity + getRect().getWidth() + 3 >= widthMap; return (exceedsScreenOnLeft || exceedsScreenOnRight); } From d3685c09e5865660a5df7d8f0b6211d500d982a8 Mon Sep 17 00:00:00 2001 From: Tiago Lousa <tig2468.a@gmail.com> Date: Thu, 9 Jun 2022 14:31:04 +0200 Subject: [PATCH 02/97] =?UTF-8?q?d=C3=A9placement=20de=20la=20dobuleProper?= =?UTF-8?q?ty=20opacit=C3=A9=20dans=20Clock?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/fr/sae/terraria/modele/Clock.java | 19 ++++++++++++++++++- .../java/fr/sae/terraria/vue/LightView.java | 18 ++---------------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/main/java/fr/sae/terraria/modele/Clock.java b/src/main/java/fr/sae/terraria/modele/Clock.java index a15c226..6849256 100644 --- a/src/main/java/fr/sae/terraria/modele/Clock.java +++ b/src/main/java/fr/sae/terraria/modele/Clock.java @@ -1,5 +1,6 @@ package fr.sae.terraria.modele; +import javafx.beans.property.SimpleDoubleProperty; import javafx.beans.property.SimpleIntegerProperty; @@ -11,12 +12,13 @@ public class Clock private final SimpleIntegerProperty minutes; private final SimpleIntegerProperty days; + private final SimpleDoubleProperty opacityNightFilter; public Clock() { super(); - + opacityNightFilter = new SimpleDoubleProperty(.0); this.minutes = new SimpleIntegerProperty(Clock.EIGHT_AM_INGAME); this.days = new SimpleIntegerProperty(1); } @@ -29,15 +31,30 @@ public void updates(int ticks) this.days.setValue(getDays()+1); this.minutes.setValue(0); } else this.minutes.setValue(getMinutes()+1); + updateOpacity(); } } public SimpleIntegerProperty minutesProperty() { return this.minutes; } public SimpleIntegerProperty daysProperty() { return this.days; } + private void updateOpacity() + { + if (this.getMinutes() > Clock.MINUTES_IN_A_DAY/2) + this.opacityNightFilter.set(((this.getMinutes()*(2. /* Compensation temps */))/Clock.MINUTES_IN_A_DAY) - (1.1 /* Décallage */)); + else this.opacityNightFilter.set(((Clock.MINUTES_IN_A_DAY - (this.getMinutes()*(4. /* Compensation temps */)))/Clock.MINUTES_IN_A_DAY) - (.1 /* Décallage */)); + } public int getMinutes() { return this.minutes.get(); } public int getDays() { return this.days.get(); } + public double getOpacityNightFilter() { + return opacityNightFilter.get(); + } + + public SimpleDoubleProperty opacityNightFilterProperty() { + return opacityNightFilter; + } + public void setMinutes(int newMinutes) { this.minutes.set(newMinutes); } } diff --git a/src/main/java/fr/sae/terraria/vue/LightView.java b/src/main/java/fr/sae/terraria/vue/LightView.java index f80be65..336cc1d 100644 --- a/src/main/java/fr/sae/terraria/vue/LightView.java +++ b/src/main/java/fr/sae/terraria/vue/LightView.java @@ -25,8 +25,7 @@ public class LightView { private static int widthMap; private static int tileSize; - private final SimpleDoubleProperty opacityNightAir; - private final SimpleDoubleProperty opacityNightFade; + private final Environment environment; private final TileMaps tileMaps; private final Circle torchLight; @@ -47,15 +46,12 @@ public LightView(Clock clock, Pane filterPane, Environment env) { widthMap = (int) (env.scaleMultiplicatorWidth*TileMaps.TILE_DEFAULT_SIZE*tileMaps.getWidth()); delimitationDirtStone = fullStoneArea(); - this.opacityNightAir = new SimpleDoubleProperty(.0); - this.opacityNightFade = new SimpleDoubleProperty(.8143); this.torchLight = new Circle(this.tileSize*CIRCLE_RAY); this.resetShapes(); this.addEffects(); - this.clock.minutesProperty().addListener(((obs, oldV, newV) -> updateOpacity())); this.filterPane.getChildren().addAll(this.actualTunnel, this.actualFade, this.actualAir); this.initTochListener(env.getTorches()); @@ -96,14 +92,6 @@ else if (c.wasAdded()){ }}); } - private void updateOpacity() - { - if (this.clock.getMinutes() > Clock.MINUTES_IN_A_DAY/2) - this.opacityNightAir.set(((this.clock.getMinutes()*(2. /* Compensation temps */))/Clock.MINUTES_IN_A_DAY) - (1.1 /* Décallage */)); - else this.opacityNightAir.set(((Clock.MINUTES_IN_A_DAY - (this.clock.getMinutes()*(4. /* Compensation temps */)))/Clock.MINUTES_IN_A_DAY) - (.1 /* Décallage */)); - } - - private int fullStoneArea() { int line = 0; @@ -143,9 +131,7 @@ private void addEffects() this.actualAir.setFill(NIGHT_COLOR); this.actualTunnel.setFill(NIGHT_COLOR); - this.actualTunnel.opacityProperty().bind(this.opacityNightFade); - this.actualFade.opacityProperty().bind(this.opacityNightFade); - this.actualAir.opacityProperty().bind(this.opacityNightAir); + this.actualAir.opacityProperty().bind(this.clock.opacityNightFilterProperty()); } private void addTochLights() From 4dcf176d7f84cf17a63ec7c64fac3a5091593bb2 Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Thu, 9 Jun 2022 14:35:27 +0200 Subject: [PATCH 03/97] Les entity qui sont movable ont une classes qui lui sont propre --- .../sae/terraria/modele/entities/Arrow.java | 13 +- .../sae/terraria/modele/entities/Rabbit.java | 6 +- .../sae/terraria/modele/entities/Slime.java | 11 +- .../modele/entities/entity/Entity.java | 130 --------------- .../modele/entities/entity/EntityMovable.java | 152 ++++++++++++++++++ .../entities/entity/MovableObjectType.java | 66 -------- .../modele/entities/player/Player.java | 15 +- .../java/fr/sae/terraria/vue/SlimeView.java | 1 - 8 files changed, 165 insertions(+), 229 deletions(-) create mode 100644 src/main/java/fr/sae/terraria/modele/entities/entity/EntityMovable.java delete mode 100644 src/main/java/fr/sae/terraria/modele/entities/entity/MovableObjectType.java diff --git a/src/main/java/fr/sae/terraria/modele/entities/Arrow.java b/src/main/java/fr/sae/terraria/modele/entities/Arrow.java index 40b9b46..8b0ba10 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/Arrow.java +++ b/src/main/java/fr/sae/terraria/modele/entities/Arrow.java @@ -2,19 +2,18 @@ import fr.sae.terraria.modele.Environment; import fr.sae.terraria.modele.entities.entity.CollideObjectType; -import fr.sae.terraria.modele.entities.entity.Entity; -import fr.sae.terraria.modele.entities.entity.MovableObjectType; +import fr.sae.terraria.modele.entities.entity.EntityMovable; import fr.sae.terraria.modele.entities.entity.StowableObjectType; -public class Arrow extends Entity implements StowableObjectType, MovableObjectType, CollideObjectType +public class Arrow extends EntityMovable implements StowableObjectType, CollideObjectType { private final Environment environment; public Arrow(final Environment environment, int x, int y, int velocity) { - super(x, y); + super(x, y, environment); this.environment = environment; this.velocity = velocity; @@ -23,10 +22,4 @@ public Arrow(final Environment environment, int x, int y, int velocity) @Override public void updates() { /* TODO document why this method is empty */ } @Override public void move() { /* TODO document why this method is empty */ } @Override public void collide() { /* TODO document why this method is empty */ } - - @Override public void moveRight() { super.moveRight(); } - @Override public void moveLeft() { super.moveLeft(); } - @Override public void jump() { /* UNE FLECHE NE PEUT SAUTER */ } - @Override public void fall() { super.fall(); } - @Override public void worldLimit() { super.worldLimit(this.environment); } } diff --git a/src/main/java/fr/sae/terraria/modele/entities/Rabbit.java b/src/main/java/fr/sae/terraria/modele/entities/Rabbit.java index 8d8d32f..5a0da73 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/Rabbit.java +++ b/src/main/java/fr/sae/terraria/modele/entities/Rabbit.java @@ -12,7 +12,7 @@ import java.util.Objects; -public class Rabbit extends Entity implements CollideObjectType, ReproductiveObjectType, MovableObjectType, CollapsibleObjectType, SpawnableObjectType +public class Rabbit extends EntityMovable implements CollideObjectType, ReproductiveObjectType, CollapsibleObjectType, SpawnableObjectType { public static final int WHEN_SPAWN_A_RABBIT = 2_500; public static final double RABBIT_SPAWN_RATE = .2; @@ -27,7 +27,7 @@ public class Rabbit extends Entity implements CollideObjectType, ReproductiveObj public Rabbit(final Environment environment, int x, int y) { - super(x, y); + super(x, y, environment); this.environment = environment; this.setPv(3); @@ -138,7 +138,7 @@ public Rabbit(final Environment environment, int x, int y) /** Modifie l'offset qui permet de tomber */ @Override public void fall() { super.fall(); } - @Override public void worldLimit() + public void worldLimit() { if (super.worldLimit(this.environment)) this.offset[0] = (-1) * this.offset[0]; diff --git a/src/main/java/fr/sae/terraria/modele/entities/Slime.java b/src/main/java/fr/sae/terraria/modele/entities/Slime.java index 721fd28..2a59a73 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/Slime.java +++ b/src/main/java/fr/sae/terraria/modele/entities/Slime.java @@ -7,18 +7,15 @@ import java.util.Objects; -public class Slime extends Entity implements CollideObjectType, MovableObjectType, CollapsibleObjectType, SpawnableObjectType +public class Slime extends EntityMovable implements CollideObjectType, CollapsibleObjectType, SpawnableObjectType { public static final int WHEN_SPAWN_A_SLIME = 2_500; public static final double SLIME_SPAWN_RATE = .2; - private final Environment environment; - public Slime(Environment environment, int x, int y) { - super(x, y); - this.environment = environment; + super(x, y, environment); this.velocity = 2; this.setPv(3); @@ -41,7 +38,7 @@ public Slime(Environment environment, int x, int y) this.offset[0] = Entity.IDLE; if (this.offset[1] == Entity.IS_JUMPING) { - if (environment.getPlayer().getX() > this.x.getValue()) + if (this.environment.getPlayer().getX() > this.x.getValue()) this.offset[0] = Entity.IS_MOVING_RIGHT; else if (environment.getPlayer().getX() < this.x.getValue()) this.offset[0] = Entity.IS_MOVING_LEFT; @@ -95,5 +92,5 @@ else if (environment.getPlayer().getX() < this.x.getValue()) @Override public void fall() { super.fall(); } - @Override public void worldLimit() { super.worldLimit(this.environment); } + public void worldLimit() { super.worldLimit(this.environment); } } diff --git a/src/main/java/fr/sae/terraria/modele/entities/entity/Entity.java b/src/main/java/fr/sae/terraria/modele/entities/entity/Entity.java index 9a728e8..f29cefe 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/entity/Entity.java +++ b/src/main/java/fr/sae/terraria/modele/entities/entity/Entity.java @@ -1,14 +1,8 @@ package fr.sae.terraria.modele.entities.entity; -import fr.sae.terraria.modele.Environment; -import fr.sae.terraria.modele.TileMaps; -import fr.sae.terraria.modele.entities.Slime; import javafx.beans.property.DoubleProperty; import javafx.beans.property.SimpleDoubleProperty; -import java.util.HashMap; -import java.util.Map; - /** * <h1><b>La classes Entity</b></h1> @@ -31,7 +25,6 @@ * * <p>Sont implementable grâce à l'interface MovableObjectType</p> * @see CollideObjectType - * @see MovableObjectType * @see ReproductiveObjectType * @see StowableObjectType * @see BreakableObjectType @@ -53,14 +46,10 @@ public abstract class Entity protected final DoubleProperty x; protected final DoubleProperty y; - protected final Gravity gravity = new Gravity(); protected Animation animation = null; protected Rect rect = null; - protected double velocity; protected double pvMax; - protected boolean air; - public int[] offset; /** @@ -76,9 +65,6 @@ protected Entity(int x, int y) this.pv = new SimpleDoubleProperty(0); this.pvMax = this.pv.get(); - this.air = false; - this.offset = new int[2]; - this.velocity = 1; } protected Entity() { this(0, 0); } @@ -89,133 +75,17 @@ protected Entity(int x, int y) */ public abstract void updates(); - /** - * Permet de detecter les collisions sur la carte et de son environment. - * - * @param environment Permet de savoir les tailles des tiles et d'avoir la matrixe de données de la carte. - * @return Il vas retourner une HashMap qui ne contiendra pas de clé ou 4 clés maximum - * left, right, top, bottom sera les clés qui peuvent être present lors d'une detection de collision. - * Il permettra de faire des actions personnalisées les actions faites par l'entité suivant d'où il rentre en collision avec son environment. - */ - protected Map<String, Boolean> collide(final Environment environment) - { - - int widthTile = environment.widthTile; int heightTile = environment.heightTile; - TileMaps tileMaps = environment.getTileMaps(); - Map<String, Boolean> whereCollide = new HashMap<>(); - - // Detection vide en dessous - int yBottom = (int) (this.getY()+getRect().getHeight()-CollideObjectType.COLLISION_TOLERANCE)/heightTile; - int posX = (int) ((this.getX()+((this.offset[0] < 0) ? CollideObjectType.COLLISION_TOLERANCE : -CollideObjectType.COLLISION_TOLERANCE)) + ((this.offset[0] > 0) ? getRect().getWidth() : 0))/widthTile; - - boolean footInTheVoid = tileMaps.getTile(posX, yBottom) == TileMaps.SKY; - if (footInTheVoid) - this.air = true; - - // Detection collision gauche droite - if (this.offset[0] != Entity.IDLE) { - int yTop = (int) (getY()+CollideObjectType.COLLISION_TOLERANCE)/heightTile; - int futurePositionXLeft = (int) ((getX()+CollideObjectType.COLLISION_TOLERANCE)+(velocity*offset[0]))/widthTile; - int futurePositionXRight = (int) ((getX()+(-CollideObjectType.COLLISION_TOLERANCE)+(velocity*offset[0])) + (getRect().getWidth()))/widthTile; - - whereCollide.put("right", tileMaps.getTile(futurePositionXRight, yTop) != TileMaps.SKY || tileMaps.getTile(futurePositionXRight, yBottom) != TileMaps.SKY); - whereCollide.put("left", tileMaps.getTile(futurePositionXLeft, yTop) != TileMaps.SKY || tileMaps.getTile(futurePositionXLeft, yBottom) != TileMaps.SKY); - } - - // Detection collision en bas et en haut - if (this.offset[1] != Entity.IDLE) { - int xLeft = (int) (getX()+CollideObjectType.COLLISION_TOLERANCE)/widthTile; - int xRight = (int) ((getX()+getRect().getWidth())-CollideObjectType.COLLISION_TOLERANCE)/widthTile; - - - // Tombe - if (this.offset[1] == Entity.IS_FALLING) { - this.gravity.degInit = 0; - double futurePositionY = gravity.formulaOfTrajectory() ; - boolean isCollideBottom = tileMaps.getTile(xLeft, (int) (futurePositionY + this.rect.getHeight())/heightTile) != TileMaps.SKY || tileMaps.getTile(xRight, (int) (futurePositionY + CollideObjectType.COLLISION_TOLERANCE +this.rect.getHeight())/heightTile) != TileMaps.SKY; - if (isCollideBottom) { - this.gravity.setJumpPosInit(this); - this.gravity.timer = 0; - this.offset[1] = Entity.IDLE; - } else setY(futurePositionY); - // Saute - } else if (this.offset[1] == Entity.IS_JUMPING) { - double futurePositionY = gravity.formulaOfTrajectory(); - - boolean isCollideTop = tileMaps.getTile(xLeft, (int) (futurePositionY + CollideObjectType.COLLISION_TOLERANCE)/heightTile) != TileMaps.SKY || tileMaps.getTile(xRight, (int) (futurePositionY + CollideObjectType.COLLISION_TOLERANCE)/heightTile) != TileMaps.SKY; - // Quand le joueur monte - if (this.gravity.flightTime >= this.gravity.timer ) { - if (isCollideTop) { - this.fall(); - this.gravity.timer = 0; - this.gravity.setJumpPosInit(this); - } else this.setY(futurePositionY); - // Quand le joueur decent - } else { - boolean isCollideBottom = tileMaps.getTile(xLeft, (int) ((futurePositionY + this.rect.getHeight()) - CollideObjectType.COLLISION_TOLERANCE)/heightTile) != TileMaps.SKY || tileMaps.getTile(xRight,(int) ((futurePositionY + this.rect.getHeight()) - CollideObjectType.COLLISION_TOLERANCE)/heightTile) != TileMaps.SKY; - - if (isCollideTop) { - this.fall(); - } else if (isCollideBottom) { - this.gravity.setJumpPosInit(this); - this.gravity.timer = 0; - this.offset[1] = Entity.IDLE; - this.air = false; - } else this.setY(futurePositionY); - } - } - } else if (this.air) { - this.gravity.degInit = 0; - int xLeft = (int) (getX()+CollideObjectType.COLLISION_TOLERANCE)/widthTile; - int xRight = (int) (getX()-CollideObjectType.COLLISION_TOLERANCE+getRect().getWidth())/widthTile; - double futurePositionY = this.gravity.formulaOfTrajectory() + this.rect.getHeight(); - - boolean isCollideBottom = tileMaps.getTile(xLeft, (int) (futurePositionY - CollideObjectType.COLLISION_TOLERANCE)/heightTile) != TileMaps.SKY || tileMaps.getTile(xRight, (int) (futurePositionY - CollideObjectType.COLLISION_TOLERANCE)/heightTile) != TileMaps.SKY; - if (isCollideBottom) { - this.offset[1] = Entity.IDLE; - this.air = false; - this.gravity.setJumpPosInit(this); - } else setY(futurePositionY - this.rect.getHeight()); - } - - return whereCollide; - } - - protected void moveRight() { this.offset[0] = Entity.IS_MOVING_RIGHT; } - protected void moveLeft() { this.offset[0] = Entity.IS_MOVING_LEFT; } - protected void jump() { this.offset[1] = Entity.IS_JUMPING; } - protected void fall() { this.offset[1] = Entity.IS_FALLING; } - - /** - * Lorsque le joueur sort de l'ecran et/ou de la carte, la fonction retourne une valeurs boolean qui sera manipulable sur les classes qui l'héritera. - * @param environment Permet d'avoir les informations naicessaire sur la carte et l'écran pour que l'entité ne sorte pas. - * - * @return false = ne sort pas | true = sort de l'écran soit vers la droite ou soit vers le bas - */ - protected boolean worldLimit(final Environment environment) - { - double widthMap = (environment.getTileMaps().getWidth()*environment.scaleMultiplicatorWidth*TileMaps.TILE_DEFAULT_SIZE) ; - - boolean exceedsScreenOnLeft = offset[0] == Entity.IS_MOVING_LEFT && getX() < 0; - boolean exceedsScreenOnRight = offset[0] == Entity.IS_MOVING_RIGHT && getX()+CollideObjectType.COLLISION_TOLERANCE+velocity + getRect().getWidth() + 3 >= widthMap; - return (exceedsScreenOnLeft || exceedsScreenOnRight); - } - - public DoubleProperty getPvProperty() { return this.pv; } public DoubleProperty getXProperty() { return this.x; } public DoubleProperty getYProperty(){ return this.y; } public Animation getAnimation() { return this.animation; } - public Gravity getGravity() { return this.gravity; } public Rect getRect() { return this.rect; } - public double getVelocity() { return this.velocity; } public double getPvMax() { return this.pv.get(); } public double getPv() { return this.pv.get(); } public double getX() { return this.x.get(); } public double getY() { return this.y.get(); } public void setRect(int width, int height) { this.rect = new Rect(x.get(), y.get(), width, height); } - public void setVelocity(double velocity) { this.velocity = velocity; } public void setPv(double pv) { this.pv.set(pv); this.pvMax = pv;} public void setX(double x) { this.x.set(x); } public void setY(double y) { this.y.set(y); } diff --git a/src/main/java/fr/sae/terraria/modele/entities/entity/EntityMovable.java b/src/main/java/fr/sae/terraria/modele/entities/entity/EntityMovable.java new file mode 100644 index 0000000..341b036 --- /dev/null +++ b/src/main/java/fr/sae/terraria/modele/entities/entity/EntityMovable.java @@ -0,0 +1,152 @@ +package fr.sae.terraria.modele.entities.entity; + +import fr.sae.terraria.modele.Environment; +import fr.sae.terraria.modele.TileMaps; + +import java.util.HashMap; +import java.util.Map; + + +public abstract class EntityMovable extends Entity +{ + protected final Environment environment; + protected final Gravity gravity; + + protected double velocity; + protected boolean air; + public int[] offset; + + + protected EntityMovable(int x, int y, final Environment environment) + { + super(x, y); + this.environment = environment; + + this.gravity = new Gravity(); + this.offset = new int[2]; + this.air = false; + this.velocity = 1; + } + + protected EntityMovable(final Environment environment) { this(0, 0, environment); } + + @Override public abstract void updates(); + public abstract void move(); + + /** + * Permet de detectés les collisions sur la carte et de son environment. + * + * @param environment Permet de savoir les tailles des tiles et d'avoir la matrixe de données de la carte. + * @return Il vas retourner une HashMap qui ne contiendra pas de clé ou 4 clés maximum + * left, right, top, bottom sera les clés qui peuvent être present lors d'une detection de collision. + * Il permettra de faire des actions personnalisées les actions faites par l'entité suivant d'où il rentre en collision avec son environment. + */ + protected Map<String, Boolean> collide(final Environment environment) + { + int widthTile = environment.widthTile; int heightTile = environment.heightTile; + TileMaps tileMaps = environment.getTileMaps(); + Map<String, Boolean> whereCollide = new HashMap<>(); + + // Detection vide en dessous + int yBottom = (int) (this.getY()+getRect().getHeight()-CollideObjectType.COLLISION_TOLERANCE)/heightTile; + int posX = (int) ((this.getX()+((this.offset[0] < 0) ? CollideObjectType.COLLISION_TOLERANCE : -CollideObjectType.COLLISION_TOLERANCE)) + ((this.offset[0] > 0) ? getRect().getWidth() : 0))/widthTile; + + boolean footInTheVoid = tileMaps.getTile(posX, yBottom) == TileMaps.SKY; + if (footInTheVoid) + this.air = true; + + // Detection collision gauche droite + if (this.offset[0] != Entity.IDLE) { + int yTop = (int) (getY()+CollideObjectType.COLLISION_TOLERANCE)/heightTile; + int futurePositionXLeft = (int) ((getX()+CollideObjectType.COLLISION_TOLERANCE)+(velocity*offset[0]))/widthTile; + int futurePositionXRight = (int) ((getX()+(-CollideObjectType.COLLISION_TOLERANCE)+(velocity*offset[0])) + (getRect().getWidth()))/widthTile; + + whereCollide.put("right", tileMaps.getTile(futurePositionXRight, yTop) != TileMaps.SKY || tileMaps.getTile(futurePositionXRight, yBottom) != TileMaps.SKY); + whereCollide.put("left", tileMaps.getTile(futurePositionXLeft, yTop) != TileMaps.SKY || tileMaps.getTile(futurePositionXLeft, yBottom) != TileMaps.SKY); + } + + // Detection collision en bas et en haut + if (this.offset[1] != Entity.IDLE) { + int xLeft = (int) (getX()+CollideObjectType.COLLISION_TOLERANCE)/widthTile; + int xRight = (int) ((getX()+getRect().getWidth())-CollideObjectType.COLLISION_TOLERANCE)/widthTile; + + + // Tombe + if (this.offset[1] == Entity.IS_FALLING) { + this.gravity.degInit = 0; + double futurePositionY = gravity.formulaOfTrajectory() ; + boolean isCollideBottom = tileMaps.getTile(xLeft, (int) (futurePositionY + this.rect.getHeight())/heightTile) != TileMaps.SKY || tileMaps.getTile(xRight, (int) (futurePositionY + CollideObjectType.COLLISION_TOLERANCE +this.rect.getHeight())/heightTile) != TileMaps.SKY; + if (isCollideBottom) { + this.gravity.setJumpPosInit(this); + this.gravity.timer = 0; + this.offset[1] = Entity.IDLE; + } else setY(futurePositionY); + // Saute + } else if (this.offset[1] == Entity.IS_JUMPING) { + double futurePositionY = gravity.formulaOfTrajectory(); + + boolean isCollideTop = tileMaps.getTile(xLeft, (int) (futurePositionY + CollideObjectType.COLLISION_TOLERANCE)/heightTile) != TileMaps.SKY || tileMaps.getTile(xRight, (int) (futurePositionY + CollideObjectType.COLLISION_TOLERANCE)/heightTile) != TileMaps.SKY; + // Quand le joueur monte + if (this.gravity.flightTime >= this.gravity.timer ) { + if (isCollideTop) { + this.fall(); + this.gravity.timer = 0; + this.gravity.setJumpPosInit(this); + } else this.setY(futurePositionY); + // Quand le joueur decent + } else { + boolean isCollideBottom = tileMaps.getTile(xLeft, (int) ((futurePositionY + this.rect.getHeight()) - CollideObjectType.COLLISION_TOLERANCE)/heightTile) != TileMaps.SKY || tileMaps.getTile(xRight,(int) ((futurePositionY + this.rect.getHeight()) - CollideObjectType.COLLISION_TOLERANCE)/heightTile) != TileMaps.SKY; + + if (isCollideTop) { + this.fall(); + } else if (isCollideBottom) { + this.gravity.setJumpPosInit(this); + this.gravity.timer = 0; + this.offset[1] = Entity.IDLE; + this.air = false; + } else this.setY(futurePositionY); + } + } + } else if (this.air) { + this.gravity.degInit = 0; + int xLeft = (int) (getX()+CollideObjectType.COLLISION_TOLERANCE)/widthTile; + int xRight = (int) (getX()-CollideObjectType.COLLISION_TOLERANCE+getRect().getWidth())/widthTile; + double futurePositionY = this.gravity.formulaOfTrajectory() + this.rect.getHeight(); + + boolean isCollideBottom = tileMaps.getTile(xLeft, (int) (futurePositionY - CollideObjectType.COLLISION_TOLERANCE)/heightTile) != TileMaps.SKY || tileMaps.getTile(xRight, (int) (futurePositionY - CollideObjectType.COLLISION_TOLERANCE)/heightTile) != TileMaps.SKY; + if (isCollideBottom) { + this.offset[1] = Entity.IDLE; + this.air = false; + this.gravity.setJumpPosInit(this); + } else setY(futurePositionY - this.rect.getHeight()); + } + + return whereCollide; + } + + protected void moveRight() { this.offset[0] = Entity.IS_MOVING_RIGHT; } + protected void moveLeft() { this.offset[0] = Entity.IS_MOVING_LEFT; } + protected void jump() { this.offset[1] = Entity.IS_JUMPING; } + protected void fall() { this.offset[1] = Entity.IS_FALLING; } + + /** + * Lorsque le joueur sort de l'ecran et/ou de la carte, la fonction retourne une valeurs boolean qui sera manipulable sur les classes qui l'héritera. + * @param environment Permet d'avoir les informations naicessaire sur la carte et l'écran pour que l'entité ne sorte pas. + * + * @return false = ne sort pas | true = sort de l'écran soit vers la droite ou soit vers le bas + */ + protected boolean worldLimit(final Environment environment) + { + double widthMap = (environment.getTileMaps().getWidth()*environment.scaleMultiplicatorWidth*TileMaps.TILE_DEFAULT_SIZE) ; + + boolean exceedsScreenOnLeft = offset[0] == Entity.IS_MOVING_LEFT && getX() < 0; + boolean exceedsScreenOnRight = offset[0] == Entity.IS_MOVING_RIGHT && getX()+CollideObjectType.COLLISION_TOLERANCE+velocity + getRect().getWidth() + 3 >= widthMap; + return (exceedsScreenOnLeft || exceedsScreenOnRight); + } + + + public double getVelocity() { return this.velocity; } + public Gravity getGravity() { return this.gravity; } + + public void setVelocity(double velocity) { this.velocity = velocity; } +} diff --git a/src/main/java/fr/sae/terraria/modele/entities/entity/MovableObjectType.java b/src/main/java/fr/sae/terraria/modele/entities/entity/MovableObjectType.java deleted file mode 100644 index 3202f79..0000000 --- a/src/main/java/fr/sae/terraria/modele/entities/entity/MovableObjectType.java +++ /dev/null @@ -1,66 +0,0 @@ -package fr.sae.terraria.modele.entities.entity; - - -/** - * <h1>Movable Object Type</h1> - * <h2>Interface utile à un objet qui hérite d'Entity</h2> - * <img src="https://raw.githubusercontent.com/NaulaN/SAE-Terraria-Like/develop/src/main/resources/fr/sae/terraria/docs/FonctionsMovable.PNG"/> - * <h2><u>Description:</u></h2> - * <p>Il permet d'implementer les fonctions qui correspond à une entité qui doit ou qui peut bouger.</p> - * <p>Il permet surtout de rendre public les functions qui sont en protected donc pas accessible à l'extérieur de la classe</p> - * @see Entity - * - * @author CHRZASZCZ Naulan - */ -public interface MovableObjectType -{ - - - /** - * Permet que l'entité bouge grâce aux offset modifier à chaque passage de la boucle du jeu. - * Donc, il doit être appelé dans "updates()" pour que le joueur puisse être déplacé. - * - * @see Entity - */ - void move(); - - /** - * Permet que l'entité lors de ses déplacements, qui ne sortent pas de la carte et aussi nis de l'écran. - * Pour l'utilisé dans une classe que vous avez récemment créé, vous devez appeler la fonction dans Entité grâce à "super.worldLimit()". - * - * @see Entity - */ - void worldLimit(); - - /** - * Modifie l'indice 0 dans la variable offset qui permet de le déplacer l'entité vers la droite. - * Pour l'utilisé dans une classe que vous avez récemment créé, vous devez appeler la fonction dans Entité grâce à "super.moveRight()". - * - * @see Entity - */ - void moveRight(); - - /** - * Modifie l'indice 0 dans la variable offset qui permet de le déplacer l'entité vers la gauche. - * Pour l'utilisé dans une classe que vous avez récemment créé, vous devez appeler la fonction dans Entité grâce à "super.moveLeft()". - * - * @see Entity - */ - void moveLeft(); - - /** - * Modifie l'indice 1 dans la variable offset qui permet d'informer l'entité qui est en train de sauter - * Pour l'utilisé dans une classe que vous avez récemment créé, vous devez appeler la fonction dans Entité grâce à "super.jump()". - * - * @see Entity - */ - void jump(); - - /** - * Modifie l'indice 1 dans la variable offset qui permet d'informer l'entité qui est en train de tomber - * Pour l'utilisé dans une classe que vous avez récemment créé, vous devez appeler la fonction dans Entité grâce à "super.fall()". - * - * @see Entity - */ - void fall(); -} diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java index d4bbf6d..cc6e72e 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java @@ -16,7 +16,7 @@ import java.util.Objects; -public class Player extends Entity implements CollideObjectType, MovableObjectType, CollapsibleObjectType, SpawnableObjectType +public class Player extends EntityMovable implements CollideObjectType, CollapsibleObjectType, SpawnableObjectType { public static final int BREAK_BLOCK_DISTANCE = 1; @@ -25,17 +25,13 @@ public class Player extends Entity implements CollideObjectType, MovableObjectTy private final ObjectProperty objectWasPickup; - - private final Environment environment; - private final Inventory inventory; private Stack stackSelected; public Player(final Environment environment) { - super(); - this.environment = environment; + super(0, 0, environment); this.inventory = new Inventory(this); this.animation = new Animation(); @@ -98,12 +94,7 @@ public Player(final Environment environment) this.getGravity().setYInit(y); } - @Override public void moveRight() { super.moveRight(); } - @Override public void moveLeft() { super.moveLeft(); } - @Override public void jump() { super.jump(); } - @Override public void fall() { super.fall(); } - - @Override public void worldLimit() + public void worldLimit() { if (super.worldLimit(this.environment)) this.offset[0] = Entity.IDLE; diff --git a/src/main/java/fr/sae/terraria/vue/SlimeView.java b/src/main/java/fr/sae/terraria/vue/SlimeView.java index 88df45c..9b1e7e5 100644 --- a/src/main/java/fr/sae/terraria/vue/SlimeView.java +++ b/src/main/java/fr/sae/terraria/vue/SlimeView.java @@ -2,7 +2,6 @@ import fr.sae.terraria.modele.TileMaps; import fr.sae.terraria.modele.entities.Slime; -import fr.sae.terraria.modele.entities.entity.Entity; import javafx.geometry.Rectangle2D; import javafx.scene.image.Image; import javafx.scene.image.ImageView; From cef0038965b362c765b928c231aed0a7fd774f77 Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Thu, 9 Jun 2022 14:37:28 +0200 Subject: [PATCH 04/97] Clean --- src/main/java/fr/sae/terraria/modele/entities/Arrow.java | 2 -- src/main/java/fr/sae/terraria/modele/entities/Rabbit.java | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/main/java/fr/sae/terraria/modele/entities/Arrow.java b/src/main/java/fr/sae/terraria/modele/entities/Arrow.java index 8b0ba10..7e30145 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/Arrow.java +++ b/src/main/java/fr/sae/terraria/modele/entities/Arrow.java @@ -8,13 +8,11 @@ public class Arrow extends EntityMovable implements StowableObjectType, CollideObjectType { - private final Environment environment; public Arrow(final Environment environment, int x, int y, int velocity) { super(x, y, environment); - this.environment = environment; this.velocity = velocity; } diff --git a/src/main/java/fr/sae/terraria/modele/entities/Rabbit.java b/src/main/java/fr/sae/terraria/modele/entities/Rabbit.java index 5a0da73..1b15411 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/Rabbit.java +++ b/src/main/java/fr/sae/terraria/modele/entities/Rabbit.java @@ -21,14 +21,12 @@ public class Rabbit extends EntityMovable implements CollideObjectType, Reproduc public static final double LUCK_OF_JUMPING = .5; public static final int JUMP_FREQUENCY = 50; - private final Environment environment; private final Animation animation; public Rabbit(final Environment environment, int x, int y) { super(x, y, environment); - this.environment = environment; this.setPv(3); this.animation = new Animation(); From d66b42762b939f87ef1698e4d4dad568153fc8c0 Mon Sep 17 00:00:00 2001 From: Tiago Lousa <tig2468.a@gmail.com> Date: Thu, 9 Jun 2022 16:29:52 +0200 Subject: [PATCH 05/97] =?UTF-8?q?ajout=20vodka=20+=20clear=20impuret=C3=A9?= =?UTF-8?q?=20tree=20sheet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modele/entities/blocks/TallGrass.java | 11 ++++++++--- .../terraria/modele/entities/items/Vodka.java | 10 ++++++++++ .../sae/terraria/vue/hud/InventoryView.java | 2 ++ .../resources/fr/sae/terraria/loots/vodka.png | Bin 0 -> 5052 bytes .../fr/sae/terraria/sprites/tree-sheet.png | Bin 9109 -> 9024 bytes 5 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 src/main/java/fr/sae/terraria/modele/entities/items/Vodka.java create mode 100644 src/main/resources/fr/sae/terraria/loots/vodka.png diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/TallGrass.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/TallGrass.java index 9fd6929..9acb301 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/TallGrass.java +++ b/src/main/java/fr/sae/terraria/modele/entities/blocks/TallGrass.java @@ -6,6 +6,7 @@ import fr.sae.terraria.modele.entities.entity.ReproductiveObjectType; import fr.sae.terraria.modele.entities.entity.SpawnableObjectType; import fr.sae.terraria.modele.entities.items.Fiber; +import fr.sae.terraria.modele.entities.items.Vodka; import javafx.beans.property.DoubleProperty; import javafx.beans.property.SimpleDoubleProperty; @@ -15,10 +16,10 @@ public class TallGrass extends Block implements ReproductiveObjectType, SpawnableObjectType { - public static final int WHEN_SPAWN_A_TALL_GRASS = 2_500; - public static final double TALL_GRASS_SPAWN_RATE = .3; + public static final int WHEN_SPAWN_A_TALL_GRASS = 50; + public static final double TALL_GRASS_SPAWN_RATE = .8; public static final double REPRODUCTION_RATE = 500; - public static final double GROWTH_SPEED = .0005; + public static final double GROWTH_SPEED = .5; public static final int GROWTH_TALL_GRASS_STEP = 6; public static final int LOOTS_FIBRE_MAX = 3; @@ -52,6 +53,10 @@ public TallGrass(Environment environment, int x, int y) for (int loot = (int) (Math.random()*3)+1; loot < LOOTS_FIBRE_MAX; loot++) this.environment.getPlayer().pickup(new Fiber()); this.environment.getEntities().remove(this); + + if (Math.random() < 0.5){ + this.environment.getPlayer().pickup(new Vodka()); + } } /** Reproduit les hautes herbes à gauche et à droite de la haute herbe parente */ diff --git a/src/main/java/fr/sae/terraria/modele/entities/items/Vodka.java b/src/main/java/fr/sae/terraria/modele/entities/items/Vodka.java new file mode 100644 index 0000000..adfd28d --- /dev/null +++ b/src/main/java/fr/sae/terraria/modele/entities/items/Vodka.java @@ -0,0 +1,10 @@ +package fr.sae.terraria.modele.entities.items; + +import fr.sae.terraria.modele.entities.entity.EatableObjectType; + +public class Vodka extends Item implements EatableObjectType { + @Override + public void eat() { + + } +} diff --git a/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java b/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java index 801384c..7a6fad0 100644 --- a/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java +++ b/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java @@ -134,6 +134,8 @@ else if (item instanceof Sword) view.setImage(View.loadAnImage("tools/sword.png", itemInventoryWidth, itemInventoryHeight)); else if (item instanceof Arrow) view.setImage(null); // TODO + else if (item instanceof Vodka) + view.setImage(View.loadAnImage("loots/vodka.png", itemInventoryWidth,itemInventoryHeight)); // Actualise le nombre d'item à l'écran this.texts.get(c.getTo()-1).setText(String.valueOf(stack.getNbItems())); diff --git a/src/main/resources/fr/sae/terraria/loots/vodka.png b/src/main/resources/fr/sae/terraria/loots/vodka.png new file mode 100644 index 0000000000000000000000000000000000000000..a33f575f949068432947d70e33598f6d7df03480 GIT binary patch literal 5052 zcmeHKX;>5I7LEd85d=X6+z6qH2uUXU0$~l3^cq1H1%)e<$s`PBGYKRh#e$WBtOcaS z1;rLOuwJQDO2OiS=q-pSNYyG76t%Wm1=PAgCjk|o+dn?f?LQ~aOlHpVo^#&sd?%Tl zu;n2(R&%T{7>td8&kIMt?F^>{7QMO*je!`9$-UIbXl*#C!>QCt2_l1W+7uOxgY}36 zgVA4YS{d{0%|+HPrL$tD7TcXtJ9V6!Ui%^zxRq>k*t@$sWv>jZEG9Ngl|A#@XglOc zTqGHw@pd&HtB+OZP&u6oR{cA)R>6Ie+mv*FcyM0)e$()Ro;$~03PT^CcYue7`xjs4 zhTS(WzBW3r>C5^2Mfj!r<ROT+y)QPw`)upcnox4=zOZMm*W`;H*0-m19Zy?xwR1sl zod4r(fgWvfyU&y?T!0bZkbUswKo9jq(aK#5y@WsUi;7mIa1NXDpui+j{{3k7hT+x9 z1y|IK!kez=MoUQ}S;KTs&ymm167MhQy%)lbb$(v-GNrJyKU#Cft9FQA*IUvcgh%36 z*@?0Wu%nGO^|Od46D<jQ4tjoAc_ne$>MEXf1D2gwiiEAL4L9SpURU{l`dzITT-uyd zy=?Sn8I8p+UNj?i<ptt}M>(5U{v@uB>BQrinH~;1I%{%u+f$y{LTy$4;(>C{zLUT1 z^0~0=%QpA6W{dotk#UyC>sr@6S`r^7ExT<m;LF&tGpk&@GrabgWm%=v1X#(v{kPby zo|0v1{W0BsVJHJI$A3V{+--fwt6-WFE=qwpxBT>`?Psa9QTv4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P5sYS0!kR)bqSL8iys_PPYvz!ZS)Z-7An*pXxghr;9lY&>bA zSdw8+zpB=U^gn#~7!4*30n~3?h7K2WR*_y0s|mgg6#j$9#5(+g5m4y&LEeeq_jJ9d z>zx>QC*$|s^`5SGV&I*O-*?yljV`M<uRE{;{RgB&UuL$!wn6BN5LWcB5FTdC@Y&t8 zuLPA?s`xP)3}*T%!#Sl@xnGP5&9wqyu=ya?a{640h(}q+P|;2SFCdcjBNUHwXxzHu z&yHsF;N?hat^F@AqdfIZIWzX4MEW9x@yX_*y}6F0QE7a9e9^<{S-F;e-<`66sP-4r zM$YJ1y-h4^F!csduYcITQM|_4$;qig7MELDkW<utzlE%CI?K=d2K@Hky?fMtIwp>4 zov=<N>dq5k*xP==7FCyLpvPzS?W{Qe8c7Z4zeTd+T-i(vW<&-#9`_&m6ipN(2wu+n IIxs%-FIKmW`~Uy| literal 0 HcmV?d00001 diff --git a/src/main/resources/fr/sae/terraria/sprites/tree-sheet.png b/src/main/resources/fr/sae/terraria/sprites/tree-sheet.png index 77a150d0eb2f68d19f523989a2cf281ccb8d056e..3c07ff119d6e9c929c0ff8898cf40b6845d2a3c4 100644 GIT binary patch delta 5120 zcmV+b6#wg$N5DpqBYzE_dQ@0+Qek%>aB^>EX>4U6ba`-PAZ2)IW&i+q+O3#rlH)oK zg#Ysta|Ce#m*bEG88J7Q<Ie|5uI;(wz3!Q+sFE$yT#$)GLT>%%-`o9*pV(q{NlMKv z=Zl}zQVX3I^}2uh`R}iE{-2-lTzUWPzDv*jD{w1vjrZG{pMUYM`=1lsm(DBsGEtq+ z2jlw(?O7qz9}_(bMcYx}g+3FtXQCMH5BxJhzmIk0R?F8TjCEi2b&`7jIr}$WcjX!U z<9#YbPla`22rK${@jt|RZy?%VaIy0upZ|@4J|<oZ@49{b?1X^4i_^zXV@KPzn%)lj zhDuHE(R#gdKY!6m;TaNt1UY|P-`;m#-lK9t|7GP=pI71gedw|79sP*D{q3!FpEGlc zo-(1%&!JvNIj<Nu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5Q=6(!5_ypzZYkptj1^VU^{<mF+)!QtsS3#o&f+>7Wb(s;j1z2zEF>O zZ0Aq0lt0DDm;`@>X$#+~yAk`!X68x{k`i`Rqbz0d9J34WxVj+9JF9fY(TQHD$2>OH zb!-5LrOvRjxNp0cktduFced(ZUv%G-yUIb=?63?<r&>HOgKRMgjc@Dy1d)ZdcIp*h z7sO^k_uPda@qCaBcrwu`0ChpA#dAc6*pRW>jc@A3SvG$&*VcsX7Vimy?xt0F8i{Y} zh_(vEEB<D`#}qG(wjSI}yekMPEHzbn+ljvsa`0Y9iOvJ!r2)0r{84Nqo^Q19h=AKr zQZre(4KFuZ4p$Jmru)`MS^_b<@QyP=t@jPzn5bS9R3IRTEHG!o6NIkm!FZzDjDayh z6DLz77$#}5nYj{eK$`_U_|rjT!SY4BlT}k7h%6wPA}HilOOlQ<Vc%^sMI4p0qjJ#1 zyQ*QaKxf5{v~nT~h!CmfpOkoMfK&}COqj@K=1TUOVE;@RVPVey3mc!;yH_6t00000 LNkvXXu0mjfX?8>6 From 10327b0d3960e43a17816659c0ca8be7728ca100 Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Thu, 9 Jun 2022 21:08:46 +0200 Subject: [PATCH 06/97] Clean --- .../modele/entities/blocks/TallGrass.java | 15 ++++++----- .../terraria/modele/entities/items/Vodka.java | 25 ++++++++++++++++--- 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/TallGrass.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/TallGrass.java index 9acb301..7209deb 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/TallGrass.java +++ b/src/main/java/fr/sae/terraria/modele/entities/blocks/TallGrass.java @@ -16,7 +16,7 @@ public class TallGrass extends Block implements ReproductiveObjectType, SpawnableObjectType { - public static final int WHEN_SPAWN_A_TALL_GRASS = 50; + public static final int WHEN_SPAWN_A_TALL_GRASS = 2_500; public static final double TALL_GRASS_SPAWN_RATE = .8; public static final double REPRODUCTION_RATE = 500; public static final double GROWTH_SPEED = .5; @@ -45,18 +45,21 @@ public TallGrass(Environment environment, int x, int y) tallGrassGrowth.set(tallGrassGrowth.get() + GROWTH_SPEED); } - /** Joue un son et donne au joueur entre 1 et 3 de fibre */ + /** + * Joue un son et donne au joueur entre 1 et 3 de fibre avec un pourcentage de chance d'avoir un easter egg + */ @Override public void breaks() { Environment.playSound("sound/cut.wav", false); for (int loot = (int) (Math.random()*3)+1; loot < LOOTS_FIBRE_MAX; loot++) this.environment.getPlayer().pickup(new Fiber()); - this.environment.getEntities().remove(this); - if (Math.random() < 0.5){ - this.environment.getPlayer().pickup(new Vodka()); - } + boolean mustDropVodka = Math.random() < Vodka.DROP_RATE; + if (mustDropVodka) + this.environment.getPlayer().pickup(new Vodka(environment)); + + this.environment.getEntities().remove(this); } /** Reproduit les hautes herbes à gauche et à droite de la haute herbe parente */ diff --git a/src/main/java/fr/sae/terraria/modele/entities/items/Vodka.java b/src/main/java/fr/sae/terraria/modele/entities/items/Vodka.java index adfd28d..1a1732f 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/items/Vodka.java +++ b/src/main/java/fr/sae/terraria/modele/entities/items/Vodka.java @@ -1,10 +1,29 @@ package fr.sae.terraria.modele.entities.items; +import fr.sae.terraria.modele.Environment; import fr.sae.terraria.modele.entities.entity.EatableObjectType; -public class Vodka extends Item implements EatableObjectType { - @Override - public void eat() { + +/** + * <h1>EasterEgg</h1> + * <h2><u>Description:</u></h2> + * <p>Ce drop lorsque le joueur casse des hautes herbes et une fois bu, l'écran sera troublé</p> + */ +public class Vodka extends Item implements EatableObjectType +{ + public static final double DROP_RATE = .1; + + private final Environment environment; + + + public Vodka(final Environment environment) + { + super(); + this.environment = environment; + } + + @Override public void eat() + { } } From f843f6899133f3a874d99eff7523c620784cf891 Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Fri, 10 Jun 2022 10:13:10 +0200 Subject: [PATCH 07/97] Lapin disparait lorsqu'il meurt --- .../sae/terraria/modele/entities/Rabbit.java | 2 +- .../java/fr/sae/terraria/vue/RabbitView.java | 3 +++ .../fr/sae/terraria/vue/TileMapsView.java | 21 +++++++++++++++---- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/main/java/fr/sae/terraria/modele/entities/Rabbit.java b/src/main/java/fr/sae/terraria/modele/entities/Rabbit.java index 1b15411..41f05d2 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/Rabbit.java +++ b/src/main/java/fr/sae/terraria/modele/entities/Rabbit.java @@ -124,7 +124,7 @@ public Rabbit(final Environment environment, int x, int y) this.getGravity().setYInit(y); this.setRect(environment.widthTile, environment.heightTile); this.environment.getEntities().add(0, this); - this.environment.getRabbits().add(0, this); + this.environment.getRabbits().add(this); } /** Modifie l'offset qui permet de le déplacer vers la droite */ diff --git a/src/main/java/fr/sae/terraria/vue/RabbitView.java b/src/main/java/fr/sae/terraria/vue/RabbitView.java index 0c9e533..2ed3744 100644 --- a/src/main/java/fr/sae/terraria/vue/RabbitView.java +++ b/src/main/java/fr/sae/terraria/vue/RabbitView.java @@ -61,4 +61,7 @@ public void displayRabbit(final Pane display) this.setAnimation(); display.getChildren().add(this.rabbitImgView); } + + + public ImageView getRabbitImgView() { return this.rabbitImgView; } } diff --git a/src/main/java/fr/sae/terraria/vue/TileMapsView.java b/src/main/java/fr/sae/terraria/vue/TileMapsView.java index eb01e53..8865ff9 100644 --- a/src/main/java/fr/sae/terraria/vue/TileMapsView.java +++ b/src/main/java/fr/sae/terraria/vue/TileMapsView.java @@ -20,6 +20,8 @@ public class TileMapsView { + private final List<ImageView> rabbitsView = new ArrayList<>(); + private final Image torchImg; private final Image floorTopImg; private final Image floorLeftImg; @@ -29,6 +31,7 @@ public class TileMapsView private final Image dirtImg; private final Image tallGrassImg; + private final Pane displayHostileBeings; private final Pane display; private final Environment environment; @@ -51,6 +54,7 @@ public TileMapsView(Environment environment, super(); this.environment = environment; this.display = displayTileMap; + this.displayHostileBeings = displayHostileBeings; this.tileHeight = (int) (TileMaps.TILE_DEFAULT_SIZE * scaleMultiplicatorHeight); this.tileWidth = (int) (TileMaps.TILE_DEFAULT_SIZE * scaleMultiplicatorWidth); @@ -72,10 +76,6 @@ public TileMapsView(Environment environment, this.createTree((Tree) c.getList().get(0)); if (c.getList().get(0) instanceof TallGrass) this.createTallGrass((TallGrass) c.getList().get(0)); - if (c.getList().get(0) instanceof Rabbit) { - RabbitView rabbitView = new RabbitView((Rabbit) c.getList().get(0), scaleMultiplicatorWidth, scaleMultiplicatorHeight); - rabbitView.displayRabbit(displayHostileBeings); - } if (c.getList().get(0) instanceof Slime) { SlimeView slimeView = new SlimeView((Slime) c.getList().get(0), scaleMultiplicatorWidth, scaleMultiplicatorHeight); slimeView.displaySlime(displayHostileBeings); @@ -110,6 +110,19 @@ public TileMapsView(Environment environment, } } }); + + this.environment.getRabbits().addListener((ListChangeListener<? super Rabbit>) c -> { + while (c.next()) { + if (c.wasAdded()) { + RabbitView rabbitView = new RabbitView(c.getList().get(0), scaleMultiplicatorWidth, scaleMultiplicatorHeight); + rabbitView.displayRabbit(this.displayHostileBeings); + this.rabbitsView.add(rabbitView.getRabbitImgView()); + } else if (c.wasRemoved()) { + this.displayHostileBeings.getChildren().remove(this.rabbitsView.get(c.getTo())); + this.rabbitsView.remove(c.getTo()); + } + } + }); } /** Decompose la carte pour afficher un à un les tiles à l'écran */ From 7441fd464443dd854236e429a183c4a5a06927a0 Mon Sep 17 00:00:00 2001 From: Tiago Lousa <tig2468.a@gmail.com> Date: Fri, 10 Jun 2022 10:49:43 +0200 Subject: [PATCH 08/97] fix items mangeables + ajout view image vdka --- .../java/fr/sae/terraria/controller/GameController.java | 4 ++-- .../fr/sae/terraria/modele/entities/blocks/TallGrass.java | 8 +++++--- .../terraria/modele/entities/player/inventory/Stack.java | 2 ++ .../java/fr/sae/terraria/vue/hud/ItemSelectedView.java | 4 ++++ 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/main/java/fr/sae/terraria/controller/GameController.java b/src/main/java/fr/sae/terraria/controller/GameController.java index 024d8e4..e3d0887 100644 --- a/src/main/java/fr/sae/terraria/controller/GameController.java +++ b/src/main/java/fr/sae/terraria/controller/GameController.java @@ -131,8 +131,8 @@ private void addKeysEventListener(final Stage stage) int distanceBetweenBlockPlayerAxisY = Math.abs(yPlayer - yBlock); boolean isOneBlockDistance = distanceBetweenBlockPlayerAxisY >= 0 && distanceBetweenBlockPlayerAxisY <= Player.BREAK_BLOCK_DISTANCE && distanceBetweenBlockPlayerAxisX >= 0 && distanceBetweenBlockPlayerAxisX <= Player.BREAK_BLOCK_DISTANCE; - if (this.player.getStackSelected() instanceof EatableObjectType) { - ((EatableObjectType) this.player.getStackSelected()).eat(); + if (this.player.getStackSelected().getItem() instanceof EatableObjectType) { + ((EatableObjectType) this.player.getStackSelected().getItem()).eat(); } else if (isOneBlockDistance) { if (click.getButton().equals(MouseButton.PRIMARY)) this.breakBlock(rectangle); diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/TallGrass.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/TallGrass.java index 7209deb..33ecf31 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/TallGrass.java +++ b/src/main/java/fr/sae/terraria/modele/entities/blocks/TallGrass.java @@ -45,9 +45,7 @@ public TallGrass(Environment environment, int x, int y) tallGrassGrowth.set(tallGrassGrowth.get() + GROWTH_SPEED); } - /** - * Joue un son et donne au joueur entre 1 et 3 de fibre avec un pourcentage de chance d'avoir un easter egg - */ + /** Joue un son et donne au joueur entre 1 et 3 de fibre */ @Override public void breaks() { Environment.playSound("sound/cut.wav", false); @@ -60,6 +58,10 @@ public TallGrass(Environment environment, int x, int y) this.environment.getPlayer().pickup(new Vodka(environment)); this.environment.getEntities().remove(this); + + if (Math.random() < 0.5){ + this.environment.getPlayer().pickup(new Vodka(environment)); + } } /** Reproduit les hautes herbes à gauche et à droite de la haute herbe parente */ diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java index df3565f..b354372 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java @@ -62,6 +62,8 @@ else if (object instanceof Wood && this.item instanceof Wood) return true; else if (object instanceof Axe && this.item instanceof Axe) return true; + else if (object instanceof Vodka && this.item instanceof Vodka) + return true; else if (object instanceof Bow && this.item instanceof Bow) return true; else if (object instanceof Pickaxe && this.item instanceof Pickaxe) diff --git a/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java b/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java index 3567ec8..2d9234f 100644 --- a/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java +++ b/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java @@ -39,6 +39,7 @@ public class ItemSelectedView private final Image woodItemImg; private final Image torchItemImg; private final Image pickaxeItemImg; + private final Image vodkaItemImg; private final Pane display; @@ -53,6 +54,7 @@ public ItemSelectedView(Pane display, Player player, double scaleMultiplicatorWi int heightItem = heightTile/2; this.itemSelectedImgView = new ImageView(); + this.vodkaItemImg = View.loadAnImage("loots/vodka.png",widthItem,heightItem); this.dirtItemImg = View.loadAnImage("tiles/floor-top.png", widthItem, heightItem); this.stoneItemImg = View.loadAnImage("tiles/rock-fill.png", widthItem, heightItem); this.torchItemImg = View.loadAnImage("tiles/torch.png", widthItem, heightItem); @@ -94,6 +96,8 @@ else if (item instanceof Iron) this.itemSelectedImgView.setImage(this.ironItemImg); else if (item instanceof Meat) this.itemSelectedImgView.setImage(this.meatItemImg); + else if (item instanceof Vodka) + this.itemSelectedImgView.setImage(this.vodkaItemImg); else if (item instanceof Pierre) this.itemSelectedImgView.setImage(this.pierreItemImg); else if (item instanceof Silex) From 7c95924d276b4cc6d24db329b82d0eeb5fe3af5b Mon Sep 17 00:00:00 2001 From: Tiago Lousa <tig2468.a@gmail.com> Date: Fri, 10 Jun 2022 11:00:48 +0200 Subject: [PATCH 09/97] fix null pointer exception --- src/main/java/fr/sae/terraria/controller/GameController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/sae/terraria/controller/GameController.java b/src/main/java/fr/sae/terraria/controller/GameController.java index e3d0887..895a2da 100644 --- a/src/main/java/fr/sae/terraria/controller/GameController.java +++ b/src/main/java/fr/sae/terraria/controller/GameController.java @@ -131,7 +131,7 @@ private void addKeysEventListener(final Stage stage) int distanceBetweenBlockPlayerAxisY = Math.abs(yPlayer - yBlock); boolean isOneBlockDistance = distanceBetweenBlockPlayerAxisY >= 0 && distanceBetweenBlockPlayerAxisY <= Player.BREAK_BLOCK_DISTANCE && distanceBetweenBlockPlayerAxisX >= 0 && distanceBetweenBlockPlayerAxisX <= Player.BREAK_BLOCK_DISTANCE; - if (this.player.getStackSelected().getItem() instanceof EatableObjectType) { + if (this.player.getStackSelected() != null && this.player.getStackSelected().getItem() instanceof EatableObjectType ) { ((EatableObjectType) this.player.getStackSelected().getItem()).eat(); } else if (isOneBlockDistance) { if (click.getButton().equals(MouseButton.PRIMARY)) From 38eec349589ff0f28ed3557993cb13a9dc80f121 Mon Sep 17 00:00:00 2001 From: Tiago Lousa <tig2468.a@gmail.com> Date: Fri, 10 Jun 2022 19:37:42 +0200 Subject: [PATCH 10/97] vodka disparait quand on l'utilise --- .../java/fr/sae/terraria/modele/entities/items/Vodka.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/fr/sae/terraria/modele/entities/items/Vodka.java b/src/main/java/fr/sae/terraria/modele/entities/items/Vodka.java index 1a1732f..ab03ed5 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/items/Vodka.java +++ b/src/main/java/fr/sae/terraria/modele/entities/items/Vodka.java @@ -2,6 +2,8 @@ import fr.sae.terraria.modele.Environment; import fr.sae.terraria.modele.entities.entity.EatableObjectType; +import fr.sae.terraria.modele.entities.player.Player; +import fr.sae.terraria.modele.entities.player.inventory.Inventory; /** @@ -24,6 +26,8 @@ public Vodka(final Environment environment) @Override public void eat() { - + Player player = environment.getPlayer(); + Inventory inventory = player.getInventory(); + inventory.get().get(inventory.getPosCursor()).remove(); } } From c2e4730e6efec79a2f910b0a7ded01e8ece8e728 Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Fri, 10 Jun 2022 20:17:09 +0200 Subject: [PATCH 11/97] =?UTF-8?q?Refonte=20complet=20de=20TileMapsView,=20?= =?UTF-8?q?Fix=20probleme=20avec=20les=20arbres=20est=20sont=20d=C3=A9sorm?= =?UTF-8?q?ais=20cassable=20et=20disparais=20une=20fois=20casser,=20les=20?= =?UTF-8?q?lapins=20disparaissent=20une=20fois=20tu=C3=A9,=20les=20slimes?= =?UTF-8?q?=20disparaissent=20une=20fois=20tu=C3=A9,=20le=20systemes=20de?= =?UTF-8?q?=20suppresion=20des=20elements=20de=20la=20vue=20=C3=A0=20?= =?UTF-8?q?=C3=A9tais=20optimis=C3=A9,=20animation=20tallgrass=20ajust?= =?UTF-8?q?=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../terraria/controller/GameController.java | 1 - .../fr/sae/terraria/modele/Environment.java | 25 +- .../sae/terraria/modele/entities/Slime.java | 4 +- .../terraria/modele/entities/blocks/Dirt.java | 12 +- .../modele/entities/blocks/Stone.java | 14 +- .../modele/entities/blocks/TallGrass.java | 18 +- .../modele/entities/blocks/Torch.java | 4 +- .../terraria/modele/entities/blocks/Tree.java | 4 +- .../java/fr/sae/terraria/vue/LightView.java | 1 - .../java/fr/sae/terraria/vue/SlimeView.java | 3 + .../fr/sae/terraria/vue/TileMapsView.java | 357 +++++++++--------- src/main/java/fr/sae/terraria/vue/View.java | 2 +- 12 files changed, 239 insertions(+), 206 deletions(-) diff --git a/src/main/java/fr/sae/terraria/controller/GameController.java b/src/main/java/fr/sae/terraria/controller/GameController.java index 024d8e4..e2e8e57 100644 --- a/src/main/java/fr/sae/terraria/controller/GameController.java +++ b/src/main/java/fr/sae/terraria/controller/GameController.java @@ -150,7 +150,6 @@ private void breakBlock(final Rectangle2D rectangle) ((BreakableObjectType) entity).breaks(); if (entity instanceof CollapsibleObjectType) // TODO TEMP, à déplacer ((CollapsibleObjectType) entity).hit(); - // Quand tous c'est bien déroulés, aprés avoir trouvé l'entité et l'objet sur l'écran, il arrête de chercher d'autre entité d'où le break break; } diff --git a/src/main/java/fr/sae/terraria/modele/Environment.java b/src/main/java/fr/sae/terraria/modele/Environment.java index 1943e2d..2aef937 100644 --- a/src/main/java/fr/sae/terraria/modele/Environment.java +++ b/src/main/java/fr/sae/terraria/modele/Environment.java @@ -3,7 +3,9 @@ import fr.sae.terraria.Terraria; import fr.sae.terraria.modele.entities.Rabbit; import fr.sae.terraria.modele.entities.Slime; +import fr.sae.terraria.modele.entities.blocks.Block; import fr.sae.terraria.modele.entities.blocks.Torch; +import fr.sae.terraria.modele.entities.blocks.Tree; import fr.sae.terraria.modele.entities.entity.CollideObjectType; import fr.sae.terraria.modele.entities.entity.Entity; import fr.sae.terraria.modele.entities.entity.ReproductiveObjectType; @@ -29,7 +31,9 @@ public class Environment { - // Permet d'update toutes les entités en une seule boucle. + private final ObservableList<Tree> trees; + private final ObservableList<Block> blocks; + // Permet update toutes les entités en une seule boucle. private final ObservableList<Entity> entities; // Range des entities en plus pour permettre facilement de savoir combien son t-il sur la carte pour limiter leur apparition private final ObservableList<Rabbit> rabbits; @@ -71,6 +75,8 @@ public Environment(double scaleMultiplicatorWidth, double scaleMultiplicatorHeig this.rabbits = FXCollections.observableArrayList(); this.slimes = FXCollections.observableArrayList(); this.torches = FXCollections.observableArrayList(); + this.blocks = FXCollections.observableArrayList(); + this.trees = FXCollections.observableArrayList(); this.player = new Player(this); this.player.setVelocity(5); @@ -123,8 +129,11 @@ private void gameLoop() } // Ajoute les entités ReproductiveObjectType - for (Entity entity : entitiesAtAdded) - this.entities.add(0, entity); + for (Entity entity : entitiesAtAdded) { + this.entities.add(entity); + if (entity instanceof Block) + this.blocks.add((Block) entity); + } entitiesAtAdded.clear(); // Génère aléatoirement des entités @@ -132,7 +141,7 @@ private void gameLoop() boolean nightTime = this.clock.getMinutes() > (Clock.MINUTES_IN_A_DAY)/2; boolean weHaveChangedDay = this.previousDays != this.clock.getDays(); if (weHaveChangedDay) - for (int i = 0; i < 3; i++) // Génère par jour, 3 arbres + for (int i = 0; i < 3; i++); // Génère par jour, 3 arbres GenerateEntity.tree(this); if (dayTime) { // Génère certaines entités uniquement pendant le jour GenerateEntity.rabbit(this); @@ -176,10 +185,12 @@ public static Clip playSound(String path, boolean loop) } + public ObservableList<Block> getBlocks() { return this.blocks; } + public ObservableList<Tree> getTrees() { return this.trees; } public ObservableList<Entity> getEntities() { return this.entities; } - public ObservableList<Rabbit> getRabbits() { return rabbits; } - public ObservableList<Torch> getTorches() { return torches; } - public ObservableList<Slime> getSlimes() { return slimes; } + public ObservableList<Rabbit> getRabbits() { return this.rabbits; } + public ObservableList<Torch> getTorches() { return this.torches; } + public ObservableList<Slime> getSlimes() { return this.slimes; } public TileMaps getTileMaps() { return this.tileMaps; } public Player getPlayer() { return this.player; } public Clock getGameClock() { return this.clock; } diff --git a/src/main/java/fr/sae/terraria/modele/entities/Slime.java b/src/main/java/fr/sae/terraria/modele/entities/Slime.java index 2a59a73..c5fe6e0 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/Slime.java +++ b/src/main/java/fr/sae/terraria/modele/entities/Slime.java @@ -80,8 +80,8 @@ else if (environment.getPlayer().getX() < this.x.getValue()) this.getGravity().setXInit(x); this.getGravity().setYInit(y); this.setRect(environment.widthTile, environment.heightTile); - this.environment.getEntities().add(0, this); - this.environment.getSlimes().add(0, this); + this.environment.getEntities().add(this); + this.environment.getSlimes().add(this); } @Override public void moveRight() { super.moveRight(); } diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/Dirt.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/Dirt.java index 8cf8f06..cb22393 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/Dirt.java +++ b/src/main/java/fr/sae/terraria/modele/entities/blocks/Dirt.java @@ -20,6 +20,7 @@ public class Dirt extends Block implements StowableObjectType, CollideObjectType private final double xOrigin; private final double yOrigin; + private int typeOfFloor; public Dirt(Environment environment, int x, int y) @@ -49,6 +50,7 @@ public Dirt(Environment environment, int x, int y) int xIndexTile = (int) (getX()/environment.widthTile); this.environment.getTileMaps().setTile(TileMaps.SKY, yIndexTile, xIndexTile); this.environment.getEntities().remove(this); + this.environment.getBlocks().remove(this); } this.setPv(this.getPv() - 1); } @@ -58,7 +60,7 @@ public Dirt(Environment environment, int x, int y) Environment.playSound("sound/axchop.wav", false); int widthTile = this.environment.widthTile; int heightTile = this.environment.heightTile; - + Entity entity = new Dirt(this.environment, x*widthTile, y*heightTile); entity.setRect(widthTile, heightTile); @@ -68,6 +70,12 @@ public Dirt(Environment environment, int x, int y) inventory.get().get(inventory.getPosCursor()).remove(); this.environment.getTileMaps().setTile(TileMaps.DIRT, y, x); - this.environment.getEntities().add(0, entity); + this.environment.getEntities().add(entity); + this.environment.getBlocks().add((Dirt) entity); } + + + public int getTypeOfFloor() { return this.typeOfFloor; } + + public void setTypeOfFloor(int type) { this.typeOfFloor = type; } } diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/Stone.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/Stone.java index c96fb32..21a3478 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/Stone.java +++ b/src/main/java/fr/sae/terraria/modele/entities/blocks/Stone.java @@ -54,14 +54,17 @@ public Stone(Environment environment, int x, int y) int xIndexTile = (int) (getX()/this.environment.widthTile); this.environment.getTileMaps().setTile(TileMaps.SKY, yIndexTile, xIndexTile); this.environment.getEntities().remove(this); + this.environment.getBlocks().remove(this); } // S'il utilise le bon outil, il commencera à casser le bloc sinon use l'outil sans casser le bloc. Stack stack = player.getStackSelected(); - if (stack.getItem() instanceof Pickaxe) - this.setPv(this.getPv() - 1); - if (stack.getItem() instanceof Tool) - ((Tool) stack.getItem()).use(); + if (!Objects.isNull(stack.getItem())) { + if (stack.getItem() instanceof Pickaxe) + this.setPv(this.getPv() - 1); + if (stack.getItem() instanceof Tool) + ((Tool) stack.getItem()).use(); + } } @Override public void place(int x, int y) @@ -79,6 +82,7 @@ public Stone(Environment environment, int x, int y) inventory.get().get(inventory.getPosCursor()).remove(); this.environment.getTileMaps().setTile(TileMaps.STONE, y, x); - this.environment.getEntities().add(0, entity); + this.environment.getEntities().add(entity); + this.environment.getBlocks().add((Block) entity); } } diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/TallGrass.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/TallGrass.java index 7209deb..8b5ecbe 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/TallGrass.java +++ b/src/main/java/fr/sae/terraria/modele/entities/blocks/TallGrass.java @@ -18,8 +18,8 @@ public class TallGrass extends Block implements ReproductiveObjectType, Spawnabl { public static final int WHEN_SPAWN_A_TALL_GRASS = 2_500; public static final double TALL_GRASS_SPAWN_RATE = .8; - public static final double REPRODUCTION_RATE = 500; - public static final double GROWTH_SPEED = .5; + public static final double REPRODUCTION_RATE = 1_250; + public static final double GROWTH_SPEED = .01; public static final int GROWTH_TALL_GRASS_STEP = 6; public static final int LOOTS_FIBRE_MAX = 3; @@ -41,8 +41,8 @@ public TallGrass(Environment environment, int x, int y) @Override public void updates() { // L'animation de pousse - if (tallGrassGrowth.get() < GROWTH_TALL_GRASS_STEP) - tallGrassGrowth.set(tallGrassGrowth.get() + GROWTH_SPEED); + if (((int) (tallGrassGrowth.get())) < TallGrass.GROWTH_TALL_GRASS_STEP) + tallGrassGrowth.set(tallGrassGrowth.get() + TallGrass.GROWTH_SPEED); } /** @@ -60,6 +60,7 @@ public TallGrass(Environment environment, int x, int y) this.environment.getPlayer().pickup(new Vodka(environment)); this.environment.getEntities().remove(this); + this.environment.getBlocks().remove(this); } /** Reproduit les hautes herbes à gauche et à droite de la haute herbe parente */ @@ -105,7 +106,9 @@ else if (rightIsAvailable) int xTallGrassChildren = (int) ((left == 0) ? (getX() - widthTile) : (getX() + widthTile)); int yTallGrassChildren = (int) getY(); - children.add(new TallGrass(this.environment, xTallGrassChildren, yTallGrassChildren)); + TallGrass tallGrassChildren = new TallGrass(this.environment, xTallGrassChildren, yTallGrassChildren); + tallGrassChildren.setRect(widthTile, heightTile); + children.add(tallGrassChildren); } } } @@ -117,7 +120,10 @@ else if (rightIsAvailable) { this.setX(x); this.setY(y); - this.environment.getEntities().add(0, this); + this.setRect(this.environment.widthTile, this.environment.heightTile); + + this.environment.getEntities().add(this); + this.environment.getBlocks().add(this); } diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/Torch.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/Torch.java index 84b5fe2..7e83cf3 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/Torch.java +++ b/src/main/java/fr/sae/terraria/modele/entities/blocks/Torch.java @@ -36,6 +36,7 @@ public Torch(Environment environment, int x, int y) this.environment.getEntities().remove(this); this.environment.getTorches().remove(this); + this.environment.getBlocks().remove(this); } @Override public void place(int x, int y) @@ -50,7 +51,8 @@ public Torch(Environment environment, int x, int y) if (!Objects.isNull(player.getStackSelected())) inventory.get().get(inventory.getPosCursor()).remove(); - environment.getEntities().add(0, entity); + environment.getEntities().add(entity); environment.getTorches().add(0, entity); + environment.getBlocks().add(entity); } } \ No newline at end of file diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/Tree.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/Tree.java index 741add5..a2736ae 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/Tree.java +++ b/src/main/java/fr/sae/terraria/modele/entities/blocks/Tree.java @@ -28,12 +28,14 @@ public Tree(Environment environment, int x, int y) // Environment.playSound("sound/grassyStep.wav", false); this.environment.getPlayer().pickup(new Wood()); this.environment.getEntities().remove(this); + this.environment.getTrees().remove(this); } @Override public void spawn(int x, int y) { this.setX(x); this.setY(y); - this.environment.getEntities().add(0, this); + this.environment.getEntities().add(this); + this.environment.getTrees().add(this); } } diff --git a/src/main/java/fr/sae/terraria/vue/LightView.java b/src/main/java/fr/sae/terraria/vue/LightView.java index 336cc1d..e575968 100644 --- a/src/main/java/fr/sae/terraria/vue/LightView.java +++ b/src/main/java/fr/sae/terraria/vue/LightView.java @@ -4,7 +4,6 @@ import fr.sae.terraria.modele.Environment; import fr.sae.terraria.modele.TileMaps; import fr.sae.terraria.modele.entities.blocks.Torch; -import javafx.beans.property.SimpleDoubleProperty; import javafx.collections.ListChangeListener; import javafx.collections.ObservableList; import javafx.scene.layout.Pane; diff --git a/src/main/java/fr/sae/terraria/vue/SlimeView.java b/src/main/java/fr/sae/terraria/vue/SlimeView.java index 9b1e7e5..935c84d 100644 --- a/src/main/java/fr/sae/terraria/vue/SlimeView.java +++ b/src/main/java/fr/sae/terraria/vue/SlimeView.java @@ -44,4 +44,7 @@ public void displaySlime(final Pane display) this.setAnimation(); display.getChildren().add(this.slimeImgView); } + + + public ImageView getSlimeImgView() { return this.slimeImgView; } } diff --git a/src/main/java/fr/sae/terraria/vue/TileMapsView.java b/src/main/java/fr/sae/terraria/vue/TileMapsView.java index 8865ff9..9aed0c9 100644 --- a/src/main/java/fr/sae/terraria/vue/TileMapsView.java +++ b/src/main/java/fr/sae/terraria/vue/TileMapsView.java @@ -5,10 +5,9 @@ import fr.sae.terraria.modele.entities.Rabbit; import fr.sae.terraria.modele.entities.Slime; import fr.sae.terraria.modele.entities.blocks.*; -import fr.sae.terraria.modele.entities.entity.Entity; import javafx.collections.ListChangeListener; import javafx.geometry.Rectangle2D; -import javafx.scene.Node; +import javafx.scene.Group; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.Pane; @@ -20,7 +19,10 @@ public class TileMapsView { - private final List<ImageView> rabbitsView = new ArrayList<>(); + private final List<ImageView> rabbitsView; + private final List<ImageView> blocksView; + private final List<ImageView> slimesView; + private final List<Group> treesView; private final Image torchImg; private final Image floorTopImg; @@ -59,6 +61,11 @@ public TileMapsView(Environment environment, this.tileHeight = (int) (TileMaps.TILE_DEFAULT_SIZE * scaleMultiplicatorHeight); this.tileWidth = (int) (TileMaps.TILE_DEFAULT_SIZE * scaleMultiplicatorWidth); + this.rabbitsView = new ArrayList<>(); + this.blocksView = new ArrayList<>(); + this.slimesView = new ArrayList<>(); + this.treesView = new ArrayList<>(); + this.floorTopImg = View.loadAnImage("tiles/floor-top.png", tileWidth, tileHeight); this.floorLeftImg = View.loadAnImage("tiles/floor-left.png", tileWidth, tileHeight); this.floorRightImg = View.loadAnImage("tiles/floor-right.png", tileWidth, tileHeight); @@ -68,208 +75,200 @@ public TileMapsView(Environment environment, this.treeImg = View.loadAnImage("sprites/tree-sheet.png", scaleMultiplicatorWidth, scaleMultiplicatorHeight); this.tallGrassImg = View.loadAnImage("tiles/tall-grass.png",tileWidth,tileHeight); - // Lorsqu'un élément est ajouté, il le dessine automatiquement à l'écran - environment.getEntities().addListener((ListChangeListener<Entity>) c -> { - while (c.next()) { - if (c.wasAdded()) { - if (c.getList().get(0) instanceof Tree) - this.createTree((Tree) c.getList().get(0)); - if (c.getList().get(0) instanceof TallGrass) - this.createTallGrass((TallGrass) c.getList().get(0)); - if (c.getList().get(0) instanceof Slime) { - SlimeView slimeView = new SlimeView((Slime) c.getList().get(0), scaleMultiplicatorWidth, scaleMultiplicatorHeight); - slimeView.displaySlime(displayHostileBeings); - } + // Ajoute et supprime les elements de l'écran qui concerne les blocks + this.environment.getBlocks().addListener((ListChangeListener<? super Block>) this::updatesBlocksView); + // Ajoute et supprime les elements de l'écran qui concerne les lapins + this.environment.getRabbits().addListener((ListChangeListener<? super Rabbit>) this::updatesRabbitView); + // Ajoute et supprime les elements de l'écran qui concerne les slimes + this.environment.getSlimes().addListener((ListChangeListener<? super Slime>) this::updatesSlimeView); + this.environment.getTrees().addListener((ListChangeListener<? super Tree>) this::updatesTreeView); + } - if (c.getList().get(0) instanceof Torch) - createTorch((Torch) c.getList().get(0)); - if (c.getList().get(0) instanceof Dirt) - displayTileMap.getChildren().add(View.createImageView(c.getList().get(0), floorTopImg)); - if (c.getList().get(0) instanceof Stone) - displayTileMap.getChildren().add(View.createImageView(c.getList().get(0), stoneImg)); + private void updatesBlocksView(ListChangeListener.Change<? extends Block> c) + { + while (c.next()) { + if (c.wasAdded()) { + ImageView blockView = new ImageView(); + Block block = c.getAddedSubList().get(0); + + blockView.setImage(null); + if (block instanceof Dirt) { + if (((Dirt) block).getTypeOfFloor() == TileMaps.FLOOR_TOP) + blockView.setImage(this.floorTopImg); + else if (((Dirt) block).getTypeOfFloor() == TileMaps.FLOOR_LEFT) + blockView.setImage(this.floorLeftImg); + else if (((Dirt) block).getTypeOfFloor() == TileMaps.FLOOR_RIGHT) + blockView.setImage(this.floorRightImg); + else if (((Dirt) block).getTypeOfFloor() == TileMaps.DIRT) + blockView.setImage(this.dirtImg); + else if (((Dirt) block).getTypeOfFloor() == 0) + blockView.setImage(this.floorTopImg); + } else if (block instanceof Stone) { + blockView.setImage(this.stoneImg); + } else if (block instanceof TallGrass) { + blockView.setImage(this.tallGrassImg); + ((TallGrass) block).getTallGrassGrowthProperty().addListener((observable, oldValue, newValue) -> blockView.setViewport(new Rectangle2D(0, ((int) ((this.tallGrassImg.getHeight() / (TallGrass.GROWTH_TALL_GRASS_STEP) * newValue.intValue()) - tallGrassImg.getHeight())), this.tallGrassImg.getWidth(), this.tallGrassImg.getHeight()))); + } else if (block instanceof Torch) { + blockView.setImage(this.torchImg); } - if (c.wasRemoved()) { - // La position de l'entité - int xEntity = (int) (c.getRemoved().get(0).getRect().get().getMinX()); - int yEntity = (int) (c.getRemoved().get(0).getRect().get().getMinY()); - - // Tant qu'on n'a pas trouvé l'objet sur le Pane, il continue la boucle. - Node nodeAtDelete = null; int i = 0; - do { - Node node = display.getChildren().get(i); - int xNode = (int) (node.getTranslateX()); - int yNode = (int) (node.getTranslateY()); - - if (xNode == xEntity && yNode == yEntity) { - nodeAtDelete = node; - display.getChildren().remove(nodeAtDelete); - } - i++; - } while (i < display.getChildren().size() && Objects.isNull(nodeAtDelete)); - } - } - }); - - this.environment.getRabbits().addListener((ListChangeListener<? super Rabbit>) c -> { - while (c.next()) { - if (c.wasAdded()) { - RabbitView rabbitView = new RabbitView(c.getList().get(0), scaleMultiplicatorWidth, scaleMultiplicatorHeight); - rabbitView.displayRabbit(this.displayHostileBeings); - this.rabbitsView.add(rabbitView.getRabbitImgView()); - } else if (c.wasRemoved()) { - this.displayHostileBeings.getChildren().remove(this.rabbitsView.get(c.getTo())); - this.rabbitsView.remove(c.getTo()); + if (!Objects.isNull(blockView.getImage())) { + blockView.translateXProperty().bind(block.getXProperty()); + blockView.translateYProperty().bind(block.getYProperty()); + + this.display.getChildren().add(blockView); + this.blocksView.add(blockView); } } - }); - } - /** Decompose la carte pour afficher un à un les tiles à l'écran */ - public void displayMaps(TileMaps tiles) - { - for (int y = 0; y < tiles.getHeight() ; y++) - for (int x = 0 ; x < tiles.getWidth() ; x++) - switch (tiles.getTile(x, y)) - { - case TileMaps.STONE: - this.createStone(x, y); - break; - case TileMaps.DIRT: - this.createDirt(x, y); - break; - case TileMaps.FLOOR_TOP: - case TileMaps.FLOOR_LEFT: - case TileMaps.FLOOR_RIGHT: - this.createFloor(tiles.getTile(x, y), x, y); - break; - default: - this.errorTile(tiles.getTile(x, y)); - break; - } + if (c.wasRemoved()) { + this.display.getChildren().remove(this.blocksView.get(c.getTo())); + this.blocksView.remove(c.getTo()); + } + } } - /** Crée et affiche un block de type arbre, il sera +/- grand */ - private void createTree(final Tree tree) + private void updatesRabbitView(ListChangeListener.Change<? extends Rabbit> c) { - List<ImageView> imagesTree = new ArrayList<>(); - - int nbFoliage = ((int) (Math.random()*2))+1; - int nbTrunk = ((int) (Math.random()*3))+1; - - Rectangle2D viewportFirstFrame = new Rectangle2D(0, 0, this.tileWidth, this.tileHeight); - ImageView firstFrameView = new ImageView(); - firstFrameView.setImage(this.treeImg); - firstFrameView.setViewport(viewportFirstFrame); - imagesTree.add(firstFrameView); - for (int f = 0; f < nbFoliage; f++) { - Rectangle2D viewportSecondFrame = new Rectangle2D(0, this.tileHeight, this.tileWidth, this.tileHeight); - ImageView secondFrameView = new ImageView(); - secondFrameView.setImage(this.treeImg); - secondFrameView.setViewport(viewportSecondFrame); - imagesTree.add(secondFrameView); - } + while (c.next()) { + if (c.wasAdded()) { + RabbitView rabbitView = new RabbitView(c.getAddedSubList().get(0), environment.scaleMultiplicatorWidth, environment.scaleMultiplicatorHeight); + rabbitView.displayRabbit(this.displayHostileBeings); + this.rabbitsView.add(rabbitView.getRabbitImgView()); + } - if (nbTrunk > 1) { - Rectangle2D viewportEndTrunk = new Rectangle2D(0, (this.tileHeight*2), this.tileWidth, this.tileHeight); - ImageView endTrunkView = new ImageView(); - endTrunkView.setImage(this.treeImg); - endTrunkView.setViewport(viewportEndTrunk); - imagesTree.add(endTrunkView); - - for (int t = 0; t < nbTrunk-1; t++) { - Rectangle2D viewportTrunk = new Rectangle2D(this.tileWidth, (this.tileHeight*2), this.tileWidth, this.tileHeight); - ImageView trunkView = new ImageView(); - trunkView.setImage(this.treeImg); - trunkView.setViewport(viewportTrunk); - imagesTree.add(trunkView); + if (c.wasRemoved()) { + this.displayHostileBeings.getChildren().remove(this.rabbitsView.get(c.getTo())); + this.rabbitsView.remove(c.getTo()); } - } else { - Rectangle2D viewportTrunk = new Rectangle2D(0, (this.tileHeight*2), this.tileWidth, this.tileHeight); - ImageView trunkView = new ImageView(); - trunkView.setImage(this.treeImg); - trunkView.setViewport(viewportTrunk); - imagesTree.add(trunkView); } - Rectangle2D viewportTrunkFoot = new Rectangle2D(0, (this.tileHeight*3), this.tileWidth, this.tileHeight); - ImageView trunkFootView = new ImageView(); - trunkFootView.setImage(this.treeImg); - trunkFootView.setViewport(viewportTrunkFoot); - imagesTree.add(trunkFootView); - - for (int i = 0; i < imagesTree.size(); i++) { - ImageView treeView = imagesTree.get(i); + } - treeView.setY((int) (((tree.getY() + this.tileHeight) + (i * this.tileHeight)) - (this.tileHeight * imagesTree.size()))); - treeView.setX((int) tree.getX()); + private void updatesSlimeView(ListChangeListener.Change<? extends Slime> c) + { + while (c.next()) { + if (c.wasAdded()) { + SlimeView slimeView = new SlimeView(c.getAddedSubList().get(0), environment.scaleMultiplicatorWidth, environment.scaleMultiplicatorHeight); + slimeView.displaySlime(this.displayHostileBeings); + this.slimesView.add(slimeView.getSlimeImgView()); + } - this.display.getChildren().add(treeView); + if (c.wasRemoved()) { + this.displayHostileBeings.getChildren().remove(this.slimesView.get(c.getTo())); + this.slimesView.remove(c.getTo()); + } } - - tree.setRect(this.tileWidth, (2+nbFoliage+nbTrunk)*this.tileHeight); } - /** - * Crée et affiche un block de type Haute Herbe. - * Applique une animation de pousse à la haute herbe - */ - private void createTallGrass(final TallGrass tallGrass) + private void updatesTreeView(ListChangeListener.Change<? extends Tree> c) { - ImageView tallGrassView = new ImageView(this.tallGrassImg); - tallGrass.setRect(this.tileWidth, this.tileHeight); - tallGrassView.setX(tallGrass.getX()); - tallGrassView.setY(tallGrass.getY()); - - // L'animation de la pousse de la haute herbe - tallGrass.getTallGrassGrowthProperty().addListener(((observable, oldValue, newValue) -> { - tallGrassView.setViewport(new Rectangle2D(0, 0, this.tallGrassImg.getWidth(), (newValue.intValue() < 1) ? 1 : (this.tallGrassImg.getHeight()/TallGrass.GROWTH_TALL_GRASS_STEP)*newValue.intValue())); - tallGrassView.setY((tallGrass.getY() - (this.tallGrassImg.getHeight()/TallGrass.GROWTH_TALL_GRASS_STEP)*newValue.intValue()) + this.tileHeight); - })); - - this.display.getChildren().add(tallGrassView); - } + while (c.next()) { + if (c.wasAdded()) { + Group group = new Group(); + + int nbFoliage = ((int) (Math.random()*2))+1; + int nbTrunk = ((int) (Math.random()*3))+1; + + Rectangle2D viewportFirstFrame = new Rectangle2D(0, 0, this.tileWidth, this.tileHeight); + ImageView firstFrameView = new ImageView(); + firstFrameView.setImage(this.treeImg); + firstFrameView.setViewport(viewportFirstFrame); + group.getChildren().add(firstFrameView); + + for (int f = 0; f < nbFoliage; f++) { + Rectangle2D viewportSecondFrame = new Rectangle2D(0, this.tileHeight, this.tileWidth, this.tileHeight); + ImageView secondFrameView = new ImageView(); + secondFrameView.setImage(this.treeImg); + secondFrameView.setViewport(viewportSecondFrame); + group.getChildren().add(secondFrameView); + } - /** Crée et affiche un tile de type pierre */ - private void createStone(int x, int y) - { - Stone stoneEntity = new Stone(this.environment, x*this.tileWidth, y*this.tileHeight); - stoneEntity.setRect(this.tileWidth, this.tileHeight); + if (nbTrunk > 1) { + Rectangle2D viewportEndTrunk = new Rectangle2D(0, (this.tileHeight*2), this.tileWidth, this.tileHeight); + ImageView endTrunkView = new ImageView(); + endTrunkView.setImage(this.treeImg); + endTrunkView.setViewport(viewportEndTrunk); + group.getChildren().add(endTrunkView); + + for (int t = 0; t < nbTrunk-1; t++) { + Rectangle2D viewportTrunk = new Rectangle2D(this.tileWidth, (this.tileHeight*2), this.tileWidth, this.tileHeight); + ImageView trunkView = new ImageView(); + trunkView.setImage(this.treeImg); + trunkView.setViewport(viewportTrunk); + group.getChildren().add(trunkView); + } + } else { + Rectangle2D viewportTrunk = new Rectangle2D(0, (this.tileHeight*2), this.tileWidth, this.tileHeight); + ImageView trunkView = new ImageView(); + trunkView.setImage(this.treeImg); + trunkView.setViewport(viewportTrunk); + group.getChildren().add(trunkView); + } + Rectangle2D viewportTrunkFoot = new Rectangle2D(0, (this.tileHeight*3), this.tileWidth, this.tileHeight); + ImageView trunkFootView = new ImageView(); + trunkFootView.setImage(this.treeImg); + trunkFootView.setViewport(viewportTrunkFoot); + group.getChildren().add(trunkFootView); + + Tree tree = c.getAddedSubList().get(0); + for (int i = 0; i < group.getChildren().size(); i++) { + ImageView treeView = (ImageView) group.getChildren().get(i); + + treeView.setY((int) (((tree.getY() + this.tileHeight) + (i * this.tileHeight)) - (this.tileHeight * group.getChildren().size()))); + treeView.setX((int) tree.getX()); + } + tree.setRect(this.tileWidth, (2+nbFoliage+nbTrunk)*this.tileHeight); + tree.getRect().updates(tree.getX(), tree.getY() - ((2+nbFoliage+nbTrunk)*this.tileHeight) + this.tileHeight); - this.display.getChildren().add(View.createImageView(stoneEntity, this.stoneImg)); - this.environment.getEntities().add(stoneEntity); - } + this.display.getChildren().add(group); + this.treesView.add(group); + } + + if (c.wasRemoved()) { + this.display.getChildren().remove(this.treesView.get(c.getTo())); + this.treesView.remove(c.getTo()); + } + } - /** Crée et affiche un block de type Torch */ - private void createTorch(final Torch torch) - { - torch.setRect(this.tileWidth, this.tileHeight); - this.display.getChildren().add(View.createImageView(torch, this.torchImg)); } - /** Crée et affiche un tile de type terre */ - private void createDirt(int x, int y) + /** Affiche une erreur au cas où si un developer a fait une erreur lors de la saisie d'un tile sur le fichier .json */ + private void errorTile(final int tile) { if (tile != TileMaps.SKY) System.out.println("Le tile '" + tile + "' n'est pas reconnu."); } + + /** Decompose la carte pour afficher un à un les tiles à l'écran */ + public void displayMaps(TileMaps tiles) { - Dirt dirtSprite = new Dirt(this.environment, x*this.tileWidth, y*this.tileHeight); - dirtSprite.setRect(this.tileWidth, this.tileHeight); + for (int y = 0; y < tiles.getHeight() ; y++) + for (int x = 0 ; x < tiles.getWidth() ; x++) + switch (tiles.getTile(x, y)) { + case TileMaps.STONE: + Stone stoneEntity = new Stone(this.environment, x*this.tileWidth, y*this.tileHeight); + stoneEntity.setRect(this.tileWidth, this.tileHeight); - this.display.getChildren().add(View.createImageView(dirtSprite, this.dirtImg)); - this.environment.getEntities().add(dirtSprite); - } + this.environment.getEntities().add(stoneEntity); + this.environment.getBlocks().add(stoneEntity); + break; + case TileMaps.DIRT: + Dirt dirtSprite = new Dirt(this.environment, x*this.tileWidth, y*this.tileHeight); + dirtSprite.setTypeOfFloor(TileMaps.DIRT); + dirtSprite.setRect(this.tileWidth, this.tileHeight); - /** - * Crée et affiche un tile de type sol - * @param typeOfFloor Quel face du tile doit être affiché - */ - private void createFloor(int typeOfFloor, int x, int y) - { - Dirt floorEntity = new Dirt(this.environment, x*this.tileWidth, y*this.tileHeight); - Image floorImg = (typeOfFloor == TileMaps.FLOOR_TOP) ? this.floorTopImg : (typeOfFloor == TileMaps.FLOOR_RIGHT) ? this.floorRightImg : this.floorLeftImg; - floorEntity.setRect(this.tileWidth, this.tileHeight); + this.environment.getEntities().add(dirtSprite); + this.environment.getBlocks().add(dirtSprite); + break; + case TileMaps.FLOOR_TOP: + case TileMaps.FLOOR_LEFT: + case TileMaps.FLOOR_RIGHT: + Dirt floorEntity = new Dirt(this.environment, x*this.tileWidth, y*this.tileHeight); + floorEntity.setTypeOfFloor(tiles.getTile(x, y)); + floorEntity.setRect(this.tileWidth, this.tileHeight); - this.display.getChildren().add(View.createImageView(floorEntity, floorImg)); - this.environment.getEntities().add(floorEntity); + this.environment.getEntities().add(floorEntity); + this.environment.getBlocks().add(floorEntity); + break; + default: + this.errorTile(tiles.getTile(x, y)); + break; + } } - - /** Affiche une erreur au cas où si un developer a fait une erreur lors de la saisie d'un tile sur le fichier .json */ - private void errorTile(final int tile) { if (tile != TileMaps.SKY) System.out.println("Le tile '" + tile + "' n'est pas reconnu."); } } diff --git a/src/main/java/fr/sae/terraria/vue/View.java b/src/main/java/fr/sae/terraria/vue/View.java index 8463ccb..b83f447 100644 --- a/src/main/java/fr/sae/terraria/vue/View.java +++ b/src/main/java/fr/sae/terraria/vue/View.java @@ -28,7 +28,7 @@ public View(final GameController gameController) { super(); - environment = gameController.environment; + this.environment = gameController.environment; final Pane displayTiledMap = gameController.displayTiledMap; final Pane displayHostileBeings = gameController.displayHostileBeings; final Pane displayHUD = gameController.displayHUD; From a79a8cafc8484ef4f2d842f9ec6a03a57f7addcd Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Fri, 10 Jun 2022 20:48:41 +0200 Subject: [PATCH 12/97] =?UTF-8?q?Les=20items=20dans=20l'inventaire=20sont?= =?UTF-8?q?=20centr=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/fr/sae/terraria/vue/hud/InventoryView.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java b/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java index 7a6fad0..8d9e0a5 100644 --- a/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java +++ b/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java @@ -142,8 +142,8 @@ else if (item instanceof Vodka) stack.nbItemsProperty().addListener((obs, oldV, newV) -> this.texts.get(c.getTo()-1).setText(String.valueOf(newV.intValue()))); if (!Objects.isNull(view.getImage())) { - view.setX(this.inventoryBarImgView.getX() + ((c.getTo()-1) * boxeInventoryWidth)); - view.setY(this.inventoryBarImgView.getY()); + view.setX((this.inventoryBarImgView.getX() + ((c.getTo()-1) * boxeInventoryWidth)) + ((boxeInventoryWidth/2) - (itemInventoryWidth/2))); + view.setY(this.inventoryBarImgView.getY() + ((boxeInventoryWidth/2) - (itemInventoryHeight/2))); this.itemsView.add(view); this.display.getChildren().add(view); From cae748f8ea5a48bf8cec726d957b66241c41ce87 Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Fri, 10 Jun 2022 20:51:04 +0200 Subject: [PATCH 13/97] L'image de la pioche est maintenant transparent --- .../fr/sae/terraria/tools/pickaxe.png | Bin 384 -> 5453 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/src/main/resources/fr/sae/terraria/tools/pickaxe.png b/src/main/resources/fr/sae/terraria/tools/pickaxe.png index 596520e0aa8900d4560a1d707f2c1f5466fc4ce8..ce02b608ce2394348797aaeb12e0a96e34d8face 100644 GIT binary patch literal 5453 zcmeHKdpJ~U7a!%4NfJq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|%`iWM04OYA z0IvbqG=spdT{{>GvU9=VgVO+9nn8hw><z326k75#gc-15XhsIoikje9!H7nXW*?K^ z3|r2yGV~w+2o=Qyu+)lT0La-OoA12kz^fS<fDHiI3IZy^KNwbB_$`Ig+1LO)3_#8X m*-VON5P%y1@-yjxfdK$ST)Z*s+s4KK0000<MNUMnLSTX}xQR~y From 0ddb639f2db64df731983bf251fd6cbe6461784b Mon Sep 17 00:00:00 2001 From: Tiago Lousa <tig2468.a@gmail.com> Date: Fri, 10 Jun 2022 23:03:49 +0200 Subject: [PATCH 14/97] mise en place DrunkView --- .../fr/sae/terraria/modele/Environment.java | 3 + .../terraria/modele/entities/items/Vodka.java | 1 + .../modele/entities/player/Player.java | 8 +- .../java/fr/sae/terraria/vue/DrunkView.java | 78 +++++++++++++++++++ .../java/fr/sae/terraria/vue/LightView.java | 5 +- src/main/java/fr/sae/terraria/vue/View.java | 1 + 6 files changed, 92 insertions(+), 4 deletions(-) create mode 100644 src/main/java/fr/sae/terraria/vue/DrunkView.java diff --git a/src/main/java/fr/sae/terraria/modele/Environment.java b/src/main/java/fr/sae/terraria/modele/Environment.java index 1943e2d..db8ea5a 100644 --- a/src/main/java/fr/sae/terraria/modele/Environment.java +++ b/src/main/java/fr/sae/terraria/modele/Environment.java @@ -8,6 +8,7 @@ import fr.sae.terraria.modele.entities.entity.Entity; import fr.sae.terraria.modele.entities.entity.ReproductiveObjectType; import fr.sae.terraria.modele.entities.items.Meat; +import fr.sae.terraria.modele.entities.items.Vodka; import fr.sae.terraria.modele.entities.player.Player; import fr.sae.terraria.modele.entities.tools.Pickaxe; import javafx.animation.Animation; @@ -119,7 +120,9 @@ private void gameLoop() this.player.pickup(meat); this.player.pickup(new Pickaxe()); + this.player.pickup(new Vodka(this)); caught[0] = true; + } // Ajoute les entités ReproductiveObjectType diff --git a/src/main/java/fr/sae/terraria/modele/entities/items/Vodka.java b/src/main/java/fr/sae/terraria/modele/entities/items/Vodka.java index ab03ed5..0a3f93f 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/items/Vodka.java +++ b/src/main/java/fr/sae/terraria/modele/entities/items/Vodka.java @@ -29,5 +29,6 @@ public Vodka(final Environment environment) Player player = environment.getPlayer(); Inventory inventory = player.getInventory(); inventory.get().get(inventory.getPosCursor()).remove(); + player.drunkProperty().set(true); } } diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java index cc6e72e..a575308 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java @@ -5,7 +5,9 @@ import fr.sae.terraria.modele.entities.player.inventory.Inventory; import fr.sae.terraria.modele.entities.player.inventory.Stack; import fr.sae.terraria.vue.View; +import javafx.beans.property.BooleanProperty; import javafx.beans.property.ObjectProperty; +import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.property.SimpleObjectProperty; import javafx.scene.image.Image; import javafx.scene.input.KeyCode; @@ -19,6 +21,7 @@ public class Player extends EntityMovable implements CollideObjectType, CollapsibleObjectType, SpawnableObjectType { public static final int BREAK_BLOCK_DISTANCE = 1; + public static final int DRUNK_EFFECT_TIME = 600; private final EnumMap<KeyCode, Boolean> keysInput; private final EnumMap<MouseButton, Boolean> mouseInput; @@ -27,11 +30,13 @@ public class Player extends EntityMovable implements CollideObjectType, Collapsi private final Inventory inventory; private Stack stackSelected; + private SimpleBooleanProperty drunk; public Player(final Environment environment) { super(0, 0, environment); + drunk = new SimpleBooleanProperty(false); this.inventory = new Inventory(this); this.animation = new Animation(); @@ -125,6 +130,7 @@ else if (key == KeyCode.Q) public Map<KeyCode, Boolean> getKeysInput() { return this.keysInput; } public Stack getStackSelected() { return this.stackSelected; } public Inventory getInventory() { return this.inventory; } - + public boolean isDrunk() {return drunk.get();} + public SimpleBooleanProperty drunkProperty() {return drunk;} public void setStackSelected(Stack stackSelected) { this.stackSelected = stackSelected; } } diff --git a/src/main/java/fr/sae/terraria/vue/DrunkView.java b/src/main/java/fr/sae/terraria/vue/DrunkView.java new file mode 100644 index 0000000..6835dec --- /dev/null +++ b/src/main/java/fr/sae/terraria/vue/DrunkView.java @@ -0,0 +1,78 @@ +package fr.sae.terraria.vue; + +import fr.sae.terraria.modele.Environment; +import fr.sae.terraria.modele.entities.player.Player; +import javafx.animation.Animation; +import javafx.animation.KeyFrame; +import javafx.animation.Timeline; +import javafx.beans.property.ObjectProperty; +import javafx.beans.property.SimpleObjectProperty; +import javafx.scene.effect.DisplacementMap; +import javafx.scene.effect.FloatMap; +import javafx.scene.layout.StackPane; +import javafx.util.Duration; + +public class DrunkView { + + private static final int WIDTH_COS = 50; + private static final int HEIGHT_COS = 100; + private FloatMap floatMap; + private ObjectProperty<DisplacementMap> displacementMap; + private int startTick; + Timeline drunkTimeline; + private double timer; + Environment environment; + + public DrunkView(Environment environment, StackPane cameraView) { + this.environment = environment; + this.drunkTimeline = new Timeline(); + this.timer = 0; + this.startTick = 0; + this.floatMap = new FloatMap(); + this.displacementMap = new SimpleObjectProperty<>(); + + + drunkTimeline.setCycleCount(Animation.INDEFINITE); + KeyFrame keyFrame = new KeyFrame(Duration.seconds(0.05), (ev -> { + updateEffect(); + })); + drunkTimeline.getKeyFrames().add(keyFrame); + + floatMap.setWidth(WIDTH_COS); + floatMap.setHeight(HEIGHT_COS); + + cameraView.effectProperty().bind(displacementMap); + + environment.getPlayer().drunkProperty().addListener((o, oldVal, newVal) -> { + if (newVal) { + displacementMap.set(new DisplacementMap()); + displacementMap.getValue().setMapData(floatMap); + startTick = environment.getTicks(); + drunkTimeline.play(); + } else {dissasambleEffect();} + }); + } + + + private void updateEffect() { + + for (int i = 0; i < WIDTH_COS; i++) { + double v = (Math.cos(timer + i / 20.0 * Math.PI) - 0.5) / 40.0; + for (int j = 0; j < HEIGHT_COS; j++) { + floatMap.setSamples(i, j, 0.0f, (float) v); + } + } + timer += 0.03; + + if (startTick+ Player.DRUNK_EFFECT_TIME <= environment.getTicks()){ + environment.getPlayer().drunkProperty().set(false); + } + + } + + private void dissasambleEffect() { + drunkTimeline.stop(); + displacementMap.set(null); + } + +} diff --git a/src/main/java/fr/sae/terraria/vue/LightView.java b/src/main/java/fr/sae/terraria/vue/LightView.java index 336cc1d..360f6dc 100644 --- a/src/main/java/fr/sae/terraria/vue/LightView.java +++ b/src/main/java/fr/sae/terraria/vue/LightView.java @@ -4,7 +4,6 @@ import fr.sae.terraria.modele.Environment; import fr.sae.terraria.modele.TileMaps; import fr.sae.terraria.modele.entities.blocks.Torch; -import javafx.beans.property.SimpleDoubleProperty; import javafx.collections.ListChangeListener; import javafx.collections.ObservableList; import javafx.scene.layout.Pane; @@ -54,10 +53,10 @@ public LightView(Clock clock, Pane filterPane, Environment env) { this.filterPane.getChildren().addAll(this.actualTunnel, this.actualFade, this.actualAir); - this.initTochListener(env.getTorches()); + this.initTorchListener(env.getTorches()); } - private void initTochListener(ObservableList<Torch> torches) { + private void initTorchListener(ObservableList<Torch> torches) { torches.addListener((ListChangeListener<? super Torch>) c -> { while(c.next()){ this.filterPane.getChildren().clear(); diff --git a/src/main/java/fr/sae/terraria/vue/View.java b/src/main/java/fr/sae/terraria/vue/View.java index 8463ccb..9f25e6a 100644 --- a/src/main/java/fr/sae/terraria/vue/View.java +++ b/src/main/java/fr/sae/terraria/vue/View.java @@ -44,6 +44,7 @@ public View(final GameController gameController) playerView.displayPlayer(displayHostileBeings); LightView lightView = new LightView(environment.getGameClock(),filter,environment); + DrunkView drunkView = new DrunkView(environment,gameController.paneHadCamera); HUDView HUDView = new HUDView(environment.getPlayer(), environment.getGameClock(), displayHUD, scaleMultiplicatorWidth, scaleMultiplicatorHeight); HUDView.display(); From 09ecb72cae4f29aef344afcfaebd9a4e380c0873 Mon Sep 17 00:00:00 2001 From: Tiago Lousa <tig2468.a@gmail.com> Date: Fri, 10 Jun 2022 23:19:46 +0200 Subject: [PATCH 15/97] =?UTF-8?q?fix=20opacit=C3=A9=20LightView=20+=20fix?= =?UTF-8?q?=20erreur=20quand=20un=20block=20=C3=A9tais=20cass=C3=A9=20sans?= =?UTF-8?q?=20rien=20dans=20la=20main?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/fr/sae/terraria/modele/entities/blocks/Stone.java | 2 +- src/main/java/fr/sae/terraria/vue/LightView.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/Stone.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/Stone.java index 21a3478..88cabcd 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/Stone.java +++ b/src/main/java/fr/sae/terraria/modele/entities/blocks/Stone.java @@ -59,7 +59,7 @@ public Stone(Environment environment, int x, int y) // S'il utilise le bon outil, il commencera à casser le bloc sinon use l'outil sans casser le bloc. Stack stack = player.getStackSelected(); - if (!Objects.isNull(stack.getItem())) { + if (!Objects.isNull(stack)) { if (stack.getItem() instanceof Pickaxe) this.setPv(this.getPv() - 1); if (stack.getItem() instanceof Tool) diff --git a/src/main/java/fr/sae/terraria/vue/LightView.java b/src/main/java/fr/sae/terraria/vue/LightView.java index 360f6dc..52e3e02 100644 --- a/src/main/java/fr/sae/terraria/vue/LightView.java +++ b/src/main/java/fr/sae/terraria/vue/LightView.java @@ -122,6 +122,7 @@ private void resetShapes() this.actualTunnel.setLayoutY(tileSize*(delimitationDirtStone+1)); this.actualFade.setLayoutY(this.actualTunnel.getLayoutY()-tileSize); + } private void addEffects() @@ -131,6 +132,8 @@ private void addEffects() this.actualTunnel.setFill(NIGHT_COLOR); this.actualAir.opacityProperty().bind(this.clock.opacityNightFilterProperty()); + this.actualFade.setOpacity(0.8); + this.actualTunnel.setOpacity(0.8); } private void addTochLights() From 999527be60754509f1a85805952bb3285d4d2317 Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Sat, 11 Jun 2022 00:47:26 +0200 Subject: [PATCH 16/97] =?UTF-8?q?Mise=20en=20clart=C3=A9=20du=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/sae/terraria/modele/Environment.java | 9 ++-- .../sae/terraria/modele/entities/Arrow.java | 2 +- .../sae/terraria/modele/entities/Rabbit.java | 26 ++++------ .../sae/terraria/modele/entities/Slime.java | 27 ++++------ .../modele/entities/blocks/Torch.java | 4 +- .../modele/entities/entity/EntityMovable.java | 50 ++++++++++++------- .../modele/entities/player/Player.java | 25 +++++----- src/main/java/fr/sae/terraria/vue/Camera.java | 5 +- .../java/fr/sae/terraria/vue/PlayerView.java | 9 ++-- .../java/fr/sae/terraria/vue/RabbitView.java | 5 +- 10 files changed, 80 insertions(+), 82 deletions(-) diff --git a/src/main/java/fr/sae/terraria/modele/Environment.java b/src/main/java/fr/sae/terraria/modele/Environment.java index 6d72878..941b12c 100644 --- a/src/main/java/fr/sae/terraria/modele/Environment.java +++ b/src/main/java/fr/sae/terraria/modele/Environment.java @@ -120,15 +120,12 @@ private void gameLoop() KeyFrame keyFrame = new KeyFrame(Duration.seconds(Terraria.TARGET_FPS), (ev -> { // TODO TEST if (!caught[0]) { - Torch torch = new Torch(this, 0, 0); - this.player.pickup(torch); - Meat meat = new Meat(this); - this.player.pickup(meat); - + this.player.pickup(new Torch(this)); + this.player.pickup(new Meat(this)); this.player.pickup(new Pickaxe()); this.player.pickup(new Vodka(this)); - caught[0] = true; + caught[0] = true; } // Ajoute les entités ReproductiveObjectType diff --git a/src/main/java/fr/sae/terraria/modele/entities/Arrow.java b/src/main/java/fr/sae/terraria/modele/entities/Arrow.java index 7e30145..d85ea7b 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/Arrow.java +++ b/src/main/java/fr/sae/terraria/modele/entities/Arrow.java @@ -12,7 +12,7 @@ public class Arrow extends EntityMovable implements StowableObjectType, CollideO public Arrow(final Environment environment, int x, int y, int velocity) { - super(x, y, environment); + super(environment, x, y); this.velocity = velocity; } diff --git a/src/main/java/fr/sae/terraria/modele/entities/Rabbit.java b/src/main/java/fr/sae/terraria/modele/entities/Rabbit.java index 41f05d2..c05e15b 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/Rabbit.java +++ b/src/main/java/fr/sae/terraria/modele/entities/Rabbit.java @@ -26,7 +26,7 @@ public class Rabbit extends EntityMovable implements CollideObjectType, Reproduc public Rabbit(final Environment environment, int x, int y) { - super(x, y, environment); + super(environment, x, y); this.setPv(3); this.animation = new Animation(); @@ -39,7 +39,7 @@ public Rabbit(final Environment environment, int x, int y) @Override public void updates() { - if (this.offset[1] == Entity.IDLE && !this.air) { + if (this.isIDLEonY() && !this.air) { this.gravity.xInit = this.x.get(); this.gravity.yInit = this.y.get(); this.gravity.vInit = this.velocity; @@ -59,15 +59,15 @@ public Rabbit(final Environment environment, int x, int y) @Override public void move() { - this.setX(this.x.get() + this.offset[0] * this.velocity); + this.setX(this.x.get() + this.getOffsetMoveX() * this.velocity); - if (this.offset[1] == Entity.IDLE && this.offset[0] != Entity.IDLE) { - int xProbablyVoid = (int) ((getX()+((this.offset[0] == Entity.IS_MOVING_LEFT) ? 0 : this.environment.widthTile)) / this.environment.widthTile); + if (this.isIDLEonY() && this.isMoving()) { + int xProbablyVoid = (int) ((getX()+((this.isMovingLeft()) ? 0 : this.environment.widthTile)) / this.environment.widthTile); int yProbablyVoid = (int) (getY() / environment.heightTile); // Si du vide risque d'y avoir lors de son déplacement if (environment.getTileMaps().getTile(xProbablyVoid, yProbablyVoid + 2) == TileMaps.SKY) { - this.offset[0] = (-1) * this.offset[0]; + this.offset[0] = (-1) * this.getOffsetMoveX(); } else { boolean mustJump = this.environment.getTicks() % Rabbit.JUMP_FREQUENCY == 0; if (mustJump) { @@ -97,7 +97,7 @@ public Rabbit(final Environment environment, int x, int y) if (!whereCollide.isEmpty()) { if (whereCollide.get("left").equals(Boolean.TRUE) || whereCollide.get("right").equals(Boolean.TRUE)) - this.offset[0] = (-1) * this.offset[0]; + this.offset[0] = (-1) * this.getOffsetMoveX(); } } @@ -123,23 +123,15 @@ public Rabbit(final Environment environment, int x, int y) this.getGravity().setXInit(x); this.getGravity().setYInit(y); this.setRect(environment.widthTile, environment.heightTile); + this.environment.getEntities().add(0, this); this.environment.getRabbits().add(this); } - /** Modifie l'offset qui permet de le déplacer vers la droite */ - @Override public void moveRight() { super.moveRight(); } - /** Modifie l'offset qui permet de le déplacer vers la gauche */ - @Override public void moveLeft() { super.moveLeft(); } - /** Modifie l'offset qui permet de le faire sauter */ - @Override public void jump() { super.jump(); } - /** Modifie l'offset qui permet de tomber */ - @Override public void fall() { super.fall(); } - public void worldLimit() { if (super.worldLimit(this.environment)) - this.offset[0] = (-1) * this.offset[0]; + this.offset[0] = (-1) * this.getOffsetMoveX(); } diff --git a/src/main/java/fr/sae/terraria/modele/entities/Slime.java b/src/main/java/fr/sae/terraria/modele/entities/Slime.java index c5fe6e0..f93846b 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/Slime.java +++ b/src/main/java/fr/sae/terraria/modele/entities/Slime.java @@ -15,7 +15,7 @@ public class Slime extends EntityMovable implements CollideObjectType, Collapsib public Slime(Environment environment, int x, int y) { - super(x, y, environment); + super(environment, x, y); this.velocity = 2; this.setPv(3); @@ -28,7 +28,7 @@ public Slime(Environment environment, int x, int y) public Slime(Environment environment) { this(environment, 0, 0); } @Override public void updates() { - if (this.offset[1] == Entity.IDLE && !this.air) { + if (this.isIDLEonY() && !this.air) { this.gravity.xInit = this.x.get(); this.gravity.yInit = this.y.get(); this.gravity.vInit = this.velocity; @@ -36,12 +36,12 @@ public Slime(Environment environment, int x, int y) this.gravity.timer = .0; } - this.offset[0] = Entity.IDLE; - if (this.offset[1] == Entity.IS_JUMPING) { + this.idleOnX(); + if (this.isJumping()) { if (this.environment.getPlayer().getX() > this.x.getValue()) - this.offset[0] = Entity.IS_MOVING_RIGHT; + this.moveRight(); else if (environment.getPlayer().getX() < this.x.getValue()) - this.offset[0] = Entity.IS_MOVING_LEFT; + this.moveLeft(); } this.move(); @@ -58,14 +58,14 @@ else if (environment.getPlayer().getX() < this.x.getValue()) if (!whereCollide.isEmpty()) if (whereCollide.get("left").equals(Boolean.TRUE) || whereCollide.get("right").equals(Boolean.TRUE)) - this.offset[0] = Entity.IDLE; + this.idleOnX(); } @Override public void move() { if (((int) (this.animation.getFrame()) == 3)) - if (this.offset[1] != Entity.IS_FALLING) this.jump(); - this.setX(this.getX() + (this.offset[0] * this.velocity)); + if (this.isNotFalling()) this.jump(); + this.setX(this.getX() + (this.getOffsetMoveX() * this.velocity)); } @Override public void hit() @@ -80,17 +80,10 @@ else if (environment.getPlayer().getX() < this.x.getValue()) this.getGravity().setXInit(x); this.getGravity().setYInit(y); this.setRect(environment.widthTile, environment.heightTile); + this.environment.getEntities().add(this); this.environment.getSlimes().add(this); } - @Override public void moveRight() { super.moveRight(); } - - @Override public void moveLeft() { super.moveLeft(); } - - @Override public void jump() { super.jump(); } - - @Override public void fall() { super.fall(); } - public void worldLimit() { super.worldLimit(this.environment); } } diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/Torch.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/Torch.java index 7e83cf3..35bdb53 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/Torch.java +++ b/src/main/java/fr/sae/terraria/modele/entities/blocks/Torch.java @@ -17,7 +17,7 @@ public class Torch extends Block implements StowableObjectType, PlaceableObjectT private double yOrigin; - public Torch(Environment environment, int x, int y) + public Torch(final Environment environment, int x, int y) { super(x, y); this.environment = environment; @@ -26,6 +26,8 @@ public Torch(Environment environment, int x, int y) this.yOrigin = y; } + public Torch(final Environment environment) { this(environment, 0, 0); } + @Override public void updates() { /* TODO document why this method is empty */ } @Override public void breaks() diff --git a/src/main/java/fr/sae/terraria/modele/entities/entity/EntityMovable.java b/src/main/java/fr/sae/terraria/modele/entities/entity/EntityMovable.java index 341b036..a555a94 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/entity/EntityMovable.java +++ b/src/main/java/fr/sae/terraria/modele/entities/entity/EntityMovable.java @@ -12,12 +12,13 @@ public abstract class EntityMovable extends Entity protected final Environment environment; protected final Gravity gravity; + public final int[] offset; + protected double velocity; protected boolean air; - public int[] offset; - protected EntityMovable(int x, int y, final Environment environment) + protected EntityMovable(final Environment environment, int x, int y) { super(x, y); this.environment = environment; @@ -28,7 +29,7 @@ protected EntityMovable(int x, int y, final Environment environment) this.velocity = 1; } - protected EntityMovable(final Environment environment) { this(0, 0, environment); } + protected EntityMovable(final Environment environment) { this(environment, 0, 0); } @Override public abstract void updates(); public abstract void move(); @@ -41,7 +42,7 @@ protected EntityMovable(int x, int y, final Environment environment) * left, right, top, bottom sera les clés qui peuvent être present lors d'une detection de collision. * Il permettra de faire des actions personnalisées les actions faites par l'entité suivant d'où il rentre en collision avec son environment. */ - protected Map<String, Boolean> collide(final Environment environment) + public Map<String, Boolean> collide(final Environment environment) { int widthTile = environment.widthTile; int heightTile = environment.heightTile; TileMaps tileMaps = environment.getTileMaps(); @@ -56,7 +57,7 @@ protected Map<String, Boolean> collide(final Environment environment) this.air = true; // Detection collision gauche droite - if (this.offset[0] != Entity.IDLE) { + if (this.isMoving()) { int yTop = (int) (getY()+CollideObjectType.COLLISION_TOLERANCE)/heightTile; int futurePositionXLeft = (int) ((getX()+CollideObjectType.COLLISION_TOLERANCE)+(velocity*offset[0]))/widthTile; int futurePositionXRight = (int) ((getX()+(-CollideObjectType.COLLISION_TOLERANCE)+(velocity*offset[0])) + (getRect().getWidth()))/widthTile; @@ -72,17 +73,17 @@ protected Map<String, Boolean> collide(final Environment environment) // Tombe - if (this.offset[1] == Entity.IS_FALLING) { + if (this.isFalling()) { this.gravity.degInit = 0; double futurePositionY = gravity.formulaOfTrajectory() ; boolean isCollideBottom = tileMaps.getTile(xLeft, (int) (futurePositionY + this.rect.getHeight())/heightTile) != TileMaps.SKY || tileMaps.getTile(xRight, (int) (futurePositionY + CollideObjectType.COLLISION_TOLERANCE +this.rect.getHeight())/heightTile) != TileMaps.SKY; if (isCollideBottom) { this.gravity.setJumpPosInit(this); this.gravity.timer = 0; - this.offset[1] = Entity.IDLE; + this.idleOnY(); } else setY(futurePositionY); // Saute - } else if (this.offset[1] == Entity.IS_JUMPING) { + } else if (this.isJumping()) { double futurePositionY = gravity.formulaOfTrajectory(); boolean isCollideTop = tileMaps.getTile(xLeft, (int) (futurePositionY + CollideObjectType.COLLISION_TOLERANCE)/heightTile) != TileMaps.SKY || tileMaps.getTile(xRight, (int) (futurePositionY + CollideObjectType.COLLISION_TOLERANCE)/heightTile) != TileMaps.SKY; @@ -102,7 +103,7 @@ protected Map<String, Boolean> collide(final Environment environment) } else if (isCollideBottom) { this.gravity.setJumpPosInit(this); this.gravity.timer = 0; - this.offset[1] = Entity.IDLE; + this.idleOnY(); this.air = false; } else this.setY(futurePositionY); } @@ -115,7 +116,7 @@ protected Map<String, Boolean> collide(final Environment environment) boolean isCollideBottom = tileMaps.getTile(xLeft, (int) (futurePositionY - CollideObjectType.COLLISION_TOLERANCE)/heightTile) != TileMaps.SKY || tileMaps.getTile(xRight, (int) (futurePositionY - CollideObjectType.COLLISION_TOLERANCE)/heightTile) != TileMaps.SKY; if (isCollideBottom) { - this.offset[1] = Entity.IDLE; + this.idleOnY(); this.air = false; this.gravity.setJumpPosInit(this); } else setY(futurePositionY - this.rect.getHeight()); @@ -124,10 +125,23 @@ protected Map<String, Boolean> collide(final Environment environment) return whereCollide; } - protected void moveRight() { this.offset[0] = Entity.IS_MOVING_RIGHT; } - protected void moveLeft() { this.offset[0] = Entity.IS_MOVING_LEFT; } - protected void jump() { this.offset[1] = Entity.IS_JUMPING; } - protected void fall() { this.offset[1] = Entity.IS_FALLING; } + public void moveRight() { this.offset[0] = Entity.IS_MOVING_RIGHT; } + public void moveLeft() { this.offset[0] = Entity.IS_MOVING_LEFT; } + public void jump() { this.offset[1] = Entity.IS_JUMPING; } + public void fall() { this.offset[1] = Entity.IS_FALLING; } + public void idleOnX() { this.offset[0] = Entity.IDLE; } + public void idleOnY() { this.offset[1] = Entity.IDLE; } + + public boolean isMovingRight() { return this.offset[0] == Entity.IS_MOVING_RIGHT; } + public boolean isMovingLeft() { return this.offset[0] == Entity.IS_MOVING_LEFT; } + public boolean isMoving() { return this.offset[0] != Entity.IDLE; } + public boolean isJumping() { return this.offset[1] == Entity.IS_JUMPING; } + public boolean isFalling() { return this.offset[1] == Entity.IS_FALLING; } + public boolean isNotFalling() { return this.offset[1] != Entity.IS_FALLING; } + /** Quand l'entité ne bouge plus sur l'axes des X */ + public boolean isIDLEonX() { return this.offset[0] == Entity.IDLE; } + /** Quand l'entité ne bouge plus sur l'axes des Y */ + public boolean isIDLEonY() { return this.offset[1] == Entity.IDLE; } /** * Lorsque le joueur sort de l'ecran et/ou de la carte, la fonction retourne une valeurs boolean qui sera manipulable sur les classes qui l'héritera. @@ -135,18 +149,20 @@ protected Map<String, Boolean> collide(final Environment environment) * * @return false = ne sort pas | true = sort de l'écran soit vers la droite ou soit vers le bas */ - protected boolean worldLimit(final Environment environment) + public boolean worldLimit(final Environment environment) { double widthMap = (environment.getTileMaps().getWidth()*environment.scaleMultiplicatorWidth*TileMaps.TILE_DEFAULT_SIZE) ; - boolean exceedsScreenOnLeft = offset[0] == Entity.IS_MOVING_LEFT && getX() < 0; - boolean exceedsScreenOnRight = offset[0] == Entity.IS_MOVING_RIGHT && getX()+CollideObjectType.COLLISION_TOLERANCE+velocity + getRect().getWidth() + 3 >= widthMap; + boolean exceedsScreenOnLeft = this.isMovingLeft() && this.getX() < 0; + boolean exceedsScreenOnRight = this.isMovingRight() && this.getX()+CollideObjectType.COLLISION_TOLERANCE+this.velocity + this.getRect().getWidth() + 3 >= widthMap; return (exceedsScreenOnLeft || exceedsScreenOnRight); } public double getVelocity() { return this.velocity; } public Gravity getGravity() { return this.gravity; } + public int getOffsetMoveX() { return this.offset[0]; } + public int getOffsetMoveY() { return this.offset[1]; } public void setVelocity(double velocity) { this.velocity = velocity; } } diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java index a575308..116fb6e 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java @@ -5,7 +5,6 @@ import fr.sae.terraria.modele.entities.player.inventory.Inventory; import fr.sae.terraria.modele.entities.player.inventory.Stack; import fr.sae.terraria.vue.View; -import javafx.beans.property.BooleanProperty; import javafx.beans.property.ObjectProperty; import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.property.SimpleObjectProperty; @@ -27,16 +26,17 @@ public class Player extends EntityMovable implements CollideObjectType, Collapsi private final EnumMap<MouseButton, Boolean> mouseInput; private final ObjectProperty objectWasPickup; + private final SimpleBooleanProperty drunk; private final Inventory inventory; private Stack stackSelected; - private SimpleBooleanProperty drunk; public Player(final Environment environment) { - super(0, 0, environment); - drunk = new SimpleBooleanProperty(false); + super(environment, 0, 0); + + this.drunk = new SimpleBooleanProperty(false); this.inventory = new Inventory(this); this.animation = new Animation(); @@ -52,7 +52,7 @@ public Player(final Environment environment) // Applique les déplacements selon les valeurs de l'offset // this.setX(this.x.get() + this.offset[0] * this.velocity); - if (this.offset[1] == Entity.IDLE && !air) { + if (this.isIDLEonY() && !air) { this.gravity.xInit = this.x.get(); this.gravity.yInit = this.y.get(); this.gravity.vInit = this.velocity; @@ -61,7 +61,7 @@ public Player(final Environment environment) this.gravity.timer = .0; } - this.offset[0] = Entity.IDLE; + this.idleOnX(); this.eventInput(); this.collide(); this.worldLimit(); @@ -72,7 +72,7 @@ public Player(final Environment environment) this.animation.loop(); } - @Override public void move() { this.setX(this.getX() + this.offset[0] * this.getVelocity()); } + @Override public void move() { this.setX(this.getX() + this.getOffsetMoveX() * this.getVelocity()); } @Override public void collide() { @@ -80,7 +80,7 @@ public Player(final Environment environment) if (!whereCollide.isEmpty()) { if (whereCollide.get("left").equals(Boolean.TRUE) || whereCollide.get("right").equals(Boolean.TRUE)) - this.offset[0] = Entity.IDLE; + this.idleOnX(); } } @@ -102,7 +102,7 @@ public Player(final Environment environment) public void worldLimit() { if (super.worldLimit(this.environment)) - this.offset[0] = Entity.IDLE; + this.idleOnX(); } /** Lie les inputs au clavier à une ou des actions. */ @@ -113,7 +113,7 @@ public void eventInput() this.keysInput.forEach((key, value) -> { if (Boolean.TRUE.equals(value)) { if (key == KeyCode.Z || key == KeyCode.SPACE) - if (this.offset[1] != Entity.IS_FALLING) this.jump(); + if (this.isNotFalling()) this.jump(); if (key == KeyCode.D) this.moveRight(); @@ -125,12 +125,13 @@ else if (key == KeyCode.Q) public void pickup(StowableObjectType pickupObject) { this.objectWasPickup.set(pickupObject); } + public SimpleBooleanProperty drunkProperty() { return drunk; } + public Map<MouseButton, Boolean> getMouseInput() { return this.mouseInput; } public Map<KeyCode, Boolean> getKeysInput() { return this.keysInput; } public Stack getStackSelected() { return this.stackSelected; } public Inventory getInventory() { return this.inventory; } - public boolean isDrunk() {return drunk.get();} - public SimpleBooleanProperty drunkProperty() {return drunk;} + public void setStackSelected(Stack stackSelected) { this.stackSelected = stackSelected; } } diff --git a/src/main/java/fr/sae/terraria/vue/Camera.java b/src/main/java/fr/sae/terraria/vue/Camera.java index bdd0645..fb59137 100644 --- a/src/main/java/fr/sae/terraria/vue/Camera.java +++ b/src/main/java/fr/sae/terraria/vue/Camera.java @@ -3,7 +3,6 @@ import fr.sae.terraria.Terraria; import fr.sae.terraria.modele.Environment; import fr.sae.terraria.modele.TileMaps; -import fr.sae.terraria.modele.entities.entity.Entity; import fr.sae.terraria.modele.entities.player.Player; import javafx.beans.binding.Bindings; import javafx.scene.layout.StackPane; @@ -50,7 +49,7 @@ public Camera(final Environment environment, final StackPane paneHadCamera) player.getYProperty().addListener((obs, oldX, newX) -> { // Suit le joueur centerPlayerOnYIntoCamera[0] = player.getY() - midHeightCamera; - if (player.offset[1] == Entity.IS_JUMPING) { + if (player.isJumping()) { gap[0] = player.getGravity().yInit - player.getY(); centerPlayerOnYIntoCamera[0] = player.getGravity().yInit - midHeightCamera; if (player.getGravity().timer > player.getGravity().flightTime*2 /* Légère bidouille */) @@ -58,7 +57,7 @@ public Camera(final Environment environment, final StackPane paneHadCamera) } // Décale "proprement" la caméra vers le haut - if (player.offset[1] == Entity.IDLE && gap[0] > 0) { + if (player.isIDLEonY() && gap[0] > 0) { gap[0] /= 2; centerPlayerOnYIntoCamera[0] = (player.getY() + gap[0]) - midHeightCamera; } diff --git a/src/main/java/fr/sae/terraria/vue/PlayerView.java b/src/main/java/fr/sae/terraria/vue/PlayerView.java index 6c612ec..74829a6 100644 --- a/src/main/java/fr/sae/terraria/vue/PlayerView.java +++ b/src/main/java/fr/sae/terraria/vue/PlayerView.java @@ -1,6 +1,5 @@ package fr.sae.terraria.vue; -import fr.sae.terraria.modele.entities.entity.Entity; import fr.sae.terraria.modele.entities.player.Player; import javafx.geometry.Rectangle2D; import javafx.scene.image.Image; @@ -49,14 +48,14 @@ private void setAnimation() player.getAnimation().getFrameProperty().addListener((obs, oldFrame, newFrame) -> { this.playerImgView.setViewport(new Rectangle2D(0, 0, widthPlayer, heightPlayer)); - if (player.offset[0] == Entity.IDLE && player.offset[1] == Entity.IDLE) + if (this.player.isIDLEonX() && this.player.isIDLEonY()) this.playerImgView.setImage(this.playerIdleImg); - if (player.offset[0] == Entity.IS_MOVING_RIGHT || player.offset[0] == Entity.IS_MOVING_LEFT) { + if (this.player.isMoving()) { Rectangle2D frameRect = new Rectangle2D((newFrame.intValue() * widthPlayer), 0, widthPlayer, heightPlayer); this.playerImgView.setViewport(frameRect); - this.playerImgView.setImage((player.offset[0] == -1) ? playerMoveLeftImg : playerMoveRightImg); + this.playerImgView.setImage((this.player.isMovingLeft()) ? playerMoveLeftImg : playerMoveRightImg); } }); } @@ -65,6 +64,6 @@ private void setAnimation() public void displayPlayer(final Pane display) { this.setAnimation(); - display.getChildren().add(playerImgView); + display.getChildren().add(this.playerImgView); } } diff --git a/src/main/java/fr/sae/terraria/vue/RabbitView.java b/src/main/java/fr/sae/terraria/vue/RabbitView.java index 2ed3744..79c8f34 100644 --- a/src/main/java/fr/sae/terraria/vue/RabbitView.java +++ b/src/main/java/fr/sae/terraria/vue/RabbitView.java @@ -2,7 +2,6 @@ import fr.sae.terraria.modele.TileMaps; import fr.sae.terraria.modele.entities.Rabbit; -import fr.sae.terraria.modele.entities.entity.Entity; import javafx.geometry.Rectangle2D; import javafx.scene.image.Image; import javafx.scene.image.ImageView; @@ -47,11 +46,11 @@ private void setAnimation() this.rabbit.getAnimation().getFrameProperty().addListener((obs, oldFrame, newFrame) -> { this.rabbitImgView.setViewport(new Rectangle2D(0, 0, this.widthTile, this.heightTile)); - if (this.rabbit.offset[0] == Entity.IS_MOVING_RIGHT || this.rabbit.offset[0] == Entity.IS_MOVING_LEFT) { + if (this.rabbit.isMoving()) { Rectangle2D frameRect = new Rectangle2D((newFrame.intValue() * this.widthTile), 0, this.widthTile, this.heightTile); this.rabbitImgView.setViewport(frameRect); - this.rabbitImgView.setImage((this.rabbit.offset[0] == -1) ? this.rabbitLeftImg : this.rabbitRightImg); + this.rabbitImgView.setImage((this.rabbit.isMovingLeft()) ? this.rabbitLeftImg : this.rabbitRightImg); } }); } From 9a003979904651974f6df5534fe3f721fff55c3d Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Sat, 11 Jun 2022 08:07:04 +0200 Subject: [PATCH 17/97] =?UTF-8?q?Review=20du=20code=20des=20vues=20de=20di?= =?UTF-8?q?ff=C3=A9rentes=20entit=C3=A9s.=20Refonte=20complet=20de=20cette?= =?UTF-8?q?=20partie?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modele/entities/entity/Animation.java | 3 +- .../java/fr/sae/terraria/vue/PlayerView.java | 69 ------------------- .../java/fr/sae/terraria/vue/RabbitView.java | 66 ------------------ .../java/fr/sae/terraria/vue/SlimeView.java | 50 -------------- .../fr/sae/terraria/vue/TileMapsView.java | 10 +-- src/main/java/fr/sae/terraria/vue/View.java | 9 ++- .../sae/terraria/vue/entities/EntityView.java | 49 +++++++++++++ .../sae/terraria/vue/entities/PlayerView.java | 45 ++++++++++++ .../sae/terraria/vue/entities/RabbitView.java | 41 +++++++++++ .../sae/terraria/vue/entities/SlimeView.java | 35 ++++++++++ 10 files changed, 184 insertions(+), 193 deletions(-) delete mode 100644 src/main/java/fr/sae/terraria/vue/PlayerView.java delete mode 100644 src/main/java/fr/sae/terraria/vue/RabbitView.java delete mode 100644 src/main/java/fr/sae/terraria/vue/SlimeView.java create mode 100644 src/main/java/fr/sae/terraria/vue/entities/EntityView.java create mode 100644 src/main/java/fr/sae/terraria/vue/entities/PlayerView.java create mode 100644 src/main/java/fr/sae/terraria/vue/entities/RabbitView.java create mode 100644 src/main/java/fr/sae/terraria/vue/entities/SlimeView.java diff --git a/src/main/java/fr/sae/terraria/modele/entities/entity/Animation.java b/src/main/java/fr/sae/terraria/modele/entities/entity/Animation.java index 6a77374..e1fc54b 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/entity/Animation.java +++ b/src/main/java/fr/sae/terraria/modele/entities/entity/Animation.java @@ -1,5 +1,6 @@ package fr.sae.terraria.modele.entities.entity; +import fr.sae.terraria.vue.entities.PlayerView; import javafx.beans.property.DoubleProperty; import javafx.beans.property.SimpleDoubleProperty; @@ -8,7 +9,7 @@ * <h1>Animation</h1> * <h2><u>Description:</u></h2> * <p>Gére uniquement la valeurs du frame pour que la vue sachent sur quel frame doit afficher l'image.</p> - * @see fr.sae.terraria.vue.PlayerView + * @see PlayerView */ public class Animation { diff --git a/src/main/java/fr/sae/terraria/vue/PlayerView.java b/src/main/java/fr/sae/terraria/vue/PlayerView.java deleted file mode 100644 index 74829a6..0000000 --- a/src/main/java/fr/sae/terraria/vue/PlayerView.java +++ /dev/null @@ -1,69 +0,0 @@ -package fr.sae.terraria.vue; - -import fr.sae.terraria.modele.entities.player.Player; -import javafx.geometry.Rectangle2D; -import javafx.scene.image.Image; -import javafx.scene.image.ImageView; -import javafx.scene.layout.Pane; - - -public class PlayerView -{ - private final ImageView playerImgView; - - private final Image playerMoveRightImg; - private final Image playerMoveLeftImg; - private final Image playerIdleImg; - - private final Player player; - - private int widthPlayer; - private int heightPlayer; - - - public PlayerView(Player player, double scaleMultiplicatorWidth, double scaleMultiplicatorHeight) - { - this.player = player; - - this.playerIdleImg = View.loadAnImage("sprites/player/player_idle.png", scaleMultiplicatorWidth, scaleMultiplicatorHeight); - this.playerMoveRightImg = View.loadAnImage("sprites/player/player_moveRight.png", scaleMultiplicatorWidth, scaleMultiplicatorHeight); - this.playerMoveLeftImg = View.loadAnImage("sprites/player/player_moveLeft.png", scaleMultiplicatorWidth, scaleMultiplicatorHeight); - - this.widthPlayer = (int) this.playerIdleImg.getWidth(); - this.heightPlayer = (int) this.playerIdleImg.getHeight(); - - this.playerImgView = View.createImageView(player, playerIdleImg); - } - - /** Applique l'animation sur le joueur */ - private void setAnimation() - { - // Change la limite de frame de l'animation selon le sprite sheet chargé - this.playerImgView.imageProperty().addListener((obs, oldImg, newImg) -> { - int newEndFrame = (int) (newImg.getWidth() / widthPlayer); - if (this.player.getAnimation().getFrame() >= newEndFrame) - this.player.getAnimation().reset(); - this.player.getAnimation().setEndFrame(newEndFrame); - }); - - player.getAnimation().getFrameProperty().addListener((obs, oldFrame, newFrame) -> { - this.playerImgView.setViewport(new Rectangle2D(0, 0, widthPlayer, heightPlayer)); - if (this.player.isIDLEonX() && this.player.isIDLEonY()) - this.playerImgView.setImage(this.playerIdleImg); - - if (this.player.isMoving()) { - Rectangle2D frameRect = new Rectangle2D((newFrame.intValue() * widthPlayer), 0, widthPlayer, heightPlayer); - - this.playerImgView.setViewport(frameRect); - this.playerImgView.setImage((this.player.isMovingLeft()) ? playerMoveLeftImg : playerMoveRightImg); - } - }); - } - - /** Synchronise les coordonnées en x et y du joueur avec l'image et ensuite l'affiche sur le Pane */ - public void displayPlayer(final Pane display) - { - this.setAnimation(); - display.getChildren().add(this.playerImgView); - } -} diff --git a/src/main/java/fr/sae/terraria/vue/RabbitView.java b/src/main/java/fr/sae/terraria/vue/RabbitView.java deleted file mode 100644 index 79c8f34..0000000 --- a/src/main/java/fr/sae/terraria/vue/RabbitView.java +++ /dev/null @@ -1,66 +0,0 @@ -package fr.sae.terraria.vue; - -import fr.sae.terraria.modele.TileMaps; -import fr.sae.terraria.modele.entities.Rabbit; -import javafx.geometry.Rectangle2D; -import javafx.scene.image.Image; -import javafx.scene.image.ImageView; -import javafx.scene.layout.Pane; - - -public class RabbitView -{ - private final ImageView rabbitImgView; - - private final Image rabbitLeftImg; - private final Image rabbitRightImg; - - private final Rabbit rabbit; - - private int widthTile; - private int heightTile; - - - public RabbitView(final Rabbit rabbit, double scaleMultiplicatorWidth, double scaleMultiplicatorHeight) - { - super(); - this.rabbit = rabbit; - - this.widthTile = (int) (scaleMultiplicatorWidth * TileMaps.TILE_DEFAULT_SIZE); - this.heightTile = (int) (scaleMultiplicatorHeight * TileMaps.TILE_DEFAULT_SIZE); - - this.rabbitLeftImg = View.loadAnImage("sprites/rabbit/rabbit_left.png", widthTile*4, heightTile); - this.rabbitRightImg = View.loadAnImage("sprites/rabbit/rabbit_right.png", widthTile*4, heightTile); - this.rabbitImgView = View.createImageView(rabbit, rabbitLeftImg); - } - - private void setAnimation() - { - // Change la limite de frame de l'animation selon le sprite sheet chargé - this.rabbitImgView.imageProperty().addListener((obs, oldImg, newImg) -> { - int newEndFrame = (int) (newImg.getWidth() / this.widthTile); - if (this.rabbit.getAnimation().getFrame() >= newEndFrame) - this.rabbit.getAnimation().reset(); - this.rabbit.getAnimation().setEndFrame(newEndFrame); - }); - - this.rabbit.getAnimation().getFrameProperty().addListener((obs, oldFrame, newFrame) -> { - this.rabbitImgView.setViewport(new Rectangle2D(0, 0, this.widthTile, this.heightTile)); - if (this.rabbit.isMoving()) { - Rectangle2D frameRect = new Rectangle2D((newFrame.intValue() * this.widthTile), 0, this.widthTile, this.heightTile); - - this.rabbitImgView.setViewport(frameRect); - this.rabbitImgView.setImage((this.rabbit.isMovingLeft()) ? this.rabbitLeftImg : this.rabbitRightImg); - } - }); - } - - public void displayRabbit(final Pane display) - { - this.setAnimation(); - display.getChildren().add(this.rabbitImgView); - } - - - public ImageView getRabbitImgView() { return this.rabbitImgView; } -} diff --git a/src/main/java/fr/sae/terraria/vue/SlimeView.java b/src/main/java/fr/sae/terraria/vue/SlimeView.java deleted file mode 100644 index 935c84d..0000000 --- a/src/main/java/fr/sae/terraria/vue/SlimeView.java +++ /dev/null @@ -1,50 +0,0 @@ -package fr.sae.terraria.vue; - -import fr.sae.terraria.modele.TileMaps; -import fr.sae.terraria.modele.entities.Slime; -import javafx.geometry.Rectangle2D; -import javafx.scene.image.Image; -import javafx.scene.image.ImageView; -import javafx.scene.layout.Pane; - - -public class SlimeView -{ - private final ImageView slimeImgView; - - private final Image slimeImg; - - private final Slime slime; - private int widthTile; - private int heightTile; - - - public SlimeView(final Slime slime, double scaleMultiplicatorWidth, double scaleMultiplicatorHeight) - { - super(); - this.slime = slime; - - this.widthTile = (int) (scaleMultiplicatorWidth * TileMaps.TILE_DEFAULT_SIZE); - this.heightTile = (int) (scaleMultiplicatorHeight * TileMaps.TILE_DEFAULT_SIZE); - - this.slimeImg = View.loadAnImage("sprites/slimes/green_slime.png", widthTile*4, heightTile); - this.slimeImgView = View.createImageView(slime, slimeImg); - } - - private void setAnimation() - { - this.slime.getAnimation().getFrameProperty().addListener((obs, oldV, newV) -> { - Rectangle2D frameRect = new Rectangle2D(newV.intValue() * this.widthTile, 0, this.widthTile, this.heightTile); - this.slimeImgView.setViewport(frameRect); - }); - } - - public void displaySlime(final Pane display) - { - this.setAnimation(); - display.getChildren().add(this.slimeImgView); - } - - - public ImageView getSlimeImgView() { return this.slimeImgView; } -} diff --git a/src/main/java/fr/sae/terraria/vue/TileMapsView.java b/src/main/java/fr/sae/terraria/vue/TileMapsView.java index 9aed0c9..70da741 100644 --- a/src/main/java/fr/sae/terraria/vue/TileMapsView.java +++ b/src/main/java/fr/sae/terraria/vue/TileMapsView.java @@ -5,6 +5,8 @@ import fr.sae.terraria.modele.entities.Rabbit; import fr.sae.terraria.modele.entities.Slime; import fr.sae.terraria.modele.entities.blocks.*; +import fr.sae.terraria.vue.entities.RabbitView; +import fr.sae.terraria.vue.entities.SlimeView; import javafx.collections.ListChangeListener; import javafx.geometry.Rectangle2D; import javafx.scene.Group; @@ -133,8 +135,8 @@ private void updatesRabbitView(ListChangeListener.Change<? extends Rabbit> c) while (c.next()) { if (c.wasAdded()) { RabbitView rabbitView = new RabbitView(c.getAddedSubList().get(0), environment.scaleMultiplicatorWidth, environment.scaleMultiplicatorHeight); - rabbitView.displayRabbit(this.displayHostileBeings); - this.rabbitsView.add(rabbitView.getRabbitImgView()); + rabbitView.display(this.displayHostileBeings); + this.rabbitsView.add(rabbitView.getImgView()); } if (c.wasRemoved()) { @@ -149,8 +151,8 @@ private void updatesSlimeView(ListChangeListener.Change<? extends Slime> c) while (c.next()) { if (c.wasAdded()) { SlimeView slimeView = new SlimeView(c.getAddedSubList().get(0), environment.scaleMultiplicatorWidth, environment.scaleMultiplicatorHeight); - slimeView.displaySlime(this.displayHostileBeings); - this.slimesView.add(slimeView.getSlimeImgView()); + slimeView.display(this.displayHostileBeings); + this.slimesView.add(slimeView.getImgView()); } if (c.wasRemoved()) { diff --git a/src/main/java/fr/sae/terraria/vue/View.java b/src/main/java/fr/sae/terraria/vue/View.java index 1da6798..530df87 100644 --- a/src/main/java/fr/sae/terraria/vue/View.java +++ b/src/main/java/fr/sae/terraria/vue/View.java @@ -4,6 +4,8 @@ import fr.sae.terraria.controller.GameController; import fr.sae.terraria.modele.Environment; import fr.sae.terraria.modele.entities.entity.Entity; +import fr.sae.terraria.modele.entities.player.Player; +import fr.sae.terraria.vue.entities.PlayerView; import fr.sae.terraria.vue.hud.HUDView; import fr.sae.terraria.vue.hud.MouseCursorView; import javafx.scene.image.Image; @@ -17,7 +19,7 @@ public class View { - private static Environment environment; + private Environment environment; /** @@ -40,8 +42,9 @@ public View(final GameController gameController) TileMapsView tileMapsView = new TileMapsView(environment, displayTiledMap, displayHostileBeings, scaleMultiplicatorWidth, scaleMultiplicatorHeight); tileMapsView.displayMaps(environment.getTileMaps()); - PlayerView playerView = new PlayerView(environment.getPlayer(), scaleMultiplicatorWidth, scaleMultiplicatorHeight); - playerView.displayPlayer(displayHostileBeings); + Player player = this.environment.getPlayer(); + PlayerView playerView = new PlayerView(player, scaleMultiplicatorWidth, scaleMultiplicatorHeight); + playerView.display(displayHostileBeings); LightView lightView = new LightView(environment.getGameClock(),filter,environment); DrunkView drunkView = new DrunkView(environment,gameController.paneHadCamera); diff --git a/src/main/java/fr/sae/terraria/vue/entities/EntityView.java b/src/main/java/fr/sae/terraria/vue/entities/EntityView.java new file mode 100644 index 0000000..056e809 --- /dev/null +++ b/src/main/java/fr/sae/terraria/vue/entities/EntityView.java @@ -0,0 +1,49 @@ +package fr.sae.terraria.vue.entities; + +import fr.sae.terraria.modele.entities.entity.Entity; +import javafx.scene.image.ImageView; +import javafx.scene.layout.Pane; + + +public abstract class EntityView +{ + protected final ImageView imgView; + protected final Entity entity; + + + protected EntityView(final Entity entity) + { + this.entity = entity; + + this.imgView = new ImageView(); + this.imgView.translateXProperty().bind(entity.getXProperty()); + this.imgView.translateYProperty().bind(entity.getYProperty()); + } + + protected abstract void animation(int frame); + + private void startAnimation() + { + int widthEntity = this.entity.getRect().getWidth(); + // int heightEntity = this.entity.getRect().getHeight(); + + // Change la limite de frame de l'animation selon le sprite sheet chargé + this.imgView.imageProperty().addListener((obs, oldImg, newImg) -> { + int newEndFrame = (int) (newImg.getWidth() / widthEntity); + if (this.entity.getAnimation().getFrame() >= newEndFrame) + this.entity.getAnimation().reset(); + this.entity.getAnimation().setEndFrame(newEndFrame); + }); + + this.entity.getAnimation().getFrameProperty().addListener((obs, oldFrame, newFrame) -> this.animation(newFrame.intValue())); + } + + public void display(final Pane display) + { + display.getChildren().add(this.imgView); + this.startAnimation(); + } + + + public ImageView getImgView() { return this.imgView; } +} diff --git a/src/main/java/fr/sae/terraria/vue/entities/PlayerView.java b/src/main/java/fr/sae/terraria/vue/entities/PlayerView.java new file mode 100644 index 0000000..8b2692a --- /dev/null +++ b/src/main/java/fr/sae/terraria/vue/entities/PlayerView.java @@ -0,0 +1,45 @@ +package fr.sae.terraria.vue.entities; + +import fr.sae.terraria.modele.entities.player.Player; +import fr.sae.terraria.vue.View; +import javafx.geometry.Rectangle2D; +import javafx.scene.image.Image; + + +public class PlayerView extends EntityView +{ + private final Image playerMoveRightImg; + private final Image playerMoveLeftImg; + private final Image playerIdleImg; + + private int widthPlayer; + private int heightPlayer; + + + public PlayerView(final Player player, double scaleMultiplicatorWidth, double scaleMultiplicatorHeight) + { + super(player); + + this.playerIdleImg = View.loadAnImage("sprites/player/player_idle.png", scaleMultiplicatorWidth, scaleMultiplicatorHeight); + this.playerMoveRightImg = View.loadAnImage("sprites/player/player_moveRight.png", scaleMultiplicatorWidth, scaleMultiplicatorHeight); + this.playerMoveLeftImg = View.loadAnImage("sprites/player/player_moveLeft.png", scaleMultiplicatorWidth, scaleMultiplicatorHeight); + this.imgView.setImage(playerIdleImg); + + this.widthPlayer = (int) this.playerIdleImg.getWidth(); + this.heightPlayer = (int) this.playerIdleImg.getHeight(); + } + + @Override protected void animation(int frame) + { + this.imgView.setViewport(new Rectangle2D(0, 0, this.widthPlayer, this.heightPlayer)); + if (((Player) this.entity).isIDLEonX() && ((Player) this.entity).isIDLEonY()) + this.imgView.setImage(this.playerIdleImg); + + if (((Player) this.entity).isMoving()) { + Rectangle2D frameRect = new Rectangle2D((frame * this.widthPlayer), 0, this.widthPlayer, this.heightPlayer); + + this.imgView.setViewport(frameRect); + this.imgView.setImage((((Player) this.entity).isMovingLeft()) ? this.playerMoveLeftImg : this.playerMoveRightImg); + } + } +} diff --git a/src/main/java/fr/sae/terraria/vue/entities/RabbitView.java b/src/main/java/fr/sae/terraria/vue/entities/RabbitView.java new file mode 100644 index 0000000..abde3b5 --- /dev/null +++ b/src/main/java/fr/sae/terraria/vue/entities/RabbitView.java @@ -0,0 +1,41 @@ +package fr.sae.terraria.vue.entities; + +import fr.sae.terraria.modele.TileMaps; +import fr.sae.terraria.modele.entities.Rabbit; +import fr.sae.terraria.vue.View; +import javafx.geometry.Rectangle2D; +import javafx.scene.image.Image; + + +public class RabbitView extends EntityView +{ + + private final Image rabbitLeftImg; + private final Image rabbitRightImg; + + + private int widthTile; + private int heightTile; + + + public RabbitView(final Rabbit rabbit, double scaleMultiplicatorWidth, double scaleMultiplicatorHeight) + { + super(rabbit); + + this.widthTile = (int) (scaleMultiplicatorWidth * TileMaps.TILE_DEFAULT_SIZE); + this.heightTile = (int) (scaleMultiplicatorHeight * TileMaps.TILE_DEFAULT_SIZE); + + this.rabbitLeftImg = View.loadAnImage("sprites/rabbit/rabbit_left.png", widthTile*4, heightTile); + this.rabbitRightImg = View.loadAnImage("sprites/rabbit/rabbit_right.png", widthTile*4, heightTile); + } + + @Override protected void animation(int frame) { + this.imgView.setViewport(new Rectangle2D(0, 0, this.widthTile, this.heightTile)); + if (((Rabbit) this.entity).isMoving()) { + Rectangle2D frameRect = new Rectangle2D((frame * this.widthTile), 0, this.widthTile, this.heightTile); + + this.imgView.setViewport(frameRect); + this.imgView.setImage((((Rabbit) this.entity).isMovingLeft()) ? this.rabbitLeftImg : this.rabbitRightImg); + } + } +} diff --git a/src/main/java/fr/sae/terraria/vue/entities/SlimeView.java b/src/main/java/fr/sae/terraria/vue/entities/SlimeView.java new file mode 100644 index 0000000..05d9104 --- /dev/null +++ b/src/main/java/fr/sae/terraria/vue/entities/SlimeView.java @@ -0,0 +1,35 @@ +package fr.sae.terraria.vue.entities; + +import fr.sae.terraria.modele.TileMaps; +import fr.sae.terraria.modele.entities.Slime; +import fr.sae.terraria.vue.View; +import javafx.geometry.Rectangle2D; +import javafx.scene.image.Image; +import javafx.scene.image.ImageView; +import javafx.scene.layout.Pane; + + +public class SlimeView extends EntityView +{ + private final Image slimeImg; + + private int widthTile; + private int heightTile; + + + public SlimeView(final Slime slime, double scaleMultiplicatorWidth, double scaleMultiplicatorHeight) + { + super(slime); + + this.widthTile = (int) (scaleMultiplicatorWidth * TileMaps.TILE_DEFAULT_SIZE); + this.heightTile = (int) (scaleMultiplicatorHeight * TileMaps.TILE_DEFAULT_SIZE); + + this.slimeImg = View.loadAnImage("sprites/slimes/green_slime.png", widthTile*4, heightTile); + this.imgView.setImage(slimeImg); + } + + @Override protected void animation(int frame) { + Rectangle2D frameRect = new Rectangle2D(frame * this.widthTile, 0, this.widthTile, this.heightTile); + this.imgView.setViewport(frameRect); + } +} From d55ef49a726f6fd3b7a22fdf7a1b48eb1bb1e76e Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Sat, 11 Jun 2022 08:47:49 +0200 Subject: [PATCH 18/97] JavaDocs --- .../fr/sae/terraria/modele/Environment.java | 3 +- .../sae/terraria/modele/GenerateEntity.java | 4 ++ .../java/fr/sae/terraria/modele/TileMaps.java | 16 +++++++ .../modele/entities/entity/Entity.java | 16 +------ .../fr/sae/terraria/vue/TileMapsView.java | 43 +++++++++++++++++++ .../sae/terraria/vue/entities/EntityView.java | 17 ++++++++ 6 files changed, 83 insertions(+), 16 deletions(-) diff --git a/src/main/java/fr/sae/terraria/modele/Environment.java b/src/main/java/fr/sae/terraria/modele/Environment.java index 941b12c..967ca08 100644 --- a/src/main/java/fr/sae/terraria/modele/Environment.java +++ b/src/main/java/fr/sae/terraria/modele/Environment.java @@ -79,6 +79,7 @@ public Environment(double scaleMultiplicatorWidth, double scaleMultiplicatorHeig this.blocks = FXCollections.observableArrayList(); this.trees = FXCollections.observableArrayList(); + // Fait apparaitre le joueur. this.player = new Player(this); this.player.setVelocity(5); this.player.setPv(4); @@ -141,7 +142,7 @@ private void gameLoop() boolean nightTime = this.clock.getMinutes() > (Clock.MINUTES_IN_A_DAY)/2; boolean weHaveChangedDay = this.previousDays != this.clock.getDays(); if (weHaveChangedDay) - for (int i = 0; i < 3; i++); // Génère par jour, 3 arbres + for (int i = 0; i < 10; i++) // Génère par jour, 3 arbres GenerateEntity.tree(this); if (dayTime) { // Génère certaines entités uniquement pendant le jour GenerateEntity.rabbit(this); diff --git a/src/main/java/fr/sae/terraria/modele/GenerateEntity.java b/src/main/java/fr/sae/terraria/modele/GenerateEntity.java index 2e96b57..ef239ab 100644 --- a/src/main/java/fr/sae/terraria/modele/GenerateEntity.java +++ b/src/main/java/fr/sae/terraria/modele/GenerateEntity.java @@ -21,6 +21,10 @@ import static fr.sae.terraria.modele.entities.blocks.Tree.WHEN_SPAWN_A_TREE; +/** + * <h1>Generate Entity</h1> + * <h2>Une classe qui permet de génère aléatoirement des entités</h2> + */ public class GenerateEntity { public static final int MAX_SPAWN_RABBIT = 100; diff --git a/src/main/java/fr/sae/terraria/modele/TileMaps.java b/src/main/java/fr/sae/terraria/modele/TileMaps.java index 2a7f312..4009aad 100644 --- a/src/main/java/fr/sae/terraria/modele/TileMaps.java +++ b/src/main/java/fr/sae/terraria/modele/TileMaps.java @@ -5,6 +5,15 @@ import java.io.FileReader; +/** + * <h1>Tile maps</h1> + * <h2>Génère à l'écran la carte tuilé</h2> + * <h3><u>Description:</u></h3> + * <p>Cette classes permet à partir d'un fichier <code>.json</code> de chargé les données de la carte</p> + * <p>Il est conservé dans la variable <code>maps</code></p> + * + * @author CHRZASZCZ Naulan + */ public class TileMaps { // Constantes @@ -89,5 +98,12 @@ public void load(final String path) public int getWidth() { return this.maps[0].length; } public int getTile(int x, int y) { return this.maps[y][x]; } + /** + * Remplace grâce aux coordonnées entrées, un tile par celui qui est mis dans l'argument + * + * @param tileIndex Le tile qui doit remplacer une autre. + * @param x la position horizontal de là où le tile doit être écrit + * @param y la position vertical de là où le tile doit être écrit + */ public void setTile(int tileIndex, int y, int x) { this.maps[y][x] = tileIndex; } } diff --git a/src/main/java/fr/sae/terraria/modele/entities/entity/Entity.java b/src/main/java/fr/sae/terraria/modele/entities/entity/Entity.java index f29cefe..1f94889 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/entity/Entity.java +++ b/src/main/java/fr/sae/terraria/modele/entities/entity/Entity.java @@ -7,23 +7,8 @@ /** * <h1><b>La classes Entity</b></h1> * <h2><u>Description:</u></h2> - * * <p>Correspond à un element physique qui doit avoir des coordonnées sur un environment.</p> - * <p>contient des fonctions privates qui peuvent êtres implémenter grâce au interface mise à disposition au sain du même package</p> - * <p></p> - * <p>C'est interfaces agissent comme une sorte de pâte à modelé, ils permettent surtout de - * rendre public les fonctions de Entity qui sont eux protected</p> - * - * <h2><u>Comment l'utiliser ?</u></h2> - * <p>Il suffit d'extend des objects qui vous souhaitez êtres des entitées</p> - * <p><u>Exemple de code qui hérite de Entity:</u></p> - * <img src="https://raw.githubusercontent.com/NaulaN/SAE-Terraria-Like/develop/src/main/resources/fr/sae/terraria/docs/ExampleExtendEntity.PNG"/> - * <p>Donc sur cette exemple dans le jeu, le lapin est considèrer comme une entités.</p> - * <p></p> - * <p>Toutes les méthodes/fonctions protected sont appelable vers l'extérieur d'un classes qui l'hérite grâce à des interfaces.</p> - * <p>Donc pour avoir correctement les fonctions:</p> * - * <p>Sont implementable grâce à l'interface MovableObjectType</p> * @see CollideObjectType * @see ReproductiveObjectType * @see StowableObjectType @@ -32,6 +17,7 @@ * @see PlaceableObjectType * @see EatableObjectType * + * * @author CHRZASZCZ Naulan */ public abstract class Entity diff --git a/src/main/java/fr/sae/terraria/vue/TileMapsView.java b/src/main/java/fr/sae/terraria/vue/TileMapsView.java index 70da741..32e2314 100644 --- a/src/main/java/fr/sae/terraria/vue/TileMapsView.java +++ b/src/main/java/fr/sae/terraria/vue/TileMapsView.java @@ -19,11 +19,21 @@ import java.util.Objects; +/** + * <h1>Tile maps View</h1> + * <h2>Une classes qui se gère de l'affichage de la carte et de ces élèments aditionnel </h2> + * <h3><u>Description:</u></h3> + * <p>Cette classe permet d'afficher, de supprimer les élèments visible à l'écran</p> + * + * @author CHRZASZCZ Naulan + */ public class TileMapsView { private final List<ImageView> rabbitsView; private final List<ImageView> blocksView; private final List<ImageView> slimesView; + // Cette liste marche differement à cause de la classes Group, cette liste conserve un groupe d'images + // La classes Group contient plus ou moins d'images selon du fait de comment il génère l'arbre. private final List<Group> treesView; private final Image torchImg; @@ -68,6 +78,7 @@ public TileMapsView(Environment environment, this.slimesView = new ArrayList<>(); this.treesView = new ArrayList<>(); + // Génération des images this.floorTopImg = View.loadAnImage("tiles/floor-top.png", tileWidth, tileHeight); this.floorLeftImg = View.loadAnImage("tiles/floor-left.png", tileWidth, tileHeight); this.floorRightImg = View.loadAnImage("tiles/floor-right.png", tileWidth, tileHeight); @@ -83,9 +94,17 @@ public TileMapsView(Environment environment, this.environment.getRabbits().addListener((ListChangeListener<? super Rabbit>) this::updatesRabbitView); // Ajoute et supprime les elements de l'écran qui concerne les slimes this.environment.getSlimes().addListener((ListChangeListener<? super Slime>) this::updatesSlimeView); + // Ajoute et supprime un groupe d'élèments de l'écran qui concerne les arbres this.environment.getTrees().addListener((ListChangeListener<? super Tree>) this::updatesTreeView); } + /** + * Supprime ou affiche les blocs qui sont ajouté dans la liste d'entité <code>List<Block> blocks;</code> + * Une fois affiché, la fonction range l'imageView crée dans la liste <code>List<ImageView> blocksView;</code> de cette classes + * + * @param c Cet argument est present car on passe cette fonction en tant que reference (this::updatesBlocksView), + * l'argument est là pour obtenir les informations concernant les modifications dans liste <code>List<Block> blocks;</code> + */ private void updatesBlocksView(ListChangeListener.Change<? extends Block> c) { while (c.next()) { @@ -130,6 +149,13 @@ else if (((Dirt) block).getTypeOfFloor() == 0) } } + /** + * Supprime ou affiche les lapins qui sont ajouté dans la liste d'entité <code>List<Rabbit> rabbits;</code> + * Une fois affiché, la fonction range l'imageView crée dans la liste <code>List<ImageView> rabbitsView;</code> de cette classe + * + * @param c Cet argument est present car on passe cette fonction en tant que reference (this::updatesRabbitsView), + * l'argument est là pour obtenir les informations concernant les modifications dans liste <code>List<Block> rabbits;</code> + */ private void updatesRabbitView(ListChangeListener.Change<? extends Rabbit> c) { while (c.next()) { @@ -146,6 +172,13 @@ private void updatesRabbitView(ListChangeListener.Change<? extends Rabbit> c) } } + /** + * Supprime ou affiche les slimes qui sont ajoutés dans la liste d'entité <code>List<Slime> slimes;</code> + * Une fois affiché, la fonction range l'imageView crée dans la liste <code>List<ImageView> slimesView;</code> de cette classe + * + * @param c Cet argument est present car on passe cette fonction en tant que reference (this::updatesSlimesView), + * l'argument est là pour obtenir les informations concernant les modifications dans liste <code>List<Slime> slimes;</code> + */ private void updatesSlimeView(ListChangeListener.Change<? extends Slime> c) { while (c.next()) { @@ -162,13 +195,23 @@ private void updatesSlimeView(ListChangeListener.Change<? extends Slime> c) } } + /** + * Supprime ou affiche les groupes d'image de l'arbre qui sont ajouté dans la liste d'entité <code>List<Tree> trees;</code> + * Génère une image plus ou moins grande selon le <code>Math.random</code> obtenue. + * Une fois affiché, la fonction range l'imageView crée dans la liste <code>List<ImageView> treesView;</code> de cette classe + * + * @param c Cet argument est present car on passe cette fonction en tant que reference (this::updatesRabbitsView), + * l'argument est là pour obtenir les informations concernant les modifications dans liste <code>List<Block> rabbits;</code> + */ private void updatesTreeView(ListChangeListener.Change<? extends Tree> c) { while (c.next()) { if (c.wasAdded()) { Group group = new Group(); + // La hauteur des feuillages int nbFoliage = ((int) (Math.random()*2))+1; + // La hauteur du tronc int nbTrunk = ((int) (Math.random()*3))+1; Rectangle2D viewportFirstFrame = new Rectangle2D(0, 0, this.tileWidth, this.tileHeight); diff --git a/src/main/java/fr/sae/terraria/vue/entities/EntityView.java b/src/main/java/fr/sae/terraria/vue/entities/EntityView.java index 056e809..3a1f6c0 100644 --- a/src/main/java/fr/sae/terraria/vue/entities/EntityView.java +++ b/src/main/java/fr/sae/terraria/vue/entities/EntityView.java @@ -5,6 +5,20 @@ import javafx.scene.layout.Pane; +/** + * <h1>Entity View</h1> + * <h2>Une classe qui permet d'affiché des entités</h2> + * <h3><u>Description:</u></h3> + * <p>Cette classe permet simplement grâce à la fonction <code>animation()</code> de codé une animations pour une entité en particulier</p> + * <p>Cette classe gère les choses suivantes:</p> + * <ul> + * <li>Crée une ImageView, pas besoin dans recrée une autre dans les classes qui hériterais cette classes.</li> + * <li>Bindings des positions de l'entité à l'ImageView.</li> + * <li>Change dynamiquement la limite de frame selon l'image utilisé.</li> + * </ul> + * + * @author CHRZASZCZ Naulan + */ public abstract class EntityView { protected final ImageView imgView; @@ -20,8 +34,10 @@ protected EntityView(final Entity entity) this.imgView.translateYProperty().bind(entity.getYProperty()); } + /** l'endroit où il va avoir les animations qui vont êtres programmer. */ protected abstract void animation(int frame); + /** La fonction qui permet de démarrer les animations des entités */ private void startAnimation() { int widthEntity = this.entity.getRect().getWidth(); @@ -38,6 +54,7 @@ private void startAnimation() this.entity.getAnimation().getFrameProperty().addListener((obs, oldFrame, newFrame) -> this.animation(newFrame.intValue())); } + /** Affiche l'entité à l'écran et démarre l'animation */ public void display(final Pane display) { display.getChildren().add(this.imgView); From 4064152c8df1a3598a13af96682111240b5c5c41 Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Sat, 11 Jun 2022 09:03:13 +0200 Subject: [PATCH 19/97] =?UTF-8?q?D=C3=A9placement=20code=20dans=20Player.j?= =?UTF-8?q?ava?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../terraria/controller/GameController.java | 63 +++++-------------- .../modele/entities/player/Player.java | 34 ++++++++++ .../sae/terraria/vue/entities/SlimeView.java | 2 - 3 files changed, 51 insertions(+), 48 deletions(-) diff --git a/src/main/java/fr/sae/terraria/controller/GameController.java b/src/main/java/fr/sae/terraria/controller/GameController.java index 8969053..2df23ec 100644 --- a/src/main/java/fr/sae/terraria/controller/GameController.java +++ b/src/main/java/fr/sae/terraria/controller/GameController.java @@ -3,7 +3,7 @@ import fr.sae.terraria.Terraria; import fr.sae.terraria.modele.Environment; import fr.sae.terraria.modele.TileMaps; -import fr.sae.terraria.modele.entities.entity.*; +import fr.sae.terraria.modele.entities.entity.EatableObjectType; import fr.sae.terraria.modele.entities.player.Player; import fr.sae.terraria.modele.entities.player.inventory.Inventory; import fr.sae.terraria.vue.Camera; @@ -20,7 +20,6 @@ import javafx.stage.Stage; import java.net.URL; -import java.util.Objects; import java.util.ResourceBundle; @@ -98,27 +97,14 @@ private void addKeysEventListener(final Stage stage) stage.addEventFilter(MouseEvent.MOUSE_CLICKED, mouse -> { this.player.getMouseInput().put(mouse.getButton(), true); - mouse.consume(); - }); - - stage.addEventFilter(MouseEvent.MOUSE_RELEASED, mouse -> { - this.player.getMouseInput().put(mouse.getButton(), false); - mouse.consume(); - }); - stage.addEventFilter(ScrollEvent.SCROLL, scroll -> { - inventory.setScroll((int) scroll.getDeltaY()); - scroll.consume(); - }); - - stage.addEventFilter(MouseEvent.MOUSE_CLICKED, click -> { final double scaleMultiplicativeWidth = (this.root.getPrefWidth() / Terraria.DISPLAY_RENDERING_WIDTH); final double scaleMultiplicativeHeight = ((this.root.getPrefHeight()-this.title.getPrefHeight()) / Terraria.DISPLAY_RENDERING_HEIGHT); final int tileWidth = (int) (TileMaps.TILE_DEFAULT_SIZE * scaleMultiplicativeWidth); final int tileHeight = (int) (TileMaps.TILE_DEFAULT_SIZE * scaleMultiplicativeHeight); // La position correcte sur le Pane - double mouseX = click.getSceneX()+((Rectangle) this.displayTiledMap.getParent().getClip()).getX(); - double mouseY = (click.getSceneY()-this.title.getPrefHeight())+((Rectangle) this.displayTiledMap.getParent().getClip()).getY(); + double mouseX = mouse.getSceneX()+((Rectangle) this.displayTiledMap.getParent().getClip()).getX(); + double mouseY = (mouse.getSceneY()-this.title.getPrefHeight())+((Rectangle) this.displayTiledMap.getParent().getClip()).getY(); // Le bloc où la souris à clicker int xBlock = (int) (mouseX/tileWidth); int yBlock = (int) (mouseY/tileHeight); @@ -134,38 +120,23 @@ private void addKeysEventListener(final Stage stage) if (this.player.getStackSelected() != null && this.player.getStackSelected().getItem() instanceof EatableObjectType ) { ((EatableObjectType) this.player.getStackSelected().getItem()).eat(); } else if (isOneBlockDistance) { - if (click.getButton().equals(MouseButton.PRIMARY)) - this.breakBlock(rectangle); - if (click.getButton().equals(MouseButton.SECONDARY)) - this.placeBlock(xBlock, yBlock); + if (mouse.getButton().equals(MouseButton.PRIMARY)) + this.player.interactWithBlock(rectangle); + if (mouse.getButton().equals(MouseButton.SECONDARY)) + this.player.placeBlock(xBlock, yBlock); } - }); - } - private void breakBlock(final Rectangle2D rectangle) - { - // Commence a cherché l'entité ciblée - for (Entity entity : this.environment.getEntities()) if (entity.getRect().collideRect(rectangle)) { - if (entity instanceof BreakableObjectType) - ((BreakableObjectType) entity).breaks(); - if (entity instanceof CollapsibleObjectType) // TODO TEMP, à déplacer - ((CollapsibleObjectType) entity).hit(); - // Quand tous c'est bien déroulés, aprés avoir trouvé l'entité et l'objet sur l'écran, il arrête de chercher d'autre entité d'où le break - break; - } - } - - private void placeBlock(int xBlock, int yBlock) - { - boolean haveAnItemOnHand = !Objects.isNull(this.player.getStackSelected()); - boolean goodPlace = this.environment.getTileMaps().getTile(xBlock, yBlock) == TileMaps.SKY; + mouse.consume(); + }); - if (haveAnItemOnHand && goodPlace) { - if (!(this.player.getStackSelected().getItem() instanceof PlaceableObjectType) && !(this.player.getStackSelected() instanceof EatableObjectType)) - return; + stage.addEventFilter(MouseEvent.MOUSE_RELEASED, mouse -> { + this.player.getMouseInput().put(mouse.getButton(), false); + mouse.consume(); + }); - if (this.player.getStackSelected().getItem() instanceof PlaceableObjectType) - ((PlaceableObjectType) this.player.getStackSelected().getItem()).place(xBlock, yBlock); - } + stage.addEventFilter(ScrollEvent.SCROLL, scroll -> { + inventory.setScroll((int) scroll.getDeltaY()); + scroll.consume(); + }); } } \ No newline at end of file diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java index 116fb6e..10c166e 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java @@ -1,6 +1,7 @@ package fr.sae.terraria.modele.entities.player; import fr.sae.terraria.modele.Environment; +import fr.sae.terraria.modele.TileMaps; import fr.sae.terraria.modele.entities.entity.*; import fr.sae.terraria.modele.entities.player.inventory.Inventory; import fr.sae.terraria.modele.entities.player.inventory.Stack; @@ -8,6 +9,7 @@ import javafx.beans.property.ObjectProperty; import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.property.SimpleObjectProperty; +import javafx.geometry.Rectangle2D; import javafx.scene.image.Image; import javafx.scene.input.KeyCode; import javafx.scene.input.MouseButton; @@ -105,6 +107,38 @@ public void worldLimit() this.idleOnX(); } + public void interactWithBlock(final Rectangle2D rectangle) + { + int i = 0; + + Entity entity = this.environment.getEntities().get(i); + while (i < this.environment.getEntities().size() && !entity.getRect().collideRect(rectangle)) { + entity = this.environment.getEntities().get(i); + i++; + } + + if (i < this.environment.getEntities().size()) { + if (entity instanceof BreakableObjectType) + ((BreakableObjectType) entity).breaks(); + if (entity instanceof CollapsibleObjectType) + ((CollapsibleObjectType) entity).hit(); + } + } + + public void placeBlock(int xBlock, int yBlock) + { + boolean haveAnItemOnHand = !Objects.isNull(this.getStackSelected()); + boolean goodPlace = this.environment.getTileMaps().getTile(xBlock, yBlock) == TileMaps.SKY; + + if (haveAnItemOnHand && goodPlace) { + if (!(this.getStackSelected().getItem() instanceof PlaceableObjectType) && !(this.getStackSelected() instanceof EatableObjectType)) + return; + + if (this.getStackSelected().getItem() instanceof PlaceableObjectType) + ((PlaceableObjectType) this.getStackSelected().getItem()).place(xBlock, yBlock); + } + } + /** Lie les inputs au clavier à une ou des actions. */ public void eventInput() { diff --git a/src/main/java/fr/sae/terraria/vue/entities/SlimeView.java b/src/main/java/fr/sae/terraria/vue/entities/SlimeView.java index 05d9104..d55105d 100644 --- a/src/main/java/fr/sae/terraria/vue/entities/SlimeView.java +++ b/src/main/java/fr/sae/terraria/vue/entities/SlimeView.java @@ -5,8 +5,6 @@ import fr.sae.terraria.vue.View; import javafx.geometry.Rectangle2D; import javafx.scene.image.Image; -import javafx.scene.image.ImageView; -import javafx.scene.layout.Pane; public class SlimeView extends EntityView From 8b49054ddd3d3ead5193e7a168af8b6fcb439869 Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Sat, 11 Jun 2022 09:16:09 +0200 Subject: [PATCH 20/97] =?UTF-8?q?D=C3=A9placement=20code,=20clean?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/fr/sae/terraria/modele/Environment.java | 2 +- src/main/java/fr/sae/terraria/modele/GenerateEntity.java | 3 +-- .../java/fr/sae/terraria/modele/entities/blocks/Tree.java | 2 +- .../fr/sae/terraria/modele/entities/entity/Entity.java | 8 +++++--- .../java/fr/sae/terraria/modele/entities/items/Vodka.java | 1 + .../fr/sae/terraria/modele/entities/player/Player.java | 1 - src/main/java/fr/sae/terraria/vue/Camera.java | 6 +++--- src/main/java/fr/sae/terraria/vue/DrunkView.java | 4 +++- src/main/java/fr/sae/terraria/vue/TileMapsView.java | 4 ++-- src/main/java/fr/sae/terraria/vue/View.java | 4 ++-- .../java/fr/sae/terraria/vue/entities/EntityView.java | 4 ++-- src/main/java/fr/sae/terraria/vue/hud/HealthBarView.java | 2 +- 12 files changed, 22 insertions(+), 19 deletions(-) diff --git a/src/main/java/fr/sae/terraria/modele/Environment.java b/src/main/java/fr/sae/terraria/modele/Environment.java index 967ca08..dc7cafa 100644 --- a/src/main/java/fr/sae/terraria/modele/Environment.java +++ b/src/main/java/fr/sae/terraria/modele/Environment.java @@ -142,7 +142,7 @@ private void gameLoop() boolean nightTime = this.clock.getMinutes() > (Clock.MINUTES_IN_A_DAY)/2; boolean weHaveChangedDay = this.previousDays != this.clock.getDays(); if (weHaveChangedDay) - for (int i = 0; i < 10; i++) // Génère par jour, 3 arbres + for (int i = 0; i < Tree.TREE_CLUSTER; i++) // Génère par jour, 3 arbres GenerateEntity.tree(this); if (dayTime) { // Génère certaines entités uniquement pendant le jour GenerateEntity.rabbit(this); diff --git a/src/main/java/fr/sae/terraria/modele/GenerateEntity.java b/src/main/java/fr/sae/terraria/modele/GenerateEntity.java index ef239ab..0ae4a12 100644 --- a/src/main/java/fr/sae/terraria/modele/GenerateEntity.java +++ b/src/main/java/fr/sae/terraria/modele/GenerateEntity.java @@ -18,7 +18,6 @@ import static fr.sae.terraria.modele.entities.blocks.TallGrass.TALL_GRASS_SPAWN_RATE; import static fr.sae.terraria.modele.entities.blocks.TallGrass.WHEN_SPAWN_A_TALL_GRASS; import static fr.sae.terraria.modele.entities.blocks.Tree.TREE_SPAWN_RATE; -import static fr.sae.terraria.modele.entities.blocks.Tree.WHEN_SPAWN_A_TREE; /** @@ -91,7 +90,7 @@ private static List<Integer> findFloors(TileMaps maps, int y) } /** À un certain moment, grace au tick, il va générer des arbres +/- grand uniquement sur un sol */ - public static void tree(Environment environment) { generateAnEntity(environment, new Tree(environment), WHEN_SPAWN_A_TREE, TREE_SPAWN_RATE); } + public static void tree(Environment environment) { generateAnEntity(environment, new Tree(environment), 1, TREE_SPAWN_RATE); } /** À un certain moment, grace au tick, il va générer des hautes herbes sur un sol */ public static void tallGrass(Environment environment) { generateAnEntity(environment, new TallGrass(environment), WHEN_SPAWN_A_TALL_GRASS, TALL_GRASS_SPAWN_RATE); } diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/Tree.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/Tree.java index a2736ae..f2180f8 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/Tree.java +++ b/src/main/java/fr/sae/terraria/modele/entities/blocks/Tree.java @@ -7,8 +7,8 @@ public class Tree extends Block implements SpawnableObjectType { - public static final int WHEN_SPAWN_A_TREE = 5_000; public static final double TREE_SPAWN_RATE = .2; + public static final double TREE_CLUSTER = 10; private final Environment environment; diff --git a/src/main/java/fr/sae/terraria/modele/entities/entity/Entity.java b/src/main/java/fr/sae/terraria/modele/entities/entity/Entity.java index 1f94889..7de70c4 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/entity/Entity.java +++ b/src/main/java/fr/sae/terraria/modele/entities/entity/Entity.java @@ -61,9 +61,11 @@ protected Entity(int x, int y) */ public abstract void updates(); - public DoubleProperty getPvProperty() { return this.pv; } - public DoubleProperty getXProperty() { return this.x; } - public DoubleProperty getYProperty(){ return this.y; } + public DoubleProperty pvProperty() { return this.pv; } + public DoubleProperty xProperty() { return this.x; } + public DoubleProperty yProperty(){ return this.y; } + + public Animation getAnimation() { return this.animation; } public Rect getRect() { return this.rect; } public double getPvMax() { return this.pv.get(); } diff --git a/src/main/java/fr/sae/terraria/modele/entities/items/Vodka.java b/src/main/java/fr/sae/terraria/modele/entities/items/Vodka.java index 0a3f93f..e0b3de4 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/items/Vodka.java +++ b/src/main/java/fr/sae/terraria/modele/entities/items/Vodka.java @@ -13,6 +13,7 @@ */ public class Vodka extends Item implements EatableObjectType { + public static final int DRUNK_EFFECT_TIME = 600; public static final double DROP_RATE = .1; private final Environment environment; diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java index 10c166e..b1487ce 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java @@ -22,7 +22,6 @@ public class Player extends EntityMovable implements CollideObjectType, CollapsibleObjectType, SpawnableObjectType { public static final int BREAK_BLOCK_DISTANCE = 1; - public static final int DRUNK_EFFECT_TIME = 600; private final EnumMap<KeyCode, Boolean> keysInput; private final EnumMap<MouseButton, Boolean> mouseInput; diff --git a/src/main/java/fr/sae/terraria/vue/Camera.java b/src/main/java/fr/sae/terraria/vue/Camera.java index fb59137..8f832ea 100644 --- a/src/main/java/fr/sae/terraria/vue/Camera.java +++ b/src/main/java/fr/sae/terraria/vue/Camera.java @@ -38,7 +38,7 @@ public Camera(final Environment environment, final StackPane paneHadCamera) this.clip.xProperty().bind( Bindings.createDoubleBinding( () -> clampRange(player.getX() - this.clip.getWidth()/2, minScrollWidthCamera, maxScrollWidthCamera), - player.getXProperty(), paneHadCamera.widthProperty() + player.xProperty(), paneHadCamera.widthProperty() ) ); @@ -46,7 +46,7 @@ public Camera(final Environment environment, final StackPane paneHadCamera) double midHeightCamera = (this.clip.getHeight()/2); double[] centerPlayerOnYIntoCamera = new double[1]; double[] gap = new double[1]; - player.getYProperty().addListener((obs, oldX, newX) -> { + player.yProperty().addListener((obs, oldX, newX) -> { // Suit le joueur centerPlayerOnYIntoCamera[0] = player.getY() - midHeightCamera; if (player.isJumping()) { @@ -67,7 +67,7 @@ public Camera(final Environment environment, final StackPane paneHadCamera) this.clip.yProperty().bind( Bindings.createDoubleBinding( () -> clampRange(centerPlayerOnYIntoCamera[0], minScrollHeightCamera, maxScrollHeightCamera), - player.getYProperty(), paneHadCamera.heightProperty() + player.yProperty(), paneHadCamera.heightProperty() ) ); diff --git a/src/main/java/fr/sae/terraria/vue/DrunkView.java b/src/main/java/fr/sae/terraria/vue/DrunkView.java index 6835dec..fcb9c76 100644 --- a/src/main/java/fr/sae/terraria/vue/DrunkView.java +++ b/src/main/java/fr/sae/terraria/vue/DrunkView.java @@ -1,6 +1,7 @@ package fr.sae.terraria.vue; import fr.sae.terraria.modele.Environment; +import fr.sae.terraria.modele.entities.items.Vodka; import fr.sae.terraria.modele.entities.player.Player; import javafx.animation.Animation; import javafx.animation.KeyFrame; @@ -16,6 +17,7 @@ public class DrunkView { private static final int WIDTH_COS = 50; private static final int HEIGHT_COS = 100; + private FloatMap floatMap; private ObjectProperty<DisplacementMap> displacementMap; private int startTick; @@ -64,7 +66,7 @@ private void updateEffect() { } timer += 0.03; - if (startTick+ Player.DRUNK_EFFECT_TIME <= environment.getTicks()){ + if (startTick+ Vodka.DRUNK_EFFECT_TIME <= environment.getTicks()){ environment.getPlayer().drunkProperty().set(false); } diff --git a/src/main/java/fr/sae/terraria/vue/TileMapsView.java b/src/main/java/fr/sae/terraria/vue/TileMapsView.java index 32e2314..b83e9aa 100644 --- a/src/main/java/fr/sae/terraria/vue/TileMapsView.java +++ b/src/main/java/fr/sae/terraria/vue/TileMapsView.java @@ -134,8 +134,8 @@ else if (((Dirt) block).getTypeOfFloor() == 0) } if (!Objects.isNull(blockView.getImage())) { - blockView.translateXProperty().bind(block.getXProperty()); - blockView.translateYProperty().bind(block.getYProperty()); + blockView.translateXProperty().bind(block.xProperty()); + blockView.translateYProperty().bind(block.yProperty()); this.display.getChildren().add(blockView); this.blocksView.add(blockView); diff --git a/src/main/java/fr/sae/terraria/vue/View.java b/src/main/java/fr/sae/terraria/vue/View.java index 530df87..1d6780c 100644 --- a/src/main/java/fr/sae/terraria/vue/View.java +++ b/src/main/java/fr/sae/terraria/vue/View.java @@ -88,8 +88,8 @@ public static Image loadAnImage(final String path, double scaleMultiplicatorWidt public static ImageView createImageView(final Entity entity, final Image img) { ImageView imageView = new ImageView(img); - imageView.translateXProperty().bind(entity.getXProperty()); - imageView.translateYProperty().bind(entity.getYProperty()); + imageView.translateXProperty().bind(entity.xProperty()); + imageView.translateYProperty().bind(entity.yProperty()); return imageView; } diff --git a/src/main/java/fr/sae/terraria/vue/entities/EntityView.java b/src/main/java/fr/sae/terraria/vue/entities/EntityView.java index 3a1f6c0..61578f5 100644 --- a/src/main/java/fr/sae/terraria/vue/entities/EntityView.java +++ b/src/main/java/fr/sae/terraria/vue/entities/EntityView.java @@ -30,8 +30,8 @@ protected EntityView(final Entity entity) this.entity = entity; this.imgView = new ImageView(); - this.imgView.translateXProperty().bind(entity.getXProperty()); - this.imgView.translateYProperty().bind(entity.getYProperty()); + this.imgView.translateXProperty().bind(entity.xProperty()); + this.imgView.translateYProperty().bind(entity.yProperty()); } /** l'endroit où il va avoir les animations qui vont êtres programmer. */ diff --git a/src/main/java/fr/sae/terraria/vue/hud/HealthBarView.java b/src/main/java/fr/sae/terraria/vue/hud/HealthBarView.java index e50f58d..4d41b99 100644 --- a/src/main/java/fr/sae/terraria/vue/hud/HealthBarView.java +++ b/src/main/java/fr/sae/terraria/vue/hud/HealthBarView.java @@ -44,7 +44,7 @@ private void displayHealthBar(double inventoryBarX, double inventoryBarY) } // Modifie le cœur selon la vie du joueur - player.getPvProperty().addListener((obs, oldPv, newPv) -> { + player.pvProperty().addListener((obs, oldPv, newPv) -> { if (oldPv.intValue() >= 0) { ImageView healthView = healths[oldPv.intValue()-1]; From e839ec7268ffc206201bedd9e63618f1b9be998f Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Sat, 11 Jun 2022 09:21:17 +0200 Subject: [PATCH 21/97] =?UTF-8?q?Arrangement=20nom=20interface=20et=20fonc?= =?UTF-8?q?tion=20li=C3=A9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/sae/terraria/controller/GameController.java | 6 +++--- ...tableObjectType.java => ConsumableObjectType.java} | 11 +++++------ .../sae/terraria/modele/entities/entity/Entity.java | 2 +- .../fr/sae/terraria/modele/entities/items/Meat.java | 6 +++--- .../fr/sae/terraria/modele/entities/items/Vodka.java | 6 +++--- .../sae/terraria/modele/entities/player/Player.java | 2 +- 6 files changed, 16 insertions(+), 17 deletions(-) rename src/main/java/fr/sae/terraria/modele/entities/entity/{EatableObjectType.java => ConsumableObjectType.java} (65%) diff --git a/src/main/java/fr/sae/terraria/controller/GameController.java b/src/main/java/fr/sae/terraria/controller/GameController.java index 2df23ec..9904f48 100644 --- a/src/main/java/fr/sae/terraria/controller/GameController.java +++ b/src/main/java/fr/sae/terraria/controller/GameController.java @@ -3,7 +3,7 @@ import fr.sae.terraria.Terraria; import fr.sae.terraria.modele.Environment; import fr.sae.terraria.modele.TileMaps; -import fr.sae.terraria.modele.entities.entity.EatableObjectType; +import fr.sae.terraria.modele.entities.entity.ConsumableObjectType; import fr.sae.terraria.modele.entities.player.Player; import fr.sae.terraria.modele.entities.player.inventory.Inventory; import fr.sae.terraria.vue.Camera; @@ -117,8 +117,8 @@ private void addKeysEventListener(final Stage stage) int distanceBetweenBlockPlayerAxisY = Math.abs(yPlayer - yBlock); boolean isOneBlockDistance = distanceBetweenBlockPlayerAxisY >= 0 && distanceBetweenBlockPlayerAxisY <= Player.BREAK_BLOCK_DISTANCE && distanceBetweenBlockPlayerAxisX >= 0 && distanceBetweenBlockPlayerAxisX <= Player.BREAK_BLOCK_DISTANCE; - if (this.player.getStackSelected() != null && this.player.getStackSelected().getItem() instanceof EatableObjectType ) { - ((EatableObjectType) this.player.getStackSelected().getItem()).eat(); + if (this.player.getStackSelected() != null && this.player.getStackSelected().getItem() instanceof ConsumableObjectType) { + ((ConsumableObjectType) this.player.getStackSelected().getItem()).consumes(); } else if (isOneBlockDistance) { if (mouse.getButton().equals(MouseButton.PRIMARY)) this.player.interactWithBlock(rectangle); diff --git a/src/main/java/fr/sae/terraria/modele/entities/entity/EatableObjectType.java b/src/main/java/fr/sae/terraria/modele/entities/entity/ConsumableObjectType.java similarity index 65% rename from src/main/java/fr/sae/terraria/modele/entities/entity/EatableObjectType.java rename to src/main/java/fr/sae/terraria/modele/entities/entity/ConsumableObjectType.java index 5293bd8..88c107b 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/entity/EatableObjectType.java +++ b/src/main/java/fr/sae/terraria/modele/entities/entity/ConsumableObjectType.java @@ -2,23 +2,22 @@ /** - * <h1>Eatable Object Type</h1> + * <h1>Consumable Object Type</h1> * <h2>Interface utile sur les objets de type rangeable dans l'inventaire</h2> * <h3><u>Description:</u></h3> - * <p>Permet de discerner les objets qui sont mangeable par une entité ou ceux qui ne le sont pas</p> + * <p>Permet de discerner les objets qui sont consommable par une entité ou ceux qui ne le sont pas</p> * * @see fr.sae.terraria.modele.entities.items.Item + * * @author CHRZASZCZ Naulan */ -public interface EatableObjectType +public interface ConsumableObjectType { /** * Permet d'appliquer des actions lorsque qu'il mange l'aliment qui est dans la main de l'entité. * Permet de faire des actions personnalisées lorsque l'action manger est activé. - * - * @see fr.sae.terraria.modele.entities.items.Meat */ - void eat(); + void consumes(); } diff --git a/src/main/java/fr/sae/terraria/modele/entities/entity/Entity.java b/src/main/java/fr/sae/terraria/modele/entities/entity/Entity.java index 7de70c4..1f3ea79 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/entity/Entity.java +++ b/src/main/java/fr/sae/terraria/modele/entities/entity/Entity.java @@ -15,7 +15,7 @@ * @see BreakableObjectType * @see CollapsibleObjectType * @see PlaceableObjectType - * @see EatableObjectType + * @see ConsumableObjectType * * * @author CHRZASZCZ Naulan diff --git a/src/main/java/fr/sae/terraria/modele/entities/items/Meat.java b/src/main/java/fr/sae/terraria/modele/entities/items/Meat.java index 63b1137..ac87769 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/items/Meat.java +++ b/src/main/java/fr/sae/terraria/modele/entities/items/Meat.java @@ -1,12 +1,12 @@ package fr.sae.terraria.modele.entities.items; import fr.sae.terraria.modele.Environment; -import fr.sae.terraria.modele.entities.entity.EatableObjectType; +import fr.sae.terraria.modele.entities.entity.ConsumableObjectType; import fr.sae.terraria.modele.entities.player.Player; import fr.sae.terraria.modele.entities.player.inventory.Inventory; -public class Meat extends Item implements EatableObjectType +public class Meat extends Item implements ConsumableObjectType { private final Environment environment; @@ -17,7 +17,7 @@ public Meat(final Environment environment) this.environment = environment; } - @Override public void eat() + @Override public void consumes() { Player player = environment.getPlayer(); diff --git a/src/main/java/fr/sae/terraria/modele/entities/items/Vodka.java b/src/main/java/fr/sae/terraria/modele/entities/items/Vodka.java index e0b3de4..10ec453 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/items/Vodka.java +++ b/src/main/java/fr/sae/terraria/modele/entities/items/Vodka.java @@ -1,7 +1,7 @@ package fr.sae.terraria.modele.entities.items; import fr.sae.terraria.modele.Environment; -import fr.sae.terraria.modele.entities.entity.EatableObjectType; +import fr.sae.terraria.modele.entities.entity.ConsumableObjectType; import fr.sae.terraria.modele.entities.player.Player; import fr.sae.terraria.modele.entities.player.inventory.Inventory; @@ -11,7 +11,7 @@ * <h2><u>Description:</u></h2> * <p>Ce drop lorsque le joueur casse des hautes herbes et une fois bu, l'écran sera troublé</p> */ -public class Vodka extends Item implements EatableObjectType +public class Vodka extends Item implements ConsumableObjectType { public static final int DRUNK_EFFECT_TIME = 600; public static final double DROP_RATE = .1; @@ -25,7 +25,7 @@ public Vodka(final Environment environment) this.environment = environment; } - @Override public void eat() + @Override public void consumes() { Player player = environment.getPlayer(); Inventory inventory = player.getInventory(); diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java index b1487ce..5491a0e 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java @@ -130,7 +130,7 @@ public void placeBlock(int xBlock, int yBlock) boolean goodPlace = this.environment.getTileMaps().getTile(xBlock, yBlock) == TileMaps.SKY; if (haveAnItemOnHand && goodPlace) { - if (!(this.getStackSelected().getItem() instanceof PlaceableObjectType) && !(this.getStackSelected() instanceof EatableObjectType)) + if (!(this.getStackSelected().getItem() instanceof PlaceableObjectType) && !(this.getStackSelected() instanceof ConsumableObjectType)) return; if (this.getStackSelected().getItem() instanceof PlaceableObjectType) From 6eef7f628ae2f35ad760d7a2af5a0a0e1c8eaf8b Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Sat, 11 Jun 2022 13:55:43 +0200 Subject: [PATCH 22/97] =?UTF-8?q?Impl=C3=A9mentation=20d'une=20=C3=A9p?= =?UTF-8?q?=C3=A9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../terraria/controller/GameController.java | 4 ++++ .../fr/sae/terraria/modele/Environment.java | 11 ++++++---- .../sae/terraria/modele/GenerateEntity.java | 10 ++++++---- .../sae/terraria/modele/entities/Slime.java | 20 ++++++++++++++++++- .../modele/entities/entity/EntityMovable.java | 1 - .../entities/player/inventory/Stack.java | 4 +++- .../terraria/modele/entities/tools/Axe.java | 10 ++-------- .../modele/entities/tools/Pickaxe.java | 6 +----- .../terraria/modele/entities/tools/Sword.java | 10 +++++----- .../terraria/modele/entities/tools/Tool.java | 13 ++++++++++++ .../java/fr/sae/terraria/vue/DrunkView.java | 1 - .../terraria/vue/hud/ItemSelectedView.java | 4 +++- 12 files changed, 63 insertions(+), 31 deletions(-) diff --git a/src/main/java/fr/sae/terraria/controller/GameController.java b/src/main/java/fr/sae/terraria/controller/GameController.java index 9904f48..2ff2b63 100644 --- a/src/main/java/fr/sae/terraria/controller/GameController.java +++ b/src/main/java/fr/sae/terraria/controller/GameController.java @@ -2,6 +2,7 @@ import fr.sae.terraria.Terraria; import fr.sae.terraria.modele.Environment; +import fr.sae.terraria.modele.GenerateEntity; import fr.sae.terraria.modele.TileMaps; import fr.sae.terraria.modele.entities.entity.ConsumableObjectType; import fr.sae.terraria.modele.entities.player.Player; @@ -85,6 +86,9 @@ private void addKeysEventListener(final Stage stage) this.environment.getGameClock().setMinutes(1_000); if (key.isShiftDown() && key.isControlDown() && key.getCode().equals(KeyCode.J)) this.environment.getGameClock().setMinutes(400); + // Fait apparaitre un slime + if (key.isShiftDown() && key.isControlDown() && key.getCode().equals(KeyCode.P)) + GenerateEntity.slime(this.environment); key.consume(); }); diff --git a/src/main/java/fr/sae/terraria/modele/Environment.java b/src/main/java/fr/sae/terraria/modele/Environment.java index dc7cafa..9706e59 100644 --- a/src/main/java/fr/sae/terraria/modele/Environment.java +++ b/src/main/java/fr/sae/terraria/modele/Environment.java @@ -13,6 +13,8 @@ import fr.sae.terraria.modele.entities.items.Vodka; import fr.sae.terraria.modele.entities.player.Player; import fr.sae.terraria.modele.entities.tools.Pickaxe; +import fr.sae.terraria.modele.entities.tools.Sword; +import fr.sae.terraria.modele.entities.tools.Tool; import javafx.animation.Animation; import javafx.animation.KeyFrame; import javafx.animation.Timeline; @@ -125,6 +127,7 @@ private void gameLoop() this.player.pickup(new Meat(this)); this.player.pickup(new Pickaxe()); this.player.pickup(new Vodka(this)); + this.player.pickup(new Sword(Tool.CRAFTED_WITH_WOOD)); caught[0] = true; } @@ -143,12 +146,12 @@ private void gameLoop() boolean weHaveChangedDay = this.previousDays != this.clock.getDays(); if (weHaveChangedDay) for (int i = 0; i < Tree.TREE_CLUSTER; i++) // Génère par jour, 3 arbres - GenerateEntity.tree(this); + GenerateEntity.treeRandomly(this); if (dayTime) { // Génère certaines entités uniquement pendant le jour - GenerateEntity.rabbit(this); - GenerateEntity.tallGrass(this); + GenerateEntity.rabbitRandomly(this); + GenerateEntity.tallGrassRandomly(this); } else if (nightTime) // Génère certaines entités uniquement pendant le soir - GenerateEntity.slime(this); + GenerateEntity.slimeRandomly(this); // Updates toutes les entités for (Entity entity : this.entities) { diff --git a/src/main/java/fr/sae/terraria/modele/GenerateEntity.java b/src/main/java/fr/sae/terraria/modele/GenerateEntity.java index 0ae4a12..3c61068 100644 --- a/src/main/java/fr/sae/terraria/modele/GenerateEntity.java +++ b/src/main/java/fr/sae/terraria/modele/GenerateEntity.java @@ -90,21 +90,23 @@ private static List<Integer> findFloors(TileMaps maps, int y) } /** À un certain moment, grace au tick, il va générer des arbres +/- grand uniquement sur un sol */ - public static void tree(Environment environment) { generateAnEntity(environment, new Tree(environment), 1, TREE_SPAWN_RATE); } + public static void treeRandomly(Environment environment) { generateAnEntity(environment, new Tree(environment), 1, TREE_SPAWN_RATE); } /** À un certain moment, grace au tick, il va générer des hautes herbes sur un sol */ - public static void tallGrass(Environment environment) { generateAnEntity(environment, new TallGrass(environment), WHEN_SPAWN_A_TALL_GRASS, TALL_GRASS_SPAWN_RATE); } + public static void tallGrassRandomly(Environment environment) { generateAnEntity(environment, new TallGrass(environment), WHEN_SPAWN_A_TALL_GRASS, TALL_GRASS_SPAWN_RATE); } /** À un certain moment, grace au tick et à l'horloge du jeu, il va générer des lapins sur un sol */ - public static void rabbit(Environment environment) + public static void rabbitRandomly(Environment environment) { if (environment.getRabbits().size() < MAX_SPAWN_RABBIT) generateAnEntity(environment, new Rabbit(environment), WHEN_SPAWN_A_RABBIT, RABBIT_SPAWN_RATE); } /** À un certain moment, grace au tick et à l'horloge du jeu, il va générer des lapins sur un sol */ - public static void slime(Environment environment) + public static void slimeRandomly(Environment environment) { if (environment.getSlimes().size() < MAX_SPAWN_SLIME) generateAnEntity(environment, new Slime(environment), WHEN_SPAWN_A_SLIME, SLIME_SPAWN_RATE); } + + public static void slime(Environment environment) { generateAnEntity(environment, new Slime(environment), 1, 1); } } diff --git a/src/main/java/fr/sae/terraria/modele/entities/Slime.java b/src/main/java/fr/sae/terraria/modele/entities/Slime.java index f93846b..d9ac18c 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/Slime.java +++ b/src/main/java/fr/sae/terraria/modele/entities/Slime.java @@ -2,6 +2,8 @@ import fr.sae.terraria.modele.Environment; import fr.sae.terraria.modele.entities.entity.*; +import fr.sae.terraria.modele.entities.player.inventory.Stack; +import fr.sae.terraria.modele.entities.tools.Sword; import java.util.Map; import java.util.Objects; @@ -45,7 +47,7 @@ else if (environment.getPlayer().getX() < this.x.getValue()) } this.move(); - this.collide(); // FIXME: 08/06/2022 : idk pourquoi le collide pose probleme pour le saut du slime + this.collide(); this.worldLimit(); if (!Objects.isNull(this.rect)) @@ -65,12 +67,28 @@ else if (environment.getPlayer().getX() < this.x.getValue()) { if (((int) (this.animation.getFrame()) == 3)) if (this.isNotFalling()) this.jump(); + this.setX(this.getX() + (this.getOffsetMoveX() * this.velocity)); } @Override public void hit() { Environment.playSound("sound/daggerswipe.wav", false); + + if (this.getPv() <= 0) { + // this.environment.getPlayer().pickup(new SlimeBall()); + + this.environment.getSlimes().remove(this); + this.environment.getEntities().remove(this); + } + + Stack stack = this.environment.getPlayer().getStackSelected(); + if (!Objects.isNull(stack)) { + if (stack.getItem() instanceof Sword) { + Sword sword = (Sword) stack.getItem(); + this.setPv(this.getPv() - (Sword.DEFAULT_DAMAGE*sword.getMaterial())); + } + } else this.setPv(this.getPv() - .5); } @Override public void spawn(int x, int y) diff --git a/src/main/java/fr/sae/terraria/modele/entities/entity/EntityMovable.java b/src/main/java/fr/sae/terraria/modele/entities/entity/EntityMovable.java index a555a94..245da0f 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/entity/EntityMovable.java +++ b/src/main/java/fr/sae/terraria/modele/entities/entity/EntityMovable.java @@ -71,7 +71,6 @@ public Map<String, Boolean> collide(final Environment environment) int xLeft = (int) (getX()+CollideObjectType.COLLISION_TOLERANCE)/widthTile; int xRight = (int) ((getX()+getRect().getWidth())-CollideObjectType.COLLISION_TOLERANCE)/widthTile; - // Tombe if (this.isFalling()) { this.gravity.degInit = 0; diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java index b354372..7a312a1 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java @@ -26,7 +26,7 @@ public class Stack public static final int MAX = 16; private StowableObjectType item = null; - private IntegerProperty nbItems; + private final IntegerProperty nbItems; public Stack() @@ -72,6 +72,8 @@ else if (object instanceof Sword && this.item instanceof Sword) return true; else if (object instanceof Arrow && this.item instanceof Arrow) return true; + else if (object instanceof Sword && this.item instanceof Sword) + return true; else return false; } diff --git a/src/main/java/fr/sae/terraria/modele/entities/tools/Axe.java b/src/main/java/fr/sae/terraria/modele/entities/tools/Axe.java index c8fae8f..3e38b7b 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/tools/Axe.java +++ b/src/main/java/fr/sae/terraria/modele/entities/tools/Axe.java @@ -5,13 +5,7 @@ public class Axe extends Tool { - public Axe() - { - super(Tool.DEFAULT_DURABILITY); - } + public Axe() { super(Tool.DEFAULT_DURABILITY); } - @Override public void use() - { - - } + @Override public void use() { Tool.DEFAULT_WEAR(this); } } diff --git a/src/main/java/fr/sae/terraria/modele/entities/tools/Pickaxe.java b/src/main/java/fr/sae/terraria/modele/entities/tools/Pickaxe.java index a79a948..2d8dfe2 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/tools/Pickaxe.java +++ b/src/main/java/fr/sae/terraria/modele/entities/tools/Pickaxe.java @@ -10,9 +10,5 @@ public Pickaxe() super(Tool.DEFAULT_DURABILITY); } - @Override public void use() - { - if (this.durability.get() > 0) - this.durability.set(this.durability.get() - 1); - } + @Override public void use() { Tool.DEFAULT_WEAR(this); } } diff --git a/src/main/java/fr/sae/terraria/modele/entities/tools/Sword.java b/src/main/java/fr/sae/terraria/modele/entities/tools/Sword.java index ba09355..ec37ab8 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/tools/Sword.java +++ b/src/main/java/fr/sae/terraria/modele/entities/tools/Sword.java @@ -3,15 +3,15 @@ public class Sword extends Tool { + public static final int DEFAULT_DAMAGE = 2; - protected Sword() + public Sword(double material) { super(Tool.DEFAULT_DURABILITY); - } - - @Override public void use() - { + this.material = material; } + + @Override public void use() { Tool.DEFAULT_WEAR(this); } } diff --git a/src/main/java/fr/sae/terraria/modele/entities/tools/Tool.java b/src/main/java/fr/sae/terraria/modele/entities/tools/Tool.java index 67dcddd..996945b 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/tools/Tool.java +++ b/src/main/java/fr/sae/terraria/modele/entities/tools/Tool.java @@ -7,10 +7,14 @@ public abstract class Tool implements StowableObjectType { + public static final double CRAFTED_WITH_WOOD = 1.; + public static final double CRAFTED_WITH_IRON = 1.5; + public static final int DEFAULT_DURABILITY = 100; protected final IntegerProperty durability; + protected double material; protected Tool(final int durability) @@ -21,4 +25,13 @@ protected Tool(final int durability) /** Use l'outil */ public abstract void use(); + + public static void DEFAULT_WEAR(final Tool tool) + { + if (tool.durability.get() > 0) + tool.durability.set(tool.durability.get() - 1); + } + + + public double getMaterial() { return this.material; } } diff --git a/src/main/java/fr/sae/terraria/vue/DrunkView.java b/src/main/java/fr/sae/terraria/vue/DrunkView.java index fcb9c76..fe16df4 100644 --- a/src/main/java/fr/sae/terraria/vue/DrunkView.java +++ b/src/main/java/fr/sae/terraria/vue/DrunkView.java @@ -2,7 +2,6 @@ import fr.sae.terraria.modele.Environment; import fr.sae.terraria.modele.entities.items.Vodka; -import fr.sae.terraria.modele.entities.player.Player; import javafx.animation.Animation; import javafx.animation.KeyFrame; import javafx.animation.Timeline; diff --git a/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java b/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java index 2d9234f..ef689a3 100644 --- a/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java +++ b/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java @@ -40,6 +40,7 @@ public class ItemSelectedView private final Image torchItemImg; private final Image pickaxeItemImg; private final Image vodkaItemImg; + private final Image swordItemImg; private final Pane display; @@ -66,6 +67,7 @@ public ItemSelectedView(Pane display, Player player, double scaleMultiplicatorWi this.meatItemImg = View.loadAnImage("loots/meat.png", widthItem, heightItem); this.woodItemImg = View.loadAnImage("loots/wood.png", widthItem, heightItem); this.pickaxeItemImg = View.loadAnImage("tools/pickaxe.png", widthItem, heightItem); + this.swordItemImg = View.loadAnImage("tools/sword.png", widthItem, heightItem); // Reset player.getInventory().get().addListener((ListChangeListener<? super Stack>) c -> { @@ -111,7 +113,7 @@ else if (item instanceof Bow) else if (item instanceof Pickaxe) this.itemSelectedImgView.setImage(this.pickaxeItemImg); else if (item instanceof Sword) - this.itemSelectedImgView.setImage(null); + this.itemSelectedImgView.setImage(this.swordItemImg); else if (item instanceof Arrow) this.itemSelectedImgView.setImage(null); } From b9cdf1735006bdde7a72eae736586f77ce88cac4 Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Sun, 12 Jun 2022 10:03:29 +0200 Subject: [PATCH 23/97] Add JUnit libs on Gradle --- build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/build.gradle b/build.gradle index 564b133..f6e9452 100644 --- a/build.gradle +++ b/build.gradle @@ -34,6 +34,7 @@ javafx { } dependencies { + implementation 'junit:junit:4.13.1' testImplementation("org.junit.jupiter:junit-jupiter-api:${junitVersion}") testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${junitVersion}") From 89470b410e89fbe1309a3bd4c9674e4aca1adaf4 Mon Sep 17 00:00:00 2001 From: Tiago Lousa <tig2468.a@gmail.com> Date: Sat, 11 Jun 2022 09:48:16 +0200 Subject: [PATCH 24/97] correction orthographe jusqu'au package entity --- src/main/java/fr/sae/terraria/Terraria.java | 2 +- .../terraria/controller/GameController.java | 2 +- .../terraria/modele/entities/blocks/Block.java | 2 +- .../terraria/modele/entities/blocks/Stone.java | 4 ++-- .../modele/entities/blocks/TallGrass.java | 6 +++--- .../modele/entities/entity/Animation.java | 4 ++-- .../entities/entity/BreakableObjectType.java | 4 ++-- .../entities/entity/CollapsibleObjectType.java | 8 ++++---- .../entities/entity/CollideObjectType.java | 8 ++++---- .../modele/entities/entity/Entity.java | 2 +- .../modele/entities/entity/EntityMovable.java | 18 +++++++++--------- .../modele/entities/entity/Gravity.java | 2 +- .../entities/entity/PlaceableObjectType.java | 6 +++--- .../entity/ReproductiveObjectType.java | 2 +- 14 files changed, 35 insertions(+), 35 deletions(-) diff --git a/src/main/java/fr/sae/terraria/Terraria.java b/src/main/java/fr/sae/terraria/Terraria.java index c6e2d52..2547bdf 100644 --- a/src/main/java/fr/sae/terraria/Terraria.java +++ b/src/main/java/fr/sae/terraria/Terraria.java @@ -21,7 +21,7 @@ public class Terraria extends Application { - // Constants + // Constantes public static final String SRC_PATH = "src/main/resources/fr/sae/terraria/"; public static final double TARGET_FPS = .017; public static final int DISPLAY_RENDERING_WIDTH = 465; diff --git a/src/main/java/fr/sae/terraria/controller/GameController.java b/src/main/java/fr/sae/terraria/controller/GameController.java index 2ff2b63..db53065 100644 --- a/src/main/java/fr/sae/terraria/controller/GameController.java +++ b/src/main/java/fr/sae/terraria/controller/GameController.java @@ -109,7 +109,7 @@ private void addKeysEventListener(final Stage stage) // La position correcte sur le Pane double mouseX = mouse.getSceneX()+((Rectangle) this.displayTiledMap.getParent().getClip()).getX(); double mouseY = (mouse.getSceneY()-this.title.getPrefHeight())+((Rectangle) this.displayTiledMap.getParent().getClip()).getY(); - // Le bloc où la souris à clicker + // Le bloc où la souris à clickée int xBlock = (int) (mouseX/tileWidth); int yBlock = (int) (mouseY/tileHeight); Rectangle2D rectangle = new Rectangle2D(mouseX, mouseY, scaleMultiplicativeWidth, scaleMultiplicativeHeight); diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java index 90b82ba..74c9251 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java +++ b/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java @@ -32,7 +32,7 @@ protected void breakAnimation(final Environment environment, final Block block, time[0]++; })); timeline.getKeyFrames().add(keyFrame); - // Faire revenir le bloc à sa position initiale lorsque l'animation est arrêté + // Faire revenir le bloc à sa position initiale lorsque l'animation est terminée timeline.statusProperty().addListener(c -> { block.setX(xOrigin); block.setY(yOrigin); diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/Stone.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/Stone.java index 88cabcd..a991360 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/Stone.java +++ b/src/main/java/fr/sae/terraria/modele/entities/blocks/Stone.java @@ -45,7 +45,7 @@ public Stone(Environment environment, int x, int y) Environment.playSound("sound/brick" + ((int) (Math.random()*2)+1) + ".wav", false); this.breakAnimation(this.environment, this, this.xOrigin, this.yOrigin); - // Une fois le bloc détruit, il donne la pierre et le supprime de la TileMaps + // Une fois le bloc cassé, de la pierre est ramassée et le bloc se supprime du Pane Player player = this.environment.getPlayer(); if (this.getPv() <= 0) { player.pickup(this); @@ -57,7 +57,7 @@ public Stone(Environment environment, int x, int y) this.environment.getBlocks().remove(this); } - // S'il utilise le bon outil, il commencera à casser le bloc sinon use l'outil sans casser le bloc. + // Peu importe l'outil qu'utilise le joueur, si c'est un outil, il perdra de la durabilité, mais le bloc ne peut que se casser avec une pioche Stack stack = player.getStackSelected(); if (!Objects.isNull(stack)) { if (stack.getItem() instanceof Pickaxe) diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/TallGrass.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/TallGrass.java index 68514c4..034f1e3 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/TallGrass.java +++ b/src/main/java/fr/sae/terraria/modele/entities/blocks/TallGrass.java @@ -45,7 +45,7 @@ public TallGrass(Environment environment, int x, int y) tallGrassGrowth.set(tallGrassGrowth.get() + TallGrass.GROWTH_SPEED); } - /** Joue un son et donne au joueur entre 1 et 3 de fibre */ + /** Joue un son et donne au joueur entre 1 et 3 fibres */ @Override public void breaks() { Environment.playSound("sound/cut.wav", false); @@ -61,7 +61,7 @@ public TallGrass(Environment environment, int x, int y) this.environment.getBlocks().remove(this); } - /** Reproduit les hautes herbes à gauche et à droite de la haute herbe parente */ + /** Reproduit des hautes herbes à gauche et à droite de celle parente */ @Override public List<Entity> reproduction(Environment environment) { List<Entity> children = new ArrayList<>(); @@ -77,7 +77,7 @@ public TallGrass(Environment environment, int x, int y) int x = -1; int y = (int) (getY()/heightTile)+1; - // Check si personne à côté + // Check si aucune entité ne se trouve à coté int left = 0; int right = 0; for (Entity entity : entities) { boolean haveAnEntityOnLeft = entity.getX() == (getX() - widthTile) && entity.getY() == getY(); diff --git a/src/main/java/fr/sae/terraria/modele/entities/entity/Animation.java b/src/main/java/fr/sae/terraria/modele/entities/entity/Animation.java index e1fc54b..3b31bad 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/entity/Animation.java +++ b/src/main/java/fr/sae/terraria/modele/entities/entity/Animation.java @@ -8,7 +8,7 @@ /** * <h1>Animation</h1> * <h2><u>Description:</u></h2> - * <p>Gére uniquement la valeurs du frame pour que la vue sachent sur quel frame doit afficher l'image.</p> + * <p>Gère uniquement la valeur du frame pour que la vue sache sur quel frame elle doit se placer</p> * @see PlayerView */ public class Animation @@ -42,6 +42,6 @@ public void loop() public double getFrame() { return this.frame.get(); } public DoubleProperty getFrameProperty() { return this.frame; } - /** Spécifie quand l'animation sur le Sprite Sheet doit s'arrêter */ + /** Spécifie à quelle frame l'animation sur le Sprite Sheet doit s'arrêter */ public void setEndFrame(int newEndFrame) { this.endFrame = newEndFrame; } } diff --git a/src/main/java/fr/sae/terraria/modele/entities/entity/BreakableObjectType.java b/src/main/java/fr/sae/terraria/modele/entities/entity/BreakableObjectType.java index c986cc2..07b891a 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/entity/BreakableObjectType.java +++ b/src/main/java/fr/sae/terraria/modele/entities/entity/BreakableObjectType.java @@ -5,7 +5,7 @@ * <h1>Breakable Object Type</h1> * <h2>Interface utile à un objet qui hérite d'Entity</h2> * <h3><u>Description:</u></h3> - * <p>Determine un objet qui est cassable</p> + * <p>Détermine un objet cassable</p> * * @see Entity * @author CHRZASCZCZ Naulan @@ -15,7 +15,7 @@ public interface BreakableObjectType /** - * Fonction appelée lorsqu'une entité tante de casser une autre entité + * Fonction appelée lorsqu'une entité tente de casser une autre entité * Permet de faire des actions personnalisées. * * @see fr.sae.terraria.modele.entities.blocks.Dirt diff --git a/src/main/java/fr/sae/terraria/modele/entities/entity/CollapsibleObjectType.java b/src/main/java/fr/sae/terraria/modele/entities/entity/CollapsibleObjectType.java index 9d57e40..b9b299f 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/entity/CollapsibleObjectType.java +++ b/src/main/java/fr/sae/terraria/modele/entities/entity/CollapsibleObjectType.java @@ -5,8 +5,8 @@ * <h1>Collapsible Object Type</h1> * <h2>Interface utile à un objet qui hérite d'Entity</h2> * <h3><u>Description:</u></h3> - * <p>Determine les objets qui sont touchable par une autre entité</p> - * <p>Il détermine surtout les objets qui sont touchable avec des flèches ou des outils qui inflige des dégâts, qui peuvent en général avoir des dégâts à cause de ses éléments</p> + * <p>Détermine les objets qui sont touchable par d'autres entités</p> + * <p>Il détermine surtout les objets qui sont touchable avec des flèches ou des outils qui infligent des dégâts, qui peuvent en général avoir des dégâts à cause de ces éléments</p> * * @see Entity * @author CHRZASZCZ Naulan @@ -16,8 +16,8 @@ public interface CollapsibleObjectType /** - * Fonction qui est appelée lorsqu'une entité touche un autre par n'importe quel manière en excluent les collisions entre collision - * Permet de faire des actions personnalisées par entité lorsque une entitée touche un autre + * Fonction qui est appelée lorsqu'une entité est touchée par une autre entité par n'importe quel moyen en excluant les collisions entre collision + * Permet de faire des actions personnalisées par entité lorsque une entité en touche une autre * * @see fr.sae.terraria.modele.entities.Rabbit */ diff --git a/src/main/java/fr/sae/terraria/modele/entities/entity/CollideObjectType.java b/src/main/java/fr/sae/terraria/modele/entities/entity/CollideObjectType.java index 89efdb9..66a8d12 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/entity/CollideObjectType.java +++ b/src/main/java/fr/sae/terraria/modele/entities/entity/CollideObjectType.java @@ -5,8 +5,8 @@ * <h1>CollideObjectType</h1> * <h2>Interface utile à un objet qui hérite d'Entity</h2> * <h3><u>Description:</u></h3> - * <p>Permet de discerner les entités qui ne sont pas des objects qui doit rentré en collisions avec d'autre entité</p> - * <p>Cela peut êtres utile sur les elements qui doit êtres au premier plan et d'autre element qui doit êtres à l'arrière plan</p> + * <p>Permet de discerner les entités qui ne sont pas des objects et qui ont des collisions avec d'autres entités</p> + * <p>Cela peut être utile sur les elements qui doivent êtres au premier plan et d'autre element qui doit êtres à l'arrière plan</p> * * @see Entity * @author CHRZASZCZ Naulan @@ -18,8 +18,8 @@ public interface CollideObjectType /** * Permet d'appliquer des collisions à l'entité qui l'utilise sur son environment. - * Pour pouvoir être fonctionnel, il doit faire appelle à "super.collide()" est de la rangé dans une variable - * de type Map pour permettre d'avoir des données relatif sur où il entre en collision + * Pour pouvoir être fonctionnelle, elle doit faire appel à "super.collide()" et de ranger son return dans une variable + * de type Map pour permettre d'avoir des données relatives sur les endroit ou l'entité entre en collision avec une autre * * @see Entity */ diff --git a/src/main/java/fr/sae/terraria/modele/entities/entity/Entity.java b/src/main/java/fr/sae/terraria/modele/entities/entity/Entity.java index 1f3ea79..77633cf 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/entity/Entity.java +++ b/src/main/java/fr/sae/terraria/modele/entities/entity/Entity.java @@ -57,7 +57,7 @@ protected Entity(int x, int y) /** * Il permet à chaque passage de la boucle du jeu, de faire diverses fonctions liée à l'Entité. - * Certaine fonction qui sera implementé grâce à des interfaces sera probablement obligatoirement mise dans cette fonction. + * Certaine fonction qui seront implementés grâce à des interfaces seront obligatoirement mise dans cette fonction. */ public abstract void updates(); diff --git a/src/main/java/fr/sae/terraria/modele/entities/entity/EntityMovable.java b/src/main/java/fr/sae/terraria/modele/entities/entity/EntityMovable.java index 245da0f..9936d74 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/entity/EntityMovable.java +++ b/src/main/java/fr/sae/terraria/modele/entities/entity/EntityMovable.java @@ -35,12 +35,12 @@ protected EntityMovable(final Environment environment, int x, int y) public abstract void move(); /** - * Permet de detectés les collisions sur la carte et de son environment. + * Permet de detectéer les collisions avec son environnement. * * @param environment Permet de savoir les tailles des tiles et d'avoir la matrixe de données de la carte. - * @return Il vas retourner une HashMap qui ne contiendra pas de clé ou 4 clés maximum - * left, right, top, bottom sera les clés qui peuvent être present lors d'une detection de collision. - * Il permettra de faire des actions personnalisées les actions faites par l'entité suivant d'où il rentre en collision avec son environment. + * @return Elle va retourner une HashMap qui ne contiendra pas de clé ou 4 clés maximum + * left, right, top, bottom seront les clés qui peuvent être presentes lors d'une detection de collision. + * Elle permettra de faire des actions personnalisées selon l'endroit où l'entité rentre en collision. */ public Map<String, Boolean> collide(final Environment environment) { @@ -66,7 +66,7 @@ public Map<String, Boolean> collide(final Environment environment) whereCollide.put("left", tileMaps.getTile(futurePositionXLeft, yTop) != TileMaps.SKY || tileMaps.getTile(futurePositionXLeft, yBottom) != TileMaps.SKY); } - // Detection collision en bas et en haut + // Detection collision bas et haut if (this.offset[1] != Entity.IDLE) { int xLeft = (int) (getX()+CollideObjectType.COLLISION_TOLERANCE)/widthTile; int xRight = (int) ((getX()+getRect().getWidth())-CollideObjectType.COLLISION_TOLERANCE)/widthTile; @@ -93,7 +93,7 @@ public Map<String, Boolean> collide(final Environment environment) this.gravity.timer = 0; this.gravity.setJumpPosInit(this); } else this.setY(futurePositionY); - // Quand le joueur decent + // Quand le joueur descends } else { boolean isCollideBottom = tileMaps.getTile(xLeft, (int) ((futurePositionY + this.rect.getHeight()) - CollideObjectType.COLLISION_TOLERANCE)/heightTile) != TileMaps.SKY || tileMaps.getTile(xRight,(int) ((futurePositionY + this.rect.getHeight()) - CollideObjectType.COLLISION_TOLERANCE)/heightTile) != TileMaps.SKY; @@ -143,10 +143,10 @@ public Map<String, Boolean> collide(final Environment environment) public boolean isIDLEonY() { return this.offset[1] == Entity.IDLE; } /** - * Lorsque le joueur sort de l'ecran et/ou de la carte, la fonction retourne une valeurs boolean qui sera manipulable sur les classes qui l'héritera. - * @param environment Permet d'avoir les informations naicessaire sur la carte et l'écran pour que l'entité ne sorte pas. + * Lorsque le joueur sort de l'ecran et/ou de la carte, la fonction retourne une valeur boolean qui sera manipulable sur les classes qui heriteront EntityMovable. + * @param environment Permet d'avoir les informations nécessaires sur la carte et l'écran pour que l'entité ne sorte pas. * - * @return false = ne sort pas | true = sort de l'écran soit vers la droite ou soit vers le bas + * @return false = ne sort pas | true = sort de l'écran soit vers la droite ou la gauche */ public boolean worldLimit(final Environment environment) { diff --git a/src/main/java/fr/sae/terraria/modele/entities/entity/Gravity.java b/src/main/java/fr/sae/terraria/modele/entities/entity/Gravity.java index d97b70d..5009fb8 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/entity/Gravity.java +++ b/src/main/java/fr/sae/terraria/modele/entities/entity/Gravity.java @@ -36,7 +36,7 @@ private double calcFlightTime() return ((this.vInit * this.amplitude) * Math.sin(this.degInit)) / Gravity.VALUE; } - /** Modifie le xInit et le yInit pour modifier le point de départ du saut ou de là où il tombe */ + /** Modifie le xInit et le yInit pour modifier le point de départ du saut ou de l'endroit où il tombe */ protected void setJumpPosInit(final Entity entity) { this.xInit = entity.getX(); this.yInit = entity.getY(); } diff --git a/src/main/java/fr/sae/terraria/modele/entities/entity/PlaceableObjectType.java b/src/main/java/fr/sae/terraria/modele/entities/entity/PlaceableObjectType.java index c3a99df..3c2669b 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/entity/PlaceableObjectType.java +++ b/src/main/java/fr/sae/terraria/modele/entities/entity/PlaceableObjectType.java @@ -3,9 +3,9 @@ /** * <h1>Placeable Object Type</h1> - * <h2>Interface utile sur les objets qui hérite de block</h2> + * <h2>Interface utile sur les objets qui héritent de block</h2> * <h3><u>Description:</u></h3> - * <p>Permet de savoir si un block sera possable sur un sol ou non</p> + * <p>Permet de savoir si un block sera posable sur un sol ou non</p> * * @see fr.sae.terraria.modele.entities.blocks.Stone * @author CHRZASZCZ Naulan @@ -15,7 +15,7 @@ public interface PlaceableObjectType /** - * Permet d'appliquer des actions lorsque qu'il tante de poser un block + * Permet d'appliquer des actions lorsque qu'il tente de poser un block * * @param x Les coordonnées du block en x lorsqu'il va êtres poser au sol * @param y Les coordonnées du block en y lorsqu'il va êtres poser au sol diff --git a/src/main/java/fr/sae/terraria/modele/entities/entity/ReproductiveObjectType.java b/src/main/java/fr/sae/terraria/modele/entities/entity/ReproductiveObjectType.java index 66818ec..329b155 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/entity/ReproductiveObjectType.java +++ b/src/main/java/fr/sae/terraria/modele/entities/entity/ReproductiveObjectType.java @@ -9,7 +9,7 @@ * <h1>Reproduction Object Type</h1> * <h2>Interface utile à un objet qui hérite d'Entity</h2> * <h3><u>Description:</u></h3> - * <p>Il permet de savoir si l'entité qui implementer cette interface est une entité qui peut se reproduire entre eux.</p> + * <p>Il permet de savoir si l'entité qui implémente cette interface est une entité qui peut se reproduire ou non</p> * * @see fr.sae.terraria.modele.entities.Rabbit * @see fr.sae.terraria.modele.entities.blocks.TallGrass From 07dd7d7d80eadcd1d0c2de12c0800f3e5a6055ff Mon Sep 17 00:00:00 2001 From: Tiago Lousa <tig2468.a@gmail.com> Date: Sun, 12 Jun 2022 12:27:59 +0200 Subject: [PATCH 25/97] fin correction orthographe --- src/main/java/fr/sae/terraria/Terraria.java | 2 +- .../java/fr/sae/terraria/modele/Environment.java | 10 +++++----- .../java/fr/sae/terraria/modele/GenerateEntity.java | 8 ++++---- .../fr/sae/terraria/modele/entities/items/Vodka.java | 2 +- .../sae/terraria/modele/entities/player/Player.java | 2 +- .../modele/entities/player/inventory/Inventory.java | 2 +- .../modele/entities/player/inventory/Stack.java | 2 +- .../fr/sae/terraria/modele/entities/tools/Tool.java | 2 +- src/main/java/fr/sae/terraria/vue/TileMapsView.java | 12 ++++++------ src/main/java/fr/sae/terraria/vue/View.java | 4 ++-- src/main/java/fr/sae/terraria/vue/hud/ClockView.java | 2 +- .../fr/sae/terraria/vue/hud/MouseCursorView.java | 2 +- 12 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/main/java/fr/sae/terraria/Terraria.java b/src/main/java/fr/sae/terraria/Terraria.java index 2547bdf..c0599a9 100644 --- a/src/main/java/fr/sae/terraria/Terraria.java +++ b/src/main/java/fr/sae/terraria/Terraria.java @@ -77,7 +77,7 @@ public void start(Stage stage) throws IOException stage.addEventFilter(KeyEvent.KEY_RELEASED, key -> timePressedKey[0] = 1); stage.sizeToScene(); - // Sync les changements du joueur entre les contrôleurs. + // Synchronise les changements du joueur entre les contrôleurs. stage.sceneProperty().addListener(((obs, oldScene, newScene) -> { if (switchScene.get()) { if (!Objects.isNull(menuController.player)) { diff --git a/src/main/java/fr/sae/terraria/modele/Environment.java b/src/main/java/fr/sae/terraria/modele/Environment.java index 9706e59..e3b33f3 100644 --- a/src/main/java/fr/sae/terraria/modele/Environment.java +++ b/src/main/java/fr/sae/terraria/modele/Environment.java @@ -36,12 +36,12 @@ public class Environment { private final ObservableList<Tree> trees; private final ObservableList<Block> blocks; - // Permet update toutes les entités en une seule boucle. + // Permet d'update toutes les entités avec une seule boucle. private final ObservableList<Entity> entities; - // Range des entities en plus pour permettre facilement de savoir combien son t-il sur la carte pour limiter leur apparition + // Range des entitiés en plus pour avoir le nombre d'entités sur la carte et limiter leurs apparitions private final ObservableList<Rabbit> rabbits; private final ObservableList<Slime> slimes; - // Permet update facilement les lumières des torches sur le filtre + // Permet d'update facilement les lumières des torches sur le filtre private final ObservableList<Torch> torches; private final TileMaps tileMaps; @@ -87,7 +87,7 @@ public Environment(double scaleMultiplicatorWidth, double scaleMultiplicatorHeig this.player.setPv(4); this.player.spawn(5*widthTile, 3*heightTile); - // Détecte si le joueur n'est pas dans un bloc lorsque qu'il met un block au sol + // Détecte si le joueur n'est pas dans un bloc lorsqu'il met un block au sol this.entities.addListener((ListChangeListener<? super Entity>) c -> { while (c.next()) if (c.wasAdded()) { Entity entity = c.getList().get(0); @@ -150,7 +150,7 @@ private void gameLoop() if (dayTime) { // Génère certaines entités uniquement pendant le jour GenerateEntity.rabbitRandomly(this); GenerateEntity.tallGrassRandomly(this); - } else if (nightTime) // Génère certaines entités uniquement pendant le soir + } else if (nightTime) // Génère certaines entités uniquement pendant le soir et la nuit GenerateEntity.slimeRandomly(this); // Updates toutes les entités diff --git a/src/main/java/fr/sae/terraria/modele/GenerateEntity.java b/src/main/java/fr/sae/terraria/modele/GenerateEntity.java index 3c61068..84b67bb 100644 --- a/src/main/java/fr/sae/terraria/modele/GenerateEntity.java +++ b/src/main/java/fr/sae/terraria/modele/GenerateEntity.java @@ -22,7 +22,7 @@ /** * <h1>Generate Entity</h1> - * <h2>Une classe qui permet de génère aléatoirement des entités</h2> + * <h2>Une classe qui permet de générer aléatoirement des entités</h2> */ public class GenerateEntity { @@ -34,11 +34,11 @@ public class GenerateEntity public GenerateEntity() { super(); } /** - * Génère une entité selon de quand il spawn et du pourcent de change qu'il spawn réellement. + * Génère une entité selon le momnt ou il est sensé apparaitre et son pourcentage de chances d'apparaitre. * * @param e L'entité concernée * @param whenSpawn Le nombre qui determine quand il doit spawn sur la carte - * @param spawnRate Le pourcentage de chance qu'il spawn réellement à l'endroit qu'on souhaite le placer + * @param spawnRate Le pourcentage de chance qu'il spawn réellement à l'endroit où l'on souhaite le placer */ private static void generateAnEntity(Environment environment, SpawnableObjectType e, int whenSpawn, double spawnRate) { @@ -101,7 +101,7 @@ public static void rabbitRandomly(Environment environment) generateAnEntity(environment, new Rabbit(environment), WHEN_SPAWN_A_RABBIT, RABBIT_SPAWN_RATE); } - /** À un certain moment, grace au tick et à l'horloge du jeu, il va générer des lapins sur un sol */ + /** À un certain moment, grace au tick et à l'horloge du jeu, il va générer des slimes sur un sol */ public static void slimeRandomly(Environment environment) { if (environment.getSlimes().size() < MAX_SPAWN_SLIME) diff --git a/src/main/java/fr/sae/terraria/modele/entities/items/Vodka.java b/src/main/java/fr/sae/terraria/modele/entities/items/Vodka.java index 10ec453..3e83262 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/items/Vodka.java +++ b/src/main/java/fr/sae/terraria/modele/entities/items/Vodka.java @@ -9,7 +9,7 @@ /** * <h1>EasterEgg</h1> * <h2><u>Description:</u></h2> - * <p>Ce drop lorsque le joueur casse des hautes herbes et une fois bu, l'écran sera troublé</p> + * <p>Se drop lorsque le joueur casse des hautes herbes et une fois bu, l'écran sera troublé</p> */ public class Vodka extends Item implements ConsumableObjectType { diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java index 5491a0e..05a0374 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java @@ -138,7 +138,7 @@ public void placeBlock(int xBlock, int yBlock) } } - /** Lie les inputs au clavier à une ou des actions. */ + /** Lie les inputs du clavier à une ou des actions. */ public void eventInput() { this.inventory.eventInput(); diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java index ac39b04..49886e1 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java @@ -36,7 +36,7 @@ public Inventory(final Player player) this.posCursor = new SimpleIntegerProperty(0); - // Change l'item de la main du joueur + // Change l'item qui se trouve dans la main du joueur this.posCursorProperty().addListener((obs, oldV, newV) -> { boolean isntOutOfInventoryBar = newV.intValue() >= 0 && newV.intValue() < nbElementOnOneLineOfInventory; diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java index 7a312a1..4dac440 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java @@ -19,7 +19,7 @@ * <h1>Stack</h1> * <h2>Objet de données lié à l'objet <code>Inventaire</code>.</h2> * <h3><u>Description:</u></h3> - * Cette dataclass est la pour avoir l'information sur combien il y a t-il d'objet du même type sur une case de l'inventaire + * Cette dataclass est présente pour savoir combien d'objets du même type se trouvent sur une case d'inventaire */ public class Stack { diff --git a/src/main/java/fr/sae/terraria/modele/entities/tools/Tool.java b/src/main/java/fr/sae/terraria/modele/entities/tools/Tool.java index 996945b..fecc8a1 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/tools/Tool.java +++ b/src/main/java/fr/sae/terraria/modele/entities/tools/Tool.java @@ -23,7 +23,7 @@ protected Tool(final int durability) this.durability = new SimpleIntegerProperty(durability); } - /** Use l'outil */ + /** Utilise l'outil */ public abstract void use(); public static void DEFAULT_WEAR(final Tool tool) diff --git a/src/main/java/fr/sae/terraria/vue/TileMapsView.java b/src/main/java/fr/sae/terraria/vue/TileMapsView.java index b83e9aa..b8f94ba 100644 --- a/src/main/java/fr/sae/terraria/vue/TileMapsView.java +++ b/src/main/java/fr/sae/terraria/vue/TileMapsView.java @@ -57,7 +57,7 @@ public class TileMapsView /** * @param environment Avoir des infos relatives à son environment * @param displayTileMap Affiche la carte tuilée - * @param displayHostileBeings Affiche les êtres hostile (Animal, Joueur, ...) + * @param displayHostileBeings Affiche les entités mouvantes (Animal, Joueur, ...) */ public TileMapsView(Environment environment, Pane displayTileMap, @@ -88,11 +88,11 @@ public TileMapsView(Environment environment, this.treeImg = View.loadAnImage("sprites/tree-sheet.png", scaleMultiplicatorWidth, scaleMultiplicatorHeight); this.tallGrassImg = View.loadAnImage("tiles/tall-grass.png",tileWidth,tileHeight); - // Ajoute et supprime les elements de l'écran qui concerne les blocks + // Ajoute et supprime les elements de l'écran qui concernent les blocks this.environment.getBlocks().addListener((ListChangeListener<? super Block>) this::updatesBlocksView); - // Ajoute et supprime les elements de l'écran qui concerne les lapins + // Ajoute et supprime les elements de l'écran qui concernent les lapins this.environment.getRabbits().addListener((ListChangeListener<? super Rabbit>) this::updatesRabbitView); - // Ajoute et supprime les elements de l'écran qui concerne les slimes + // Ajoute et supprime les elements de l'écran qui concernent les slimes this.environment.getSlimes().addListener((ListChangeListener<? super Slime>) this::updatesSlimeView); // Ajoute et supprime un groupe d'élèments de l'écran qui concerne les arbres this.environment.getTrees().addListener((ListChangeListener<? super Tree>) this::updatesTreeView); @@ -277,10 +277,10 @@ private void updatesTreeView(ListChangeListener.Change<? extends Tree> c) } - /** Affiche une erreur au cas où si un developer a fait une erreur lors de la saisie d'un tile sur le fichier .json */ + /** Affiche une erreur si un developer a fait une erreur lors de la saisie d'un tile dans le fichier .json */ private void errorTile(final int tile) { if (tile != TileMaps.SKY) System.out.println("Le tile '" + tile + "' n'est pas reconnu."); } - /** Decompose la carte pour afficher un à un les tiles à l'écran */ + /** Decompose la carte pour afficher une à une les tiles à l'écran */ public void displayMaps(TileMaps tiles) { for (int y = 0; y < tiles.getHeight() ; y++) diff --git a/src/main/java/fr/sae/terraria/vue/View.java b/src/main/java/fr/sae/terraria/vue/View.java index 1d6780c..640fe79 100644 --- a/src/main/java/fr/sae/terraria/vue/View.java +++ b/src/main/java/fr/sae/terraria/vue/View.java @@ -24,7 +24,7 @@ public class View /** * Cette classe lors de l'initialisation, crée et génére toutes les views du jeux - * Contient des fonctions essentiels au chargement des images et des creations de vue + * Contient des fonctions essentielles au chargement des images et des creations de vue */ public View(final GameController gameController) { @@ -55,7 +55,7 @@ public View(final GameController gameController) new MouseCursorView(displayHUD, displayCursorMouse, scaleMultiplicatorWidth, scaleMultiplicatorHeight); } - /** Essaye de trouver et de charger l'image sinon renvoie null */ + /** Essaye de trouver et de charger l'image, si elle n'est pas trouvée, retourne null */ private static Image foundImage(final String path) { Image img = null; diff --git a/src/main/java/fr/sae/terraria/vue/hud/ClockView.java b/src/main/java/fr/sae/terraria/vue/hud/ClockView.java index e1ccbce..ca74105 100644 --- a/src/main/java/fr/sae/terraria/vue/hud/ClockView.java +++ b/src/main/java/fr/sae/terraria/vue/hud/ClockView.java @@ -29,7 +29,7 @@ public ClockView(Clock gameTime, Pane display, double scaleMultiplicatorWidth, d this.clockCursorImg = View.loadAnImage("clock-cursor.png",scaleMultiplicatorWidth,scaleMultiplicatorHeight); } - /** Affiche une horloge à aiguille visuelle à l'écran. */ + /** Affiche une horloge à aiguille à l'écran. */ private void displayClock(Image inventoryBarImg, double inventoryBarX, double inventoryBarY) { ImageView clockCursorView = new ImageView(clockCursorImg); diff --git a/src/main/java/fr/sae/terraria/vue/hud/MouseCursorView.java b/src/main/java/fr/sae/terraria/vue/hud/MouseCursorView.java index 1a9edf8..8ef2348 100644 --- a/src/main/java/fr/sae/terraria/vue/hud/MouseCursorView.java +++ b/src/main/java/fr/sae/terraria/vue/hud/MouseCursorView.java @@ -20,7 +20,7 @@ public class MouseCursorView /** * Un rectangle rouge qui suit la souris - * Permet de savoir où nous cliquons sur l'écran plus précisément sur quel tile + * Permet de savoir où le joueur clique sur l'écran plus précisément sur quel tile * * @param display L'afficheur qui se gère du HUD * @param scaleMultiplicatorWidth Scaling en largeur From 7cb6375a247950b5c160f4bc86a3ea00e22677a0 Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Sun, 12 Jun 2022 12:57:10 +0200 Subject: [PATCH 26/97] Player.java Move tested --- build.gradle | 6 +-- .../terraria/modele/entities/items/Meat.java | 6 +-- .../modele/entities/player/Player.java | 13 ++++-- .../entities/player/inventory/Inventory.java | 7 ++- .../entities/player/inventory/Stack.java | 2 +- src/main/java/fr/sae/terraria/vue/View.java | 17 ++++--- src/main/java/module-info.java | 4 -- .../modele/entities/player/PlayerTest.java | 46 +++++++++++++++++++ 8 files changed, 75 insertions(+), 26 deletions(-) create mode 100644 src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java diff --git a/build.gradle b/build.gradle index f6e9452..3bb5a0b 100644 --- a/build.gradle +++ b/build.gradle @@ -34,11 +34,11 @@ javafx { } dependencies { - implementation 'junit:junit:4.13.1' + implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.7' + implementation 'junit:junit:4.13.2' + testImplementation("org.junit.jupiter:junit-jupiter-api:${junitVersion}") testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${junitVersion}") - - implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.7' } test { diff --git a/src/main/java/fr/sae/terraria/modele/entities/items/Meat.java b/src/main/java/fr/sae/terraria/modele/entities/items/Meat.java index ac87769..2a748ea 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/items/Meat.java +++ b/src/main/java/fr/sae/terraria/modele/entities/items/Meat.java @@ -21,11 +21,7 @@ public Meat(final Environment environment) { Player player = environment.getPlayer(); - if (player.getPv() < player.getPvMax()) { - Inventory inventory = player.getInventory(); - + if (player.getPv() < player.getPvMax()) player.setPv(player.getPv() + 1); - inventory.get().get(inventory.getPosCursor()).remove(); - } } } diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java index 05a0374..e191aef 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java @@ -85,16 +85,21 @@ public Player(final Environment environment) } } - @Override public void hit() { } + @Override public void hit() + { + this.setPv(this.getPv() - 1); + } @Override public void spawn(int x, int y) { this.setX(x); this.setY(y); - Image image = View.loadAnImage("sprites/player/player_idle.png", environment.scaleMultiplicatorWidth, environment.scaleMultiplicatorHeight); - this.setRect((int) image.getWidth(), (int) image.getHeight()); - image.cancel(); + Image img = View.loadAnImage("sprites/player/player_idle.png", environment.scaleMultiplicatorWidth, environment.scaleMultiplicatorHeight); + if (!Objects.isNull(img)) { + this.setRect((int) img.getWidth(), (int) img.getHeight()); + img.cancel(); + } else this.setRect(10, 10); this.getGravity().setXInit(x); this.getGravity().setYInit(y); diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java index 49886e1..e3be515 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java @@ -63,13 +63,17 @@ public void put(StowableObjectType item) if (nbStacksInventory == 0) { Stack stack = new Stack(); stack.nbItemsProperty().addListener((observable, oldValue, newValue) -> { + if (newValue.intValue() < oldValue.intValue()) { + Inventory inventory = player.getInventory(); + inventory.get().get(inventory.getPosCursor()).remove(); + } + if (newValue.intValue() <= 0) { this.value.remove(stack); this.player.setStackSelected(null); } }); stack.setItem(item); - stack.add(); this.value.add(stack); this.player.setStackSelected(stack); } else { @@ -93,7 +97,6 @@ public void put(StowableObjectType item) } }); stack.setItem(item); - stack.add(); this.value.add(stack); this.player.setStackSelected(stack); } diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java index 4dac440..f597d22 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java @@ -33,7 +33,7 @@ public Stack() { super(); - this.nbItems = new SimpleIntegerProperty(0); + this.nbItems = new SimpleIntegerProperty(1); } public boolean isSameItem(StowableObjectType object) diff --git a/src/main/java/fr/sae/terraria/vue/View.java b/src/main/java/fr/sae/terraria/vue/View.java index 640fe79..9294968 100644 --- a/src/main/java/fr/sae/terraria/vue/View.java +++ b/src/main/java/fr/sae/terraria/vue/View.java @@ -76,13 +76,16 @@ private static Image foundImage(final String path) public static Image loadAnImage(final String path, double scaleMultiplicatorWidth, double scaleMultiplicatorHeight) { Image img = View.foundImage(path); - double width = img.getWidth(); - double height = img.getHeight(); - img.cancel(); - - double widthScaled = width*scaleMultiplicatorWidth; - double heightScaled = height*scaleMultiplicatorHeight; - return new Image(img.getUrl(), widthScaled, heightScaled, false, false, false); + if (!Objects.isNull(img)) { + double width = img.getWidth(); + double height = img.getHeight(); + img.cancel(); + + double widthScaled = width*scaleMultiplicatorWidth; + double heightScaled = height*scaleMultiplicatorHeight; + return new Image(img.getUrl(), widthScaled, heightScaled, false, false, false); + } + return null; } public static ImageView createImageView(final Entity entity, final Image img) diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index 0b865f5..fefed6a 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -4,10 +4,6 @@ requires com.google.gson; requires java.desktop; - - opens fr.sae.terraria to javafx.fxml; - exports fr.sae.terraria; - exports fr.sae.terraria.controller; opens fr.sae.terraria.controller to javafx.fxml; exports fr.sae.terraria.modele; opens fr.sae.terraria.modele to javafx.fxml; diff --git a/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java b/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java new file mode 100644 index 0000000..a6b52d6 --- /dev/null +++ b/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java @@ -0,0 +1,46 @@ +package fr.sae.terraria.modele.entities.player; + +import fr.sae.terraria.modele.Environment; +import fr.sae.terraria.modele.entities.items.Coal; +import fr.sae.terraria.modele.entities.items.Meat; +import fr.sae.terraria.modele.entities.items.Vodka; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.BeforeAll; + +import static org.junit.jupiter.api.Assertions.*; + + +public class PlayerTest +{ + private static Environment environment; + + + public PlayerTest() { super(); } + + @BeforeAll public static void init() + { + environment = new Environment(1., 1.); + } + + @Test public final void moveTest() + { + double previousPosX; + + Player player = environment.getPlayer(); + previousPosX = player.getX(); + player.moveRight(); + player.move(); + + assertEquals(previousPosX + player.getVelocity(), player.getX(), + "Test: déplacement vers la droite."); + player.idleOnX(); + + + previousPosX = player.getX(); + player.moveLeft(); + player.move(); + + assertEquals(previousPosX - player.getVelocity(), player.getX(), + "Test: déplacement vers la gauche"); + } +} From e2e7582898dc91214050ceae283d0385111f3e2c Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Sun, 12 Jun 2022 12:57:50 +0200 Subject: [PATCH 27/97] Player.java Hit tested --- .../modele/entities/player/PlayerTest.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java b/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java index a6b52d6..dc74d41 100644 --- a/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java +++ b/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java @@ -43,4 +43,20 @@ public class PlayerTest assertEquals(previousPosX - player.getVelocity(), player.getX(), "Test: déplacement vers la gauche"); } + + + @Test public final void collideTest() + { + + } + + @Test public final void hitTest() + { + Player player = environment.getPlayer(); + double previousPv = player.getPv(); + player.hit(); + + assertEquals(previousPv - 1, player.getPv(), + "Vérifie s'il y a bien subit un dégât"); + } } From 5c849396715b4261a3dd5ab78f6acb1e094d8daa Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Sun, 12 Jun 2022 12:58:38 +0200 Subject: [PATCH 28/97] Player.java Spawn tested --- .../modele/entities/player/PlayerTest.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java b/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java index dc74d41..6c6e4bf 100644 --- a/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java +++ b/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java @@ -59,4 +59,22 @@ public class PlayerTest assertEquals(previousPv - 1, player.getPv(), "Vérifie s'il y a bien subit un dégât"); } + + @Test public final void spawnTest() + { + Player player = environment.getPlayer(); + int spawnLocX = 100; + int spawnLocY = 100; + + player.spawn(spawnLocX, spawnLocY); + + assertEquals(player.getX(), spawnLocX, + "Regarde si la localisation en X est correcte"); + assertEquals(player.getY(), spawnLocY, + "Regarde si la localisation en X est correcte"); + assertEquals(player.getGravity().xInit, spawnLocX, + "Regarde si la localisation au niveau de la gestion de la gravité, en X est correcte"); + assertEquals(player.getGravity().yInit, spawnLocY, + "Regarde si la localisation au niveau de la gestion de la gravité, en X est correcte"); + } } From 84f7ff5cd9c66c5d4c58562a4b4e91cccb2c8336 Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Sun, 12 Jun 2022 12:59:08 +0200 Subject: [PATCH 29/97] Player.java Drunk tested --- .../modele/entities/player/PlayerTest.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java b/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java index 6c6e4bf..1e2ab26 100644 --- a/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java +++ b/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java @@ -77,4 +77,29 @@ public class PlayerTest assertEquals(player.getGravity().yInit, spawnLocY, "Regarde si la localisation au niveau de la gestion de la gravité, en X est correcte"); } + + @Test public final void worldLimitTest() + { + + } + + @Test public final void interactWithBlockTest() + { + + } + + @Test public final void placeBlockTest() + { + + } + + @Test public final void drunkTest() + { + Player player = environment.getPlayer(); + player.pickup(new Vodka(environment)); + + assertFalse(player.drunkProperty().get()); + ((Vodka) player.getStackSelected().getItem()).consumes(); + assertTrue(player.drunkProperty().get()); + } } From c2d078d5d7a82a42ff17b93d3679189f7747ec9b Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Sun, 12 Jun 2022 12:59:33 +0200 Subject: [PATCH 30/97] Player.java Pickup tested --- .../modele/entities/player/PlayerTest.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java b/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java index 1e2ab26..8c0085e 100644 --- a/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java +++ b/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java @@ -102,4 +102,33 @@ public class PlayerTest ((Vodka) player.getStackSelected().getItem()).consumes(); assertTrue(player.drunkProperty().get()); } + + @Test public final void pickupTest() + { + Player player = environment.getPlayer(); + player.getInventory().posCursorProperty().set(0); + + + // Test avec de la viande + player.pickup(new Meat(environment)); + assertTrue(player.getStackSelected().getItem() instanceof Meat, + "Verifie si le stack est bien de la viande"); + assertEquals(player.getStackSelected().getNbItems(), 1, + "Verifie s'il y a bien 1 objet dans le stack"); + ((Meat) player.getStackSelected().getItem()).consumes(); + player.getStackSelected().remove(); + + assertNull(player.getStackSelected()); + + + // Test avec du charbon + player.pickup(new Coal()); + assertTrue(player.getStackSelected().getItem() instanceof Coal, + "Verifie si le stack est bien du charbon"); + assertEquals(player.getStackSelected().getNbItems(), 1, + "Verifie s'il y a bien 1 objet dans le stack"); + player.getStackSelected().remove(); + + assertNull(player.getStackSelected()); + } } From c91640dba11cbd97a6b9d82b45afe8d3ef6c3973 Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Sun, 12 Jun 2022 13:08:09 +0200 Subject: [PATCH 31/97] Player.java placeBlock tested --- .../modele/entities/player/PlayerTest.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java b/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java index 8c0085e..3d63765 100644 --- a/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java +++ b/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java @@ -1,6 +1,8 @@ package fr.sae.terraria.modele.entities.player; import fr.sae.terraria.modele.Environment; +import fr.sae.terraria.modele.TileMaps; +import fr.sae.terraria.modele.entities.blocks.Dirt; import fr.sae.terraria.modele.entities.items.Coal; import fr.sae.terraria.modele.entities.items.Meat; import fr.sae.terraria.modele.entities.items.Vodka; @@ -90,7 +92,15 @@ public class PlayerTest @Test public final void placeBlockTest() { + Player player = environment.getPlayer(); + TileMaps tileMaps = environment.getTileMaps(); + player.pickup(new Dirt(environment, 1, 1)); + + assertEquals(tileMaps.getTile(0, 0), TileMaps.SKY); + player.placeBlock(0, 0); + assertEquals(tileMaps.getTile(0, 0), TileMaps.DIRT); + assertNull(player.getStackSelected()); } @Test public final void drunkTest() @@ -98,9 +108,11 @@ public class PlayerTest Player player = environment.getPlayer(); player.pickup(new Vodka(environment)); - assertFalse(player.drunkProperty().get()); + assertFalse(player.drunkProperty().get(), + "Vérifie si il n'est pas bourré"); ((Vodka) player.getStackSelected().getItem()).consumes(); - assertTrue(player.drunkProperty().get()); + assertTrue(player.drunkProperty().get(), + "Verife si il est bourré"); } @Test public final void pickupTest() From 71cf4f6f0b73561f11b1312ca83581545d20cebe Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Sun, 12 Jun 2022 13:19:32 +0200 Subject: [PATCH 32/97] Player.java interactWithBlock tested --- .../modele/entities/player/PlayerTest.java | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java b/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java index 3d63765..5333138 100644 --- a/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java +++ b/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java @@ -2,13 +2,17 @@ import fr.sae.terraria.modele.Environment; import fr.sae.terraria.modele.TileMaps; +import fr.sae.terraria.modele.entities.Rabbit; import fr.sae.terraria.modele.entities.blocks.Dirt; import fr.sae.terraria.modele.entities.items.Coal; import fr.sae.terraria.modele.entities.items.Meat; import fr.sae.terraria.modele.entities.items.Vodka; +import javafx.geometry.Rectangle2D; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.BeforeAll; +import java.awt.*; + import static org.junit.jupiter.api.Assertions.*; @@ -85,9 +89,31 @@ public class PlayerTest } - @Test public final void interactWithBlockTest() + @Test public final void interactWithBlockTest() // TODO: Le nom est probablement mal choisie { + Rectangle2D blockSelected; + double beforePv; + Player player = environment.getPlayer(); + + Dirt dirt = new Dirt(environment, 1, 1); + dirt.setRect(1, 1); + environment.getEntities().add(dirt); + blockSelected = new Rectangle2D(1, 1, 1, 1); + + beforePv = dirt.getPv(); + player.interactWithBlock(blockSelected); + assertEquals(beforePv - 1, dirt.getPv()); + environment.getEntities().remove(dirt); + + + Rabbit rabbit = new Rabbit(environment, 10, 10); + rabbit.setRect(1, 1); + environment.getEntities().add(rabbit); + blockSelected = new Rectangle2D(10, 10, 1, 1); + beforePv = rabbit.getPv(); + player.interactWithBlock(blockSelected); + assertEquals(beforePv - 1, rabbit.getPv()); } @Test public final void placeBlockTest() From ad8f87a0649ef934eff9c2bce7c86a542c222e1e Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Sun, 12 Jun 2022 13:28:02 +0200 Subject: [PATCH 33/97] Player.java worldLimit Tested --- .../modele/entities/player/PlayerTest.java | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java b/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java index 5333138..7a80abc 100644 --- a/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java +++ b/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java @@ -19,6 +19,7 @@ public class PlayerTest { private static Environment environment; + private static Player player; public PlayerTest() { super(); } @@ -26,13 +27,13 @@ public class PlayerTest @BeforeAll public static void init() { environment = new Environment(1., 1.); + player = environment.getPlayer(); } @Test public final void moveTest() { double previousPosX; - Player player = environment.getPlayer(); previousPosX = player.getX(); player.moveRight(); player.move(); @@ -58,7 +59,6 @@ public class PlayerTest @Test public final void hitTest() { - Player player = environment.getPlayer(); double previousPv = player.getPv(); player.hit(); @@ -68,7 +68,6 @@ public class PlayerTest @Test public final void spawnTest() { - Player player = environment.getPlayer(); int spawnLocX = 100; int spawnLocY = 100; @@ -86,14 +85,29 @@ public class PlayerTest @Test public final void worldLimitTest() { + player.setX(2*TileMaps.TILE_DEFAULT_SIZE); + player.moveLeft(); + player.worldLimit(); + + assertTrue(player.isMovingLeft()); + + player.setX(-TileMaps.TILE_DEFAULT_SIZE); + player.moveLeft(); + player.worldLimit(); + + assertTrue(player.isIDLEonX()); + + player.setX(environment.getTileMaps().getWidth()*TileMaps.TILE_DEFAULT_SIZE + TileMaps.TILE_DEFAULT_SIZE); + player.moveRight(); + player.worldLimit(); + assertTrue(player.isIDLEonX()); } - @Test public final void interactWithBlockTest() // TODO: Le nom est probablement mal choisie + @Test public final void interactWithBlockTest() // TODO: Le nom est probablement mal choisie dans player { Rectangle2D blockSelected; double beforePv; - Player player = environment.getPlayer(); Dirt dirt = new Dirt(environment, 1, 1); dirt.setRect(1, 1); @@ -118,7 +132,6 @@ public class PlayerTest @Test public final void placeBlockTest() { - Player player = environment.getPlayer(); TileMaps tileMaps = environment.getTileMaps(); player.pickup(new Dirt(environment, 1, 1)); @@ -131,7 +144,6 @@ public class PlayerTest @Test public final void drunkTest() { - Player player = environment.getPlayer(); player.pickup(new Vodka(environment)); assertFalse(player.drunkProperty().get(), @@ -143,7 +155,6 @@ public class PlayerTest @Test public final void pickupTest() { - Player player = environment.getPlayer(); player.getInventory().posCursorProperty().set(0); From 11788df7fc211179fbab9f7a6c0c3348daff1992 Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Sun, 12 Jun 2022 13:38:47 +0200 Subject: [PATCH 34/97] Tentative test collision --- .../modele/entities/player/PlayerTest.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java b/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java index 7a80abc..fefc3a1 100644 --- a/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java +++ b/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java @@ -54,7 +54,36 @@ public class PlayerTest @Test public final void collideTest() { + /* + // Le TOP et le BOTTOM est un pet complex à tester dans un JUnit + Dirt dirtLeft = new Dirt(environment, 1, 1); + dirtLeft.setRect(1, 1); + environment.getEntities().add(dirtLeft); + Dirt dirtRight = new Dirt(environment, 5, 1); + dirtRight.setRect(1, 1); + environment.getEntities().add(dirtRight); + player.setRect(1, 1); + player.setVelocity(0); + player.setY(1); + + player.setX(3); + player.moveLeft(); + player.collide(); + + assertTrue(player.isMovingLeft()); + + player.setX(1); + player.moveLeft(); + player.collide(); + assertTrue(player.isIDLEonX()); + + player.setX(5); + player.moveRight(); + player.collide(); + + assertTrue(player.isIDLEonX()); + */ } @Test public final void hitTest() From 4d6c1a8d0c66036bddcadf16de3154d5322bf2db Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Sun, 12 Jun 2022 14:11:35 +0200 Subject: [PATCH 35/97] Clean --- .../sae/terraria/modele/entities/items/Meat.java | 1 - .../entities/player/inventory/Inventory.java | 2 +- src/main/resources/fr/sae/terraria/vue/game.fxml | 3 +-- src/main/resources/fr/sae/terraria/vue/menu.fxml | 14 ++++---------- 4 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/main/java/fr/sae/terraria/modele/entities/items/Meat.java b/src/main/java/fr/sae/terraria/modele/entities/items/Meat.java index 2a748ea..dfafc11 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/items/Meat.java +++ b/src/main/java/fr/sae/terraria/modele/entities/items/Meat.java @@ -3,7 +3,6 @@ import fr.sae.terraria.modele.Environment; import fr.sae.terraria.modele.entities.entity.ConsumableObjectType; import fr.sae.terraria.modele.entities.player.Player; -import fr.sae.terraria.modele.entities.player.inventory.Inventory; public class Meat extends Item implements ConsumableObjectType diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java index e3be515..00f47cf 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java @@ -49,7 +49,7 @@ public Inventory(final Player player) }); } - private int nbStacksIntoInventory() { return this.value.size(); } + public int nbStacksIntoInventory() { return this.value.size(); } /** * Place des objets de type rangeable dans l'inventaire. diff --git a/src/main/resources/fr/sae/terraria/vue/game.fxml b/src/main/resources/fr/sae/terraria/vue/game.fxml index 7c4c3df..41b20eb 100644 --- a/src/main/resources/fr/sae/terraria/vue/game.fxml +++ b/src/main/resources/fr/sae/terraria/vue/game.fxml @@ -1,10 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> + <?import javafx.scene.layout.*?> <?import javafx.scene.text.Text?> <?import java.net.URL?> - - <BorderPane fx:id="root" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" diff --git a/src/main/resources/fr/sae/terraria/vue/menu.fxml b/src/main/resources/fr/sae/terraria/vue/menu.fxml index 0ed6d7f..44444d0 100644 --- a/src/main/resources/fr/sae/terraria/vue/menu.fxml +++ b/src/main/resources/fr/sae/terraria/vue/menu.fxml @@ -1,16 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> -<?import javafx.scene.control.ScrollPane?> -<?import javafx.scene.control.Separator?> -<?import javafx.scene.control.SplitPane?> -<?import javafx.scene.layout.BorderPane?> -<?import javafx.scene.layout.HBox?> -<?import javafx.scene.layout.Pane?> -<?import javafx.scene.text.Font?> -<?import javafx.scene.text.Text?> -<?import java.net.URL?> - +<?import javafx.scene.control.*?> +<?import javafx.scene.layout.*?> +<?import javafx.scene.text.*?> +<?import java.net.URL?> <BorderPane fx:id="root" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" From 365bb46ea9ed1ad9dfed159fb32ff218c4aab3d6 Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Sun, 12 Jun 2022 14:12:51 +0200 Subject: [PATCH 36/97] Inventory.java nbStacksIntoInventory tested --- .../modele/entities/player/PlayerTest.java | 4 +-- .../player/inventory/InventoryTest.java | 35 +++++++++++++++++++ 2 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 src/test/java/fr/sae/terraria/modele/entities/player/inventory/InventoryTest.java diff --git a/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java b/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java index fefc3a1..7b0c190 100644 --- a/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java +++ b/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java @@ -8,10 +8,8 @@ import fr.sae.terraria.modele.entities.items.Meat; import fr.sae.terraria.modele.entities.items.Vodka; import javafx.geometry.Rectangle2D; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.BeforeAll; - -import java.awt.*; +import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; diff --git a/src/test/java/fr/sae/terraria/modele/entities/player/inventory/InventoryTest.java b/src/test/java/fr/sae/terraria/modele/entities/player/inventory/InventoryTest.java new file mode 100644 index 0000000..a09fcf4 --- /dev/null +++ b/src/test/java/fr/sae/terraria/modele/entities/player/inventory/InventoryTest.java @@ -0,0 +1,35 @@ +package fr.sae.terraria.modele.entities.player.inventory; + +import fr.sae.terraria.modele.Environment; +import fr.sae.terraria.modele.entities.blocks.Dirt; +import fr.sae.terraria.modele.entities.player.Player; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + + +public class InventoryTest +{ + private static Environment environment; + private static Player player; + private static Inventory inventory; + + + @BeforeAll public static void init() + { + environment = new Environment(1., 1.); + player = environment.getPlayer(); + inventory = player.getInventory(); + } + + @Test public final void nbStacksIntoInventoryTest() + { + for (int i = 0; i < 16; i++) + inventory.put(new Dirt(environment, 1, 1)); + assertEquals(inventory.nbStacksIntoInventory(), 1); + + inventory.put(new Dirt(environment, 1, 1)); + assertEquals(inventory.nbStacksIntoInventory(), 2); + } +} From 6ed872257b3561d80a235686b0a41fe5161ccb6a Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Sun, 12 Jun 2022 14:32:40 +0200 Subject: [PATCH 37/97] Inventory.java Stack.nbItems tested --- .../entities/player/inventory/Inventory.java | 6 ++++++ .../player/inventory/InventoryTest.java | 20 +++++++++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java index 00f47cf..9abe93c 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java @@ -91,6 +91,11 @@ public void put(StowableObjectType item) // Si tous les stacks present sont pleins ou aucune ne correspond à l'objet qui à étais pris, il crée un nouveau stack Stack stack = new Stack(); stack.nbItemsProperty().addListener((observable, oldValue, newValue) -> { + if (newValue.intValue() < oldValue.intValue()) { + Inventory inventory = player.getInventory(); + inventory.get().get(inventory.getPosCursor()).remove(); + } + if (newValue.intValue() <= 0) { this.value.remove(stack); this.player.setStackSelected(null); @@ -149,6 +154,7 @@ else if (key.equals(KeyCode.DIGIT9)) public IntegerProperty posCursorProperty() { return this.posCursor; } + public Stack getStack() { return this.value.get(this.getPosCursor()); } public int getPosCursor() { return this.posCursor.get(); } public ObservableList<Stack> get() { return this.value; } public Map<KeyCode, Boolean> getKeysInput() { return this.keysInput; } diff --git a/src/test/java/fr/sae/terraria/modele/entities/player/inventory/InventoryTest.java b/src/test/java/fr/sae/terraria/modele/entities/player/inventory/InventoryTest.java index a09fcf4..d2ecfb9 100644 --- a/src/test/java/fr/sae/terraria/modele/entities/player/inventory/InventoryTest.java +++ b/src/test/java/fr/sae/terraria/modele/entities/player/inventory/InventoryTest.java @@ -12,24 +12,32 @@ public class InventoryTest { private static Environment environment; - private static Player player; private static Inventory inventory; @BeforeAll public static void init() { environment = new Environment(1., 1.); - player = environment.getPlayer(); + Player player = environment.getPlayer(); inventory = player.getInventory(); } @Test public final void nbStacksIntoInventoryTest() { - for (int i = 0; i < 16; i++) + for (int i = 0; i < Stack.MAX; i++) inventory.put(new Dirt(environment, 1, 1)); - assertEquals(inventory.nbStacksIntoInventory(), 1); + assertEquals(2, inventory.nbStacksIntoInventory()); - inventory.put(new Dirt(environment, 1, 1)); - assertEquals(inventory.nbStacksIntoInventory(), 2); + for (int i = 0; i < Stack.MAX; i++) + inventory.put(new Dirt(environment, 1, 1)); + assertEquals(3, inventory.nbStacksIntoInventory()); + } + + @Test public final void nbItemsIntoStackTest() + { + inventory.posCursorProperty().set(0); + for (int i = 0; i < Stack.MAX; i++) + inventory.put(new Dirt(environment, 1, 1)); + assertEquals(Stack.MAX, inventory.getStack().getNbItems()); } } From 5c05bdc3425846b998229e87e67547c53c43dce9 Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Sun, 12 Jun 2022 14:41:27 +0200 Subject: [PATCH 38/97] Duplication de code enlever dans Inventory.java --- .../entities/player/inventory/Inventory.java | 52 ++++++++----------- 1 file changed, 21 insertions(+), 31 deletions(-) diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java index 9abe93c..476dc74 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java @@ -49,6 +49,25 @@ public Inventory(final Player player) }); } + private void createStack(StowableObjectType item) + { + Stack stack = new Stack(); + stack.nbItemsProperty().addListener((observable, oldValue, newValue) -> { + if (newValue.intValue() < oldValue.intValue()) { + Inventory inventory = player.getInventory(); + inventory.get().get(inventory.getPosCursor()).remove(); + } + + if (newValue.intValue() <= 0) { + this.value.remove(stack); + this.player.setStackSelected(null); + } + }); + stack.setItem(item); + this.value.add(stack); + this.player.setStackSelected(stack); + } + public int nbStacksIntoInventory() { return this.value.size(); } /** @@ -61,21 +80,7 @@ public void put(StowableObjectType item) if (nbStacksInventory < NB_BOXES_MAX) { if (nbStacksInventory == 0) { - Stack stack = new Stack(); - stack.nbItemsProperty().addListener((observable, oldValue, newValue) -> { - if (newValue.intValue() < oldValue.intValue()) { - Inventory inventory = player.getInventory(); - inventory.get().get(inventory.getPosCursor()).remove(); - } - - if (newValue.intValue() <= 0) { - this.value.remove(stack); - this.player.setStackSelected(null); - } - }); - stack.setItem(item); - this.value.add(stack); - this.player.setStackSelected(stack); + this.createStack(item); } else { for (Stack stack : this.value) { int beforeSize = stack.getNbItems(); @@ -87,23 +92,8 @@ public void put(StowableObjectType item) if (beforeSize != afterSize) return; } - // Si tous les stacks present sont pleins ou aucune ne correspond à l'objet qui à étais pris, il crée un nouveau stack - Stack stack = new Stack(); - stack.nbItemsProperty().addListener((observable, oldValue, newValue) -> { - if (newValue.intValue() < oldValue.intValue()) { - Inventory inventory = player.getInventory(); - inventory.get().get(inventory.getPosCursor()).remove(); - } - - if (newValue.intValue() <= 0) { - this.value.remove(stack); - this.player.setStackSelected(null); - } - }); - stack.setItem(item); - this.value.add(stack); - this.player.setStackSelected(stack); + this.createStack(item); } } } From b36d92d020fd25a6941254b18c75bdad0622eac1 Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Sun, 12 Jun 2022 15:03:06 +0200 Subject: [PATCH 39/97] fix import fxml failed --- src/main/java/module-info.java | 6 +++++- src/main/resources/fr/sae/terraria/vue/menu.fxml | 14 ++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index fefed6a..e7b3690 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -1,9 +1,13 @@ -module fr.sae.terraria { +module fr.sae.terraria +{ + requires javafx.graphics; requires javafx.controls; requires javafx.fxml; requires com.google.gson; requires java.desktop; + opens fr.sae.terraria to javafx.graphics; + exports fr.sae.terraria; opens fr.sae.terraria.controller to javafx.fxml; exports fr.sae.terraria.modele; opens fr.sae.terraria.modele to javafx.fxml; diff --git a/src/main/resources/fr/sae/terraria/vue/menu.fxml b/src/main/resources/fr/sae/terraria/vue/menu.fxml index 44444d0..0ed6d7f 100644 --- a/src/main/resources/fr/sae/terraria/vue/menu.fxml +++ b/src/main/resources/fr/sae/terraria/vue/menu.fxml @@ -1,10 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> - -<?import javafx.scene.control.*?> -<?import javafx.scene.layout.*?> -<?import javafx.scene.text.*?> +<?import javafx.scene.control.ScrollPane?> +<?import javafx.scene.control.Separator?> +<?import javafx.scene.control.SplitPane?> +<?import javafx.scene.layout.BorderPane?> +<?import javafx.scene.layout.HBox?> +<?import javafx.scene.layout.Pane?> +<?import javafx.scene.text.Font?> +<?import javafx.scene.text.Text?> <?import java.net.URL?> + + <BorderPane fx:id="root" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" From dbf88f544e24d1df14907ff606034b866799ddf2 Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Sun, 12 Jun 2022 15:06:45 +0200 Subject: [PATCH 40/97] Fix transparence sword.png --- .../resources/fr/sae/terraria/tools/sword.png | Bin 349 -> 5190 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/src/main/resources/fr/sae/terraria/tools/sword.png b/src/main/resources/fr/sae/terraria/tools/sword.png index 599eeeaf239dc7bcd5133479068b2777bc934fe7..1b1bcaf40f5a9d8bb8364f9a7a3e0aeaca5a6855 100644 GIT binary patch literal 5190 zcmeHKc~}!?6OX7M5fF=rB1nwTh>-h$#6+$H2o$7<0^Xa=23E*HvPl4yLqI$#YN-@0 zUVv1vQm|B|XpvGu<<P1hDpaV5sK_CTf<@)q1XO&!{^Rp}{m<mtWOv?~-^~1G-bvnV zL4iJ|SZgc>gE1BQ@`KTDbKNz?5dE}!HUeNUlc@0_VMs8b#VM3>2^<aKkT?Z|gJNL` z1{2%d6S^|%-U5@?5tctq^7q7LRX@wQUFDoe`s>W`r>?6D_gBJ;sQh)0{H%=I|8`59 zHfTlqocVyc!grp{nT=1k(K(uKrymKn3A`(IwI`kldy6M*@x6Na4SY8zG4p!A&;lA5 zNWmX};Qo@k`&D6E?~DUm#CQ?XT)5!C_S8Yl0qj%F<0+TgeXRW2q!n?Z;m4hMf9A&r z{yN+<KlkPgO=|hnOUd6~G<NU&_J9~MIG8HLIL8ak%FDMWad%u-JK(G>iV``GESy4j z9jv><TY2z`qtdEF@$-`V83Sx5rvW?X4U0Cs3O7q=_eQK<zqHM}9k#f7NB2Ze+raN- z#XrpLw9L*fXqd1fsS&fqr01-Kth%T;4BK<er)st1^ps+cgVvDsjnI{a2DuM<U305f zg=by0SGF(AbaRti+c*d<CSFqi(VIqgE~_ud`vq!PS3bRf<}tfL-QU~Ox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OXa)hW0fEs8|5dg0zycsZtY#1Z8vxR5Vq*`cNzn`f@RX>gt<RuiXatUL8zVDt zJkOiAo}s8H6D)=cpd@9GA^bvu46^cy3<7LIKm&TAGPnUeCBj_r@!fkc|H#QbV44tM z1o<1p0BOE*{yZGRt*aN|E&&+^;^PBg7l0JQG=l($25E+c2|fUK0SFMX4HGah003K) V&T8shK%)Qv002ovPDHLkV1imQdszSg From 0e7935ccd568b29c1029379f7e0af97e35a12b2d Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Sun, 12 Jun 2022 15:15:08 +0200 Subject: [PATCH 41/97] Fix animation qui clignote --- .../terraria/modele/entities/entity/Animation.java | 1 + .../java/fr/sae/terraria/vue/entities/EntityView.java | 6 +++++- src/main/resources/fr/sae/terraria/vue/menu.fxml | 11 +++-------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/java/fr/sae/terraria/modele/entities/entity/Animation.java b/src/main/java/fr/sae/terraria/modele/entities/entity/Animation.java index 3b31bad..11364ec 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/entity/Animation.java +++ b/src/main/java/fr/sae/terraria/modele/entities/entity/Animation.java @@ -40,6 +40,7 @@ public void loop() public double getFrame() { return this.frame.get(); } + public double getEndFrame() { return this.endFrame; } public DoubleProperty getFrameProperty() { return this.frame; } /** Spécifie à quelle frame l'animation sur le Sprite Sheet doit s'arrêter */ diff --git a/src/main/java/fr/sae/terraria/vue/entities/EntityView.java b/src/main/java/fr/sae/terraria/vue/entities/EntityView.java index 61578f5..9a49898 100644 --- a/src/main/java/fr/sae/terraria/vue/entities/EntityView.java +++ b/src/main/java/fr/sae/terraria/vue/entities/EntityView.java @@ -51,7 +51,11 @@ private void startAnimation() this.entity.getAnimation().setEndFrame(newEndFrame); }); - this.entity.getAnimation().getFrameProperty().addListener((obs, oldFrame, newFrame) -> this.animation(newFrame.intValue())); + this.entity.getAnimation().getFrameProperty().addListener((obs, oldFrame, newFrame) -> { + if(newFrame.intValue() >= this.entity.getAnimation().getEndFrame()) + this.animation(oldFrame.intValue()); + else this.animation(newFrame.intValue()); + }); } /** Affiche l'entité à l'écran et démarre l'animation */ diff --git a/src/main/resources/fr/sae/terraria/vue/menu.fxml b/src/main/resources/fr/sae/terraria/vue/menu.fxml index 0ed6d7f..04ff0b3 100644 --- a/src/main/resources/fr/sae/terraria/vue/menu.fxml +++ b/src/main/resources/fr/sae/terraria/vue/menu.fxml @@ -1,13 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> -<?import javafx.scene.control.ScrollPane?> -<?import javafx.scene.control.Separator?> -<?import javafx.scene.control.SplitPane?> -<?import javafx.scene.layout.BorderPane?> -<?import javafx.scene.layout.HBox?> -<?import javafx.scene.layout.Pane?> -<?import javafx.scene.text.Font?> -<?import javafx.scene.text.Text?> +<?import javafx.scene.control.*?> +<?import javafx.scene.layout.*?> +<?import javafx.scene.text.*?> <?import java.net.URL?> From f9cfef897078a867527135cb9f28841a61171a9f Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Sun, 12 Jun 2022 16:10:21 +0200 Subject: [PATCH 42/97] =?UTF-8?q?Craft=20Roche=20cr=C3=A9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/fr/sae/terraria/Terraria.java | 1 + .../terraria/controller/MenuController.java | 28 ++++++++++++++++++- .../entities/blocks/{Stone.java => Rock.java} | 14 ++++++---- .../entities/entity/BreakableObjectType.java | 4 ++- .../entities/entity/PlaceableObjectType.java | 6 ++-- .../items/{Pierre.java => Stone.java} | 2 +- .../entities/player/inventory/Stack.java | 6 ++-- .../fr/sae/terraria/vue/TileMapsView.java | 10 +++---- .../sae/terraria/vue/hud/InventoryView.java | 6 ++-- .../terraria/vue/hud/ItemSelectedView.java | 6 ++-- .../resources/fr/sae/terraria/vue/menu.fxml | 9 ++++++ 11 files changed, 68 insertions(+), 24 deletions(-) rename src/main/java/fr/sae/terraria/modele/entities/blocks/{Stone.java => Rock.java} (86%) rename src/main/java/fr/sae/terraria/modele/entities/items/{Pierre.java => Stone.java} (56%) diff --git a/src/main/java/fr/sae/terraria/Terraria.java b/src/main/java/fr/sae/terraria/Terraria.java index c0599a9..1185b3a 100644 --- a/src/main/java/fr/sae/terraria/Terraria.java +++ b/src/main/java/fr/sae/terraria/Terraria.java @@ -88,6 +88,7 @@ public void start(Stage stage) throws IOException } else { if (!Objects.isNull(gameController.player)) { menuController.player = gameController.player; + menuController.environment = gameController.environment; menuController.loop.play(); gameController.environment.getLoop().stop(); } diff --git a/src/main/java/fr/sae/terraria/controller/MenuController.java b/src/main/java/fr/sae/terraria/controller/MenuController.java index e8c3855..d33479b 100644 --- a/src/main/java/fr/sae/terraria/controller/MenuController.java +++ b/src/main/java/fr/sae/terraria/controller/MenuController.java @@ -1,10 +1,15 @@ package fr.sae.terraria.controller; import fr.sae.terraria.Terraria; +import fr.sae.terraria.modele.Environment; +import fr.sae.terraria.modele.entities.blocks.Rock; +import fr.sae.terraria.modele.entities.items.Stone; import fr.sae.terraria.modele.entities.player.Player; +import fr.sae.terraria.modele.entities.player.inventory.Stack; import javafx.animation.Animation; import javafx.animation.KeyFrame; import javafx.animation.Timeline; +import javafx.event.Event; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.layout.HBox; @@ -23,9 +28,11 @@ public class MenuController implements Initializable @FXML public Pane displayInventory; @FXML public Pane displayLexique; @FXML public HBox HBoxText; + @FXML public HBox lexique4; public Timeline loop; private Stage stage; + public Environment environment = null; public Player player = null; public double scaleMultiplicatorWidth; public double scaleMultiplicatorHeight; @@ -47,11 +54,30 @@ public MenuController(final Stage stage) KeyFrame keyFrame = new KeyFrame(Duration.seconds(Terraria.TARGET_FPS), (ev -> { if (!Objects.isNull(this.player)) { - System.out.println(this.player.getInventory()); + // System.out.println(this.player.getInventory()); } })); this.loop.getKeyFrames().add(keyFrame); this.loop.play(); + + // Craft de la roche à partir de 3 pierres + this.lexique4.addEventFilter(Event.ANY, ev -> { + if (ev.getEventType().getName().equalsIgnoreCase("MOUSE_PRESSED")) { + System.out.println("click"); + + int i = this.player.getInventory().get().size()-1; + while (i > 0 && !(this.player.getInventory().get().get(i).getItem() instanceof Stone) && this.player.getInventory().get().get(i).getNbItems() > 2) + i--; + + Stack stack = this.player.getInventory().get().get(i); + System.out.println(stack.getItem()); + if (stack.getItem() instanceof Stone) { + for (int j = 0; j < 3; j++) + stack.remove(); + this.player.pickup(new Rock(this.environment)); + } + } + }); } } diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/Stone.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/Rock.java similarity index 86% rename from src/main/java/fr/sae/terraria/modele/entities/blocks/Stone.java rename to src/main/java/fr/sae/terraria/modele/entities/blocks/Rock.java index a991360..336740a 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/Stone.java +++ b/src/main/java/fr/sae/terraria/modele/entities/blocks/Rock.java @@ -6,6 +6,7 @@ import fr.sae.terraria.modele.entities.entity.Entity; import fr.sae.terraria.modele.entities.entity.PlaceableObjectType; import fr.sae.terraria.modele.entities.entity.StowableObjectType; +import fr.sae.terraria.modele.entities.items.Stone; import fr.sae.terraria.modele.entities.player.Player; import fr.sae.terraria.modele.entities.player.inventory.Inventory; import fr.sae.terraria.modele.entities.player.inventory.Stack; @@ -15,7 +16,7 @@ import java.util.Objects; -public class Stone extends Block implements StowableObjectType, CollideObjectType, PlaceableObjectType +public class Rock extends Block implements StowableObjectType, CollideObjectType, PlaceableObjectType { public static final int BREAK_RESISTANCE = 5; @@ -25,7 +26,7 @@ public class Stone extends Block implements StowableObjectType, CollideObjectTyp private final double yOrigin; - public Stone(Environment environment, int x, int y) + public Rock(Environment environment, int x, int y) { super(x, y); this.environment = environment; @@ -33,9 +34,11 @@ public Stone(Environment environment, int x, int y) this.xOrigin = x; this.yOrigin = y; - this.pv.set(Stone.BREAK_RESISTANCE); + this.pv.set(Rock.BREAK_RESISTANCE); } + public Rock(Environment environment) { this(environment, 0, 0); } + @Override public void updates() { /* TODO document why this method is empty */ } @Override public void collide() { /* NE RIEN REMPLIR */ } @@ -48,7 +51,8 @@ public Stone(Environment environment, int x, int y) // Une fois le bloc cassé, de la pierre est ramassée et le bloc se supprime du Pane Player player = this.environment.getPlayer(); if (this.getPv() <= 0) { - player.pickup(this); + for (int i = 0; i < 3; i++) + player.pickup(new Stone()); int yIndexTile = (int) (getY()/this.environment.heightTile); int xIndexTile = (int) (getX()/this.environment.widthTile); @@ -73,7 +77,7 @@ public Stone(Environment environment, int x, int y) int widthTile = this.environment.widthTile; int heightTile = this.environment.heightTile; - Entity entity = new Stone(this.environment, x*widthTile, y*heightTile); + Entity entity = new Rock(this.environment, x*widthTile, y*heightTile); entity.setRect(widthTile, heightTile); Player player = this.environment.getPlayer(); diff --git a/src/main/java/fr/sae/terraria/modele/entities/entity/BreakableObjectType.java b/src/main/java/fr/sae/terraria/modele/entities/entity/BreakableObjectType.java index 07b891a..e076a99 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/entity/BreakableObjectType.java +++ b/src/main/java/fr/sae/terraria/modele/entities/entity/BreakableObjectType.java @@ -1,6 +1,8 @@ package fr.sae.terraria.modele.entities.entity; +import fr.sae.terraria.modele.entities.blocks.Rock; + /** * <h1>Breakable Object Type</h1> * <h2>Interface utile à un objet qui hérite d'Entity</h2> @@ -20,7 +22,7 @@ public interface BreakableObjectType * * @see fr.sae.terraria.modele.entities.blocks.Dirt * @see fr.sae.terraria.modele.entities.blocks.TallGrass - * @see fr.sae.terraria.modele.entities.blocks.Stone + * @see Rock */ void breaks(); } diff --git a/src/main/java/fr/sae/terraria/modele/entities/entity/PlaceableObjectType.java b/src/main/java/fr/sae/terraria/modele/entities/entity/PlaceableObjectType.java index 3c2669b..2720b5f 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/entity/PlaceableObjectType.java +++ b/src/main/java/fr/sae/terraria/modele/entities/entity/PlaceableObjectType.java @@ -1,13 +1,15 @@ package fr.sae.terraria.modele.entities.entity; +import fr.sae.terraria.modele.entities.blocks.Rock; + /** * <h1>Placeable Object Type</h1> * <h2>Interface utile sur les objets qui héritent de block</h2> * <h3><u>Description:</u></h3> * <p>Permet de savoir si un block sera posable sur un sol ou non</p> * - * @see fr.sae.terraria.modele.entities.blocks.Stone + * @see Rock * @author CHRZASZCZ Naulan */ public interface PlaceableObjectType @@ -19,7 +21,7 @@ public interface PlaceableObjectType * * @param x Les coordonnées du block en x lorsqu'il va êtres poser au sol * @param y Les coordonnées du block en y lorsqu'il va êtres poser au sol - * @see fr.sae.terraria.modele.entities.blocks.Stone + * @see Rock */ void place(final int x, final int y); } diff --git a/src/main/java/fr/sae/terraria/modele/entities/items/Pierre.java b/src/main/java/fr/sae/terraria/modele/entities/items/Stone.java similarity index 56% rename from src/main/java/fr/sae/terraria/modele/entities/items/Pierre.java rename to src/main/java/fr/sae/terraria/modele/entities/items/Stone.java index c481a70..c7eed84 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/items/Pierre.java +++ b/src/main/java/fr/sae/terraria/modele/entities/items/Stone.java @@ -1,4 +1,4 @@ package fr.sae.terraria.modele.entities.items; -public class Pierre extends Item { } +public class Stone extends Item { } diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java index f597d22..9a62beb 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java @@ -2,7 +2,7 @@ import fr.sae.terraria.modele.entities.Arrow; import fr.sae.terraria.modele.entities.blocks.Dirt; -import fr.sae.terraria.modele.entities.blocks.Stone; +import fr.sae.terraria.modele.entities.blocks.Rock; import fr.sae.terraria.modele.entities.blocks.TallGrass; import fr.sae.terraria.modele.entities.blocks.Torch; import fr.sae.terraria.modele.entities.entity.StowableObjectType; @@ -40,7 +40,7 @@ public boolean isSameItem(StowableObjectType object) { if (object instanceof Dirt && this.item instanceof Dirt) return true; - else if (object instanceof Stone && this.item instanceof Stone) + else if (object instanceof Rock && this.item instanceof Rock) return true; else if (object instanceof TallGrass && this.item instanceof TallGrass) return true; @@ -54,7 +54,7 @@ else if (object instanceof Iron && this.item instanceof Iron) return true; else if (object instanceof Meat && this.item instanceof Meat) return true; - else if (object instanceof Pierre && this.item instanceof Pierre) + else if (object instanceof Stone && this.item instanceof Stone) return true; else if (object instanceof Silex && this.item instanceof Silex) return true; diff --git a/src/main/java/fr/sae/terraria/vue/TileMapsView.java b/src/main/java/fr/sae/terraria/vue/TileMapsView.java index b8f94ba..9086a30 100644 --- a/src/main/java/fr/sae/terraria/vue/TileMapsView.java +++ b/src/main/java/fr/sae/terraria/vue/TileMapsView.java @@ -124,7 +124,7 @@ else if (((Dirt) block).getTypeOfFloor() == TileMaps.DIRT) blockView.setImage(this.dirtImg); else if (((Dirt) block).getTypeOfFloor() == 0) blockView.setImage(this.floorTopImg); - } else if (block instanceof Stone) { + } else if (block instanceof Rock) { blockView.setImage(this.stoneImg); } else if (block instanceof TallGrass) { blockView.setImage(this.tallGrassImg); @@ -287,11 +287,11 @@ public void displayMaps(TileMaps tiles) for (int x = 0 ; x < tiles.getWidth() ; x++) switch (tiles.getTile(x, y)) { case TileMaps.STONE: - Stone stoneEntity = new Stone(this.environment, x*this.tileWidth, y*this.tileHeight); - stoneEntity.setRect(this.tileWidth, this.tileHeight); + Rock rockEntity = new Rock(this.environment, x*this.tileWidth, y*this.tileHeight); + rockEntity.setRect(this.tileWidth, this.tileHeight); - this.environment.getEntities().add(stoneEntity); - this.environment.getBlocks().add(stoneEntity); + this.environment.getEntities().add(rockEntity); + this.environment.getBlocks().add(rockEntity); break; case TileMaps.DIRT: Dirt dirtSprite = new Dirt(this.environment, x*this.tileWidth, y*this.tileHeight); diff --git a/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java b/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java index 8d9e0a5..fc13085 100644 --- a/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java +++ b/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java @@ -4,7 +4,7 @@ import fr.sae.terraria.modele.TileMaps; import fr.sae.terraria.modele.entities.Arrow; import fr.sae.terraria.modele.entities.blocks.Dirt; -import fr.sae.terraria.modele.entities.blocks.Stone; +import fr.sae.terraria.modele.entities.blocks.Rock; import fr.sae.terraria.modele.entities.blocks.TallGrass; import fr.sae.terraria.modele.entities.blocks.Torch; import fr.sae.terraria.modele.entities.entity.StowableObjectType; @@ -104,7 +104,7 @@ private void displayItemIntoInventoryBar() if (item instanceof Dirt) view.setImage(View.loadAnImage("tiles/floor-top.png", itemInventoryWidth, itemInventoryHeight)); - else if (item instanceof Stone) + else if (item instanceof Rock) view.setImage(View.loadAnImage("tiles/rock-fill.png", itemInventoryWidth, itemInventoryHeight)); else if (item instanceof TallGrass) view.setImage(View.loadAnImage("tiles/tall-grass.png.png", itemInventoryWidth, itemInventoryHeight)); @@ -118,7 +118,7 @@ else if (item instanceof Iron) view.setImage(View.loadAnImage("loots/iron.png", itemInventoryWidth, itemInventoryHeight)); else if (item instanceof Meat) view.setImage(View.loadAnImage("loots/meat.png", itemInventoryWidth, itemInventoryHeight)); - else if (item instanceof Pierre) + else if (item instanceof Stone) view.setImage(View.loadAnImage("loots/pierre.png", itemInventoryWidth, itemInventoryHeight)); else if (item instanceof Silex) view.setImage(View.loadAnImage("loots/silex.png", itemInventoryWidth, itemInventoryHeight)); diff --git a/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java b/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java index ef689a3..7807ce2 100644 --- a/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java +++ b/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java @@ -3,7 +3,7 @@ import fr.sae.terraria.modele.TileMaps; import fr.sae.terraria.modele.entities.Arrow; import fr.sae.terraria.modele.entities.blocks.Dirt; -import fr.sae.terraria.modele.entities.blocks.Stone; +import fr.sae.terraria.modele.entities.blocks.Rock; import fr.sae.terraria.modele.entities.blocks.TallGrass; import fr.sae.terraria.modele.entities.blocks.Torch; import fr.sae.terraria.modele.entities.entity.StowableObjectType; @@ -84,7 +84,7 @@ public ItemSelectedView(Pane display, Player player, double scaleMultiplicatorWi if (item instanceof Dirt) this.itemSelectedImgView.setImage(this.dirtItemImg); - else if (item instanceof Stone) + else if (item instanceof Rock) this.itemSelectedImgView.setImage(this.stoneItemImg); else if (item instanceof TallGrass) this.itemSelectedImgView.setImage(null); @@ -100,7 +100,7 @@ else if (item instanceof Meat) this.itemSelectedImgView.setImage(this.meatItemImg); else if (item instanceof Vodka) this.itemSelectedImgView.setImage(this.vodkaItemImg); - else if (item instanceof Pierre) + else if (item instanceof Stone) this.itemSelectedImgView.setImage(this.pierreItemImg); else if (item instanceof Silex) this.itemSelectedImgView.setImage(this.silexItemImg); diff --git a/src/main/resources/fr/sae/terraria/vue/menu.fxml b/src/main/resources/fr/sae/terraria/vue/menu.fxml index 04ff0b3..c9a37a1 100644 --- a/src/main/resources/fr/sae/terraria/vue/menu.fxml +++ b/src/main/resources/fr/sae/terraria/vue/menu.fxml @@ -85,6 +85,15 @@ <Text text="1 Bâton | 2 Minerais de fer"/> </HBox> <Separator layoutY="158.0" prefHeight="5.0" prefWidth="625.0"/> + <HBox id="notAvailable" + fx:id="lexique4" + layoutY="163.0" + prefHeight="50.0" + prefWidth="625.0"> + <Text text="1 Roche" textAlignment="CENTER"/> + <Text text="3 pierres"/> + </HBox> + <Separator layoutY="213.0" prefHeight="5.0" prefWidth="625.0"/> </Pane> </ScrollPane> </center> From 0bdb6747637d33fe0264c7ad3f0d5a6974241f05 Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Sun, 12 Jun 2022 16:18:08 +0200 Subject: [PATCH 43/97] =?UTF-8?q?Craft=20Roche=20cr=C3=A9e=20(clean)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/fr/sae/terraria/controller/MenuController.java | 7 ++----- .../java/fr/sae/terraria/modele/entities/blocks/Rock.java | 1 + 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/java/fr/sae/terraria/controller/MenuController.java b/src/main/java/fr/sae/terraria/controller/MenuController.java index d33479b..f567540 100644 --- a/src/main/java/fr/sae/terraria/controller/MenuController.java +++ b/src/main/java/fr/sae/terraria/controller/MenuController.java @@ -64,16 +64,13 @@ public MenuController(final Stage stage) // Craft de la roche à partir de 3 pierres this.lexique4.addEventFilter(Event.ANY, ev -> { if (ev.getEventType().getName().equalsIgnoreCase("MOUSE_PRESSED")) { - System.out.println("click"); - int i = this.player.getInventory().get().size()-1; - while (i > 0 && !(this.player.getInventory().get().get(i).getItem() instanceof Stone) && this.player.getInventory().get().get(i).getNbItems() > 2) + while (i > 0 && !(this.player.getInventory().get().get(i).getItem() instanceof Stone) && this.player.getInventory().get().get(i).getNbItems() >= Rock.STONE_LOOTS) i--; Stack stack = this.player.getInventory().get().get(i); - System.out.println(stack.getItem()); if (stack.getItem() instanceof Stone) { - for (int j = 0; j < 3; j++) + for (int j = 0; j < Rock.STONE_LOOTS; j++) stack.remove(); this.player.pickup(new Rock(this.environment)); } diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/Rock.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/Rock.java index 336740a..ddb3741 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/Rock.java +++ b/src/main/java/fr/sae/terraria/modele/entities/blocks/Rock.java @@ -19,6 +19,7 @@ public class Rock extends Block implements StowableObjectType, CollideObjectType, PlaceableObjectType { public static final int BREAK_RESISTANCE = 5; + public static final int STONE_LOOTS = 3; private final Environment environment; From b60784cf3a89f7c69595b9147f2c6f87393b7483 Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Sun, 12 Jun 2022 19:43:20 +0200 Subject: [PATCH 44/97] Refonte complete du code --- .../terraria/controller/MenuController.java | 6 +- .../sae/terraria/modele/GenerateEntity.java | 17 ++--- .../java/fr/sae/terraria/modele/TileMaps.java | 14 ++-- .../java/fr/sae/terraria/modele/TileSet.java | 20 ++++++ .../sae/terraria/modele/entities/Rabbit.java | 3 +- .../modele/entities/blocks/Block.java | 2 + .../terraria/modele/entities/blocks/Dirt.java | 12 ++-- .../terraria/modele/entities/blocks/Rock.java | 14 ++-- .../modele/entities/blocks/TallGrass.java | 13 ++-- .../terraria/modele/entities/blocks/Tree.java | 4 +- .../modele/entities/entity/EntityMovable.java | 36 ++++++----- .../terraria/modele/entities/items/Coal.java | 4 -- .../terraria/modele/entities/items/Fiber.java | 4 -- .../terraria/modele/entities/items/Iron.java | 4 -- .../terraria/modele/entities/items/Item.java | 18 +++++- .../terraria/modele/entities/items/Meat.java | 3 +- .../terraria/modele/entities/items/Silex.java | 4 -- .../terraria/modele/entities/items/Stone.java | 4 -- .../terraria/modele/entities/items/Vodka.java | 3 +- .../terraria/modele/entities/items/Wood.java | 3 - .../modele/entities/player/Player.java | 5 +- .../entities/player/inventory/Stack.java | 54 ++++++++-------- .../java/fr/sae/terraria/vue/LightView.java | 3 +- .../fr/sae/terraria/vue/TileMapsView.java | 64 ++++++++----------- .../sae/terraria/vue/hud/InventoryView.java | 33 +++++----- .../terraria/vue/hud/ItemSelectedView.java | 34 +++++----- src/main/java/module-info.java | 2 +- .../modele/entities/player/PlayerTest.java | 6 +- 28 files changed, 200 insertions(+), 189 deletions(-) create mode 100644 src/main/java/fr/sae/terraria/modele/TileSet.java delete mode 100644 src/main/java/fr/sae/terraria/modele/entities/items/Coal.java delete mode 100644 src/main/java/fr/sae/terraria/modele/entities/items/Fiber.java delete mode 100644 src/main/java/fr/sae/terraria/modele/entities/items/Iron.java delete mode 100644 src/main/java/fr/sae/terraria/modele/entities/items/Silex.java delete mode 100644 src/main/java/fr/sae/terraria/modele/entities/items/Stone.java delete mode 100644 src/main/java/fr/sae/terraria/modele/entities/items/Wood.java diff --git a/src/main/java/fr/sae/terraria/controller/MenuController.java b/src/main/java/fr/sae/terraria/controller/MenuController.java index f567540..d8334c7 100644 --- a/src/main/java/fr/sae/terraria/controller/MenuController.java +++ b/src/main/java/fr/sae/terraria/controller/MenuController.java @@ -3,7 +3,7 @@ import fr.sae.terraria.Terraria; import fr.sae.terraria.modele.Environment; import fr.sae.terraria.modele.entities.blocks.Rock; -import fr.sae.terraria.modele.entities.items.Stone; +import fr.sae.terraria.modele.entities.items.Item; import fr.sae.terraria.modele.entities.player.Player; import fr.sae.terraria.modele.entities.player.inventory.Stack; import javafx.animation.Animation; @@ -65,11 +65,11 @@ public MenuController(final Stage stage) this.lexique4.addEventFilter(Event.ANY, ev -> { if (ev.getEventType().getName().equalsIgnoreCase("MOUSE_PRESSED")) { int i = this.player.getInventory().get().size()-1; - while (i > 0 && !(this.player.getInventory().get().get(i).getItem() instanceof Stone) && this.player.getInventory().get().get(i).getNbItems() >= Rock.STONE_LOOTS) + while (i > 0 && !(this.player.getInventory().get().get(i).getItem().equals(Item.STONE)) && this.player.getInventory().get().get(i).getNbItems() >= Rock.STONE_LOOTS) i--; Stack stack = this.player.getInventory().get().get(i); - if (stack.getItem() instanceof Stone) { + if (stack.getItem() instanceof Item && stack.getItem().equals(Item.STONE)) { for (int j = 0; j < Rock.STONE_LOOTS; j++) stack.remove(); this.player.pickup(new Rock(this.environment)); diff --git a/src/main/java/fr/sae/terraria/modele/GenerateEntity.java b/src/main/java/fr/sae/terraria/modele/GenerateEntity.java index 84b67bb..50301a0 100644 --- a/src/main/java/fr/sae/terraria/modele/GenerateEntity.java +++ b/src/main/java/fr/sae/terraria/modele/GenerateEntity.java @@ -43,17 +43,17 @@ public class GenerateEntity private static void generateAnEntity(Environment environment, SpawnableObjectType e, int whenSpawn, double spawnRate) { List<Entity> entities = environment.getEntities(); - TileMaps maps = environment.getTileMaps(); + TileMaps tileMaps = environment.getTileMaps(); int widthTile = environment.widthTile; int heightTile = environment.heightTile; int ticks = environment.getTicks(); // Fréquence d'apparition if (ticks%whenSpawn == 0) - for (int y = 0; y < maps.getHeight(); y++) + for (int y = 0; y < tileMaps.getHeight(); y++) // Est-ce que l'arbre doit spawn sur ce 'y' if (Math.random() < spawnRate) { - List<Integer> locFloorsOnAxisX = findFloors(maps, y); + List<Integer> locFloorsOnAxisX = findFloors(tileMaps, y); // Si il y a du sol sur la ligne if (!locFloorsOnAxisX.isEmpty()) { int onWhichFloor = random.nextInt(locFloorsOnAxisX.size()); @@ -61,7 +61,7 @@ private static void generateAnEntity(Environment environment, SpawnableObjectTyp int xEntity = targetFloor * widthTile; int yEntity = ((y == 0) ? y : (y - 1)) * heightTile; // Verifies au cas où si le tile au-dessus de lui est bien une casse vide (Du ciel) - if (maps.getTile(targetFloor, y - 1) == TileMaps.SKY) { + if (tileMaps.isSkyTile(targetFloor, y-1)) { for (Entity entity : entities) // Une entité est déjà present ? Il ne le génère pas et arrête complétement la fonction if (xEntity == entity.getX() && yEntity == entity.getY()) @@ -76,15 +76,12 @@ private static void generateAnEntity(Environment environment, SpawnableObjectTyp } /** Range les positions du sol sur la ligne 'y' */ - private static List<Integer> findFloors(TileMaps maps, int y) + private static List<Integer> findFloors(TileMaps tileMaps, int y) { List<Integer> localisation = new ArrayList<>(); - for (int x = 0; x < maps.getWidth(); x++) { - int targetTile = maps.getTile(x, y); - - if (targetTile == TileMaps.FLOOR_TOP || targetTile == TileMaps.FLOOR_RIGHT || targetTile == TileMaps.FLOOR_LEFT) + for (int x = 0; x < tileMaps.getWidth(); x++) + if (tileMaps.isFloorTopTile(x, y) || tileMaps.isFloorRightTile(x, y) || tileMaps.isFloorLeftTile(x, y)) localisation.add(x); - } return localisation; } diff --git a/src/main/java/fr/sae/terraria/modele/TileMaps.java b/src/main/java/fr/sae/terraria/modele/TileMaps.java index 4009aad..0479e4c 100644 --- a/src/main/java/fr/sae/terraria/modele/TileMaps.java +++ b/src/main/java/fr/sae/terraria/modele/TileMaps.java @@ -16,14 +16,7 @@ */ public class TileMaps { - // Constantes public static final int TILE_DEFAULT_SIZE = 16; - public static final int SKY = 0; - public static final int STONE = 1; - public static final int DIRT = 2; - public static final int FLOOR_TOP = 3; - public static final int FLOOR_LEFT = 4; - public static final int FLOOR_RIGHT = 5; // Qui concerne la carte private int[][] maps; @@ -93,6 +86,13 @@ public void load(final String path) } catch (Exception e) { e.printStackTrace(); } } + public boolean isDirtTile(double x, double y) { return this.getTile((int) x, (int) y) == TileSet.DIRT.ordinal(); } + public boolean isSkyTile(double x, double y) { return this.getTile((int) x, (int) y) == TileSet.SKY.ordinal(); } + public boolean isRockTile(double x, double y) { return this.getTile((int) x, (int) y) == TileSet.ROCK.ordinal(); } + public boolean isFloorTopTile(double x, double y) { return this.getTile((int) x, (int) y) == TileSet.FLOOR_TOP.ordinal(); } + public boolean isFloorRightTile(double x, double y) { return this.getTile((int) x, (int) y) == TileSet.FLOOR_RIGHT.ordinal(); } + public boolean isFloorLeftTile(double x, double y) { return this.getTile((int) x, (int) y) == TileSet.FLOOR_LEFT.ordinal(); } + public int getHeight() { return this.maps.length; } public int getWidth() { return this.maps[0].length; } diff --git a/src/main/java/fr/sae/terraria/modele/TileSet.java b/src/main/java/fr/sae/terraria/modele/TileSet.java new file mode 100644 index 0000000..8457896 --- /dev/null +++ b/src/main/java/fr/sae/terraria/modele/TileSet.java @@ -0,0 +1,20 @@ +package fr.sae.terraria.modele; + + +public enum TileSet +{ + SKY, + ROCK, + DIRT, + FLOOR_TOP, + FLOOR_LEFT, + FLOOR_RIGHT; + + + public static boolean isSkyTile(TileSet item) { return item == TileSet.SKY; } + public static boolean isRockTile(TileSet item) { return item == TileSet.ROCK; } + public static boolean isDirtTile(TileSet item) { return item == TileSet.DIRT; } + public static boolean isFloorTopTile(TileSet item) { return item == TileSet.FLOOR_TOP; } + public static boolean isFloorRightTile(TileSet item) { return item == TileSet.FLOOR_RIGHT; } + public static boolean isFloorLeftTile(TileSet item) { return item == TileSet.FLOOR_LEFT; } +} diff --git a/src/main/java/fr/sae/terraria/modele/entities/Rabbit.java b/src/main/java/fr/sae/terraria/modele/entities/Rabbit.java index c05e15b..e0bc584 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/Rabbit.java +++ b/src/main/java/fr/sae/terraria/modele/entities/Rabbit.java @@ -59,6 +59,7 @@ public Rabbit(final Environment environment, int x, int y) @Override public void move() { + TileMaps tileMaps = this.environment.getTileMaps(); this.setX(this.x.get() + this.getOffsetMoveX() * this.velocity); if (this.isIDLEonY() && this.isMoving()) { @@ -66,7 +67,7 @@ public Rabbit(final Environment environment, int x, int y) int yProbablyVoid = (int) (getY() / environment.heightTile); // Si du vide risque d'y avoir lors de son déplacement - if (environment.getTileMaps().getTile(xProbablyVoid, yProbablyVoid + 2) == TileMaps.SKY) { + if (tileMaps.isSkyTile(xProbablyVoid, yProbablyVoid+2)) { this.offset[0] = (-1) * this.getOffsetMoveX(); } else { boolean mustJump = this.environment.getTicks() % Rabbit.JUMP_FREQUENCY == 0; diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java index 74c9251..4939e52 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java +++ b/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java @@ -41,4 +41,6 @@ protected void breakAnimation(final Environment environment, final Block block, } @Override public abstract void updates(); + + public static boolean isDirt(Object obj) { return obj instanceof Dirt; } } diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/Dirt.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/Dirt.java index cb22393..266e52a 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/Dirt.java +++ b/src/main/java/fr/sae/terraria/modele/entities/blocks/Dirt.java @@ -2,10 +2,12 @@ import fr.sae.terraria.modele.Environment; import fr.sae.terraria.modele.TileMaps; +import fr.sae.terraria.modele.TileSet; import fr.sae.terraria.modele.entities.entity.CollideObjectType; import fr.sae.terraria.modele.entities.entity.Entity; import fr.sae.terraria.modele.entities.entity.PlaceableObjectType; import fr.sae.terraria.modele.entities.entity.StowableObjectType; +import fr.sae.terraria.modele.entities.items.Item; import fr.sae.terraria.modele.entities.player.Player; import fr.sae.terraria.modele.entities.player.inventory.Inventory; @@ -20,7 +22,7 @@ public class Dirt extends Block implements StowableObjectType, CollideObjectType private final double xOrigin; private final double yOrigin; - private int typeOfFloor; + private TileSet typeOfFloor; public Dirt(Environment environment, int x, int y) @@ -48,7 +50,7 @@ public Dirt(Environment environment, int x, int y) int yIndexTile = (int) (getY()/environment.heightTile); int xIndexTile = (int) (getX()/environment.widthTile); - this.environment.getTileMaps().setTile(TileMaps.SKY, yIndexTile, xIndexTile); + this.environment.getTileMaps().setTile(TileSet.SKY.ordinal(), yIndexTile, xIndexTile); this.environment.getEntities().remove(this); this.environment.getBlocks().remove(this); } @@ -69,13 +71,13 @@ public Dirt(Environment environment, int x, int y) if (!Objects.isNull(player.getStackSelected())) inventory.get().get(inventory.getPosCursor()).remove(); - this.environment.getTileMaps().setTile(TileMaps.DIRT, y, x); + this.environment.getTileMaps().setTile(TileSet.DIRT.ordinal(), y, x); this.environment.getEntities().add(entity); this.environment.getBlocks().add((Dirt) entity); } - public int getTypeOfFloor() { return this.typeOfFloor; } + public TileSet getTypeOfFloor() { return this.typeOfFloor; } - public void setTypeOfFloor(int type) { this.typeOfFloor = type; } + public void setTypeOfFloor(TileSet type) { this.typeOfFloor = type; } } diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/Rock.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/Rock.java index ddb3741..53c5aed 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/Rock.java +++ b/src/main/java/fr/sae/terraria/modele/entities/blocks/Rock.java @@ -2,11 +2,11 @@ import fr.sae.terraria.modele.Environment; import fr.sae.terraria.modele.TileMaps; +import fr.sae.terraria.modele.TileSet; import fr.sae.terraria.modele.entities.entity.CollideObjectType; -import fr.sae.terraria.modele.entities.entity.Entity; import fr.sae.terraria.modele.entities.entity.PlaceableObjectType; import fr.sae.terraria.modele.entities.entity.StowableObjectType; -import fr.sae.terraria.modele.entities.items.Stone; +import fr.sae.terraria.modele.entities.items.Item; import fr.sae.terraria.modele.entities.player.Player; import fr.sae.terraria.modele.entities.player.inventory.Inventory; import fr.sae.terraria.modele.entities.player.inventory.Stack; @@ -53,11 +53,11 @@ public Rock(Environment environment, int x, int y) Player player = this.environment.getPlayer(); if (this.getPv() <= 0) { for (int i = 0; i < 3; i++) - player.pickup(new Stone()); + player.pickup(Item.STONE); int yIndexTile = (int) (getY()/this.environment.heightTile); int xIndexTile = (int) (getX()/this.environment.widthTile); - this.environment.getTileMaps().setTile(TileMaps.SKY, yIndexTile, xIndexTile); + this.environment.getTileMaps().setTile(TileSet.SKY.ordinal(), yIndexTile, xIndexTile); this.environment.getEntities().remove(this); this.environment.getBlocks().remove(this); } @@ -78,7 +78,7 @@ public Rock(Environment environment, int x, int y) int widthTile = this.environment.widthTile; int heightTile = this.environment.heightTile; - Entity entity = new Rock(this.environment, x*widthTile, y*heightTile); + Block entity = new Rock(this.environment, x*widthTile, y*heightTile); entity.setRect(widthTile, heightTile); Player player = this.environment.getPlayer(); @@ -86,8 +86,8 @@ public Rock(Environment environment, int x, int y) if (!Objects.isNull(player.getStackSelected())) inventory.get().get(inventory.getPosCursor()).remove(); - this.environment.getTileMaps().setTile(TileMaps.STONE, y, x); + this.environment.getTileMaps().setTile(TileSet.ROCK.ordinal(), y, x); this.environment.getEntities().add(entity); - this.environment.getBlocks().add((Block) entity); + this.environment.getBlocks().add(entity); } } diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/TallGrass.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/TallGrass.java index 034f1e3..da4db4f 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/TallGrass.java +++ b/src/main/java/fr/sae/terraria/modele/entities/blocks/TallGrass.java @@ -5,7 +5,7 @@ import fr.sae.terraria.modele.entities.entity.Entity; import fr.sae.terraria.modele.entities.entity.ReproductiveObjectType; import fr.sae.terraria.modele.entities.entity.SpawnableObjectType; -import fr.sae.terraria.modele.entities.items.Fiber; +import fr.sae.terraria.modele.entities.items.Item; import fr.sae.terraria.modele.entities.items.Vodka; import javafx.beans.property.DoubleProperty; import javafx.beans.property.SimpleDoubleProperty; @@ -51,7 +51,7 @@ public TallGrass(Environment environment, int x, int y) Environment.playSound("sound/cut.wav", false); for (int loot = (int) (Math.random()*3)+1; loot < LOOTS_FIBRE_MAX; loot++) - this.environment.getPlayer().pickup(new Fiber()); + this.environment.getPlayer().pickup(Item.FIBER); boolean mustDropVodka = Math.random() < Vodka.DROP_RATE; if (mustDropVodka) @@ -68,11 +68,12 @@ public TallGrass(Environment environment, int x, int y) boolean tallGrassMustReproduce = environment.getTicks()%TallGrass.REPRODUCTION_RATE == 0; if (tallGrassMustReproduce) { + final TileMaps tileMaps = environment.getTileMaps(); List<Entity> entities = environment.getEntities(); int heightTile = environment.heightTile; int widthTile = environment.widthTile; - int widthMaps = environment.getTileMaps().getWidth(); - int heightMaps = environment.getTileMaps().getHeight(); + int widthMaps = tileMaps.getWidth(); + int heightMaps = tileMaps.getHeight(); int x = -1; int y = (int) (getY()/heightTile)+1; @@ -98,13 +99,13 @@ else if (rightIsAvailable) // La place sur la carte boolean isntOutTheMap = (x >= 0 && x < widthMaps) && (y >= 0 && y < heightMaps); if (isntOutTheMap) { - boolean dontHaveTile = environment.getTileMaps().getTile(x, y) != TileMaps.SKY; + boolean dontHaveTile = !tileMaps.isSkyTile(x, y); if (dontHaveTile) { int xTallGrassChildren = (int) ((left == 0) ? (getX() - widthTile) : (getX() + widthTile)); int yTallGrassChildren = (int) getY(); - TallGrass tallGrassChildren = new TallGrass(this.environment, xTallGrassChildren, yTallGrassChildren); + TallGrass tallGrassChildren = new TallGrass(environment, xTallGrassChildren, yTallGrassChildren); tallGrassChildren.setRect(widthTile, heightTile); children.add(tallGrassChildren); } diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/Tree.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/Tree.java index f2180f8..42d9193 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/Tree.java +++ b/src/main/java/fr/sae/terraria/modele/entities/blocks/Tree.java @@ -2,7 +2,7 @@ import fr.sae.terraria.modele.Environment; import fr.sae.terraria.modele.entities.entity.SpawnableObjectType; -import fr.sae.terraria.modele.entities.items.Wood; +import fr.sae.terraria.modele.entities.items.Item; public class Tree extends Block implements SpawnableObjectType @@ -26,7 +26,7 @@ public Tree(Environment environment, int x, int y) @Override public void breaks() { // Environment.playSound("sound/grassyStep.wav", false); - this.environment.getPlayer().pickup(new Wood()); + this.environment.getPlayer().pickup(Item.WOOD); this.environment.getEntities().remove(this); this.environment.getTrees().remove(this); } diff --git a/src/main/java/fr/sae/terraria/modele/entities/entity/EntityMovable.java b/src/main/java/fr/sae/terraria/modele/entities/entity/EntityMovable.java index 9936d74..1f58418 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/entity/EntityMovable.java +++ b/src/main/java/fr/sae/terraria/modele/entities/entity/EntityMovable.java @@ -2,6 +2,7 @@ import fr.sae.terraria.modele.Environment; import fr.sae.terraria.modele.TileMaps; +import fr.sae.terraria.modele.TileSet; import java.util.HashMap; import java.util.Map; @@ -52,18 +53,18 @@ public Map<String, Boolean> collide(final Environment environment) int yBottom = (int) (this.getY()+getRect().getHeight()-CollideObjectType.COLLISION_TOLERANCE)/heightTile; int posX = (int) ((this.getX()+((this.offset[0] < 0) ? CollideObjectType.COLLISION_TOLERANCE : -CollideObjectType.COLLISION_TOLERANCE)) + ((this.offset[0] > 0) ? getRect().getWidth() : 0))/widthTile; - boolean footInTheVoid = tileMaps.getTile(posX, yBottom) == TileMaps.SKY; + boolean footInTheVoid = tileMaps.getTile(posX, yBottom) == TileSet.SKY.ordinal(); if (footInTheVoid) this.air = true; // Detection collision gauche droite if (this.isMoving()) { int yTop = (int) (getY()+CollideObjectType.COLLISION_TOLERANCE)/heightTile; - int futurePositionXLeft = (int) ((getX()+CollideObjectType.COLLISION_TOLERANCE)+(velocity*offset[0]))/widthTile; - int futurePositionXRight = (int) ((getX()+(-CollideObjectType.COLLISION_TOLERANCE)+(velocity*offset[0])) + (getRect().getWidth()))/widthTile; + int futurPosXLeft = (int) ((getX()+CollideObjectType.COLLISION_TOLERANCE)+(velocity*offset[0]))/widthTile; + int futurPosXRight = (int) ((getX()+(-CollideObjectType.COLLISION_TOLERANCE)+(velocity*offset[0])) + (getRect().getWidth()))/widthTile; - whereCollide.put("right", tileMaps.getTile(futurePositionXRight, yTop) != TileMaps.SKY || tileMaps.getTile(futurePositionXRight, yBottom) != TileMaps.SKY); - whereCollide.put("left", tileMaps.getTile(futurePositionXLeft, yTop) != TileMaps.SKY || tileMaps.getTile(futurePositionXLeft, yBottom) != TileMaps.SKY); + whereCollide.put("right", !tileMaps.isSkyTile(futurPosXRight, yTop) || !tileMaps.isSkyTile(futurPosXRight, yBottom)); + whereCollide.put("left", !tileMaps.isSkyTile(futurPosXLeft, yTop) || !tileMaps.isSkyTile(futurPosXLeft, yBottom)); } // Detection collision bas et haut @@ -74,28 +75,29 @@ public Map<String, Boolean> collide(final Environment environment) // Tombe if (this.isFalling()) { this.gravity.degInit = 0; - double futurePositionY = gravity.formulaOfTrajectory() ; - boolean isCollideBottom = tileMaps.getTile(xLeft, (int) (futurePositionY + this.rect.getHeight())/heightTile) != TileMaps.SKY || tileMaps.getTile(xRight, (int) (futurePositionY + CollideObjectType.COLLISION_TOLERANCE +this.rect.getHeight())/heightTile) != TileMaps.SKY; + double futurPosY = gravity.formulaOfTrajectory() ; + + boolean isCollideBottom = !tileMaps.isSkyTile(xLeft, (futurPosY + this.rect.getHeight())/heightTile) || !tileMaps.isSkyTile(xRight, (futurPosY + CollideObjectType.COLLISION_TOLERANCE +this.rect.getHeight())/heightTile); if (isCollideBottom) { this.gravity.setJumpPosInit(this); this.gravity.timer = 0; this.idleOnY(); - } else setY(futurePositionY); + } else setY(futurPosY); // Saute } else if (this.isJumping()) { - double futurePositionY = gravity.formulaOfTrajectory(); + double futurPosY = gravity.formulaOfTrajectory(); - boolean isCollideTop = tileMaps.getTile(xLeft, (int) (futurePositionY + CollideObjectType.COLLISION_TOLERANCE)/heightTile) != TileMaps.SKY || tileMaps.getTile(xRight, (int) (futurePositionY + CollideObjectType.COLLISION_TOLERANCE)/heightTile) != TileMaps.SKY; + boolean isCollideTop = !tileMaps.isSkyTile(xLeft, (futurPosY + CollideObjectType.COLLISION_TOLERANCE)/heightTile) || !tileMaps.isSkyTile(xRight, (futurPosY + CollideObjectType.COLLISION_TOLERANCE)/heightTile); // Quand le joueur monte - if (this.gravity.flightTime >= this.gravity.timer ) { + if (this.gravity.flightTime >= this.gravity.timer) { if (isCollideTop) { this.fall(); this.gravity.timer = 0; this.gravity.setJumpPosInit(this); - } else this.setY(futurePositionY); + } else this.setY(futurPosY); // Quand le joueur descends } else { - boolean isCollideBottom = tileMaps.getTile(xLeft, (int) ((futurePositionY + this.rect.getHeight()) - CollideObjectType.COLLISION_TOLERANCE)/heightTile) != TileMaps.SKY || tileMaps.getTile(xRight,(int) ((futurePositionY + this.rect.getHeight()) - CollideObjectType.COLLISION_TOLERANCE)/heightTile) != TileMaps.SKY; + boolean isCollideBottom = !tileMaps.isSkyTile(xLeft, ((futurPosY + this.rect.getHeight()) - CollideObjectType.COLLISION_TOLERANCE)/heightTile) || !tileMaps.isSkyTile(xRight, ((futurPosY + this.rect.getHeight()) - CollideObjectType.COLLISION_TOLERANCE)/heightTile); if (isCollideTop) { this.fall(); @@ -104,21 +106,21 @@ public Map<String, Boolean> collide(final Environment environment) this.gravity.timer = 0; this.idleOnY(); this.air = false; - } else this.setY(futurePositionY); + } else this.setY(futurPosY); } } } else if (this.air) { this.gravity.degInit = 0; int xLeft = (int) (getX()+CollideObjectType.COLLISION_TOLERANCE)/widthTile; int xRight = (int) (getX()-CollideObjectType.COLLISION_TOLERANCE+getRect().getWidth())/widthTile; - double futurePositionY = this.gravity.formulaOfTrajectory() + this.rect.getHeight(); + double futurPosY = this.gravity.formulaOfTrajectory() + this.rect.getHeight(); - boolean isCollideBottom = tileMaps.getTile(xLeft, (int) (futurePositionY - CollideObjectType.COLLISION_TOLERANCE)/heightTile) != TileMaps.SKY || tileMaps.getTile(xRight, (int) (futurePositionY - CollideObjectType.COLLISION_TOLERANCE)/heightTile) != TileMaps.SKY; + boolean isCollideBottom = !tileMaps.isSkyTile(xLeft, (futurPosY - CollideObjectType.COLLISION_TOLERANCE)/heightTile) || !tileMaps.isSkyTile(xRight, (futurPosY - CollideObjectType.COLLISION_TOLERANCE)/heightTile); if (isCollideBottom) { this.idleOnY(); this.air = false; this.gravity.setJumpPosInit(this); - } else setY(futurePositionY - this.rect.getHeight()); + } else setY(futurPosY - this.rect.getHeight()); } return whereCollide; diff --git a/src/main/java/fr/sae/terraria/modele/entities/items/Coal.java b/src/main/java/fr/sae/terraria/modele/entities/items/Coal.java deleted file mode 100644 index 217ff53..0000000 --- a/src/main/java/fr/sae/terraria/modele/entities/items/Coal.java +++ /dev/null @@ -1,4 +0,0 @@ -package fr.sae.terraria.modele.entities.items; - - -public class Coal extends Item { } diff --git a/src/main/java/fr/sae/terraria/modele/entities/items/Fiber.java b/src/main/java/fr/sae/terraria/modele/entities/items/Fiber.java deleted file mode 100644 index e817b90..0000000 --- a/src/main/java/fr/sae/terraria/modele/entities/items/Fiber.java +++ /dev/null @@ -1,4 +0,0 @@ -package fr.sae.terraria.modele.entities.items; - - -public class Fiber extends Item { } diff --git a/src/main/java/fr/sae/terraria/modele/entities/items/Iron.java b/src/main/java/fr/sae/terraria/modele/entities/items/Iron.java deleted file mode 100644 index 4d6796e..0000000 --- a/src/main/java/fr/sae/terraria/modele/entities/items/Iron.java +++ /dev/null @@ -1,4 +0,0 @@ -package fr.sae.terraria.modele.entities.items; - - -public class Iron extends Item { } diff --git a/src/main/java/fr/sae/terraria/modele/entities/items/Item.java b/src/main/java/fr/sae/terraria/modele/entities/items/Item.java index 31c59cf..d458bf8 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/items/Item.java +++ b/src/main/java/fr/sae/terraria/modele/entities/items/Item.java @@ -3,4 +3,20 @@ import fr.sae.terraria.modele.entities.entity.StowableObjectType; -public class Item implements StowableObjectType { } +public enum Item implements StowableObjectType +{ + COAL, + FIBER, + IRON, + SILEX, + STONE, + WOOD; + + + public static boolean isCoal(StowableObjectType obj) { return obj == Item.COAL; } + public static boolean isFiber(StowableObjectType obj) { return obj == Item.FIBER; } + public static boolean isIron(StowableObjectType obj) { return obj == Item.IRON; } + public static boolean isStone(StowableObjectType obj) { return obj == Item.STONE; } + public static boolean isSilex(StowableObjectType obj) { return obj == Item.SILEX; } + public static boolean isWood(StowableObjectType obj) { return obj == Item.WOOD; } +} diff --git a/src/main/java/fr/sae/terraria/modele/entities/items/Meat.java b/src/main/java/fr/sae/terraria/modele/entities/items/Meat.java index dfafc11..831aeb4 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/items/Meat.java +++ b/src/main/java/fr/sae/terraria/modele/entities/items/Meat.java @@ -2,10 +2,11 @@ import fr.sae.terraria.modele.Environment; import fr.sae.terraria.modele.entities.entity.ConsumableObjectType; +import fr.sae.terraria.modele.entities.entity.StowableObjectType; import fr.sae.terraria.modele.entities.player.Player; -public class Meat extends Item implements ConsumableObjectType +public class Meat implements ConsumableObjectType, StowableObjectType { private final Environment environment; diff --git a/src/main/java/fr/sae/terraria/modele/entities/items/Silex.java b/src/main/java/fr/sae/terraria/modele/entities/items/Silex.java deleted file mode 100644 index 0efd689..0000000 --- a/src/main/java/fr/sae/terraria/modele/entities/items/Silex.java +++ /dev/null @@ -1,4 +0,0 @@ -package fr.sae.terraria.modele.entities.items; - - -public class Silex extends Item { } diff --git a/src/main/java/fr/sae/terraria/modele/entities/items/Stone.java b/src/main/java/fr/sae/terraria/modele/entities/items/Stone.java deleted file mode 100644 index c7eed84..0000000 --- a/src/main/java/fr/sae/terraria/modele/entities/items/Stone.java +++ /dev/null @@ -1,4 +0,0 @@ -package fr.sae.terraria.modele.entities.items; - - -public class Stone extends Item { } diff --git a/src/main/java/fr/sae/terraria/modele/entities/items/Vodka.java b/src/main/java/fr/sae/terraria/modele/entities/items/Vodka.java index 3e83262..de241fa 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/items/Vodka.java +++ b/src/main/java/fr/sae/terraria/modele/entities/items/Vodka.java @@ -2,6 +2,7 @@ import fr.sae.terraria.modele.Environment; import fr.sae.terraria.modele.entities.entity.ConsumableObjectType; +import fr.sae.terraria.modele.entities.entity.StowableObjectType; import fr.sae.terraria.modele.entities.player.Player; import fr.sae.terraria.modele.entities.player.inventory.Inventory; @@ -11,7 +12,7 @@ * <h2><u>Description:</u></h2> * <p>Se drop lorsque le joueur casse des hautes herbes et une fois bu, l'écran sera troublé</p> */ -public class Vodka extends Item implements ConsumableObjectType +public class Vodka implements ConsumableObjectType, StowableObjectType { public static final int DRUNK_EFFECT_TIME = 600; public static final double DROP_RATE = .1; diff --git a/src/main/java/fr/sae/terraria/modele/entities/items/Wood.java b/src/main/java/fr/sae/terraria/modele/entities/items/Wood.java deleted file mode 100644 index 1a43066..0000000 --- a/src/main/java/fr/sae/terraria/modele/entities/items/Wood.java +++ /dev/null @@ -1,3 +0,0 @@ -package fr.sae.terraria.modele.entities.items; - -public class Wood extends Item { } diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java index e191aef..691a029 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java @@ -131,11 +131,12 @@ public void interactWithBlock(final Rectangle2D rectangle) public void placeBlock(int xBlock, int yBlock) { + TileMaps tileMaps = this.environment.getTileMaps(); boolean haveAnItemOnHand = !Objects.isNull(this.getStackSelected()); - boolean goodPlace = this.environment.getTileMaps().getTile(xBlock, yBlock) == TileMaps.SKY; + boolean goodPlace = tileMaps.isSkyTile(xBlock, yBlock); if (haveAnItemOnHand && goodPlace) { - if (!(this.getStackSelected().getItem() instanceof PlaceableObjectType) && !(this.getStackSelected() instanceof ConsumableObjectType)) + if (!(this.getStackSelected().getItem() instanceof PlaceableObjectType) && !(this.getStackSelected().getItem() instanceof ConsumableObjectType)) return; if (this.getStackSelected().getItem() instanceof PlaceableObjectType) diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java index 9a62beb..2d50628 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java @@ -36,45 +36,45 @@ public Stack() this.nbItems = new SimpleIntegerProperty(1); } - public boolean isSameItem(StowableObjectType object) + public boolean isSameItem(StowableObjectType obj) { - if (object instanceof Dirt && this.item instanceof Dirt) + if (obj instanceof Dirt && this.item instanceof Dirt) return true; - else if (object instanceof Rock && this.item instanceof Rock) + else if (obj instanceof Rock && this.item instanceof Rock) return true; - else if (object instanceof TallGrass && this.item instanceof TallGrass) + else if (obj instanceof TallGrass && this.item instanceof TallGrass) return true; - else if (object instanceof Torch && this.item instanceof Torch) + else if (obj instanceof Torch && this.item instanceof Torch) return true; - else if (object instanceof Coal && this.item instanceof Coal) + else if (obj instanceof Meat && this.item instanceof Meat) return true; - else if (object instanceof Fiber && this.item instanceof Fiber) + else if (obj instanceof Axe && this.item instanceof Axe) return true; - else if (object instanceof Iron && this.item instanceof Iron) + else if (obj instanceof Vodka && this.item instanceof Vodka) return true; - else if (object instanceof Meat && this.item instanceof Meat) + else if (obj instanceof Bow && this.item instanceof Bow) return true; - else if (object instanceof Stone && this.item instanceof Stone) + else if (obj instanceof Pickaxe && this.item instanceof Pickaxe) return true; - else if (object instanceof Silex && this.item instanceof Silex) + else if (obj instanceof Sword && this.item instanceof Sword) return true; - else if (object instanceof Wood && this.item instanceof Wood) + else if (obj instanceof Arrow && this.item instanceof Arrow) return true; - else if (object instanceof Axe && this.item instanceof Axe) - return true; - else if (object instanceof Vodka && this.item instanceof Vodka) - return true; - else if (object instanceof Bow && this.item instanceof Bow) - return true; - else if (object instanceof Pickaxe && this.item instanceof Pickaxe) - return true; - else if (object instanceof Sword && this.item instanceof Sword) - return true; - else if (object instanceof Arrow && this.item instanceof Arrow) - return true; - else if (object instanceof Sword && this.item instanceof Sword) - return true; - else return false; + else if (obj instanceof Item) { + if (Item.isCoal(obj) && Item.isCoal(this.item)) + return true; + else if (Item.isFiber(obj) && Item.isFiber(this.item)) + return true; + else if (Item.isIron(obj) && Item.isIron(this.item)) + return true; + else if (Item.isStone(obj) && Item.isStone(this.item)) + return true; + else if (Item.isSilex(obj) && Item.isSilex(this.item)) + return true; + else if (Item.isWood(obj) && Item.isWood(this.item)) + return true; + else return false; + } else return false; } public IntegerProperty nbItemsProperty() { return this.nbItems; } diff --git a/src/main/java/fr/sae/terraria/vue/LightView.java b/src/main/java/fr/sae/terraria/vue/LightView.java index 52e3e02..0055693 100644 --- a/src/main/java/fr/sae/terraria/vue/LightView.java +++ b/src/main/java/fr/sae/terraria/vue/LightView.java @@ -3,6 +3,7 @@ import fr.sae.terraria.modele.Clock; import fr.sae.terraria.modele.Environment; import fr.sae.terraria.modele.TileMaps; +import fr.sae.terraria.modele.TileSet; import fr.sae.terraria.modele.entities.blocks.Torch; import javafx.collections.ListChangeListener; import javafx.collections.ObservableList; @@ -103,7 +104,7 @@ private int fullStoneArea() column = 0; while (column < this.tileMaps.getWidth() && !found && !wrongLine) { - if (this.tileMaps.getTile(column, line) != TileMaps.STONE) + if (this.tileMaps.isRockTile(column, line)) wrongLine = true; else if (column == this.tileMaps.getWidth() - 1) found = true; diff --git a/src/main/java/fr/sae/terraria/vue/TileMapsView.java b/src/main/java/fr/sae/terraria/vue/TileMapsView.java index 9086a30..fdf25ae 100644 --- a/src/main/java/fr/sae/terraria/vue/TileMapsView.java +++ b/src/main/java/fr/sae/terraria/vue/TileMapsView.java @@ -2,6 +2,7 @@ import fr.sae.terraria.modele.Environment; import fr.sae.terraria.modele.TileMaps; +import fr.sae.terraria.modele.TileSet; import fr.sae.terraria.modele.entities.Rabbit; import fr.sae.terraria.modele.entities.Slime; import fr.sae.terraria.modele.entities.blocks.*; @@ -114,16 +115,15 @@ private void updatesBlocksView(ListChangeListener.Change<? extends Block> c) blockView.setImage(null); if (block instanceof Dirt) { - if (((Dirt) block).getTypeOfFloor() == TileMaps.FLOOR_TOP) + Dirt dirt = (Dirt) block; + if (TileSet.isFloorTopTile(dirt.getTypeOfFloor())) blockView.setImage(this.floorTopImg); - else if (((Dirt) block).getTypeOfFloor() == TileMaps.FLOOR_LEFT) + else if (TileSet.isFloorLeftTile(dirt.getTypeOfFloor())) blockView.setImage(this.floorLeftImg); - else if (((Dirt) block).getTypeOfFloor() == TileMaps.FLOOR_RIGHT) + else if (TileSet.isFloorRightTile(dirt.getTypeOfFloor())) blockView.setImage(this.floorRightImg); - else if (((Dirt) block).getTypeOfFloor() == TileMaps.DIRT) + else if (TileSet.isDirtTile(dirt.getTypeOfFloor())) blockView.setImage(this.dirtImg); - else if (((Dirt) block).getTypeOfFloor() == 0) - blockView.setImage(this.floorTopImg); } else if (block instanceof Rock) { blockView.setImage(this.stoneImg); } else if (block instanceof TallGrass) { @@ -277,43 +277,31 @@ private void updatesTreeView(ListChangeListener.Change<? extends Tree> c) } - /** Affiche une erreur si un developer a fait une erreur lors de la saisie d'un tile dans le fichier .json */ - private void errorTile(final int tile) { if (tile != TileMaps.SKY) System.out.println("Le tile '" + tile + "' n'est pas reconnu."); } - /** Decompose la carte pour afficher une à une les tiles à l'écran */ public void displayMaps(TileMaps tiles) { for (int y = 0; y < tiles.getHeight() ; y++) for (int x = 0 ; x < tiles.getWidth() ; x++) - switch (tiles.getTile(x, y)) { - case TileMaps.STONE: - Rock rockEntity = new Rock(this.environment, x*this.tileWidth, y*this.tileHeight); - rockEntity.setRect(this.tileWidth, this.tileHeight); - - this.environment.getEntities().add(rockEntity); - this.environment.getBlocks().add(rockEntity); - break; - case TileMaps.DIRT: - Dirt dirtSprite = new Dirt(this.environment, x*this.tileWidth, y*this.tileHeight); - dirtSprite.setTypeOfFloor(TileMaps.DIRT); - dirtSprite.setRect(this.tileWidth, this.tileHeight); - - this.environment.getEntities().add(dirtSprite); - this.environment.getBlocks().add(dirtSprite); - break; - case TileMaps.FLOOR_TOP: - case TileMaps.FLOOR_LEFT: - case TileMaps.FLOOR_RIGHT: - Dirt floorEntity = new Dirt(this.environment, x*this.tileWidth, y*this.tileHeight); - floorEntity.setTypeOfFloor(tiles.getTile(x, y)); - floorEntity.setRect(this.tileWidth, this.tileHeight); - - this.environment.getEntities().add(floorEntity); - this.environment.getBlocks().add(floorEntity); - break; - default: - this.errorTile(tiles.getTile(x, y)); - break; + if (tiles.isRockTile(x, y)) { + Rock rockEntity = new Rock(this.environment, x*this.tileWidth, y*this.tileHeight); + rockEntity.setRect(this.tileWidth, this.tileHeight); + + this.environment.getEntities().add(rockEntity); + this.environment.getBlocks().add(rockEntity); + } else if (tiles.isDirtTile(x, y)) { + Dirt dirtSprite = new Dirt(this.environment, x*this.tileWidth, y*this.tileHeight); + dirtSprite.setTypeOfFloor(TileSet.DIRT); + dirtSprite.setRect(this.tileWidth, this.tileHeight); + + this.environment.getEntities().add(dirtSprite); + this.environment.getBlocks().add(dirtSprite); + } else if (tiles.isFloorTopTile(x, y) || tiles.isFloorLeftTile(x, y) || tiles.isFloorRightTile(x, y)) { + Dirt floorEntity = new Dirt(this.environment, x*this.tileWidth, y*this.tileHeight); + floorEntity.setTypeOfFloor((tiles.isFloorTopTile(x, y)) ? TileSet.FLOOR_TOP : (tiles.isFloorRightTile(x, y)) ? TileSet.FLOOR_RIGHT : TileSet.FLOOR_LEFT); + floorEntity.setRect(this.tileWidth, this.tileHeight); + + this.environment.getEntities().add(floorEntity); + this.environment.getBlocks().add(floorEntity); } } } diff --git a/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java b/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java index fc13085..bba30c6 100644 --- a/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java +++ b/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java @@ -3,10 +3,7 @@ import fr.sae.terraria.Terraria; import fr.sae.terraria.modele.TileMaps; import fr.sae.terraria.modele.entities.Arrow; -import fr.sae.terraria.modele.entities.blocks.Dirt; -import fr.sae.terraria.modele.entities.blocks.Rock; -import fr.sae.terraria.modele.entities.blocks.TallGrass; -import fr.sae.terraria.modele.entities.blocks.Torch; +import fr.sae.terraria.modele.entities.blocks.*; import fr.sae.terraria.modele.entities.entity.StowableObjectType; import fr.sae.terraria.modele.entities.items.*; import fr.sae.terraria.modele.entities.player.inventory.Inventory; @@ -102,7 +99,7 @@ private void displayItemIntoInventoryBar() Stack stack = c.getAddedSubList().get(0); StowableObjectType item = stack.getItem(); - if (item instanceof Dirt) + if (Block.isDirt(item)) view.setImage(View.loadAnImage("tiles/floor-top.png", itemInventoryWidth, itemInventoryHeight)); else if (item instanceof Rock) view.setImage(View.loadAnImage("tiles/rock-fill.png", itemInventoryWidth, itemInventoryHeight)); @@ -110,20 +107,8 @@ else if (item instanceof TallGrass) view.setImage(View.loadAnImage("tiles/tall-grass.png.png", itemInventoryWidth, itemInventoryHeight)); else if (item instanceof Torch) view.setImage(View.loadAnImage("tiles/torch.png", itemInventoryWidth, itemInventoryHeight)); - else if (item instanceof Coal) - view.setImage(View.loadAnImage("loots/coal.png", itemInventoryWidth, itemInventoryHeight)); - else if (item instanceof Fiber) - view.setImage(View.loadAnImage("loots/fiber.png", itemInventoryWidth, itemInventoryHeight)); - else if (item instanceof Iron) - view.setImage(View.loadAnImage("loots/iron.png", itemInventoryWidth, itemInventoryHeight)); else if (item instanceof Meat) view.setImage(View.loadAnImage("loots/meat.png", itemInventoryWidth, itemInventoryHeight)); - else if (item instanceof Stone) - view.setImage(View.loadAnImage("loots/pierre.png", itemInventoryWidth, itemInventoryHeight)); - else if (item instanceof Silex) - view.setImage(View.loadAnImage("loots/silex.png", itemInventoryWidth, itemInventoryHeight)); - else if (item instanceof Wood) - view.setImage(View.loadAnImage("loots/wood.png", itemInventoryWidth, itemInventoryHeight)); else if (item instanceof Axe) view.setImage(null); // TODO else if (item instanceof Bow) @@ -136,6 +121,20 @@ else if (item instanceof Arrow) view.setImage(null); // TODO else if (item instanceof Vodka) view.setImage(View.loadAnImage("loots/vodka.png", itemInventoryWidth,itemInventoryHeight)); + else if (item instanceof Item) { + if (Item.isCoal(item)) + view.setImage(View.loadAnImage("loots/coal.png", itemInventoryWidth, itemInventoryHeight)); + else if (Item.isFiber(item)) + view.setImage(View.loadAnImage("loots/fiber.png", itemInventoryWidth, itemInventoryHeight)); + else if (Item.isIron(item)) + view.setImage(View.loadAnImage("loots/iron.png", itemInventoryWidth, itemInventoryHeight)); + else if (Item.isStone(item)) + view.setImage(View.loadAnImage("loots/pierre.png", itemInventoryWidth, itemInventoryHeight)); + else if (Item.isSilex(item)) + view.setImage(View.loadAnImage("loots/silex.png", itemInventoryWidth, itemInventoryHeight)); + else if (Item.isWood(item)) + view.setImage(View.loadAnImage("loots/wood.png", itemInventoryWidth, itemInventoryHeight)); + } // Actualise le nombre d'item à l'écran this.texts.get(c.getTo()-1).setText(String.valueOf(stack.getNbItems())); diff --git a/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java b/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java index 7807ce2..b96aeb2 100644 --- a/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java +++ b/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java @@ -33,7 +33,7 @@ public class ItemSelectedView private final Image coalItemImg; private final Image fibreItemImg; private final Image ironItemImg; - private final Image pierreItemImg; + private final Image rockItemImg; private final Image silexItemImg; private final Image meatItemImg; private final Image woodItemImg; @@ -57,12 +57,12 @@ public ItemSelectedView(Pane display, Player player, double scaleMultiplicatorWi this.itemSelectedImgView = new ImageView(); this.vodkaItemImg = View.loadAnImage("loots/vodka.png",widthItem,heightItem); this.dirtItemImg = View.loadAnImage("tiles/floor-top.png", widthItem, heightItem); - this.stoneItemImg = View.loadAnImage("tiles/rock-fill.png", widthItem, heightItem); + this.rockItemImg = View.loadAnImage("tiles/rock-fill.png", widthItem, heightItem); this.torchItemImg = View.loadAnImage("tiles/torch.png", widthItem, heightItem); this.coalItemImg = View.loadAnImage("loots/coal.png", widthItem, heightItem); this.fibreItemImg = View.loadAnImage("loots/fiber.png", widthItem, heightItem); this.ironItemImg = View.loadAnImage("loots/iron.png", widthItem, heightItem); - this.pierreItemImg = View.loadAnImage("loots/pierre.png", widthItem, heightItem); + this.stoneItemImg = View.loadAnImage("loots/pierre.png", widthItem, heightItem); this.silexItemImg = View.loadAnImage("loots/silex.png", widthItem, heightItem); this.meatItemImg = View.loadAnImage("loots/meat.png", widthItem, heightItem); this.woodItemImg = View.loadAnImage("loots/wood.png", widthItem, heightItem); @@ -85,27 +85,15 @@ public ItemSelectedView(Pane display, Player player, double scaleMultiplicatorWi if (item instanceof Dirt) this.itemSelectedImgView.setImage(this.dirtItemImg); else if (item instanceof Rock) - this.itemSelectedImgView.setImage(this.stoneItemImg); + this.itemSelectedImgView.setImage(this.rockItemImg); else if (item instanceof TallGrass) this.itemSelectedImgView.setImage(null); else if (item instanceof Torch) this.itemSelectedImgView.setImage(this.torchItemImg); - else if (item instanceof Coal) - this.itemSelectedImgView.setImage(this.coalItemImg); - else if (item instanceof Fiber) - this.itemSelectedImgView.setImage(this.fibreItemImg); - else if (item instanceof Iron) - this.itemSelectedImgView.setImage(this.ironItemImg); else if (item instanceof Meat) this.itemSelectedImgView.setImage(this.meatItemImg); else if (item instanceof Vodka) this.itemSelectedImgView.setImage(this.vodkaItemImg); - else if (item instanceof Stone) - this.itemSelectedImgView.setImage(this.pierreItemImg); - else if (item instanceof Silex) - this.itemSelectedImgView.setImage(this.silexItemImg); - else if (item instanceof Wood) - this.itemSelectedImgView.setImage(this.woodItemImg); else if (item instanceof Axe) this.itemSelectedImgView.setImage(null); else if (item instanceof Bow) @@ -116,6 +104,20 @@ else if (item instanceof Sword) this.itemSelectedImgView.setImage(this.swordItemImg); else if (item instanceof Arrow) this.itemSelectedImgView.setImage(null); + else if (item instanceof Item) { + if (Item.isCoal(item)) + this.itemSelectedImgView.setImage(this.coalItemImg); + else if (Item.isFiber(item)) + this.itemSelectedImgView.setImage(this.fibreItemImg); + else if (Item.isIron(item)) + this.itemSelectedImgView.setImage(this.ironItemImg); + else if (Item.isStone(item)) + this.itemSelectedImgView.setImage(this.stoneItemImg); + else if (Item.isSilex(item)) + this.itemSelectedImgView.setImage(this.silexItemImg); + else if (Item.isWood(item)) + this.itemSelectedImgView.setImage(this.woodItemImg); + } } }); diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index e7b3690..c9a249e 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -10,7 +10,6 @@ exports fr.sae.terraria; opens fr.sae.terraria.controller to javafx.fxml; exports fr.sae.terraria.modele; - opens fr.sae.terraria.modele to javafx.fxml; exports fr.sae.terraria.modele.entities; opens fr.sae.terraria.modele.entities to javafx.fxml; exports fr.sae.terraria.modele.entities.entity; @@ -19,4 +18,5 @@ opens fr.sae.terraria.modele.entities.player to javafx.fxml; exports fr.sae.terraria.modele.entities.player.inventory; opens fr.sae.terraria.modele.entities.player.inventory to javafx.fxml; + opens fr.sae.terraria.modele to javafx.fxml, javafx.graphics; } \ No newline at end of file diff --git a/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java b/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java index 7b0c190..092fba5 100644 --- a/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java +++ b/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java @@ -2,9 +2,9 @@ import fr.sae.terraria.modele.Environment; import fr.sae.terraria.modele.TileMaps; +import fr.sae.terraria.modele.TileSet; import fr.sae.terraria.modele.entities.Rabbit; import fr.sae.terraria.modele.entities.blocks.Dirt; -import fr.sae.terraria.modele.entities.items.Coal; import fr.sae.terraria.modele.entities.items.Meat; import fr.sae.terraria.modele.entities.items.Vodka; import javafx.geometry.Rectangle2D; @@ -162,9 +162,9 @@ public class PlayerTest TileMaps tileMaps = environment.getTileMaps(); player.pickup(new Dirt(environment, 1, 1)); - assertEquals(tileMaps.getTile(0, 0), TileMaps.SKY); + assertEquals(tileMaps.getTile(0, 0), TileSet.SKY.ordinal()); player.placeBlock(0, 0); - assertEquals(tileMaps.getTile(0, 0), TileMaps.DIRT); + assertEquals(tileMaps.getTile(0, 0), TileSet.DIRT.ordinal()); assertNull(player.getStackSelected()); } From 671bf1f2bbc5d003e00778e37bd3b2edec4c677a Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Sun, 12 Jun 2022 19:48:53 +0200 Subject: [PATCH 45/97] Fix pierre qui ne se stack pas --- .../java/fr/sae/terraria/modele/entities/player/Player.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java index 691a029..ce091a0 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java @@ -26,7 +26,6 @@ public class Player extends EntityMovable implements CollideObjectType, Collapsi private final EnumMap<KeyCode, Boolean> keysInput; private final EnumMap<MouseButton, Boolean> mouseInput; - private final ObjectProperty objectWasPickup; private final SimpleBooleanProperty drunk; private final Inventory inventory; @@ -43,9 +42,6 @@ public Player(final Environment environment) this.animation = new Animation(); this.keysInput = new EnumMap<>(KeyCode.class); this.mouseInput = new EnumMap<>(MouseButton.class); - - this.objectWasPickup = new SimpleObjectProperty(null); - this.objectWasPickup.addListener((obs, oldObject, newObject) -> this.inventory.put((StowableObjectType) newObject)); } @Override public void updates() @@ -162,7 +158,7 @@ else if (key == KeyCode.Q) }); } - public void pickup(StowableObjectType pickupObject) { this.objectWasPickup.set(pickupObject); } + public void pickup(StowableObjectType pickupObject) { this.inventory.put(pickupObject); } public SimpleBooleanProperty drunkProperty() { return drunk; } From 00271e09f37edc64c9d9d8db8bbfb45d0f222cb7 Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Sun, 12 Jun 2022 19:53:17 +0200 Subject: [PATCH 46/97] Fix filter --- .../fr/sae/terraria/modele/entities/blocks/Dirt.java | 2 -- .../fr/sae/terraria/modele/entities/blocks/Rock.java | 1 - .../fr/sae/terraria/modele/entities/player/Player.java | 2 -- .../terraria/modele/entities/player/inventory/Stack.java | 4 +++- src/main/java/fr/sae/terraria/vue/LightView.java | 8 ++++---- src/main/java/fr/sae/terraria/vue/hud/InventoryView.java | 9 +++++++-- .../java/fr/sae/terraria/vue/hud/ItemSelectedView.java | 4 +++- 7 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/Dirt.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/Dirt.java index 266e52a..8593925 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/Dirt.java +++ b/src/main/java/fr/sae/terraria/modele/entities/blocks/Dirt.java @@ -1,13 +1,11 @@ package fr.sae.terraria.modele.entities.blocks; import fr.sae.terraria.modele.Environment; -import fr.sae.terraria.modele.TileMaps; import fr.sae.terraria.modele.TileSet; import fr.sae.terraria.modele.entities.entity.CollideObjectType; import fr.sae.terraria.modele.entities.entity.Entity; import fr.sae.terraria.modele.entities.entity.PlaceableObjectType; import fr.sae.terraria.modele.entities.entity.StowableObjectType; -import fr.sae.terraria.modele.entities.items.Item; import fr.sae.terraria.modele.entities.player.Player; import fr.sae.terraria.modele.entities.player.inventory.Inventory; diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/Rock.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/Rock.java index 53c5aed..8b8636c 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/Rock.java +++ b/src/main/java/fr/sae/terraria/modele/entities/blocks/Rock.java @@ -1,7 +1,6 @@ package fr.sae.terraria.modele.entities.blocks; import fr.sae.terraria.modele.Environment; -import fr.sae.terraria.modele.TileMaps; import fr.sae.terraria.modele.TileSet; import fr.sae.terraria.modele.entities.entity.CollideObjectType; import fr.sae.terraria.modele.entities.entity.PlaceableObjectType; diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java index ce091a0..2bdab01 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java @@ -6,9 +6,7 @@ import fr.sae.terraria.modele.entities.player.inventory.Inventory; import fr.sae.terraria.modele.entities.player.inventory.Stack; import fr.sae.terraria.vue.View; -import javafx.beans.property.ObjectProperty; import javafx.beans.property.SimpleBooleanProperty; -import javafx.beans.property.SimpleObjectProperty; import javafx.geometry.Rectangle2D; import javafx.scene.image.Image; import javafx.scene.input.KeyCode; diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java index 2d50628..3434557 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java @@ -6,7 +6,9 @@ import fr.sae.terraria.modele.entities.blocks.TallGrass; import fr.sae.terraria.modele.entities.blocks.Torch; import fr.sae.terraria.modele.entities.entity.StowableObjectType; -import fr.sae.terraria.modele.entities.items.*; +import fr.sae.terraria.modele.entities.items.Item; +import fr.sae.terraria.modele.entities.items.Meat; +import fr.sae.terraria.modele.entities.items.Vodka; import fr.sae.terraria.modele.entities.tools.Axe; import fr.sae.terraria.modele.entities.tools.Bow; import fr.sae.terraria.modele.entities.tools.Pickaxe; diff --git a/src/main/java/fr/sae/terraria/vue/LightView.java b/src/main/java/fr/sae/terraria/vue/LightView.java index 0055693..49e149d 100644 --- a/src/main/java/fr/sae/terraria/vue/LightView.java +++ b/src/main/java/fr/sae/terraria/vue/LightView.java @@ -3,7 +3,6 @@ import fr.sae.terraria.modele.Clock; import fr.sae.terraria.modele.Environment; import fr.sae.terraria.modele.TileMaps; -import fr.sae.terraria.modele.TileSet; import fr.sae.terraria.modele.entities.blocks.Torch; import javafx.collections.ListChangeListener; import javafx.collections.ObservableList; @@ -13,6 +12,7 @@ import javafx.scene.shape.Rectangle; import javafx.scene.shape.Shape; + public class LightView { private static final int CIRCLE_RAY = 3; private static final Color NIGHT_COLOR = Color.web("#0d0d38"); @@ -104,7 +104,7 @@ private int fullStoneArea() column = 0; while (column < this.tileMaps.getWidth() && !found && !wrongLine) { - if (this.tileMaps.isRockTile(column, line)) + if (!this.tileMaps.isRockTile(column, line)) wrongLine = true; else if (column == this.tileMaps.getWidth() - 1) found = true; @@ -133,8 +133,8 @@ private void addEffects() this.actualTunnel.setFill(NIGHT_COLOR); this.actualAir.opacityProperty().bind(this.clock.opacityNightFilterProperty()); - this.actualFade.setOpacity(0.8); - this.actualTunnel.setOpacity(0.8); + this.actualFade.setOpacity(.8); + this.actualTunnel.setOpacity(.8); } private void addTochLights() diff --git a/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java b/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java index bba30c6..a622e8b 100644 --- a/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java +++ b/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java @@ -3,9 +3,14 @@ import fr.sae.terraria.Terraria; import fr.sae.terraria.modele.TileMaps; import fr.sae.terraria.modele.entities.Arrow; -import fr.sae.terraria.modele.entities.blocks.*; +import fr.sae.terraria.modele.entities.blocks.Block; +import fr.sae.terraria.modele.entities.blocks.Rock; +import fr.sae.terraria.modele.entities.blocks.TallGrass; +import fr.sae.terraria.modele.entities.blocks.Torch; import fr.sae.terraria.modele.entities.entity.StowableObjectType; -import fr.sae.terraria.modele.entities.items.*; +import fr.sae.terraria.modele.entities.items.Item; +import fr.sae.terraria.modele.entities.items.Meat; +import fr.sae.terraria.modele.entities.items.Vodka; import fr.sae.terraria.modele.entities.player.inventory.Inventory; import fr.sae.terraria.modele.entities.player.inventory.Stack; import fr.sae.terraria.modele.entities.tools.Axe; diff --git a/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java b/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java index b96aeb2..1d7a33e 100644 --- a/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java +++ b/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java @@ -7,7 +7,9 @@ import fr.sae.terraria.modele.entities.blocks.TallGrass; import fr.sae.terraria.modele.entities.blocks.Torch; import fr.sae.terraria.modele.entities.entity.StowableObjectType; -import fr.sae.terraria.modele.entities.items.*; +import fr.sae.terraria.modele.entities.items.Item; +import fr.sae.terraria.modele.entities.items.Meat; +import fr.sae.terraria.modele.entities.items.Vodka; import fr.sae.terraria.modele.entities.player.Player; import fr.sae.terraria.modele.entities.player.inventory.Stack; import fr.sae.terraria.modele.entities.tools.Axe; From 3f8fed0023171f3a9aae1f135c589d82069c8a7d Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Sun, 12 Jun 2022 20:43:47 +0200 Subject: [PATCH 47/97] =?UTF-8?q?Simplification=20du=20code=20des=20=C3=A9?= =?UTF-8?q?quipements?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/sae/terraria/modele/Environment.java | 8 +-- .../sae/terraria/modele/entities/Slime.java | 8 +-- .../terraria/modele/entities/blocks/Rock.java | 8 +-- .../entities/player/inventory/Stack.java | 56 ++++++++++--------- .../terraria/modele/entities/tools/Axe.java | 11 ---- .../terraria/modele/entities/tools/Bow.java | 14 ----- .../modele/entities/tools/MaterialSet.java | 8 +++ .../modele/entities/tools/Pickaxe.java | 14 ----- .../terraria/modele/entities/tools/Sword.java | 17 ------ .../terraria/modele/entities/tools/Tool.java | 45 +++++++++++---- .../modele/entities/tools/ToolSet.java | 11 ++++ .../sae/terraria/vue/hud/InventoryView.java | 24 ++++---- .../terraria/vue/hud/ItemSelectedView.java | 24 ++++---- 13 files changed, 116 insertions(+), 132 deletions(-) delete mode 100644 src/main/java/fr/sae/terraria/modele/entities/tools/Axe.java delete mode 100644 src/main/java/fr/sae/terraria/modele/entities/tools/Bow.java create mode 100644 src/main/java/fr/sae/terraria/modele/entities/tools/MaterialSet.java delete mode 100644 src/main/java/fr/sae/terraria/modele/entities/tools/Pickaxe.java delete mode 100644 src/main/java/fr/sae/terraria/modele/entities/tools/Sword.java create mode 100644 src/main/java/fr/sae/terraria/modele/entities/tools/ToolSet.java diff --git a/src/main/java/fr/sae/terraria/modele/Environment.java b/src/main/java/fr/sae/terraria/modele/Environment.java index e3b33f3..0071a43 100644 --- a/src/main/java/fr/sae/terraria/modele/Environment.java +++ b/src/main/java/fr/sae/terraria/modele/Environment.java @@ -12,9 +12,9 @@ import fr.sae.terraria.modele.entities.items.Meat; import fr.sae.terraria.modele.entities.items.Vodka; import fr.sae.terraria.modele.entities.player.Player; -import fr.sae.terraria.modele.entities.tools.Pickaxe; -import fr.sae.terraria.modele.entities.tools.Sword; +import fr.sae.terraria.modele.entities.tools.MaterialSet; import fr.sae.terraria.modele.entities.tools.Tool; +import fr.sae.terraria.modele.entities.tools.ToolSet; import javafx.animation.Animation; import javafx.animation.KeyFrame; import javafx.animation.Timeline; @@ -125,9 +125,9 @@ private void gameLoop() if (!caught[0]) { this.player.pickup(new Torch(this)); this.player.pickup(new Meat(this)); - this.player.pickup(new Pickaxe()); + this.player.pickup(new Tool(ToolSet.PICKAXE, MaterialSet.IRON)); this.player.pickup(new Vodka(this)); - this.player.pickup(new Sword(Tool.CRAFTED_WITH_WOOD)); + this.player.pickup(new Tool(ToolSet.SWORD, MaterialSet.IRON)); caught[0] = true; } diff --git a/src/main/java/fr/sae/terraria/modele/entities/Slime.java b/src/main/java/fr/sae/terraria/modele/entities/Slime.java index d9ac18c..dde2840 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/Slime.java +++ b/src/main/java/fr/sae/terraria/modele/entities/Slime.java @@ -3,7 +3,7 @@ import fr.sae.terraria.modele.Environment; import fr.sae.terraria.modele.entities.entity.*; import fr.sae.terraria.modele.entities.player.inventory.Stack; -import fr.sae.terraria.modele.entities.tools.Sword; +import fr.sae.terraria.modele.entities.tools.Tool; import java.util.Map; import java.util.Objects; @@ -84,9 +84,9 @@ else if (environment.getPlayer().getX() < this.x.getValue()) Stack stack = this.environment.getPlayer().getStackSelected(); if (!Objects.isNull(stack)) { - if (stack.getItem() instanceof Sword) { - Sword sword = (Sword) stack.getItem(); - this.setPv(this.getPv() - (Sword.DEFAULT_DAMAGE*sword.getMaterial())); + if (Tool.isSword(((Tool) stack.getItem()).getTypeOfTool())) { + Tool tool = (Tool) stack.getItem(); + this.setPv(this.getPv() - tool.damage()); } } else this.setPv(this.getPv() - .5); } diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/Rock.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/Rock.java index 8b8636c..e648461 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/Rock.java +++ b/src/main/java/fr/sae/terraria/modele/entities/blocks/Rock.java @@ -9,7 +9,6 @@ import fr.sae.terraria.modele.entities.player.Player; import fr.sae.terraria.modele.entities.player.inventory.Inventory; import fr.sae.terraria.modele.entities.player.inventory.Stack; -import fr.sae.terraria.modele.entities.tools.Pickaxe; import fr.sae.terraria.modele.entities.tools.Tool; import java.util.Objects; @@ -63,11 +62,10 @@ public Rock(Environment environment, int x, int y) // Peu importe l'outil qu'utilise le joueur, si c'est un outil, il perdra de la durabilité, mais le bloc ne peut que se casser avec une pioche Stack stack = player.getStackSelected(); - if (!Objects.isNull(stack)) { - if (stack.getItem() instanceof Pickaxe) + if (!Objects.isNull(stack) && stack.getItem() instanceof Tool) { + if (Tool.isPickaxe(((Tool) stack.getItem()).getTypeOfTool())) this.setPv(this.getPv() - 1); - if (stack.getItem() instanceof Tool) - ((Tool) stack.getItem()).use(); + ((Tool) stack.getItem()).use(); } } diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java index 3434557..0c1edea 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java @@ -9,10 +9,7 @@ import fr.sae.terraria.modele.entities.items.Item; import fr.sae.terraria.modele.entities.items.Meat; import fr.sae.terraria.modele.entities.items.Vodka; -import fr.sae.terraria.modele.entities.tools.Axe; -import fr.sae.terraria.modele.entities.tools.Bow; -import fr.sae.terraria.modele.entities.tools.Pickaxe; -import fr.sae.terraria.modele.entities.tools.Sword; +import fr.sae.terraria.modele.entities.tools.Tool; import javafx.beans.property.IntegerProperty; import javafx.beans.property.SimpleIntegerProperty; @@ -42,41 +39,46 @@ public boolean isSameItem(StowableObjectType obj) { if (obj instanceof Dirt && this.item instanceof Dirt) return true; - else if (obj instanceof Rock && this.item instanceof Rock) + if (obj instanceof Rock && this.item instanceof Rock) return true; - else if (obj instanceof TallGrass && this.item instanceof TallGrass) + if (obj instanceof TallGrass && this.item instanceof TallGrass) return true; - else if (obj instanceof Torch && this.item instanceof Torch) + if (obj instanceof Torch && this.item instanceof Torch) return true; - else if (obj instanceof Meat && this.item instanceof Meat) + if (obj instanceof Meat && this.item instanceof Meat) return true; - else if (obj instanceof Axe && this.item instanceof Axe) + if (obj instanceof Vodka && this.item instanceof Vodka) return true; - else if (obj instanceof Vodka && this.item instanceof Vodka) - return true; - else if (obj instanceof Bow && this.item instanceof Bow) - return true; - else if (obj instanceof Pickaxe && this.item instanceof Pickaxe) - return true; - else if (obj instanceof Sword && this.item instanceof Sword) - return true; - else if (obj instanceof Arrow && this.item instanceof Arrow) - return true; - else if (obj instanceof Item) { + + if (obj instanceof Tool && this.item instanceof Tool) { + if (Tool.isAxe(((Tool) obj).getTypeOfTool()) && Tool.isAxe(((Tool) this.item).getTypeOfTool())) + return true; + if (Tool.isBow(((Tool) obj).getTypeOfTool()) && Tool.isBow(((Tool) this.item).getTypeOfTool())) + return true; + if (Tool.isPickaxe(((Tool) obj).getTypeOfTool()) && Tool.isPickaxe(((Tool) this.item).getTypeOfTool())) + return true; + if (Tool.isSword(((Tool) obj).getTypeOfTool()) && Tool.isSword(((Tool) this.item).getTypeOfTool())) + return true; + if (Tool.isArrow(((Tool) obj).getTypeOfTool()) && Tool.isArrow(((Tool) this.item).getTypeOfTool())) + return true; + } + + if (obj instanceof Item && this.item instanceof Item) { if (Item.isCoal(obj) && Item.isCoal(this.item)) return true; - else if (Item.isFiber(obj) && Item.isFiber(this.item)) + if (Item.isFiber(obj) && Item.isFiber(this.item)) return true; - else if (Item.isIron(obj) && Item.isIron(this.item)) + if (Item.isIron(obj) && Item.isIron(this.item)) return true; - else if (Item.isStone(obj) && Item.isStone(this.item)) + if (Item.isStone(obj) && Item.isStone(this.item)) return true; - else if (Item.isSilex(obj) && Item.isSilex(this.item)) + if (Item.isSilex(obj) && Item.isSilex(this.item)) return true; - else if (Item.isWood(obj) && Item.isWood(this.item)) + if (Item.isWood(obj) && Item.isWood(this.item)) return true; - else return false; - } else return false; + } + + return false; } public IntegerProperty nbItemsProperty() { return this.nbItems; } diff --git a/src/main/java/fr/sae/terraria/modele/entities/tools/Axe.java b/src/main/java/fr/sae/terraria/modele/entities/tools/Axe.java deleted file mode 100644 index 3e38b7b..0000000 --- a/src/main/java/fr/sae/terraria/modele/entities/tools/Axe.java +++ /dev/null @@ -1,11 +0,0 @@ -package fr.sae.terraria.modele.entities.tools; - - -public class Axe extends Tool -{ - - - public Axe() { super(Tool.DEFAULT_DURABILITY); } - - @Override public void use() { Tool.DEFAULT_WEAR(this); } -} diff --git a/src/main/java/fr/sae/terraria/modele/entities/tools/Bow.java b/src/main/java/fr/sae/terraria/modele/entities/tools/Bow.java deleted file mode 100644 index 4ab6433..0000000 --- a/src/main/java/fr/sae/terraria/modele/entities/tools/Bow.java +++ /dev/null @@ -1,14 +0,0 @@ -package fr.sae.terraria.modele.entities.tools; - - -public class Bow extends Tool -{ - - - protected Bow(int durability) { super(durability); } - - @Override public void use() - { - - } -} diff --git a/src/main/java/fr/sae/terraria/modele/entities/tools/MaterialSet.java b/src/main/java/fr/sae/terraria/modele/entities/tools/MaterialSet.java new file mode 100644 index 0000000..6def89c --- /dev/null +++ b/src/main/java/fr/sae/terraria/modele/entities/tools/MaterialSet.java @@ -0,0 +1,8 @@ +package fr.sae.terraria.modele.entities.tools; + + +public enum MaterialSet +{ + WOOD, + IRON; +} diff --git a/src/main/java/fr/sae/terraria/modele/entities/tools/Pickaxe.java b/src/main/java/fr/sae/terraria/modele/entities/tools/Pickaxe.java deleted file mode 100644 index 2d8dfe2..0000000 --- a/src/main/java/fr/sae/terraria/modele/entities/tools/Pickaxe.java +++ /dev/null @@ -1,14 +0,0 @@ -package fr.sae.terraria.modele.entities.tools; - - -public class Pickaxe extends Tool -{ - - - public Pickaxe() - { - super(Tool.DEFAULT_DURABILITY); - } - - @Override public void use() { Tool.DEFAULT_WEAR(this); } -} diff --git a/src/main/java/fr/sae/terraria/modele/entities/tools/Sword.java b/src/main/java/fr/sae/terraria/modele/entities/tools/Sword.java deleted file mode 100644 index ec37ab8..0000000 --- a/src/main/java/fr/sae/terraria/modele/entities/tools/Sword.java +++ /dev/null @@ -1,17 +0,0 @@ -package fr.sae.terraria.modele.entities.tools; - - -public class Sword extends Tool -{ - public static final int DEFAULT_DAMAGE = 2; - - - public Sword(double material) - { - super(Tool.DEFAULT_DURABILITY); - - this.material = material; - } - - @Override public void use() { Tool.DEFAULT_WEAR(this); } -} diff --git a/src/main/java/fr/sae/terraria/modele/entities/tools/Tool.java b/src/main/java/fr/sae/terraria/modele/entities/tools/Tool.java index fecc8a1..e817f88 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/tools/Tool.java +++ b/src/main/java/fr/sae/terraria/modele/entities/tools/Tool.java @@ -5,33 +5,58 @@ import javafx.beans.property.SimpleIntegerProperty; -public abstract class Tool implements StowableObjectType +public class Tool implements StowableObjectType { public static final double CRAFTED_WITH_WOOD = 1.; public static final double CRAFTED_WITH_IRON = 1.5; public static final int DEFAULT_DURABILITY = 100; + public static final int DEFAULT_DAMAGE = 1; - protected final IntegerProperty durability; + private final IntegerProperty durability; - protected double material; + private final MaterialSet material; + private final ToolSet tool; - protected Tool(final int durability) + public Tool(final ToolSet tool, final MaterialSet material) { super(); - this.durability = new SimpleIntegerProperty(durability); + this.tool = tool; + this.material = material; + this.durability = new SimpleIntegerProperty(Tool.DEFAULT_DURABILITY); } /** Utilise l'outil */ - public abstract void use(); + public void use() + { + if (this.durability.get() > 0) + this.durability.set(this.durability.get() - 1); + } - public static void DEFAULT_WEAR(final Tool tool) + public double damage() { - if (tool.durability.get() > 0) - tool.durability.set(tool.durability.get() - 1); + if (this.tool == ToolSet.SWORD) { + if (this.material == MaterialSet.WOOD) + return Tool.DEFAULT_DAMAGE * Tool.CRAFTED_WITH_WOOD; + else if (this.material == MaterialSet.IRON) + return Tool.DEFAULT_DAMAGE * Tool.CRAFTED_WITH_IRON; + } else { + if (this.material == MaterialSet.WOOD) + return Tool.DEFAULT_DAMAGE * (Tool.CRAFTED_WITH_WOOD/2); + else if (this.material == MaterialSet.IRON) + return Tool.DEFAULT_DAMAGE * (Tool.CRAFTED_WITH_IRON/2); + } + return Tool.DEFAULT_DAMAGE; } + public static boolean isAxe(ToolSet tool) { return tool == ToolSet.AXE; } + public static boolean isBow(ToolSet tool) { return tool == ToolSet.BOW; } + public static boolean isPickaxe(ToolSet tool) { return tool == ToolSet.PICKAXE; } + public static boolean isSword(ToolSet tool) { return tool == ToolSet.SWORD; } + public static boolean isArrow(ToolSet tool) { return tool == ToolSet.ARROW; } + - public double getMaterial() { return this.material; } + public ToolSet getTypeOfTool() { return this.tool; } + public MaterialSet getMaterial() { return this.material; } } diff --git a/src/main/java/fr/sae/terraria/modele/entities/tools/ToolSet.java b/src/main/java/fr/sae/terraria/modele/entities/tools/ToolSet.java new file mode 100644 index 0000000..4557712 --- /dev/null +++ b/src/main/java/fr/sae/terraria/modele/entities/tools/ToolSet.java @@ -0,0 +1,11 @@ +package fr.sae.terraria.modele.entities.tools; + + +public enum ToolSet +{ + AXE, + BOW, + PICKAXE, + SWORD, + ARROW +} diff --git a/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java b/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java index a622e8b..b4c2885 100644 --- a/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java +++ b/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java @@ -13,10 +13,7 @@ import fr.sae.terraria.modele.entities.items.Vodka; import fr.sae.terraria.modele.entities.player.inventory.Inventory; import fr.sae.terraria.modele.entities.player.inventory.Stack; -import fr.sae.terraria.modele.entities.tools.Axe; -import fr.sae.terraria.modele.entities.tools.Bow; -import fr.sae.terraria.modele.entities.tools.Pickaxe; -import fr.sae.terraria.modele.entities.tools.Sword; +import fr.sae.terraria.modele.entities.tools.Tool; import fr.sae.terraria.vue.View; import javafx.collections.ListChangeListener; import javafx.scene.image.Image; @@ -114,19 +111,20 @@ else if (item instanceof Torch) view.setImage(View.loadAnImage("tiles/torch.png", itemInventoryWidth, itemInventoryHeight)); else if (item instanceof Meat) view.setImage(View.loadAnImage("loots/meat.png", itemInventoryWidth, itemInventoryHeight)); - else if (item instanceof Axe) - view.setImage(null); // TODO - else if (item instanceof Bow) - view.setImage(null); // TODO - else if (item instanceof Pickaxe) - view.setImage(View.loadAnImage("tools/pickaxe.png", itemInventoryWidth, itemInventoryHeight)); - else if (item instanceof Sword) - view.setImage(View.loadAnImage("tools/sword.png", itemInventoryWidth, itemInventoryHeight)); else if (item instanceof Arrow) view.setImage(null); // TODO else if (item instanceof Vodka) view.setImage(View.loadAnImage("loots/vodka.png", itemInventoryWidth,itemInventoryHeight)); - else if (item instanceof Item) { + else if (item instanceof Tool) { + if (Tool.isAxe(((Tool) item).getTypeOfTool())) + view.setImage(null); // TODO + else if (Tool.isBow(((Tool) item).getTypeOfTool())) + view.setImage(null); // TODO + else if (Tool.isPickaxe(((Tool) item).getTypeOfTool())) + view.setImage(View.loadAnImage("tools/pickaxe.png", itemInventoryWidth, itemInventoryHeight)); + else if (Tool.isSword(((Tool) item).getTypeOfTool())) + view.setImage(View.loadAnImage("tools/sword.png", itemInventoryWidth, itemInventoryHeight)); + } else if (item instanceof Item) { if (Item.isCoal(item)) view.setImage(View.loadAnImage("loots/coal.png", itemInventoryWidth, itemInventoryHeight)); else if (Item.isFiber(item)) diff --git a/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java b/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java index 1d7a33e..8b8e07e 100644 --- a/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java +++ b/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java @@ -12,10 +12,7 @@ import fr.sae.terraria.modele.entities.items.Vodka; import fr.sae.terraria.modele.entities.player.Player; import fr.sae.terraria.modele.entities.player.inventory.Stack; -import fr.sae.terraria.modele.entities.tools.Axe; -import fr.sae.terraria.modele.entities.tools.Bow; -import fr.sae.terraria.modele.entities.tools.Pickaxe; -import fr.sae.terraria.modele.entities.tools.Sword; +import fr.sae.terraria.modele.entities.tools.Tool; import fr.sae.terraria.vue.View; import javafx.collections.ListChangeListener; import javafx.scene.image.Image; @@ -96,17 +93,18 @@ else if (item instanceof Meat) this.itemSelectedImgView.setImage(this.meatItemImg); else if (item instanceof Vodka) this.itemSelectedImgView.setImage(this.vodkaItemImg); - else if (item instanceof Axe) - this.itemSelectedImgView.setImage(null); - else if (item instanceof Bow) - this.itemSelectedImgView.setImage(null); - else if (item instanceof Pickaxe) - this.itemSelectedImgView.setImage(this.pickaxeItemImg); - else if (item instanceof Sword) - this.itemSelectedImgView.setImage(this.swordItemImg); else if (item instanceof Arrow) this.itemSelectedImgView.setImage(null); - else if (item instanceof Item) { + else if (item instanceof Tool) { + if (Tool.isAxe(((Tool) item).getTypeOfTool())) + this.itemSelectedImgView.setImage(null); + else if (Tool.isBow(((Tool) item).getTypeOfTool())) + this.itemSelectedImgView.setImage(null); + else if (Tool.isPickaxe(((Tool) item).getTypeOfTool())) + this.itemSelectedImgView.setImage(this.pickaxeItemImg); + else if (Tool.isSword(((Tool) item).getTypeOfTool())) + this.itemSelectedImgView.setImage(this.swordItemImg); + } else if (item instanceof Item) { if (Item.isCoal(item)) this.itemSelectedImgView.setImage(this.coalItemImg); else if (Item.isFiber(item)) From 656a15f89564537866ff584adc56567db5f4cea9 Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Sun, 12 Jun 2022 23:11:13 +0200 Subject: [PATCH 48/97] Simplification du code des blocks --- .../terraria/controller/MenuController.java | 9 +- .../fr/sae/terraria/modele/Environment.java | 10 +- .../sae/terraria/modele/GenerateEntity.java | 4 +- .../java/fr/sae/terraria/modele/TileSet.java | 25 +++- .../modele/entities/blocks/Block.java | 128 ++++++++++++++++-- .../modele/entities/blocks/BlockSet.java | 14 ++ .../terraria/modele/entities/blocks/Dirt.java | 81 ----------- .../modele/entities/blocks/Grass.java | 17 --- .../terraria/modele/entities/blocks/Rock.java | 90 ------------ .../modele/entities/blocks/TallGrass.java | 22 +-- .../modele/entities/blocks/Torch.java | 60 -------- .../terraria/modele/entities/blocks/Tree.java | 6 +- .../entities/entity/BreakableObjectType.java | 6 - .../entities/entity/PlaceableObjectType.java | 2 - .../entities/player/inventory/Stack.java | 24 ++-- .../java/fr/sae/terraria/vue/LightView.java | 6 +- .../fr/sae/terraria/vue/TileMapsView.java | 52 ++++--- .../sae/terraria/vue/hud/InventoryView.java | 23 ++-- .../terraria/vue/hud/ItemSelectedView.java | 34 +++-- .../modele/entities/player/PlayerTest.java | 1 - .../player/inventory/InventoryTest.java | 1 - 21 files changed, 251 insertions(+), 364 deletions(-) create mode 100644 src/main/java/fr/sae/terraria/modele/entities/blocks/BlockSet.java delete mode 100644 src/main/java/fr/sae/terraria/modele/entities/blocks/Dirt.java delete mode 100644 src/main/java/fr/sae/terraria/modele/entities/blocks/Grass.java delete mode 100644 src/main/java/fr/sae/terraria/modele/entities/blocks/Rock.java delete mode 100644 src/main/java/fr/sae/terraria/modele/entities/blocks/Torch.java diff --git a/src/main/java/fr/sae/terraria/controller/MenuController.java b/src/main/java/fr/sae/terraria/controller/MenuController.java index d8334c7..372bc30 100644 --- a/src/main/java/fr/sae/terraria/controller/MenuController.java +++ b/src/main/java/fr/sae/terraria/controller/MenuController.java @@ -2,7 +2,8 @@ import fr.sae.terraria.Terraria; import fr.sae.terraria.modele.Environment; -import fr.sae.terraria.modele.entities.blocks.Rock; +import fr.sae.terraria.modele.entities.blocks.Block; +import fr.sae.terraria.modele.entities.blocks.BlockSet; import fr.sae.terraria.modele.entities.items.Item; import fr.sae.terraria.modele.entities.player.Player; import fr.sae.terraria.modele.entities.player.inventory.Stack; @@ -65,14 +66,14 @@ public MenuController(final Stage stage) this.lexique4.addEventFilter(Event.ANY, ev -> { if (ev.getEventType().getName().equalsIgnoreCase("MOUSE_PRESSED")) { int i = this.player.getInventory().get().size()-1; - while (i > 0 && !(this.player.getInventory().get().get(i).getItem().equals(Item.STONE)) && this.player.getInventory().get().get(i).getNbItems() >= Rock.STONE_LOOTS) + while (i > 0 && !(this.player.getInventory().get().get(i).getItem().equals(Item.STONE)) && this.player.getInventory().get().get(i).getNbItems() >= Block.ROCK_NB_LOOTS) i--; Stack stack = this.player.getInventory().get().get(i); if (stack.getItem() instanceof Item && stack.getItem().equals(Item.STONE)) { - for (int j = 0; j < Rock.STONE_LOOTS; j++) + for (int j = 0; j < Block.ROCK_NB_LOOTS; j++) stack.remove(); - this.player.pickup(new Rock(this.environment)); + this.player.pickup(new Block(BlockSet.ROCK, this.environment)); } } }); diff --git a/src/main/java/fr/sae/terraria/modele/Environment.java b/src/main/java/fr/sae/terraria/modele/Environment.java index 0071a43..92bd859 100644 --- a/src/main/java/fr/sae/terraria/modele/Environment.java +++ b/src/main/java/fr/sae/terraria/modele/Environment.java @@ -4,7 +4,7 @@ import fr.sae.terraria.modele.entities.Rabbit; import fr.sae.terraria.modele.entities.Slime; import fr.sae.terraria.modele.entities.blocks.Block; -import fr.sae.terraria.modele.entities.blocks.Torch; +import fr.sae.terraria.modele.entities.blocks.BlockSet; import fr.sae.terraria.modele.entities.blocks.Tree; import fr.sae.terraria.modele.entities.entity.CollideObjectType; import fr.sae.terraria.modele.entities.entity.Entity; @@ -42,7 +42,7 @@ public class Environment private final ObservableList<Rabbit> rabbits; private final ObservableList<Slime> slimes; // Permet d'update facilement les lumières des torches sur le filtre - private final ObservableList<Torch> torches; + private final ObservableList<Block> torches; private final TileMaps tileMaps; private final Player player; @@ -123,7 +123,7 @@ private void gameLoop() KeyFrame keyFrame = new KeyFrame(Duration.seconds(Terraria.TARGET_FPS), (ev -> { // TODO TEST if (!caught[0]) { - this.player.pickup(new Torch(this)); + this.player.pickup(new Block(BlockSet.TORCH, this)); this.player.pickup(new Meat(this)); this.player.pickup(new Tool(ToolSet.PICKAXE, MaterialSet.IRON)); this.player.pickup(new Vodka(this)); @@ -145,7 +145,7 @@ private void gameLoop() boolean nightTime = this.clock.getMinutes() > (Clock.MINUTES_IN_A_DAY)/2; boolean weHaveChangedDay = this.previousDays != this.clock.getDays(); if (weHaveChangedDay) - for (int i = 0; i < Tree.TREE_CLUSTER; i++) // Génère par jour, 3 arbres + for (int i = 0; i < 10; i++) // Génère par jour, 3 arbres GenerateEntity.treeRandomly(this); if (dayTime) { // Génère certaines entités uniquement pendant le jour GenerateEntity.rabbitRandomly(this); @@ -193,7 +193,7 @@ public static Clip playSound(String path, boolean loop) public ObservableList<Tree> getTrees() { return this.trees; } public ObservableList<Entity> getEntities() { return this.entities; } public ObservableList<Rabbit> getRabbits() { return this.rabbits; } - public ObservableList<Torch> getTorches() { return this.torches; } + public ObservableList<Block> getTorches() { return this.torches; } public ObservableList<Slime> getSlimes() { return this.slimes; } public TileMaps getTileMaps() { return this.tileMaps; } public Player getPlayer() { return this.player; } diff --git a/src/main/java/fr/sae/terraria/modele/GenerateEntity.java b/src/main/java/fr/sae/terraria/modele/GenerateEntity.java index 50301a0..3824ed5 100644 --- a/src/main/java/fr/sae/terraria/modele/GenerateEntity.java +++ b/src/main/java/fr/sae/terraria/modele/GenerateEntity.java @@ -2,6 +2,8 @@ import fr.sae.terraria.modele.entities.Rabbit; import fr.sae.terraria.modele.entities.Slime; +import fr.sae.terraria.modele.entities.blocks.Block; +import fr.sae.terraria.modele.entities.blocks.BlockSet; import fr.sae.terraria.modele.entities.blocks.TallGrass; import fr.sae.terraria.modele.entities.blocks.Tree; import fr.sae.terraria.modele.entities.entity.Entity; @@ -17,7 +19,6 @@ import static fr.sae.terraria.modele.entities.Slime.WHEN_SPAWN_A_SLIME; import static fr.sae.terraria.modele.entities.blocks.TallGrass.TALL_GRASS_SPAWN_RATE; import static fr.sae.terraria.modele.entities.blocks.TallGrass.WHEN_SPAWN_A_TALL_GRASS; -import static fr.sae.terraria.modele.entities.blocks.Tree.TREE_SPAWN_RATE; /** @@ -26,6 +27,7 @@ */ public class GenerateEntity { + private static final int TREE_SPAWN_RATE = 2500; public static final int MAX_SPAWN_RABBIT = 100; public static final int MAX_SPAWN_SLIME = 100; private static final Random random = new Random(); diff --git a/src/main/java/fr/sae/terraria/modele/TileSet.java b/src/main/java/fr/sae/terraria/modele/TileSet.java index 8457896..2a0a3f6 100644 --- a/src/main/java/fr/sae/terraria/modele/TileSet.java +++ b/src/main/java/fr/sae/terraria/modele/TileSet.java @@ -1,5 +1,7 @@ package fr.sae.terraria.modele; +import fr.sae.terraria.modele.entities.blocks.BlockSet; + public enum TileSet { @@ -8,7 +10,9 @@ public enum TileSet DIRT, FLOOR_TOP, FLOOR_LEFT, - FLOOR_RIGHT; + FLOOR_RIGHT, + TALL_GRASS, + TREE; public static boolean isSkyTile(TileSet item) { return item == TileSet.SKY; } @@ -17,4 +21,23 @@ public enum TileSet public static boolean isFloorTopTile(TileSet item) { return item == TileSet.FLOOR_TOP; } public static boolean isFloorRightTile(TileSet item) { return item == TileSet.FLOOR_RIGHT; } public static boolean isFloorLeftTile(TileSet item) { return item == TileSet.FLOOR_LEFT; } + + public static TileSet getTileSet(BlockSet blockSet) + { + if (blockSet == BlockSet.DIRT) + return TileSet.DIRT; + if (blockSet == BlockSet.ROCK) + return TileSet.ROCK; + if (blockSet == BlockSet.FLOOR_LEFT) + return TileSet.FLOOR_LEFT; + if (blockSet == BlockSet.FLOOR_RIGHT) + return TileSet.FLOOR_RIGHT; + if (blockSet == BlockSet.FLOOR_TOP) + return TileSet.FLOOR_TOP; + if (blockSet == BlockSet.TALL_GRASS) + return TileSet.TALL_GRASS; + if (blockSet == BlockSet.TREE) + return TileSet.TREE; + return null; + } } diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java index 4939e52..109d1fc 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java +++ b/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java @@ -2,23 +2,49 @@ import fr.sae.terraria.Terraria; import fr.sae.terraria.modele.Environment; +import fr.sae.terraria.modele.TileSet; import fr.sae.terraria.modele.entities.entity.BreakableObjectType; import fr.sae.terraria.modele.entities.entity.Entity; +import fr.sae.terraria.modele.entities.entity.PlaceableObjectType; +import fr.sae.terraria.modele.entities.entity.StowableObjectType; +import fr.sae.terraria.modele.entities.items.Item; +import fr.sae.terraria.modele.entities.items.Vodka; +import fr.sae.terraria.modele.entities.player.Player; +import fr.sae.terraria.modele.entities.player.inventory.Inventory; import javafx.animation.KeyFrame; import javafx.animation.Timeline; import javafx.util.Duration; +import java.util.Objects; -public abstract class Block extends Entity implements BreakableObjectType + +public class Block extends Entity implements BreakableObjectType, PlaceableObjectType, StowableObjectType { + public static final int ROCK_NB_LOOTS = 3; + public static final int DEFAULT_RESISTANCE = 2; + + private final Environment environment; + private final BlockSet typeOfBlock; + private final double xOrigin; + private final double yOrigin; - protected Block(int x, int y) + + public Block(final BlockSet typeOfBlock, final Environment environment, int x, int y) { super(x, y); + this.typeOfBlock = typeOfBlock; + this.environment = environment; + + this.xOrigin = x; + this.yOrigin = y; + + this.pv.set(Block.DEFAULT_RESISTANCE); } - protected void breakAnimation(final Environment environment, final Block block, double xOrigin, double yOrigin) + public Block(final BlockSet typeOfBlock, final Environment environment) { this(typeOfBlock, environment, 0, 0); } + + private void breakAnimation() { Timeline timeline = new Timeline(); int animationCycleCount = 5; @@ -26,21 +52,105 @@ protected void breakAnimation(final Environment environment, final Block block, // Animation de cassure du bloc timeline.setCycleCount(animationCycleCount); KeyFrame keyFrame = new KeyFrame(Duration.seconds(Terraria.TARGET_FPS), (ev -> { - block.setX(xOrigin + (Math.cos(time[0])*environment.scaleMultiplicatorWidth)); - block.setY(yOrigin + (-Math.sin(time[0]*environment.scaleMultiplicatorHeight))); + this.setX(xOrigin + (Math.cos(time[0])*environment.scaleMultiplicatorWidth)); + this.setY(yOrigin + (-Math.sin(time[0]*environment.scaleMultiplicatorHeight))); time[0]++; })); timeline.getKeyFrames().add(keyFrame); // Faire revenir le bloc à sa position initiale lorsque l'animation est terminée timeline.statusProperty().addListener(c -> { - block.setX(xOrigin); - block.setY(yOrigin); + this.setX(xOrigin); + this.setY(yOrigin); }); timeline.play(); } - @Override public abstract void updates(); + private void loots() + { + Player player = this.environment.getPlayer(); + + if (this.typeOfBlock == BlockSet.FLOOR_TOP || this.typeOfBlock == BlockSet.FLOOR_LEFT || this.typeOfBlock == BlockSet.FLOOR_RIGHT) { + player.pickup(new Block(BlockSet.FLOOR_TOP, this.environment)); + } else if (this.typeOfBlock == BlockSet.DIRT) { + player.pickup(new Block(BlockSet.DIRT, this.environment, 0, 0)); + } else if (this.typeOfBlock == BlockSet.ROCK) { + for (int loot = 0; loot < Block.ROCK_NB_LOOTS; loot++) + player.pickup(Item.STONE); + } else if (this.typeOfBlock == BlockSet.TALL_GRASS) { + for (int loot = (int) (Math.random()*3)+1; loot < TallGrass.LOOTS_FIBRE_MAX; loot++) + player.pickup(Item.FIBER); + + boolean mustDropVodka = Math.random() < Vodka.DROP_RATE; + if (mustDropVodka) + player.pickup(new Vodka(this.environment)); + } else if (this.typeOfBlock == BlockSet.TORCH) { + player.pickup(new Block(BlockSet.TORCH, this.environment)); + } else if (this.typeOfBlock == BlockSet.TREE) { + player.pickup(new Block(BlockSet.TREE, this.environment)); + } + } + + @Override public void updates() { } + + @Override public void breaks() + { + if (this.typeOfBlock == BlockSet.ROCK) + Environment.playSound("sound/brick" + ((int) (Math.random()*2)+1) + ".wav", false); + else if (this.typeOfBlock == BlockSet.TALL_GRASS) + Environment.playSound("sound/cut.wav", false); + else Environment.playSound("sound/grassyStep.wav", false); + this.breakAnimation(); + + if (this.getPv() <= 0) { + this.loots(); + + int yIndexTile = (int) (getY()/environment.heightTile); + int xIndexTile = (int) (getX()/environment.widthTile); + this.environment.getTileMaps().setTile(TileSet.SKY.ordinal(), yIndexTile, xIndexTile); + this.environment.getEntities().remove(this); + this.environment.getBlocks().remove(this); + } + + this.setPv(this.getPv() - 1); + } + + @Override public void place(final int x, final int y) + { + Environment.playSound("sound/axchop.wav", false); + int widthTile = this.environment.widthTile; + int heightTile = this.environment.heightTile; + + Block block = new Block(this.typeOfBlock, this.environment, x*widthTile, y*heightTile); + block.setRect(widthTile, heightTile); + + Player player = this.environment.getPlayer(); + Inventory inventory = player.getInventory(); + if (!Objects.isNull(player.getStackSelected())) + inventory.get().get(inventory.getPosCursor()).remove(); + + TileSet tile = TileSet.getTileSet(this.typeOfBlock); + if (!Objects.isNull(tile)) + this.environment.getTileMaps().setTile(tile.ordinal(), y, x); + this.environment.getEntities().add(block); + this.environment.getBlocks().add(block); + + if (this.typeOfBlock == BlockSet.TREE) + this.environment.getTrees().add((Tree) block); + if (this.typeOfBlock == BlockSet.TORCH) + this.environment.getTorches().add(block); + + } + + public static boolean isFloorTop(final Block block) { return block.getTypeOfBlock() == BlockSet.FLOOR_TOP; } + public static boolean isFloorLeft(final Block block) { return block.getTypeOfBlock() == BlockSet.FLOOR_LEFT; } + public static boolean isFloorRight(final Block block) { return block.getTypeOfBlock() == BlockSet.FLOOR_RIGHT; } + public static boolean isDirt(final Block block) { return block.getTypeOfBlock() == BlockSet.DIRT; } + public static boolean isRock(final Block block) { return block.getTypeOfBlock() == BlockSet.ROCK; } + public static boolean isTallGrass(final Block block) { return block.getTypeOfBlock() == BlockSet.TALL_GRASS; } + public static boolean isTorch(final Block block) { return block.getTypeOfBlock() == BlockSet.TORCH; } + + - public static boolean isDirt(Object obj) { return obj instanceof Dirt; } + public BlockSet getTypeOfBlock() { return this.typeOfBlock; } } diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/BlockSet.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/BlockSet.java new file mode 100644 index 0000000..2de0c16 --- /dev/null +++ b/src/main/java/fr/sae/terraria/modele/entities/blocks/BlockSet.java @@ -0,0 +1,14 @@ +package fr.sae.terraria.modele.entities.blocks; + + +public enum BlockSet +{ + FLOOR_TOP, + FLOOR_RIGHT, + FLOOR_LEFT, + DIRT, + ROCK, + TALL_GRASS, + TORCH, + TREE +} diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/Dirt.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/Dirt.java deleted file mode 100644 index 8593925..0000000 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/Dirt.java +++ /dev/null @@ -1,81 +0,0 @@ -package fr.sae.terraria.modele.entities.blocks; - -import fr.sae.terraria.modele.Environment; -import fr.sae.terraria.modele.TileSet; -import fr.sae.terraria.modele.entities.entity.CollideObjectType; -import fr.sae.terraria.modele.entities.entity.Entity; -import fr.sae.terraria.modele.entities.entity.PlaceableObjectType; -import fr.sae.terraria.modele.entities.entity.StowableObjectType; -import fr.sae.terraria.modele.entities.player.Player; -import fr.sae.terraria.modele.entities.player.inventory.Inventory; - -import java.util.Objects; - - -public class Dirt extends Block implements StowableObjectType, CollideObjectType, PlaceableObjectType -{ - public static final int BREAK_RESISTANCE = 2; - - private final Environment environment; - - private final double xOrigin; - private final double yOrigin; - private TileSet typeOfFloor; - - - public Dirt(Environment environment, int x, int y) - { - super(x, y); - this.environment = environment; - - this.xOrigin = x; - this.yOrigin = y; - - this.pv.set(Dirt.BREAK_RESISTANCE); - } - - @Override public void updates() { /* TODO document why this method is empty */ } - - @Override public void collide() { /* NE RIEN REMPLIR */ } - - @Override public void breaks() - { - Environment.playSound("sound/grassyStep.wav", false); - this.breakAnimation(environment, this, xOrigin, yOrigin); - - if (this.getPv() <= 0) { - this.environment.getPlayer().pickup(this); - - int yIndexTile = (int) (getY()/environment.heightTile); - int xIndexTile = (int) (getX()/environment.widthTile); - this.environment.getTileMaps().setTile(TileSet.SKY.ordinal(), yIndexTile, xIndexTile); - this.environment.getEntities().remove(this); - this.environment.getBlocks().remove(this); - } - this.setPv(this.getPv() - 1); - } - - @Override public void place(final int x, final int y) - { - Environment.playSound("sound/axchop.wav", false); - int widthTile = this.environment.widthTile; - int heightTile = this.environment.heightTile; - - Entity entity = new Dirt(this.environment, x*widthTile, y*heightTile); - entity.setRect(widthTile, heightTile); - - Player player = this.environment.getPlayer(); - Inventory inventory = player.getInventory(); - if (!Objects.isNull(player.getStackSelected())) - inventory.get().get(inventory.getPosCursor()).remove(); - - this.environment.getTileMaps().setTile(TileSet.DIRT.ordinal(), y, x); - this.environment.getEntities().add(entity); - this.environment.getBlocks().add((Dirt) entity); - } - - - public TileSet getTypeOfFloor() { return this.typeOfFloor; } - - public void setTypeOfFloor(TileSet type) { this.typeOfFloor = type; } -} diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/Grass.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/Grass.java deleted file mode 100644 index 7e07df6..0000000 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/Grass.java +++ /dev/null @@ -1,17 +0,0 @@ -package fr.sae.terraria.modele.entities.blocks; - -import fr.sae.terraria.modele.Environment; - -public class Grass extends Block -{ - - - public Grass(int x, int y) { super(x, y); } - - @Override public void updates() { /* TODO document why this method is empty */ } - - @Override public void breaks() - { - Environment.playSound("sound/grassyStep.wav", false); - } -} diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/Rock.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/Rock.java deleted file mode 100644 index e648461..0000000 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/Rock.java +++ /dev/null @@ -1,90 +0,0 @@ -package fr.sae.terraria.modele.entities.blocks; - -import fr.sae.terraria.modele.Environment; -import fr.sae.terraria.modele.TileSet; -import fr.sae.terraria.modele.entities.entity.CollideObjectType; -import fr.sae.terraria.modele.entities.entity.PlaceableObjectType; -import fr.sae.terraria.modele.entities.entity.StowableObjectType; -import fr.sae.terraria.modele.entities.items.Item; -import fr.sae.terraria.modele.entities.player.Player; -import fr.sae.terraria.modele.entities.player.inventory.Inventory; -import fr.sae.terraria.modele.entities.player.inventory.Stack; -import fr.sae.terraria.modele.entities.tools.Tool; - -import java.util.Objects; - - -public class Rock extends Block implements StowableObjectType, CollideObjectType, PlaceableObjectType -{ - public static final int BREAK_RESISTANCE = 5; - public static final int STONE_LOOTS = 3; - - private final Environment environment; - - private final double xOrigin; - private final double yOrigin; - - - public Rock(Environment environment, int x, int y) - { - super(x, y); - this.environment = environment; - - this.xOrigin = x; - this.yOrigin = y; - - this.pv.set(Rock.BREAK_RESISTANCE); - } - - public Rock(Environment environment) { this(environment, 0, 0); } - - @Override public void updates() { /* TODO document why this method is empty */ } - - @Override public void collide() { /* NE RIEN REMPLIR */ } - - @Override public void breaks() - { - Environment.playSound("sound/brick" + ((int) (Math.random()*2)+1) + ".wav", false); - this.breakAnimation(this.environment, this, this.xOrigin, this.yOrigin); - - // Une fois le bloc cassé, de la pierre est ramassée et le bloc se supprime du Pane - Player player = this.environment.getPlayer(); - if (this.getPv() <= 0) { - for (int i = 0; i < 3; i++) - player.pickup(Item.STONE); - - int yIndexTile = (int) (getY()/this.environment.heightTile); - int xIndexTile = (int) (getX()/this.environment.widthTile); - this.environment.getTileMaps().setTile(TileSet.SKY.ordinal(), yIndexTile, xIndexTile); - this.environment.getEntities().remove(this); - this.environment.getBlocks().remove(this); - } - - // Peu importe l'outil qu'utilise le joueur, si c'est un outil, il perdra de la durabilité, mais le bloc ne peut que se casser avec une pioche - Stack stack = player.getStackSelected(); - if (!Objects.isNull(stack) && stack.getItem() instanceof Tool) { - if (Tool.isPickaxe(((Tool) stack.getItem()).getTypeOfTool())) - this.setPv(this.getPv() - 1); - ((Tool) stack.getItem()).use(); - } - } - - @Override public void place(int x, int y) - { - Environment.playSound("sound/axchop.wav", false); - int widthTile = this.environment.widthTile; - int heightTile = this.environment.heightTile; - - Block entity = new Rock(this.environment, x*widthTile, y*heightTile); - entity.setRect(widthTile, heightTile); - - Player player = this.environment.getPlayer(); - Inventory inventory = player.getInventory(); - if (!Objects.isNull(player.getStackSelected())) - inventory.get().get(inventory.getPosCursor()).remove(); - - this.environment.getTileMaps().setTile(TileSet.ROCK.ordinal(), y, x); - this.environment.getEntities().add(entity); - this.environment.getBlocks().add(entity); - } -} diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/TallGrass.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/TallGrass.java index da4db4f..2311f99 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/TallGrass.java +++ b/src/main/java/fr/sae/terraria/modele/entities/blocks/TallGrass.java @@ -5,8 +5,6 @@ import fr.sae.terraria.modele.entities.entity.Entity; import fr.sae.terraria.modele.entities.entity.ReproductiveObjectType; import fr.sae.terraria.modele.entities.entity.SpawnableObjectType; -import fr.sae.terraria.modele.entities.items.Item; -import fr.sae.terraria.modele.entities.items.Vodka; import javafx.beans.property.DoubleProperty; import javafx.beans.property.SimpleDoubleProperty; @@ -28,9 +26,9 @@ public class TallGrass extends Block implements ReproductiveObjectType, Spawnabl private final Environment environment; - public TallGrass(Environment environment, int x, int y) + public TallGrass(final Environment environment, int x, int y) { - super(x, y); + super(BlockSet.TALL_GRASS, environment, x, y); this.environment = environment; this.tallGrassGrowth = new SimpleDoubleProperty(0); @@ -45,22 +43,6 @@ public TallGrass(Environment environment, int x, int y) tallGrassGrowth.set(tallGrassGrowth.get() + TallGrass.GROWTH_SPEED); } - /** Joue un son et donne au joueur entre 1 et 3 fibres */ - @Override public void breaks() - { - Environment.playSound("sound/cut.wav", false); - - for (int loot = (int) (Math.random()*3)+1; loot < LOOTS_FIBRE_MAX; loot++) - this.environment.getPlayer().pickup(Item.FIBER); - - boolean mustDropVodka = Math.random() < Vodka.DROP_RATE; - if (mustDropVodka) - this.environment.getPlayer().pickup(new Vodka(environment)); - - this.environment.getEntities().remove(this); - this.environment.getBlocks().remove(this); - } - /** Reproduit des hautes herbes à gauche et à droite de celle parente */ @Override public List<Entity> reproduction(Environment environment) { diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/Torch.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/Torch.java deleted file mode 100644 index 35bdb53..0000000 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/Torch.java +++ /dev/null @@ -1,60 +0,0 @@ -package fr.sae.terraria.modele.entities.blocks; - -import fr.sae.terraria.modele.Environment; -import fr.sae.terraria.modele.entities.entity.PlaceableObjectType; -import fr.sae.terraria.modele.entities.entity.StowableObjectType; -import fr.sae.terraria.modele.entities.player.Player; -import fr.sae.terraria.modele.entities.player.inventory.Inventory; - -import java.util.Objects; - - -public class Torch extends Block implements StowableObjectType, PlaceableObjectType -{ - private final Environment environment; - - private double xOrigin; - private double yOrigin; - - - public Torch(final Environment environment, int x, int y) - { - super(x, y); - this.environment = environment; - - this.xOrigin = x; - this.yOrigin = y; - } - - public Torch(final Environment environment) { this(environment, 0, 0); } - - @Override public void updates() { /* TODO document why this method is empty */ } - - @Override public void breaks() - { - this.breakAnimation(environment, this, xOrigin, yOrigin); - - this.environment.getPlayer().pickup(this); - - this.environment.getEntities().remove(this); - this.environment.getTorches().remove(this); - this.environment.getBlocks().remove(this); - } - - @Override public void place(int x, int y) - { - Environment.playSound("sound/axchop.wav", false); - - Torch entity = new Torch(this.environment, x*environment.widthTile, y*environment.heightTile); - entity.setRect(environment.widthTile, environment.heightTile); - - Player player = this.environment.getPlayer(); - Inventory inventory = player.getInventory(); - if (!Objects.isNull(player.getStackSelected())) - inventory.get().get(inventory.getPosCursor()).remove(); - - environment.getEntities().add(entity); - environment.getTorches().add(0, entity); - environment.getBlocks().add(entity); - } -} \ No newline at end of file diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/Tree.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/Tree.java index 42d9193..5271002 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/Tree.java +++ b/src/main/java/fr/sae/terraria/modele/entities/blocks/Tree.java @@ -13,13 +13,13 @@ public class Tree extends Block implements SpawnableObjectType private final Environment environment; - public Tree(Environment environment, int x, int y) + public Tree(final Environment environment, int x, int y) { - super(x, y); + super(BlockSet.TREE, environment, x, y); this.environment = environment; } - public Tree(Environment environment) { this(environment, 0, 0); } + public Tree(final Environment environment) { this(environment, 0, 0); } @Override public void updates() { /* TODO document why this method is empty */ } diff --git a/src/main/java/fr/sae/terraria/modele/entities/entity/BreakableObjectType.java b/src/main/java/fr/sae/terraria/modele/entities/entity/BreakableObjectType.java index e076a99..ea05aa6 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/entity/BreakableObjectType.java +++ b/src/main/java/fr/sae/terraria/modele/entities/entity/BreakableObjectType.java @@ -1,8 +1,6 @@ package fr.sae.terraria.modele.entities.entity; -import fr.sae.terraria.modele.entities.blocks.Rock; - /** * <h1>Breakable Object Type</h1> * <h2>Interface utile à un objet qui hérite d'Entity</h2> @@ -19,10 +17,6 @@ public interface BreakableObjectType /** * Fonction appelée lorsqu'une entité tente de casser une autre entité * Permet de faire des actions personnalisées. - * - * @see fr.sae.terraria.modele.entities.blocks.Dirt - * @see fr.sae.terraria.modele.entities.blocks.TallGrass - * @see Rock */ void breaks(); } diff --git a/src/main/java/fr/sae/terraria/modele/entities/entity/PlaceableObjectType.java b/src/main/java/fr/sae/terraria/modele/entities/entity/PlaceableObjectType.java index 2720b5f..8c66ebf 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/entity/PlaceableObjectType.java +++ b/src/main/java/fr/sae/terraria/modele/entities/entity/PlaceableObjectType.java @@ -1,8 +1,6 @@ package fr.sae.terraria.modele.entities.entity; -import fr.sae.terraria.modele.entities.blocks.Rock; - /** * <h1>Placeable Object Type</h1> * <h2>Interface utile sur les objets qui héritent de block</h2> diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java index 0c1edea..b93dc9d 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java @@ -1,10 +1,7 @@ package fr.sae.terraria.modele.entities.player.inventory; -import fr.sae.terraria.modele.entities.Arrow; -import fr.sae.terraria.modele.entities.blocks.Dirt; -import fr.sae.terraria.modele.entities.blocks.Rock; +import fr.sae.terraria.modele.entities.blocks.Block; import fr.sae.terraria.modele.entities.blocks.TallGrass; -import fr.sae.terraria.modele.entities.blocks.Torch; import fr.sae.terraria.modele.entities.entity.StowableObjectType; import fr.sae.terraria.modele.entities.items.Item; import fr.sae.terraria.modele.entities.items.Meat; @@ -37,19 +34,22 @@ public Stack() public boolean isSameItem(StowableObjectType obj) { - if (obj instanceof Dirt && this.item instanceof Dirt) - return true; - if (obj instanceof Rock && this.item instanceof Rock) - return true; - if (obj instanceof TallGrass && this.item instanceof TallGrass) - return true; - if (obj instanceof Torch && this.item instanceof Torch) - return true; if (obj instanceof Meat && this.item instanceof Meat) return true; if (obj instanceof Vodka && this.item instanceof Vodka) return true; + if (obj instanceof Block && this.item instanceof Block) { + if (Block.isDirt((Block) obj) && Block.isDirt((Block) this.item)) + return true; + if (Block.isRock((Block) obj) && Block.isRock((Block) this.item)) + return true; + if (Block.isTallGrass((Block) obj) && Block.isTallGrass((Block) this.item)) + return true; + if (Block.isTorch((Block) obj) && Block.isTorch((Block) this.item)) + return true; + } + if (obj instanceof Tool && this.item instanceof Tool) { if (Tool.isAxe(((Tool) obj).getTypeOfTool()) && Tool.isAxe(((Tool) this.item).getTypeOfTool())) return true; diff --git a/src/main/java/fr/sae/terraria/vue/LightView.java b/src/main/java/fr/sae/terraria/vue/LightView.java index 49e149d..ca5c2ec 100644 --- a/src/main/java/fr/sae/terraria/vue/LightView.java +++ b/src/main/java/fr/sae/terraria/vue/LightView.java @@ -3,7 +3,7 @@ import fr.sae.terraria.modele.Clock; import fr.sae.terraria.modele.Environment; import fr.sae.terraria.modele.TileMaps; -import fr.sae.terraria.modele.entities.blocks.Torch; +import fr.sae.terraria.modele.entities.blocks.Block; import javafx.collections.ListChangeListener; import javafx.collections.ObservableList; import javafx.scene.layout.Pane; @@ -57,8 +57,8 @@ public LightView(Clock clock, Pane filterPane, Environment env) { this.initTorchListener(env.getTorches()); } - private void initTorchListener(ObservableList<Torch> torches) { - torches.addListener((ListChangeListener<? super Torch>) c -> { + private void initTorchListener(ObservableList<Block> torches) { + torches.addListener((ListChangeListener<? super Block>) c -> { while(c.next()){ this.filterPane.getChildren().clear(); addTochLights(); diff --git a/src/main/java/fr/sae/terraria/vue/TileMapsView.java b/src/main/java/fr/sae/terraria/vue/TileMapsView.java index fdf25ae..235c4b5 100644 --- a/src/main/java/fr/sae/terraria/vue/TileMapsView.java +++ b/src/main/java/fr/sae/terraria/vue/TileMapsView.java @@ -5,7 +5,10 @@ import fr.sae.terraria.modele.TileSet; import fr.sae.terraria.modele.entities.Rabbit; import fr.sae.terraria.modele.entities.Slime; -import fr.sae.terraria.modele.entities.blocks.*; +import fr.sae.terraria.modele.entities.blocks.Block; +import fr.sae.terraria.modele.entities.blocks.BlockSet; +import fr.sae.terraria.modele.entities.blocks.TallGrass; +import fr.sae.terraria.modele.entities.blocks.Tree; import fr.sae.terraria.vue.entities.RabbitView; import fr.sae.terraria.vue.entities.SlimeView; import javafx.collections.ListChangeListener; @@ -114,22 +117,20 @@ private void updatesBlocksView(ListChangeListener.Change<? extends Block> c) Block block = c.getAddedSubList().get(0); blockView.setImage(null); - if (block instanceof Dirt) { - Dirt dirt = (Dirt) block; - if (TileSet.isFloorTopTile(dirt.getTypeOfFloor())) - blockView.setImage(this.floorTopImg); - else if (TileSet.isFloorLeftTile(dirt.getTypeOfFloor())) - blockView.setImage(this.floorLeftImg); - else if (TileSet.isFloorRightTile(dirt.getTypeOfFloor())) - blockView.setImage(this.floorRightImg); - else if (TileSet.isDirtTile(dirt.getTypeOfFloor())) - blockView.setImage(this.dirtImg); - } else if (block instanceof Rock) { + if (Block.isDirt(block)) { + blockView.setImage(this.dirtImg); + } else if (Block.isFloorTop(block)) { + blockView.setImage(this.floorTopImg); + } else if (Block.isFloorLeft(block)) { + blockView.setImage(this.floorLeftImg); + } else if (Block.isFloorRight(block)) { + blockView.setImage(this.floorRightImg); + } else if (Block.isRock(block)) { blockView.setImage(this.stoneImg); - } else if (block instanceof TallGrass) { + } else if (Block.isTallGrass(block)) { blockView.setImage(this.tallGrassImg); ((TallGrass) block).getTallGrassGrowthProperty().addListener((observable, oldValue, newValue) -> blockView.setViewport(new Rectangle2D(0, ((int) ((this.tallGrassImg.getHeight() / (TallGrass.GROWTH_TALL_GRASS_STEP) * newValue.intValue()) - tallGrassImg.getHeight())), this.tallGrassImg.getWidth(), this.tallGrassImg.getHeight()))); - } else if (block instanceof Torch) { + } else if (Block.isTorch(block)) { blockView.setImage(this.torchImg); } @@ -203,7 +204,7 @@ private void updatesSlimeView(ListChangeListener.Change<? extends Slime> c) * @param c Cet argument est present car on passe cette fonction en tant que reference (this::updatesRabbitsView), * l'argument est là pour obtenir les informations concernant les modifications dans liste <code>List<Block> rabbits;</code> */ - private void updatesTreeView(ListChangeListener.Change<? extends Tree> c) + private void updatesTreeView(ListChangeListener.Change<? extends Block> c) { while (c.next()) { if (c.wasAdded()) { @@ -255,7 +256,7 @@ private void updatesTreeView(ListChangeListener.Change<? extends Tree> c) trunkFootView.setViewport(viewportTrunkFoot); group.getChildren().add(trunkFootView); - Tree tree = c.getAddedSubList().get(0); + Tree tree = (Tree) c.getAddedSubList().get(0); for (int i = 0; i < group.getChildren().size(); i++) { ImageView treeView = (ImageView) group.getChildren().get(i); @@ -281,27 +282,34 @@ private void updatesTreeView(ListChangeListener.Change<? extends Tree> c) public void displayMaps(TileMaps tiles) { for (int y = 0; y < tiles.getHeight() ; y++) - for (int x = 0 ; x < tiles.getWidth() ; x++) + for (int x = 0 ; x < tiles.getWidth() ; x++) { + int xBlock = x * this.tileWidth; + int yBlock = y * this.tileHeight; + if (tiles.isRockTile(x, y)) { - Rock rockEntity = new Rock(this.environment, x*this.tileWidth, y*this.tileHeight); + Block rockEntity = new Block(BlockSet.ROCK, this.environment, xBlock, yBlock); rockEntity.setRect(this.tileWidth, this.tileHeight); this.environment.getEntities().add(rockEntity); this.environment.getBlocks().add(rockEntity); } else if (tiles.isDirtTile(x, y)) { - Dirt dirtSprite = new Dirt(this.environment, x*this.tileWidth, y*this.tileHeight); - dirtSprite.setTypeOfFloor(TileSet.DIRT); + Block dirtSprite = new Block(BlockSet.DIRT, this.environment, xBlock, yBlock); dirtSprite.setRect(this.tileWidth, this.tileHeight); this.environment.getEntities().add(dirtSprite); this.environment.getBlocks().add(dirtSprite); } else if (tiles.isFloorTopTile(x, y) || tiles.isFloorLeftTile(x, y) || tiles.isFloorRightTile(x, y)) { - Dirt floorEntity = new Dirt(this.environment, x*this.tileWidth, y*this.tileHeight); - floorEntity.setTypeOfFloor((tiles.isFloorTopTile(x, y)) ? TileSet.FLOOR_TOP : (tiles.isFloorRightTile(x, y)) ? TileSet.FLOOR_RIGHT : TileSet.FLOOR_LEFT); + Block floorEntity = null; + if (tiles.isFloorTopTile(x, y)) + floorEntity = new Block(BlockSet.FLOOR_TOP, this.environment, xBlock, yBlock); + else if (tiles.isFloorLeftTile(x, y)) + floorEntity = new Block(BlockSet.FLOOR_LEFT, this.environment, xBlock, yBlock); + else floorEntity = new Block(BlockSet.FLOOR_RIGHT, this.environment, xBlock, yBlock); floorEntity.setRect(this.tileWidth, this.tileHeight); this.environment.getEntities().add(floorEntity); this.environment.getBlocks().add(floorEntity); } + } } } diff --git a/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java b/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java index b4c2885..1c7efe5 100644 --- a/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java +++ b/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java @@ -4,9 +4,7 @@ import fr.sae.terraria.modele.TileMaps; import fr.sae.terraria.modele.entities.Arrow; import fr.sae.terraria.modele.entities.blocks.Block; -import fr.sae.terraria.modele.entities.blocks.Rock; import fr.sae.terraria.modele.entities.blocks.TallGrass; -import fr.sae.terraria.modele.entities.blocks.Torch; import fr.sae.terraria.modele.entities.entity.StowableObjectType; import fr.sae.terraria.modele.entities.items.Item; import fr.sae.terraria.modele.entities.items.Meat; @@ -101,21 +99,22 @@ private void displayItemIntoInventoryBar() Stack stack = c.getAddedSubList().get(0); StowableObjectType item = stack.getItem(); - if (Block.isDirt(item)) - view.setImage(View.loadAnImage("tiles/floor-top.png", itemInventoryWidth, itemInventoryHeight)); - else if (item instanceof Rock) - view.setImage(View.loadAnImage("tiles/rock-fill.png", itemInventoryWidth, itemInventoryHeight)); - else if (item instanceof TallGrass) - view.setImage(View.loadAnImage("tiles/tall-grass.png.png", itemInventoryWidth, itemInventoryHeight)); - else if (item instanceof Torch) - view.setImage(View.loadAnImage("tiles/torch.png", itemInventoryWidth, itemInventoryHeight)); - else if (item instanceof Meat) + if (item instanceof Meat) view.setImage(View.loadAnImage("loots/meat.png", itemInventoryWidth, itemInventoryHeight)); else if (item instanceof Arrow) view.setImage(null); // TODO else if (item instanceof Vodka) view.setImage(View.loadAnImage("loots/vodka.png", itemInventoryWidth,itemInventoryHeight)); - else if (item instanceof Tool) { + else if (item instanceof Block) { + if (Block.isDirt((Block) item)) + view.setImage(View.loadAnImage("tiles/floor-top.png", itemInventoryWidth, itemInventoryHeight)); + else if (Block.isRock((Block) item)) + view.setImage(View.loadAnImage("tiles/rock-fill.png", itemInventoryWidth, itemInventoryHeight)); + else if (Block.isTallGrass((Block) item)) + view.setImage(View.loadAnImage("tiles/tall-grass.png.png", itemInventoryWidth, itemInventoryHeight)); + else if (Block.isTorch((Block) item)) + view.setImage(View.loadAnImage("tiles/torch.png", itemInventoryWidth, itemInventoryHeight)); + } else if (item instanceof Tool) { if (Tool.isAxe(((Tool) item).getTypeOfTool())) view.setImage(null); // TODO else if (Tool.isBow(((Tool) item).getTypeOfTool())) diff --git a/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java b/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java index 8b8e07e..6a90f61 100644 --- a/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java +++ b/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java @@ -2,10 +2,9 @@ import fr.sae.terraria.modele.TileMaps; import fr.sae.terraria.modele.entities.Arrow; -import fr.sae.terraria.modele.entities.blocks.Dirt; -import fr.sae.terraria.modele.entities.blocks.Rock; +import fr.sae.terraria.modele.entities.blocks.Block; +import fr.sae.terraria.modele.entities.blocks.BlockSet; import fr.sae.terraria.modele.entities.blocks.TallGrass; -import fr.sae.terraria.modele.entities.blocks.Torch; import fr.sae.terraria.modele.entities.entity.StowableObjectType; import fr.sae.terraria.modele.entities.items.Item; import fr.sae.terraria.modele.entities.items.Meat; @@ -81,21 +80,26 @@ public ItemSelectedView(Pane display, Player player, double scaleMultiplicatorWi if (!Objects.isNull(player.getStackSelected())) { StowableObjectType item = player.getStackSelected().getItem(); - if (item instanceof Dirt) - this.itemSelectedImgView.setImage(this.dirtItemImg); - else if (item instanceof Rock) - this.itemSelectedImgView.setImage(this.rockItemImg); - else if (item instanceof TallGrass) - this.itemSelectedImgView.setImage(null); - else if (item instanceof Torch) - this.itemSelectedImgView.setImage(this.torchItemImg); - else if (item instanceof Meat) + if (item instanceof Meat) this.itemSelectedImgView.setImage(this.meatItemImg); else if (item instanceof Vodka) this.itemSelectedImgView.setImage(this.vodkaItemImg); else if (item instanceof Arrow) this.itemSelectedImgView.setImage(null); - else if (item instanceof Tool) { + + if (item instanceof Block) + { + if (Block.isDirt((Block) item)) + this.itemSelectedImgView.setImage(this.dirtItemImg); + else if (Block.isRock((Block) item)) + this.itemSelectedImgView.setImage(this.rockItemImg); + else if (Block.isTallGrass((Block) item)) + this.itemSelectedImgView.setImage(null); + else if (Block.isTorch((Block) item)) + this.itemSelectedImgView.setImage(this.torchItemImg); + } + + if (item instanceof Tool) { if (Tool.isAxe(((Tool) item).getTypeOfTool())) this.itemSelectedImgView.setImage(null); else if (Tool.isBow(((Tool) item).getTypeOfTool())) @@ -104,7 +108,9 @@ else if (Tool.isPickaxe(((Tool) item).getTypeOfTool())) this.itemSelectedImgView.setImage(this.pickaxeItemImg); else if (Tool.isSword(((Tool) item).getTypeOfTool())) this.itemSelectedImgView.setImage(this.swordItemImg); - } else if (item instanceof Item) { + } + + if (item instanceof Item) { if (Item.isCoal(item)) this.itemSelectedImgView.setImage(this.coalItemImg); else if (Item.isFiber(item)) diff --git a/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java b/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java index 092fba5..39343c5 100644 --- a/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java +++ b/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java @@ -4,7 +4,6 @@ import fr.sae.terraria.modele.TileMaps; import fr.sae.terraria.modele.TileSet; import fr.sae.terraria.modele.entities.Rabbit; -import fr.sae.terraria.modele.entities.blocks.Dirt; import fr.sae.terraria.modele.entities.items.Meat; import fr.sae.terraria.modele.entities.items.Vodka; import javafx.geometry.Rectangle2D; diff --git a/src/test/java/fr/sae/terraria/modele/entities/player/inventory/InventoryTest.java b/src/test/java/fr/sae/terraria/modele/entities/player/inventory/InventoryTest.java index d2ecfb9..48d09ac 100644 --- a/src/test/java/fr/sae/terraria/modele/entities/player/inventory/InventoryTest.java +++ b/src/test/java/fr/sae/terraria/modele/entities/player/inventory/InventoryTest.java @@ -1,7 +1,6 @@ package fr.sae.terraria.modele.entities.player.inventory; import fr.sae.terraria.modele.Environment; -import fr.sae.terraria.modele.entities.blocks.Dirt; import fr.sae.terraria.modele.entities.player.Player; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; From 11c7ee0b3bd6d553db8482b2da75507b83b9b149 Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Sun, 12 Jun 2022 23:34:22 +0200 Subject: [PATCH 49/97] Fix rock --- .../fr/sae/terraria/modele/GenerateEntity.java | 8 +++----- .../fr/sae/terraria/modele/entities/Slime.java | 2 +- .../sae/terraria/modele/entities/blocks/Block.java | 14 ++++++++++++-- .../modele/entities/player/inventory/Stack.java | 11 +++++------ .../sae/terraria/modele/entities/tools/Tool.java | 10 +++++----- .../java/fr/sae/terraria/vue/TileMapsView.java | 1 - .../fr/sae/terraria/vue/hud/InventoryView.java | 9 ++++----- .../fr/sae/terraria/vue/hud/ItemSelectedView.java | 10 ++++------ 8 files changed, 34 insertions(+), 31 deletions(-) diff --git a/src/main/java/fr/sae/terraria/modele/GenerateEntity.java b/src/main/java/fr/sae/terraria/modele/GenerateEntity.java index 3824ed5..b97c487 100644 --- a/src/main/java/fr/sae/terraria/modele/GenerateEntity.java +++ b/src/main/java/fr/sae/terraria/modele/GenerateEntity.java @@ -2,8 +2,6 @@ import fr.sae.terraria.modele.entities.Rabbit; import fr.sae.terraria.modele.entities.Slime; -import fr.sae.terraria.modele.entities.blocks.Block; -import fr.sae.terraria.modele.entities.blocks.BlockSet; import fr.sae.terraria.modele.entities.blocks.TallGrass; import fr.sae.terraria.modele.entities.blocks.Tree; import fr.sae.terraria.modele.entities.entity.Entity; @@ -80,12 +78,12 @@ private static void generateAnEntity(Environment environment, SpawnableObjectTyp /** Range les positions du sol sur la ligne 'y' */ private static List<Integer> findFloors(TileMaps tileMaps, int y) { - List<Integer> localisation = new ArrayList<>(); + List<Integer> loc = new ArrayList<>(); for (int x = 0; x < tileMaps.getWidth(); x++) if (tileMaps.isFloorTopTile(x, y) || tileMaps.isFloorRightTile(x, y) || tileMaps.isFloorLeftTile(x, y)) - localisation.add(x); + loc.add(x); - return localisation; + return loc; } /** À un certain moment, grace au tick, il va générer des arbres +/- grand uniquement sur un sol */ diff --git a/src/main/java/fr/sae/terraria/modele/entities/Slime.java b/src/main/java/fr/sae/terraria/modele/entities/Slime.java index dde2840..f798ecd 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/Slime.java +++ b/src/main/java/fr/sae/terraria/modele/entities/Slime.java @@ -84,7 +84,7 @@ else if (environment.getPlayer().getX() < this.x.getValue()) Stack stack = this.environment.getPlayer().getStackSelected(); if (!Objects.isNull(stack)) { - if (Tool.isSword(((Tool) stack.getItem()).getTypeOfTool())) { + if (Tool.isSword((Tool) stack.getItem())) { Tool tool = (Tool) stack.getItem(); this.setPv(this.getPv() - tool.damage()); } diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java index 109d1fc..1c0efb7 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java +++ b/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java @@ -11,6 +11,9 @@ import fr.sae.terraria.modele.entities.items.Vodka; import fr.sae.terraria.modele.entities.player.Player; import fr.sae.terraria.modele.entities.player.inventory.Inventory; +import fr.sae.terraria.modele.entities.player.inventory.Stack; +import fr.sae.terraria.modele.entities.tools.Tool; +import fr.sae.terraria.modele.entities.tools.ToolSet; import javafx.animation.KeyFrame; import javafx.animation.Timeline; import javafx.util.Duration; @@ -112,7 +115,15 @@ else if (this.typeOfBlock == BlockSet.TALL_GRASS) this.environment.getBlocks().remove(this); } - this.setPv(this.getPv() - 1); + if (isRock(this)) { + Stack item = this.environment.getPlayer().getStackSelected(); + if (!Objects.isNull(item) && item.getItem() instanceof Tool) { + Tool tool = (Tool) item.getItem(); + if (Tool.isPickaxe(tool)) + this.setPv(this.getPv() - 1); + tool.use(); + } + } else this.setPv(this.getPv() - 1); } @Override public void place(final int x, final int y) @@ -151,6 +162,5 @@ else if (this.typeOfBlock == BlockSet.TALL_GRASS) public static boolean isTorch(final Block block) { return block.getTypeOfBlock() == BlockSet.TORCH; } - public BlockSet getTypeOfBlock() { return this.typeOfBlock; } } diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java index b93dc9d..6018d08 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java @@ -1,7 +1,6 @@ package fr.sae.terraria.modele.entities.player.inventory; import fr.sae.terraria.modele.entities.blocks.Block; -import fr.sae.terraria.modele.entities.blocks.TallGrass; import fr.sae.terraria.modele.entities.entity.StowableObjectType; import fr.sae.terraria.modele.entities.items.Item; import fr.sae.terraria.modele.entities.items.Meat; @@ -51,15 +50,15 @@ public boolean isSameItem(StowableObjectType obj) } if (obj instanceof Tool && this.item instanceof Tool) { - if (Tool.isAxe(((Tool) obj).getTypeOfTool()) && Tool.isAxe(((Tool) this.item).getTypeOfTool())) + if (Tool.isAxe((Tool) obj) && Tool.isAxe((Tool) this.item)) return true; - if (Tool.isBow(((Tool) obj).getTypeOfTool()) && Tool.isBow(((Tool) this.item).getTypeOfTool())) + if (Tool.isBow((Tool) obj) && Tool.isBow((Tool) this.item)) return true; - if (Tool.isPickaxe(((Tool) obj).getTypeOfTool()) && Tool.isPickaxe(((Tool) this.item).getTypeOfTool())) + if (Tool.isPickaxe((Tool) obj) && Tool.isPickaxe((Tool) this.item)) return true; - if (Tool.isSword(((Tool) obj).getTypeOfTool()) && Tool.isSword(((Tool) this.item).getTypeOfTool())) + if (Tool.isSword((Tool) obj) && Tool.isSword((Tool) this.item)) return true; - if (Tool.isArrow(((Tool) obj).getTypeOfTool()) && Tool.isArrow(((Tool) this.item).getTypeOfTool())) + if (Tool.isArrow((Tool) obj) && Tool.isArrow((Tool) this.item)) return true; } diff --git a/src/main/java/fr/sae/terraria/modele/entities/tools/Tool.java b/src/main/java/fr/sae/terraria/modele/entities/tools/Tool.java index e817f88..f36e22b 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/tools/Tool.java +++ b/src/main/java/fr/sae/terraria/modele/entities/tools/Tool.java @@ -50,11 +50,11 @@ else if (this.material == MaterialSet.IRON) return Tool.DEFAULT_DAMAGE; } - public static boolean isAxe(ToolSet tool) { return tool == ToolSet.AXE; } - public static boolean isBow(ToolSet tool) { return tool == ToolSet.BOW; } - public static boolean isPickaxe(ToolSet tool) { return tool == ToolSet.PICKAXE; } - public static boolean isSword(ToolSet tool) { return tool == ToolSet.SWORD; } - public static boolean isArrow(ToolSet tool) { return tool == ToolSet.ARROW; } + public static boolean isAxe(Tool tool) { return tool.getTypeOfTool() == ToolSet.AXE; } + public static boolean isBow(Tool tool) { return tool.getTypeOfTool() == ToolSet.BOW; } + public static boolean isPickaxe(Tool tool) { return tool.getTypeOfTool() == ToolSet.PICKAXE; } + public static boolean isSword(Tool tool) { return tool.getTypeOfTool() == ToolSet.SWORD; } + public static boolean isArrow(Tool tool) { return tool.getTypeOfTool() == ToolSet.ARROW; } public ToolSet getTypeOfTool() { return this.tool; } diff --git a/src/main/java/fr/sae/terraria/vue/TileMapsView.java b/src/main/java/fr/sae/terraria/vue/TileMapsView.java index 235c4b5..811dc87 100644 --- a/src/main/java/fr/sae/terraria/vue/TileMapsView.java +++ b/src/main/java/fr/sae/terraria/vue/TileMapsView.java @@ -2,7 +2,6 @@ import fr.sae.terraria.modele.Environment; import fr.sae.terraria.modele.TileMaps; -import fr.sae.terraria.modele.TileSet; import fr.sae.terraria.modele.entities.Rabbit; import fr.sae.terraria.modele.entities.Slime; import fr.sae.terraria.modele.entities.blocks.Block; diff --git a/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java b/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java index 1c7efe5..7314d9b 100644 --- a/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java +++ b/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java @@ -4,7 +4,6 @@ import fr.sae.terraria.modele.TileMaps; import fr.sae.terraria.modele.entities.Arrow; import fr.sae.terraria.modele.entities.blocks.Block; -import fr.sae.terraria.modele.entities.blocks.TallGrass; import fr.sae.terraria.modele.entities.entity.StowableObjectType; import fr.sae.terraria.modele.entities.items.Item; import fr.sae.terraria.modele.entities.items.Meat; @@ -115,13 +114,13 @@ else if (Block.isTallGrass((Block) item)) else if (Block.isTorch((Block) item)) view.setImage(View.loadAnImage("tiles/torch.png", itemInventoryWidth, itemInventoryHeight)); } else if (item instanceof Tool) { - if (Tool.isAxe(((Tool) item).getTypeOfTool())) + if (Tool.isAxe((Tool) item)) view.setImage(null); // TODO - else if (Tool.isBow(((Tool) item).getTypeOfTool())) + else if (Tool.isBow((Tool) item)) view.setImage(null); // TODO - else if (Tool.isPickaxe(((Tool) item).getTypeOfTool())) + else if (Tool.isPickaxe((Tool) item)) view.setImage(View.loadAnImage("tools/pickaxe.png", itemInventoryWidth, itemInventoryHeight)); - else if (Tool.isSword(((Tool) item).getTypeOfTool())) + else if (Tool.isSword((Tool) item)) view.setImage(View.loadAnImage("tools/sword.png", itemInventoryWidth, itemInventoryHeight)); } else if (item instanceof Item) { if (Item.isCoal(item)) diff --git a/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java b/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java index 6a90f61..ce0832a 100644 --- a/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java +++ b/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java @@ -3,8 +3,6 @@ import fr.sae.terraria.modele.TileMaps; import fr.sae.terraria.modele.entities.Arrow; import fr.sae.terraria.modele.entities.blocks.Block; -import fr.sae.terraria.modele.entities.blocks.BlockSet; -import fr.sae.terraria.modele.entities.blocks.TallGrass; import fr.sae.terraria.modele.entities.entity.StowableObjectType; import fr.sae.terraria.modele.entities.items.Item; import fr.sae.terraria.modele.entities.items.Meat; @@ -100,13 +98,13 @@ else if (Block.isTorch((Block) item)) } if (item instanceof Tool) { - if (Tool.isAxe(((Tool) item).getTypeOfTool())) + if (Tool.isAxe((Tool) item)) this.itemSelectedImgView.setImage(null); - else if (Tool.isBow(((Tool) item).getTypeOfTool())) + else if (Tool.isBow((Tool) item)) this.itemSelectedImgView.setImage(null); - else if (Tool.isPickaxe(((Tool) item).getTypeOfTool())) + else if (Tool.isPickaxe((Tool) item)) this.itemSelectedImgView.setImage(this.pickaxeItemImg); - else if (Tool.isSword(((Tool) item).getTypeOfTool())) + else if (Tool.isSword((Tool) item)) this.itemSelectedImgView.setImage(this.swordItemImg); } From 7fe8d458543fd6654ee5b745f1f92311dff656b2 Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Sun, 12 Jun 2022 23:36:30 +0200 Subject: [PATCH 50/97] Fix tree --- src/main/java/fr/sae/terraria/modele/Environment.java | 2 +- src/main/java/fr/sae/terraria/modele/GenerateEntity.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/sae/terraria/modele/Environment.java b/src/main/java/fr/sae/terraria/modele/Environment.java index 92bd859..c565965 100644 --- a/src/main/java/fr/sae/terraria/modele/Environment.java +++ b/src/main/java/fr/sae/terraria/modele/Environment.java @@ -145,7 +145,7 @@ private void gameLoop() boolean nightTime = this.clock.getMinutes() > (Clock.MINUTES_IN_A_DAY)/2; boolean weHaveChangedDay = this.previousDays != this.clock.getDays(); if (weHaveChangedDay) - for (int i = 0; i < 10; i++) // Génère par jour, 3 arbres + for (int i = 0; i < 15; i++) // Génère par jour, 3 arbres GenerateEntity.treeRandomly(this); if (dayTime) { // Génère certaines entités uniquement pendant le jour GenerateEntity.rabbitRandomly(this); diff --git a/src/main/java/fr/sae/terraria/modele/GenerateEntity.java b/src/main/java/fr/sae/terraria/modele/GenerateEntity.java index b97c487..f2494ac 100644 --- a/src/main/java/fr/sae/terraria/modele/GenerateEntity.java +++ b/src/main/java/fr/sae/terraria/modele/GenerateEntity.java @@ -25,7 +25,7 @@ */ public class GenerateEntity { - private static final int TREE_SPAWN_RATE = 2500; + private static final double TREE_SPAWN_RATE = .1; public static final int MAX_SPAWN_RABBIT = 100; public static final int MAX_SPAWN_SLIME = 100; private static final Random random = new Random(); From 677f34d037e6f6df4d299f10e3ae799da4d9328e Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Mon, 13 Jun 2022 13:20:15 +0200 Subject: [PATCH 51/97] Fix classes not found --- .../modele/entities/blocks/Block.java | 1 - .../resources/fr/sae/terraria/vue/menu.fxml | 3 +-- .../modele/entities/player/PlayerTest.java | 21 +++++++++++-------- .../player/inventory/InventoryTest.java | 8 ++++--- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java index 1c0efb7..4dd741d 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java +++ b/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java @@ -13,7 +13,6 @@ import fr.sae.terraria.modele.entities.player.inventory.Inventory; import fr.sae.terraria.modele.entities.player.inventory.Stack; import fr.sae.terraria.modele.entities.tools.Tool; -import fr.sae.terraria.modele.entities.tools.ToolSet; import javafx.animation.KeyFrame; import javafx.animation.Timeline; import javafx.util.Duration; diff --git a/src/main/resources/fr/sae/terraria/vue/menu.fxml b/src/main/resources/fr/sae/terraria/vue/menu.fxml index c9a37a1..5206fcf 100644 --- a/src/main/resources/fr/sae/terraria/vue/menu.fxml +++ b/src/main/resources/fr/sae/terraria/vue/menu.fxml @@ -1,11 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> + <?import javafx.scene.control.*?> <?import javafx.scene.layout.*?> <?import javafx.scene.text.*?> <?import java.net.URL?> - - <BorderPane fx:id="root" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" diff --git a/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java b/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java index 39343c5..88feb0a 100644 --- a/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java +++ b/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java @@ -4,6 +4,9 @@ import fr.sae.terraria.modele.TileMaps; import fr.sae.terraria.modele.TileSet; import fr.sae.terraria.modele.entities.Rabbit; +import fr.sae.terraria.modele.entities.blocks.Block; +import fr.sae.terraria.modele.entities.blocks.BlockSet; +import fr.sae.terraria.modele.entities.items.Item; import fr.sae.terraria.modele.entities.items.Meat; import fr.sae.terraria.modele.entities.items.Vodka; import javafx.geometry.Rectangle2D; @@ -135,15 +138,15 @@ public class PlayerTest Rectangle2D blockSelected; double beforePv; - Dirt dirt = new Dirt(environment, 1, 1); - dirt.setRect(1, 1); - environment.getEntities().add(dirt); + Block block = new Block(BlockSet.DIRT, environment, 1, 1); + block.setRect(1, 1); + environment.getEntities().add(block); blockSelected = new Rectangle2D(1, 1, 1, 1); - beforePv = dirt.getPv(); + beforePv = block.getPv(); player.interactWithBlock(blockSelected); - assertEquals(beforePv - 1, dirt.getPv()); - environment.getEntities().remove(dirt); + assertEquals(beforePv - 1, block.getPv()); + environment.getEntities().remove(block); Rabbit rabbit = new Rabbit(environment, 10, 10); @@ -159,7 +162,7 @@ public class PlayerTest @Test public final void placeBlockTest() { TileMaps tileMaps = environment.getTileMaps(); - player.pickup(new Dirt(environment, 1, 1)); + player.pickup(new Block(BlockSet.DIRT, environment)); assertEquals(tileMaps.getTile(0, 0), TileSet.SKY.ordinal()); player.placeBlock(0, 0); @@ -197,8 +200,8 @@ public class PlayerTest // Test avec du charbon - player.pickup(new Coal()); - assertTrue(player.getStackSelected().getItem() instanceof Coal, + player.pickup(Item.COAL); + assertTrue(Item.isCoal(player.getStackSelected().getItem()), "Verifie si le stack est bien du charbon"); assertEquals(player.getStackSelected().getNbItems(), 1, "Verifie s'il y a bien 1 objet dans le stack"); diff --git a/src/test/java/fr/sae/terraria/modele/entities/player/inventory/InventoryTest.java b/src/test/java/fr/sae/terraria/modele/entities/player/inventory/InventoryTest.java index 48d09ac..086c9c7 100644 --- a/src/test/java/fr/sae/terraria/modele/entities/player/inventory/InventoryTest.java +++ b/src/test/java/fr/sae/terraria/modele/entities/player/inventory/InventoryTest.java @@ -1,6 +1,8 @@ package fr.sae.terraria.modele.entities.player.inventory; import fr.sae.terraria.modele.Environment; +import fr.sae.terraria.modele.entities.blocks.Block; +import fr.sae.terraria.modele.entities.blocks.BlockSet; import fr.sae.terraria.modele.entities.player.Player; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -24,11 +26,11 @@ public class InventoryTest @Test public final void nbStacksIntoInventoryTest() { for (int i = 0; i < Stack.MAX; i++) - inventory.put(new Dirt(environment, 1, 1)); + inventory.put(new Block(BlockSet.DIRT, environment)); assertEquals(2, inventory.nbStacksIntoInventory()); for (int i = 0; i < Stack.MAX; i++) - inventory.put(new Dirt(environment, 1, 1)); + inventory.put(new Block(BlockSet.DIRT, environment)); assertEquals(3, inventory.nbStacksIntoInventory()); } @@ -36,7 +38,7 @@ public class InventoryTest { inventory.posCursorProperty().set(0); for (int i = 0; i < Stack.MAX; i++) - inventory.put(new Dirt(environment, 1, 1)); + inventory.put(new Block(BlockSet.DIRT, environment)); assertEquals(Stack.MAX, inventory.getStack().getNbItems()); } } From eb4046a92289c53aec17e8d55d4ef6cdc2068dc8 Mon Sep 17 00:00:00 2001 From: "Naulan.CHRZ" <67024770+NaulaN@users.noreply.github.com> Date: Thu, 9 Jun 2022 16:20:16 +0200 Subject: [PATCH 52/97] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5bad094..56a810e 100644 --- a/README.md +++ b/README.md @@ -12,9 +12,9 @@ IUT de Montreuil Paris8 | BUT Informatique en 1er année. ### Progression: [Les sprints](https://github.com/NaulaN/SAE-Terraria-Like/releases) -- [X] Sprint n°1 -- [X] Sprint n°2 -- [ ] Sprint n°3 +- [X] [Sprint n°1](https://github.com/NaulaN/SAE-Terraria-Like/pull/2) +- [X] [Sprint n°2](https://github.com/NaulaN/SAE-Terraria-Like/pull/8) +- [ ] [Sprint n°3](https://github.com/NaulaN/SAE-Terraria-Like/pull/14) - [ ] Sprint n°4 ### Qu'est-ce que c'est ce projet ? From 74f1da156a974ecb2c0b9f769d549ed81b6733af Mon Sep 17 00:00:00 2001 From: "Naulan.CHRZ" <67024770+NaulaN@users.noreply.github.com> Date: Thu, 9 Jun 2022 16:20:30 +0200 Subject: [PATCH 53/97] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 56a810e..bbbef7e 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ IUT de Montreuil Paris8 | BUT Informatique en 1er année. [Les sprints](https://github.com/NaulaN/SAE-Terraria-Like/releases) - [X] [Sprint n°1](https://github.com/NaulaN/SAE-Terraria-Like/pull/2) - [X] [Sprint n°2](https://github.com/NaulaN/SAE-Terraria-Like/pull/8) -- [ ] [Sprint n°3](https://github.com/NaulaN/SAE-Terraria-Like/pull/14) +- [X] [Sprint n°3](https://github.com/NaulaN/SAE-Terraria-Like/pull/14) - [ ] Sprint n°4 ### Qu'est-ce que c'est ce projet ? From 6999321adf705f093a80a4a48b60dfacdb0f70a0 Mon Sep 17 00:00:00 2001 From: Tiago Lousa <tig2468.a@gmail.com> Date: Mon, 13 Jun 2022 14:52:49 +0200 Subject: [PATCH 54/97] fix label inverntaire --- .../sae/terraria/modele/entities/player/Player.java | 2 ++ .../modele/entities/player/inventory/Inventory.java | 12 ++++++++---- .../java/fr/sae/terraria/vue/hud/InventoryView.java | 11 +++++++++-- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java index 2bdab01..b390917 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java @@ -2,9 +2,11 @@ import fr.sae.terraria.modele.Environment; import fr.sae.terraria.modele.TileMaps; +import fr.sae.terraria.modele.entities.blocks.Tree; import fr.sae.terraria.modele.entities.entity.*; import fr.sae.terraria.modele.entities.player.inventory.Inventory; import fr.sae.terraria.modele.entities.player.inventory.Stack; +import fr.sae.terraria.modele.entities.tools.Tool; import fr.sae.terraria.vue.View; import javafx.beans.property.SimpleBooleanProperty; import javafx.geometry.Rectangle2D; diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java index 476dc74..b50654f 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java @@ -41,10 +41,7 @@ public Inventory(final Player player) boolean isntOutOfInventoryBar = newV.intValue() >= 0 && newV.intValue() < nbElementOnOneLineOfInventory; if (isntOutOfInventoryBar) { - Stack stack = null; - if (this.getPosCursor() < this.get().size()) - stack = this.get().get(this.getPosCursor()); - this.player.setStackSelected(stack); + refreshStack(); } }); } @@ -141,6 +138,13 @@ else if (key.equals(KeyCode.DIGIT9)) this.scroll = 0; } + private void refreshStack() { + Stack stack = null; + if (this.getPosCursor() < this.get().size()) + stack = this.get().get(this.getPosCursor()); + this.player.setStackSelected(stack); + } + public IntegerProperty posCursorProperty() { return this.posCursor; } diff --git a/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java b/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java index 7314d9b..c8bcd7f 100644 --- a/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java +++ b/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java @@ -138,8 +138,7 @@ else if (Item.isWood(item)) } // Actualise le nombre d'item à l'écran - this.texts.get(c.getTo()-1).setText(String.valueOf(stack.getNbItems())); - stack.nbItemsProperty().addListener((obs, oldV, newV) -> this.texts.get(c.getTo()-1).setText(String.valueOf(newV.intValue()))); + this.texts.get(c.getTo()-1).textProperty().bind(c.getAddedSubList().get(0).nbItemsProperty().asString()); if (!Objects.isNull(view.getImage())) { view.setX((this.inventoryBarImgView.getX() + ((c.getTo()-1) * boxeInventoryWidth)) + ((boxeInventoryWidth/2) - (itemInventoryWidth/2))); @@ -156,6 +155,14 @@ else if (Item.isWood(item)) for (int i = c.getTo(); i < itemsView.size(); i++) this.itemsView.get(i).setX(this.itemsView.get(i).getX() - boxeInventoryWidth); + + for (int i = 0; i < inventory.get().size(); i ++){ + this.texts.get(inventory.get().size()).textProperty().unbind(); + this.texts.get(i).textProperty().bind(inventory.get().get(i).nbItemsProperty().asString()); + } + this.texts.get(inventory.get().size()).textProperty().unbind(); + this.texts.get(inventory.get().size()).setText("0"); + } } }); From 95794a5aca0df39090df03d5dae3d05629430c15 Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Mon, 13 Jun 2022 21:32:19 +0200 Subject: [PATCH 55/97] Fix image floor top dans l'inventaire --- .../modele/entities/blocks/Block.java | 11 ++++------- .../entities/player/inventory/Inventory.java | 19 +++++++++---------- .../entities/player/inventory/Stack.java | 6 ++++++ .../sae/terraria/vue/hud/InventoryView.java | 2 +- 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java index 4dd741d..a67a8d0 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java +++ b/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java @@ -26,7 +26,7 @@ public class Block extends Entity implements BreakableObjectType, PlaceableObjec public static final int DEFAULT_RESISTANCE = 2; private final Environment environment; - private final BlockSet typeOfBlock; + private BlockSet typeOfBlock; private final double xOrigin; private final double yOrigin; @@ -72,10 +72,8 @@ private void loots() { Player player = this.environment.getPlayer(); - if (this.typeOfBlock == BlockSet.FLOOR_TOP || this.typeOfBlock == BlockSet.FLOOR_LEFT || this.typeOfBlock == BlockSet.FLOOR_RIGHT) { + if (this.typeOfBlock == BlockSet.FLOOR_TOP || this.typeOfBlock == BlockSet.FLOOR_LEFT || this.typeOfBlock == BlockSet.FLOOR_RIGHT || this.typeOfBlock == BlockSet.DIRT) { player.pickup(new Block(BlockSet.FLOOR_TOP, this.environment)); - } else if (this.typeOfBlock == BlockSet.DIRT) { - player.pickup(new Block(BlockSet.DIRT, this.environment, 0, 0)); } else if (this.typeOfBlock == BlockSet.ROCK) { for (int loot = 0; loot < Block.ROCK_NB_LOOTS; loot++) player.pickup(Item.STONE); @@ -131,13 +129,12 @@ else if (this.typeOfBlock == BlockSet.TALL_GRASS) int widthTile = this.environment.widthTile; int heightTile = this.environment.heightTile; - Block block = new Block(this.typeOfBlock, this.environment, x*widthTile, y*heightTile); - block.setRect(widthTile, heightTile); - Player player = this.environment.getPlayer(); Inventory inventory = player.getInventory(); if (!Objects.isNull(player.getStackSelected())) inventory.get().get(inventory.getPosCursor()).remove(); + Block block = new Block(BlockSet.FLOOR_TOP, this.environment, x*widthTile, y*heightTile); + block.setRect(widthTile, heightTile); TileSet tile = TileSet.getTileSet(this.typeOfBlock); if (!Objects.isNull(tile)) diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java index b50654f..a61e7f4 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java @@ -40,12 +40,19 @@ public Inventory(final Player player) this.posCursorProperty().addListener((obs, oldV, newV) -> { boolean isntOutOfInventoryBar = newV.intValue() >= 0 && newV.intValue() < nbElementOnOneLineOfInventory; - if (isntOutOfInventoryBar) { + if (isntOutOfInventoryBar) refreshStack(); - } }); } + private void refreshStack() + { + Stack stack = null; + if (this.getPosCursor() < this.get().size()) + stack = this.get().get(this.getPosCursor()); + this.player.setStackSelected(stack); + } + private void createStack(StowableObjectType item) { Stack stack = new Stack(); @@ -137,14 +144,6 @@ else if (key.equals(KeyCode.DIGIT9)) this.scroll = 0; } - - private void refreshStack() { - Stack stack = null; - if (this.getPosCursor() < this.get().size()) - stack = this.get().get(this.getPosCursor()); - this.player.setStackSelected(stack); - } - public IntegerProperty posCursorProperty() { return this.posCursor; } diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java index 6018d08..80f9366 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java @@ -41,6 +41,12 @@ public boolean isSameItem(StowableObjectType obj) if (obj instanceof Block && this.item instanceof Block) { if (Block.isDirt((Block) obj) && Block.isDirt((Block) this.item)) return true; + if (Block.isFloorTop((Block) obj) && Block.isFloorTop((Block) this.item)) + return true; + if (Block.isFloorLeft((Block) obj) && Block.isFloorLeft((Block) this.item)) + return true; + if (Block.isFloorRight((Block) obj) && Block.isFloorRight((Block) this.item)) + return true; if (Block.isRock((Block) obj) && Block.isRock((Block) this.item)) return true; if (Block.isTallGrass((Block) obj) && Block.isTallGrass((Block) this.item)) diff --git a/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java b/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java index c8bcd7f..a21fcf3 100644 --- a/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java +++ b/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java @@ -105,7 +105,7 @@ else if (item instanceof Arrow) else if (item instanceof Vodka) view.setImage(View.loadAnImage("loots/vodka.png", itemInventoryWidth,itemInventoryHeight)); else if (item instanceof Block) { - if (Block.isDirt((Block) item)) + if (Block.isFloorTop((Block) item)) view.setImage(View.loadAnImage("tiles/floor-top.png", itemInventoryWidth, itemInventoryHeight)); else if (Block.isRock((Block) item)) view.setImage(View.loadAnImage("tiles/rock-fill.png", itemInventoryWidth, itemInventoryHeight)); From a92017ba8aba753ebfb8e3aa59397a437d217bd2 Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Tue, 14 Jun 2022 09:53:14 +0200 Subject: [PATCH 56/97] Fix block stone --- .../fr/sae/terraria/modele/entities/blocks/Block.java | 6 +++++- .../sae/terraria/modele/entities/player/Player.java | 2 -- .../modele/entities/player/inventory/Inventory.java | 5 ----- .../java/fr/sae/terraria/vue/hud/InventoryView.java | 11 ++++++++--- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java index a67a8d0..27e297e 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java +++ b/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java @@ -133,7 +133,11 @@ else if (this.typeOfBlock == BlockSet.TALL_GRASS) Inventory inventory = player.getInventory(); if (!Objects.isNull(player.getStackSelected())) inventory.get().get(inventory.getPosCursor()).remove(); - Block block = new Block(BlockSet.FLOOR_TOP, this.environment, x*widthTile, y*heightTile); + + Block block; + if (Block.isDirt(this) || Block.isFloorTop(this) || Block.isFloorLeft(this) || Block.isFloorRight(this)) + block = new Block(BlockSet.FLOOR_TOP, this.environment, x*widthTile, y*heightTile); + else block = new Block(this.typeOfBlock, this.environment, x*widthTile, y*heightTile); block.setRect(widthTile, heightTile); TileSet tile = TileSet.getTileSet(this.typeOfBlock); diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java index b390917..2bdab01 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java @@ -2,11 +2,9 @@ import fr.sae.terraria.modele.Environment; import fr.sae.terraria.modele.TileMaps; -import fr.sae.terraria.modele.entities.blocks.Tree; import fr.sae.terraria.modele.entities.entity.*; import fr.sae.terraria.modele.entities.player.inventory.Inventory; import fr.sae.terraria.modele.entities.player.inventory.Stack; -import fr.sae.terraria.modele.entities.tools.Tool; import fr.sae.terraria.vue.View; import javafx.beans.property.SimpleBooleanProperty; import javafx.geometry.Rectangle2D; diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java index a61e7f4..b90bd1e 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java @@ -57,11 +57,6 @@ private void createStack(StowableObjectType item) { Stack stack = new Stack(); stack.nbItemsProperty().addListener((observable, oldValue, newValue) -> { - if (newValue.intValue() < oldValue.intValue()) { - Inventory inventory = player.getInventory(); - inventory.get().get(inventory.getPosCursor()).remove(); - } - if (newValue.intValue() <= 0) { this.value.remove(stack); this.player.setStackSelected(null); diff --git a/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java b/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java index a21fcf3..81b2edd 100644 --- a/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java +++ b/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java @@ -104,7 +104,8 @@ else if (item instanceof Arrow) view.setImage(null); // TODO else if (item instanceof Vodka) view.setImage(View.loadAnImage("loots/vodka.png", itemInventoryWidth,itemInventoryHeight)); - else if (item instanceof Block) { + + if (item instanceof Block) { if (Block.isFloorTop((Block) item)) view.setImage(View.loadAnImage("tiles/floor-top.png", itemInventoryWidth, itemInventoryHeight)); else if (Block.isRock((Block) item)) @@ -113,7 +114,9 @@ else if (Block.isTallGrass((Block) item)) view.setImage(View.loadAnImage("tiles/tall-grass.png.png", itemInventoryWidth, itemInventoryHeight)); else if (Block.isTorch((Block) item)) view.setImage(View.loadAnImage("tiles/torch.png", itemInventoryWidth, itemInventoryHeight)); - } else if (item instanceof Tool) { + } + + if (item instanceof Tool) { if (Tool.isAxe((Tool) item)) view.setImage(null); // TODO else if (Tool.isBow((Tool) item)) @@ -122,7 +125,9 @@ else if (Tool.isPickaxe((Tool) item)) view.setImage(View.loadAnImage("tools/pickaxe.png", itemInventoryWidth, itemInventoryHeight)); else if (Tool.isSword((Tool) item)) view.setImage(View.loadAnImage("tools/sword.png", itemInventoryWidth, itemInventoryHeight)); - } else if (item instanceof Item) { + } + + if (item instanceof Item) { if (Item.isCoal(item)) view.setImage(View.loadAnImage("loots/coal.png", itemInventoryWidth, itemInventoryHeight)); else if (Item.isFiber(item)) From 0d87356295a54c3f4fbb3e49e336d4761cf7a35c Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Tue, 14 Jun 2022 09:58:39 +0200 Subject: [PATCH 57/97] Correction nom fonction --- src/main/java/fr/sae/terraria/vue/LightView.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/sae/terraria/vue/LightView.java b/src/main/java/fr/sae/terraria/vue/LightView.java index ca5c2ec..5ee3eb9 100644 --- a/src/main/java/fr/sae/terraria/vue/LightView.java +++ b/src/main/java/fr/sae/terraria/vue/LightView.java @@ -61,7 +61,7 @@ private void initTorchListener(ObservableList<Block> torches) { torches.addListener((ListChangeListener<? super Block>) c -> { while(c.next()){ this.filterPane.getChildren().clear(); - addTochLights(); + addTorchLights(); if (c.wasRemoved()){ resetShapes(); @@ -137,7 +137,7 @@ private void addEffects() this.actualTunnel.setOpacity(.8); } - private void addTochLights() + private void addTorchLights() { for (int i = 0; i < this.environment.getTorches().size() ; i ++){ Circle torchLight = new Circle(tileSize*CIRCLE_RAY); From fbdd88e9cce325b39ffa4060b5f983b9c7407511 Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Tue, 14 Jun 2022 10:01:12 +0200 Subject: [PATCH 58/97] Fix torches --- src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java | 2 ++ src/main/java/fr/sae/terraria/vue/LightView.java | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java index 27e297e..e9b24e6 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java +++ b/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java @@ -110,6 +110,8 @@ else if (this.typeOfBlock == BlockSet.TALL_GRASS) this.environment.getTileMaps().setTile(TileSet.SKY.ordinal(), yIndexTile, xIndexTile); this.environment.getEntities().remove(this); this.environment.getBlocks().remove(this); + if (Block.isTorch(this)) + this.environment.getTorches().remove(this); } if (isRock(this)) { diff --git a/src/main/java/fr/sae/terraria/vue/LightView.java b/src/main/java/fr/sae/terraria/vue/LightView.java index 5ee3eb9..c3bd47a 100644 --- a/src/main/java/fr/sae/terraria/vue/LightView.java +++ b/src/main/java/fr/sae/terraria/vue/LightView.java @@ -25,7 +25,6 @@ public class LightView { private static int widthMap; private static int tileSize; - private final Environment environment; private final TileMaps tileMaps; private final Circle torchLight; From f9905c850388d3ad5f0916ed330c96b07e8a882d Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Tue, 14 Jun 2022 10:03:18 +0200 Subject: [PATCH 59/97] Fix tree --- .../java/fr/sae/terraria/modele/entities/blocks/Block.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java index e9b24e6..f5141d1 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java +++ b/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java @@ -109,9 +109,12 @@ else if (this.typeOfBlock == BlockSet.TALL_GRASS) int xIndexTile = (int) (getX()/environment.widthTile); this.environment.getTileMaps().setTile(TileSet.SKY.ordinal(), yIndexTile, xIndexTile); this.environment.getEntities().remove(this); + this.environment.getBlocks().remove(this); if (Block.isTorch(this)) this.environment.getTorches().remove(this); + if (Block.isTree(this)) + this.environment.getTrees().remove(this); } if (isRock(this)) { @@ -162,6 +165,7 @@ else if (this.typeOfBlock == BlockSet.TALL_GRASS) public static boolean isRock(final Block block) { return block.getTypeOfBlock() == BlockSet.ROCK; } public static boolean isTallGrass(final Block block) { return block.getTypeOfBlock() == BlockSet.TALL_GRASS; } public static boolean isTorch(final Block block) { return block.getTypeOfBlock() == BlockSet.TORCH; } + public static boolean isTree(final Block block) { return block.getTypeOfBlock() == BlockSet.TREE; } public BlockSet getTypeOfBlock() { return this.typeOfBlock; } From 96dbf8dbfa3b4eeddfc434b70c12a153b4b7d562 Mon Sep 17 00:00:00 2001 From: Tiago Lousa <tig2468.a@gmail.com> Date: Tue, 14 Jun 2022 10:28:13 +0200 Subject: [PATCH 60/97] fix casser bloc --- .../java/fr/sae/terraria/modele/entities/player/Player.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java index 2bdab01..d968872 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java @@ -110,12 +110,13 @@ public void interactWithBlock(final Rectangle2D rectangle) int i = 0; Entity entity = this.environment.getEntities().get(i); - while (i < this.environment.getEntities().size() && !entity.getRect().collideRect(rectangle)) { + while (!entity.getRect().collideRect(rectangle) && i < this.environment.getEntities().size() ) { entity = this.environment.getEntities().get(i); i++; } + System.out.println(i); - if (i < this.environment.getEntities().size()) { + if (i <= this.environment.getEntities().size()) { if (entity instanceof BreakableObjectType) ((BreakableObjectType) entity).breaks(); if (entity instanceof CollapsibleObjectType) From 5c6c9fd47b4015786d27ebcd40384ff10b7de4cb Mon Sep 17 00:00:00 2001 From: Tiago Lousa <tig2468.a@gmail.com> Date: Tue, 14 Jun 2022 10:29:55 +0200 Subject: [PATCH 61/97] clean --- src/main/java/fr/sae/terraria/modele/entities/player/Player.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java index d968872..4da68b2 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java @@ -114,7 +114,6 @@ public void interactWithBlock(final Rectangle2D rectangle) entity = this.environment.getEntities().get(i); i++; } - System.out.println(i); if (i <= this.environment.getEntities().size()) { if (entity instanceof BreakableObjectType) From 2481b1738fa289fdb7360aa8c2655b725b73eed5 Mon Sep 17 00:00:00 2001 From: Tiago Lousa <tig2468.a@gmail.com> Date: Tue, 14 Jun 2022 10:36:13 +0200 Subject: [PATCH 62/97] fix bloc casse --- .../java/fr/sae/terraria/modele/entities/player/Player.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java index 4da68b2..47b9761 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java @@ -115,7 +115,7 @@ public void interactWithBlock(final Rectangle2D rectangle) i++; } - if (i <= this.environment.getEntities().size()) { + if (i <= this.environment.getEntities().size() && entity.getRect().collideRect(rectangle)) { if (entity instanceof BreakableObjectType) ((BreakableObjectType) entity).breaks(); if (entity instanceof CollapsibleObjectType) @@ -128,6 +128,7 @@ public void placeBlock(int xBlock, int yBlock) TileMaps tileMaps = this.environment.getTileMaps(); boolean haveAnItemOnHand = !Objects.isNull(this.getStackSelected()); boolean goodPlace = tileMaps.isSkyTile(xBlock, yBlock); + System.out.println(getStackSelected().getItem()); if (haveAnItemOnHand && goodPlace) { if (!(this.getStackSelected().getItem() instanceof PlaceableObjectType) && !(this.getStackSelected().getItem() instanceof ConsumableObjectType)) From 11f148a144c484c65f9baa341bf3594abc7f320c Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Tue, 14 Jun 2022 10:54:41 +0200 Subject: [PATCH 63/97] =?UTF-8?q?Modification=20systeme=20de=20durabilit?= =?UTF-8?q?=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modele/entities/blocks/Block.java | 29 +++++++++---------- .../modele/entities/blocks/BlockSet.java | 26 ++++++++++++----- 2 files changed, 32 insertions(+), 23 deletions(-) diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java index f5141d1..83f769c 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java +++ b/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java @@ -23,10 +23,9 @@ public class Block extends Entity implements BreakableObjectType, PlaceableObjectType, StowableObjectType { public static final int ROCK_NB_LOOTS = 3; - public static final int DEFAULT_RESISTANCE = 2; private final Environment environment; - private BlockSet typeOfBlock; + private final BlockSet typeOfBlock; private final double xOrigin; private final double yOrigin; @@ -41,7 +40,7 @@ public Block(final BlockSet typeOfBlock, final Environment environment, int x, i this.xOrigin = x; this.yOrigin = y; - this.pv.set(Block.DEFAULT_RESISTANCE); + this.pv.set(typeOfBlock.getDurability()); } public Block(final BlockSet typeOfBlock, final Environment environment) { this(typeOfBlock, environment, 0, 0); } @@ -72,21 +71,21 @@ private void loots() { Player player = this.environment.getPlayer(); - if (this.typeOfBlock == BlockSet.FLOOR_TOP || this.typeOfBlock == BlockSet.FLOOR_LEFT || this.typeOfBlock == BlockSet.FLOOR_RIGHT || this.typeOfBlock == BlockSet.DIRT) { + if (Block.isFloorTop(this) || Block.isFloorLeft(this) || Block.isFloorRight(this) || Block.isDirt(this)) { player.pickup(new Block(BlockSet.FLOOR_TOP, this.environment)); - } else if (this.typeOfBlock == BlockSet.ROCK) { + } else if (Block.isRock(this)) { for (int loot = 0; loot < Block.ROCK_NB_LOOTS; loot++) player.pickup(Item.STONE); - } else if (this.typeOfBlock == BlockSet.TALL_GRASS) { + } else if (Block.isTallGrass(this)) { for (int loot = (int) (Math.random()*3)+1; loot < TallGrass.LOOTS_FIBRE_MAX; loot++) player.pickup(Item.FIBER); boolean mustDropVodka = Math.random() < Vodka.DROP_RATE; if (mustDropVodka) player.pickup(new Vodka(this.environment)); - } else if (this.typeOfBlock == BlockSet.TORCH) { + } else if (Block.isTorch(this)) { player.pickup(new Block(BlockSet.TORCH, this.environment)); - } else if (this.typeOfBlock == BlockSet.TREE) { + } else if (Block.isTree(this)) { player.pickup(new Block(BlockSet.TREE, this.environment)); } } @@ -95,9 +94,9 @@ private void loots() @Override public void breaks() { - if (this.typeOfBlock == BlockSet.ROCK) + if (Block.isRock(this)) Environment.playSound("sound/brick" + ((int) (Math.random()*2)+1) + ".wav", false); - else if (this.typeOfBlock == BlockSet.TALL_GRASS) + else if (Block.isTallGrass(this)) Environment.playSound("sound/cut.wav", false); else Environment.playSound("sound/grassyStep.wav", false); this.breakAnimation(); @@ -108,8 +107,8 @@ else if (this.typeOfBlock == BlockSet.TALL_GRASS) int yIndexTile = (int) (getY()/environment.heightTile); int xIndexTile = (int) (getX()/environment.widthTile); this.environment.getTileMaps().setTile(TileSet.SKY.ordinal(), yIndexTile, xIndexTile); - this.environment.getEntities().remove(this); + this.environment.getEntities().remove(this); this.environment.getBlocks().remove(this); if (Block.isTorch(this)) this.environment.getTorches().remove(this); @@ -117,7 +116,7 @@ else if (this.typeOfBlock == BlockSet.TALL_GRASS) this.environment.getTrees().remove(this); } - if (isRock(this)) { + if (Block.isRock(this)) { Stack item = this.environment.getPlayer().getStackSelected(); if (!Objects.isNull(item) && item.getItem() instanceof Tool) { Tool tool = (Tool) item.getItem(); @@ -148,12 +147,12 @@ else if (this.typeOfBlock == BlockSet.TALL_GRASS) TileSet tile = TileSet.getTileSet(this.typeOfBlock); if (!Objects.isNull(tile)) this.environment.getTileMaps().setTile(tile.ordinal(), y, x); + this.environment.getEntities().add(block); this.environment.getBlocks().add(block); - - if (this.typeOfBlock == BlockSet.TREE) + if (Block.isTree(this)) this.environment.getTrees().add((Tree) block); - if (this.typeOfBlock == BlockSet.TORCH) + if (Block.isTorch(this)) this.environment.getTorches().add(block); } diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/BlockSet.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/BlockSet.java index 2de0c16..10be91e 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/BlockSet.java +++ b/src/main/java/fr/sae/terraria/modele/entities/blocks/BlockSet.java @@ -3,12 +3,22 @@ public enum BlockSet { - FLOOR_TOP, - FLOOR_RIGHT, - FLOOR_LEFT, - DIRT, - ROCK, - TALL_GRASS, - TORCH, - TREE + FLOOR_TOP(3), + FLOOR_RIGHT(3), + FLOOR_LEFT(3), + DIRT(3), + ROCK(5), + TALL_GRASS(2), + TORCH(1), + TREE(4); + + private final int durability; + + + BlockSet(final int durability) + { + this.durability = durability; + } + + public int getDurability() { return this.durability; } } From 84f80d19d22bfcfb3cbe222415809df4d7723c28 Mon Sep 17 00:00:00 2001 From: Tiago Lousa <tig2468.a@gmail.com> Date: Tue, 14 Jun 2022 10:41:44 +0200 Subject: [PATCH 64/97] fix bloc casse --- .../java/fr/sae/terraria/modele/entities/player/Player.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java index 47b9761..5b212fc 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java @@ -115,7 +115,7 @@ public void interactWithBlock(final Rectangle2D rectangle) i++; } - if (i <= this.environment.getEntities().size() && entity.getRect().collideRect(rectangle)) { + if (entity.getRect().collideRect(rectangle)) { if (entity instanceof BreakableObjectType) ((BreakableObjectType) entity).breaks(); if (entity instanceof CollapsibleObjectType) From 153a071b6c515c0800b684f6f09674874d13519e Mon Sep 17 00:00:00 2001 From: Tiago Lousa <tig2468.a@gmail.com> Date: Tue, 14 Jun 2022 11:24:48 +0200 Subject: [PATCH 65/97] fix duplication --- .../java/fr/sae/terraria/modele/entities/player/Player.java | 2 +- .../modele/entities/player/inventory/Inventory.java | 2 +- .../terraria/modele/entities/player/inventory/Stack.java | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java index 5b212fc..04f033b 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java @@ -128,9 +128,9 @@ public void placeBlock(int xBlock, int yBlock) TileMaps tileMaps = this.environment.getTileMaps(); boolean haveAnItemOnHand = !Objects.isNull(this.getStackSelected()); boolean goodPlace = tileMaps.isSkyTile(xBlock, yBlock); - System.out.println(getStackSelected().getItem()); if (haveAnItemOnHand && goodPlace) { + this.inventory.refreshStack(); if (!(this.getStackSelected().getItem() instanceof PlaceableObjectType) && !(this.getStackSelected().getItem() instanceof ConsumableObjectType)) return; diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java index b90bd1e..9f33f90 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java @@ -45,7 +45,7 @@ public Inventory(final Player player) }); } - private void refreshStack() + public void refreshStack() { Stack stack = null; if (this.getPosCursor() < this.get().size()) diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java index 80f9366..7c54957 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java @@ -92,6 +92,12 @@ public boolean isSameItem(StowableObjectType obj) public void add() { if (this.getNbItems() < Stack.MAX) this.nbItems.set(this.getNbItems() + 1); } public void remove() { if (this.getNbItems() > 0) this.nbItems.set(this.getNbItems() - 1); } + @Override public String toString(){ + if (item instanceof Block) + return String.valueOf(((Block) item).getTypeOfBlock()); + return item.toString(); + } + public int getNbItems() { return this.nbItems.get(); } public StowableObjectType getItem() { return this.item; } From 14aa424e0357ce18ea23371fb0279531ad3fc34a Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Tue, 14 Jun 2022 11:27:53 +0200 Subject: [PATCH 66/97] little edit --- .../java/fr/sae/terraria/modele/entities/blocks/Block.java | 1 - .../terraria/modele/entities/player/inventory/Inventory.java | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java index 83f769c..bde3826 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java +++ b/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java @@ -154,7 +154,6 @@ else if (Block.isTallGrass(this)) this.environment.getTrees().add((Tree) block); if (Block.isTorch(this)) this.environment.getTorches().add(block); - } public static boolean isFloorTop(final Block block) { return block.getTypeOfBlock() == BlockSet.FLOOR_TOP; } diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java index 9f33f90..d8c9789 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java @@ -5,6 +5,7 @@ import javafx.beans.property.IntegerProperty; import javafx.beans.property.SimpleIntegerProperty; import javafx.collections.FXCollections; +import javafx.collections.ListChangeListener; import javafx.collections.ObservableList; import javafx.scene.input.KeyCode; @@ -37,8 +38,8 @@ public Inventory(final Player player) this.posCursor = new SimpleIntegerProperty(0); // Change l'item qui se trouve dans la main du joueur - this.posCursorProperty().addListener((obs, oldV, newV) -> { - boolean isntOutOfInventoryBar = newV.intValue() >= 0 && newV.intValue() < nbElementOnOneLineOfInventory; + this.posCursorProperty().addListener((obs, oldPos, newPos) -> { + boolean isntOutOfInventoryBar = newPos.intValue() >= 0 && newPos.intValue() < nbElementOnOneLineOfInventory; if (isntOutOfInventoryBar) refreshStack(); From 7e0d30923f055f307bcc19b0bc73f3905d1914c4 Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Tue, 14 Jun 2022 11:29:36 +0200 Subject: [PATCH 67/97] Fix cursor img selected floor top --- src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java b/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java index ce0832a..a5418ff 100644 --- a/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java +++ b/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java @@ -87,7 +87,7 @@ else if (item instanceof Arrow) if (item instanceof Block) { - if (Block.isDirt((Block) item)) + if (Block.isFloorTop((Block) item)) this.itemSelectedImgView.setImage(this.dirtItemImg); else if (Block.isRock((Block) item)) this.itemSelectedImgView.setImage(this.rockItemImg); From b3b17e9be4b88482554c1e69afc457a82cb7b38d Mon Sep 17 00:00:00 2001 From: Tiago Lousa <tig2468.a@gmail.com> Date: Tue, 14 Jun 2022 11:42:20 +0200 Subject: [PATCH 68/97] fix ItemSelectedView --- .../terraria/vue/hud/ItemSelectedView.java | 99 ++++++++++--------- 1 file changed, 55 insertions(+), 44 deletions(-) diff --git a/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java b/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java index a5418ff..672b7ac 100644 --- a/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java +++ b/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java @@ -8,10 +8,13 @@ import fr.sae.terraria.modele.entities.items.Meat; import fr.sae.terraria.modele.entities.items.Vodka; import fr.sae.terraria.modele.entities.player.Player; +import fr.sae.terraria.modele.entities.player.inventory.Inventory; import fr.sae.terraria.modele.entities.player.inventory.Stack; import fr.sae.terraria.modele.entities.tools.Tool; import fr.sae.terraria.vue.View; import javafx.collections.ListChangeListener; +import javafx.collections.ObservableArray; +import javafx.collections.ObservableList; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.input.MouseEvent; @@ -40,9 +43,12 @@ public class ItemSelectedView private final Pane display; + private final Player player; + public ItemSelectedView(Pane display, Player player, double scaleMultiplicatorWidth, double scaleMultiplicatorHeight) { + this.player = player; this.display = display; int widthTile = (int) (scaleMultiplicatorWidth * TileMaps.TILE_DEFAULT_SIZE); @@ -67,23 +73,34 @@ public ItemSelectedView(Pane display, Player player, double scaleMultiplicatorWi // Reset player.getInventory().get().addListener((ListChangeListener<? super Stack>) c -> { - while (c.next()) { - if (c.wasRemoved()) - this.itemSelectedImgView.setImage(null); - } + while (c.next()) + refreshView(); }); player.getInventory().posCursorProperty().addListener((obs, oldItemSelected, newItemSelected) -> { - this.itemSelectedImgView.setImage(null); - if (!Objects.isNull(player.getStackSelected())) { - StowableObjectType item = player.getStackSelected().getItem(); - - if (item instanceof Meat) - this.itemSelectedImgView.setImage(this.meatItemImg); - else if (item instanceof Vodka) - this.itemSelectedImgView.setImage(this.vodkaItemImg); - else if (item instanceof Arrow) - this.itemSelectedImgView.setImage(null); + refreshView(); + }); + + display.addEventFilter(MouseEvent.MOUSE_MOVED, mouse -> { + itemSelectedImgView.setX(mouse.getX()); + itemSelectedImgView.setY(mouse.getY()); + }); + } + + private void refreshView(){ + ObservableList<Stack> inventory = this.player.getInventory().get(); + int posCursor = this.player.getInventory().getPosCursor(); + + this.itemSelectedImgView.setImage(null); + if (posCursor < inventory.size() && posCursor >= 0) { + StowableObjectType item = inventory.get(posCursor).getItem(); + + if (item instanceof Meat) + this.itemSelectedImgView.setImage(this.meatItemImg); + else if (item instanceof Vodka) + this.itemSelectedImgView.setImage(this.vodkaItemImg); + else if (item instanceof Arrow) + this.itemSelectedImgView.setImage(null); if (item instanceof Block) { @@ -97,38 +114,32 @@ else if (Block.isTorch((Block) item)) this.itemSelectedImgView.setImage(this.torchItemImg); } - if (item instanceof Tool) { - if (Tool.isAxe((Tool) item)) - this.itemSelectedImgView.setImage(null); - else if (Tool.isBow((Tool) item)) - this.itemSelectedImgView.setImage(null); - else if (Tool.isPickaxe((Tool) item)) - this.itemSelectedImgView.setImage(this.pickaxeItemImg); - else if (Tool.isSword((Tool) item)) - this.itemSelectedImgView.setImage(this.swordItemImg); - } - - if (item instanceof Item) { - if (Item.isCoal(item)) - this.itemSelectedImgView.setImage(this.coalItemImg); - else if (Item.isFiber(item)) - this.itemSelectedImgView.setImage(this.fibreItemImg); - else if (Item.isIron(item)) - this.itemSelectedImgView.setImage(this.ironItemImg); - else if (Item.isStone(item)) - this.itemSelectedImgView.setImage(this.stoneItemImg); - else if (Item.isSilex(item)) - this.itemSelectedImgView.setImage(this.silexItemImg); - else if (Item.isWood(item)) - this.itemSelectedImgView.setImage(this.woodItemImg); - } + if (item instanceof Tool) { + if (Tool.isAxe((Tool) item)) + this.itemSelectedImgView.setImage(null); + else if (Tool.isBow((Tool) item)) + this.itemSelectedImgView.setImage(null); + else if (Tool.isPickaxe((Tool) item)) + this.itemSelectedImgView.setImage(this.pickaxeItemImg); + else if (Tool.isSword((Tool) item)) + this.itemSelectedImgView.setImage(this.swordItemImg); } - }); - display.addEventFilter(MouseEvent.MOUSE_MOVED, mouse -> { - itemSelectedImgView.setX(mouse.getX()); - itemSelectedImgView.setY(mouse.getY()); - }); + if (item instanceof Item) { + if (Item.isCoal(item)) + this.itemSelectedImgView.setImage(this.coalItemImg); + else if (Item.isFiber(item)) + this.itemSelectedImgView.setImage(this.fibreItemImg); + else if (Item.isIron(item)) + this.itemSelectedImgView.setImage(this.ironItemImg); + else if (Item.isStone(item)) + this.itemSelectedImgView.setImage(this.stoneItemImg); + else if (Item.isSilex(item)) + this.itemSelectedImgView.setImage(this.silexItemImg); + else if (Item.isWood(item)) + this.itemSelectedImgView.setImage(this.woodItemImg); + } + } } public void display() { display.getChildren().add(itemSelectedImgView); } From 6396cdaa8b10259966ae6c2930698739a702c1f6 Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Tue, 14 Jun 2022 11:54:06 +0200 Subject: [PATCH 69/97] =?UTF-8?q?Fix=20d=C3=A9passement=20limite=20inventa?= =?UTF-8?q?ire?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../terraria/modele/entities/player/inventory/Inventory.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java index d8c9789..97eab23 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java @@ -93,7 +93,8 @@ public void put(StowableObjectType item) return; } // Si tous les stacks present sont pleins ou aucune ne correspond à l'objet qui à étais pris, il crée un nouveau stack - this.createStack(item); + if (this.value.size() < 9) + this.createStack(item); } } } From 2699c6998d228bed8d88a2d070e23869bd781aed Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Tue, 14 Jun 2022 11:54:43 +0200 Subject: [PATCH 70/97] =?UTF-8?q?Fix=20d=C3=A9passement=20limite=20inventa?= =?UTF-8?q?ire?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../terraria/modele/entities/player/inventory/Inventory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java index 97eab23..8197938 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java @@ -93,7 +93,7 @@ public void put(StowableObjectType item) return; } // Si tous les stacks present sont pleins ou aucune ne correspond à l'objet qui à étais pris, il crée un nouveau stack - if (this.value.size() < 9) + if (this.value.size() < (Inventory.NB_BOXES_MAX / Inventory.NB_LINES)) this.createStack(item); } } From 9ed122ab7bd85f328fea2637fc2f4c1762ba6f60 Mon Sep 17 00:00:00 2001 From: Tiago Lousa <tig2468.a@gmail.com> Date: Tue, 14 Jun 2022 11:50:44 +0200 Subject: [PATCH 71/97] fix loot tall grass --- src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java index bde3826..2cdedf1 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java +++ b/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java @@ -77,7 +77,7 @@ private void loots() for (int loot = 0; loot < Block.ROCK_NB_LOOTS; loot++) player.pickup(Item.STONE); } else if (Block.isTallGrass(this)) { - for (int loot = (int) (Math.random()*3)+1; loot < TallGrass.LOOTS_FIBRE_MAX; loot++) + for (int loot = (int) (Math.random()*3)+1; loot <= TallGrass.LOOTS_FIBRE_MAX; loot++) player.pickup(Item.FIBER); boolean mustDropVodka = Math.random() < Vodka.DROP_RATE; From 0279cbb15dff566f0df7a36bdd1096cb94d0aff6 Mon Sep 17 00:00:00 2001 From: Tiago Lousa <tig2468.a@gmail.com> Date: Tue, 14 Jun 2022 12:05:57 +0200 Subject: [PATCH 72/97] fix pioche qui ne cassais plus la pierre --- .../sae/terraria/modele/entities/player/inventory/Inventory.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java index 8197938..f36812f 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java @@ -65,7 +65,6 @@ private void createStack(StowableObjectType item) }); stack.setItem(item); this.value.add(stack); - this.player.setStackSelected(stack); } public int nbStacksIntoInventory() { return this.value.size(); } From 4c65755dabb92efda1b3f91ecaae02df006d7eac Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Tue, 14 Jun 2022 12:18:27 +0200 Subject: [PATCH 73/97] Fix cast error on Slime.java --- src/main/java/fr/sae/terraria/modele/entities/Slime.java | 2 +- .../modele/entities/player/inventory/Inventory.java | 5 ++--- src/main/java/fr/sae/terraria/vue/hud/InventoryView.java | 2 +- src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java | 6 +----- .../fr/sae/terraria/modele/entities/player/PlayerTest.java | 2 +- .../modele/entities/player/inventory/InventoryTest.java | 2 +- 6 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/main/java/fr/sae/terraria/modele/entities/Slime.java b/src/main/java/fr/sae/terraria/modele/entities/Slime.java index f798ecd..21d6674 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/Slime.java +++ b/src/main/java/fr/sae/terraria/modele/entities/Slime.java @@ -84,7 +84,7 @@ else if (environment.getPlayer().getX() < this.x.getValue()) Stack stack = this.environment.getPlayer().getStackSelected(); if (!Objects.isNull(stack)) { - if (Tool.isSword((Tool) stack.getItem())) { + if (stack.getItem() instanceof Tool && Tool.isSword((Tool) stack.getItem())) { Tool tool = (Tool) stack.getItem(); this.setPv(this.getPv() - tool.damage()); } diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java index 8197938..066e24c 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java @@ -5,7 +5,6 @@ import javafx.beans.property.IntegerProperty; import javafx.beans.property.SimpleIntegerProperty; import javafx.collections.FXCollections; -import javafx.collections.ListChangeListener; import javafx.collections.ObservableList; import javafx.scene.input.KeyCode; @@ -38,7 +37,7 @@ public Inventory(final Player player) this.posCursor = new SimpleIntegerProperty(0); // Change l'item qui se trouve dans la main du joueur - this.posCursorProperty().addListener((obs, oldPos, newPos) -> { + this.cursorProperty().addListener((obs, oldPos, newPos) -> { boolean isntOutOfInventoryBar = newPos.intValue() >= 0 && newPos.intValue() < nbElementOnOneLineOfInventory; if (isntOutOfInventoryBar) @@ -141,7 +140,7 @@ else if (key.equals(KeyCode.DIGIT9)) this.scroll = 0; } - public IntegerProperty posCursorProperty() { return this.posCursor; } + public IntegerProperty cursorProperty() { return this.posCursor; } public Stack getStack() { return this.value.get(this.getPosCursor()); } diff --git a/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java b/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java index 81b2edd..8fbd19f 100644 --- a/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java +++ b/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java @@ -192,7 +192,7 @@ private void displayCursorInventoryBar() { this.cursorImgView.setX(((windowWidth - inventoryBarImg.getWidth()) / 2 - scaleMultiplicatorWidth)); this.cursorImgView.setY(((windowHeight - inventoryBarImg.getHeight()) - tileHeight) - scaleMultiplicatorHeight); - this.inventory.posCursorProperty().addListener((obs, oldV, newV) -> this.cursorImgView.setX(((windowWidth - inventoryBarImg.getWidth()) / 2 + ((inventoryBarImg.getWidth() / 9) * newV.intValue() - scaleMultiplicatorWidth)))); + this.inventory.cursorProperty().addListener((obs, oldV, newV) -> this.cursorImgView.setX(((windowWidth - inventoryBarImg.getWidth()) / 2 + ((inventoryBarImg.getWidth() / 9) * newV.intValue() - scaleMultiplicatorWidth)))); this.display.getChildren().add(cursorImgView); } diff --git a/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java b/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java index 672b7ac..94487e5 100644 --- a/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java +++ b/src/main/java/fr/sae/terraria/vue/hud/ItemSelectedView.java @@ -8,20 +8,16 @@ import fr.sae.terraria.modele.entities.items.Meat; import fr.sae.terraria.modele.entities.items.Vodka; import fr.sae.terraria.modele.entities.player.Player; -import fr.sae.terraria.modele.entities.player.inventory.Inventory; import fr.sae.terraria.modele.entities.player.inventory.Stack; import fr.sae.terraria.modele.entities.tools.Tool; import fr.sae.terraria.vue.View; import javafx.collections.ListChangeListener; -import javafx.collections.ObservableArray; import javafx.collections.ObservableList; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.input.MouseEvent; import javafx.scene.layout.Pane; -import java.util.Objects; - public class ItemSelectedView { @@ -77,7 +73,7 @@ public ItemSelectedView(Pane display, Player player, double scaleMultiplicatorWi refreshView(); }); - player.getInventory().posCursorProperty().addListener((obs, oldItemSelected, newItemSelected) -> { + player.getInventory().cursorProperty().addListener((obs, oldItemSelected, newItemSelected) -> { refreshView(); }); diff --git a/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java b/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java index 88feb0a..f1b3e85 100644 --- a/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java +++ b/src/test/java/fr/sae/terraria/modele/entities/player/PlayerTest.java @@ -184,7 +184,7 @@ public class PlayerTest @Test public final void pickupTest() { - player.getInventory().posCursorProperty().set(0); + player.getInventory().cursorProperty().set(0); // Test avec de la viande diff --git a/src/test/java/fr/sae/terraria/modele/entities/player/inventory/InventoryTest.java b/src/test/java/fr/sae/terraria/modele/entities/player/inventory/InventoryTest.java index 086c9c7..0e46f39 100644 --- a/src/test/java/fr/sae/terraria/modele/entities/player/inventory/InventoryTest.java +++ b/src/test/java/fr/sae/terraria/modele/entities/player/inventory/InventoryTest.java @@ -36,7 +36,7 @@ public class InventoryTest @Test public final void nbItemsIntoStackTest() { - inventory.posCursorProperty().set(0); + inventory.cursorProperty().set(0); for (int i = 0; i < Stack.MAX; i++) inventory.put(new Block(BlockSet.DIRT, environment)); assertEquals(Stack.MAX, inventory.getStack().getNbItems()); From 16b081aec19cef8eed4c9a4c4d99d265205d8dc2 Mon Sep 17 00:00:00 2001 From: theblackreaper <abouche0603@gmail.com> Date: Tue, 14 Jun 2022 12:20:39 +0200 Subject: [PATCH 74/97] creation du craft --- .../terraria/controller/MenuController.java | 26 ++-- .../modele/entities/player/Player.java | 4 + .../entities/player/inventory/Craft.java | 134 ++++++++++++++++++ .../entities/player/inventory/Inventory.java | 1 + .../entities/player/inventory/Stack.java | 1 + .../resources/fr/sae/terraria/vue/menu.fxml | 78 ++++++++-- 6 files changed, 226 insertions(+), 18 deletions(-) create mode 100644 src/main/java/fr/sae/terraria/modele/entities/player/inventory/Craft.java diff --git a/src/main/java/fr/sae/terraria/controller/MenuController.java b/src/main/java/fr/sae/terraria/controller/MenuController.java index 372bc30..605993c 100644 --- a/src/main/java/fr/sae/terraria/controller/MenuController.java +++ b/src/main/java/fr/sae/terraria/controller/MenuController.java @@ -21,6 +21,7 @@ import java.net.URL; import java.util.Objects; import java.util.ResourceBundle; +import java.util.concurrent.locks.ReentrantLock; public class MenuController implements Initializable @@ -29,7 +30,18 @@ public class MenuController implements Initializable @FXML public Pane displayInventory; @FXML public Pane displayLexique; @FXML public HBox HBoxText; - @FXML public HBox lexique4; + @FXML public HBox lexiconStone; + @FXML public HBox lexiconPickaxe1; + @FXML public HBox lexiconPickaxe2; + @FXML public HBox lexiconPickaxe3; + @FXML public HBox lexiconAxe1; + @FXML public HBox lexiconAxe2; + @FXML public HBox lexiconAxe3; + @FXML public HBox lexiconSword1; + @FXML public HBox lexiconSword2; + @FXML public HBox lexiconSword3; + + public Timeline loop; private Stage stage; @@ -63,17 +75,11 @@ public MenuController(final Stage stage) this.loop.play(); // Craft de la roche à partir de 3 pierres - this.lexique4.addEventFilter(Event.ANY, ev -> { + this.lexiconStone.addEventFilter(Event.ANY, ev -> { if (ev.getEventType().getName().equalsIgnoreCase("MOUSE_PRESSED")) { int i = this.player.getInventory().get().size()-1; - while (i > 0 && !(this.player.getInventory().get().get(i).getItem().equals(Item.STONE)) && this.player.getInventory().get().get(i).getNbItems() >= Block.ROCK_NB_LOOTS) - i--; - - Stack stack = this.player.getInventory().get().get(i); - if (stack.getItem() instanceof Item && stack.getItem().equals(Item.STONE)) { - for (int j = 0; j < Block.ROCK_NB_LOOTS; j++) - stack.remove(); - this.player.pickup(new Block(BlockSet.ROCK, this.environment)); + if (player.getCraft().possibleToCreateTool(10)) { + player.getCraft().createTool(10); } } }); diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java index 04f033b..474b30c 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java @@ -3,6 +3,7 @@ import fr.sae.terraria.modele.Environment; import fr.sae.terraria.modele.TileMaps; import fr.sae.terraria.modele.entities.entity.*; +import fr.sae.terraria.modele.entities.player.inventory.Craft; import fr.sae.terraria.modele.entities.player.inventory.Inventory; import fr.sae.terraria.modele.entities.player.inventory.Stack; import fr.sae.terraria.vue.View; @@ -28,6 +29,7 @@ public class Player extends EntityMovable implements CollideObjectType, Collapsi private final Inventory inventory; private Stack stackSelected; + private Craft craft; public Player(final Environment environment) @@ -36,6 +38,7 @@ public Player(final Environment environment) this.drunk = new SimpleBooleanProperty(false); this.inventory = new Inventory(this); + this.craft = new Craft(this.inventory, environment); this.animation = new Animation(); this.keysInput = new EnumMap<>(KeyCode.class); @@ -166,6 +169,7 @@ else if (key == KeyCode.Q) public Map<KeyCode, Boolean> getKeysInput() { return this.keysInput; } public Stack getStackSelected() { return this.stackSelected; } public Inventory getInventory() { return this.inventory; } + public Craft getCraft() { return craft; } public void setStackSelected(Stack stackSelected) { this.stackSelected = stackSelected; } } diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Craft.java b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Craft.java new file mode 100644 index 0000000..882e19a --- /dev/null +++ b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Craft.java @@ -0,0 +1,134 @@ +package fr.sae.terraria.modele.entities.player.inventory; + +import fr.sae.terraria.modele.Environment; +import fr.sae.terraria.modele.entities.blocks.Block; +import fr.sae.terraria.modele.entities.blocks.BlockSet; +import fr.sae.terraria.modele.entities.entity.StowableObjectType; +import fr.sae.terraria.modele.entities.items.Item; + +import fr.sae.terraria.modele.entities.player.Player; +import fr.sae.terraria.modele.entities.tools.*; + +import java.util.Objects; + +public class Craft { + private Inventory inventory; + private Environment environment; + public Craft(Inventory inventory, Environment environment) { + this.inventory = inventory; + } + + public boolean possibleToCreateTool(int id) { + boolean firstGood = false; + boolean secundGood = false; + int quantityNeeded = 0; + for (int i = 0; i < this.inventory.NB_BOXES_MAX; i++) { + if (id <= 9) { + if (id <= 6) { + quantityNeeded = 2; + //TODO a changé le bois en stick + if (Item.isWood(this.inventory.get().get(i).getItem()) && this.inventory.get().get(i).getNbItems() >= quantityNeeded) { + firstGood = true; + quantityNeeded = 3; + } + + } else { + quantityNeeded = 1; + //TODO a changé le bois en stick + if (Item.isWood(this.inventory.get().get(i).getItem()) && this.inventory.get().get(i).getNbItems() >= quantityNeeded) { + firstGood = true; + quantityNeeded = 2; + } + } + if (id % 3 == 1) { + if (Item.isWood(this.inventory.get().get(i).getItem()) && this.inventory.get().get(i).getNbItems() >= quantityNeeded) { + secundGood = true; + } + } + if (id % 3 == 2) { + if (Item.isStone(this.inventory.get().get(i).getItem()) && this.inventory.get().get(i).getNbItems() >= quantityNeeded) { + secundGood = true; + } + } + if (id % 3 == 0) { + if (Item.isIron(this.inventory.get().get(i).getItem()) && this.inventory.get().get(i).getNbItems() >= quantityNeeded) { + secundGood = true; + } + } + } + else if (id == 10) { + quantityNeeded = 3; + if (Item.isStone(this.inventory.get().get(i).getItem()) && this.inventory.get().get(i).getNbItems() >= quantityNeeded) { + firstGood = true; + secundGood = true; + } + } else if (id == 11) { + quantityNeeded = 3; + //TODO a changé le bois en stick + if (Item.isWood(this.inventory.get().get(i).getItem()) && this.inventory.get().get(i).getNbItems() >= quantityNeeded) { + firstGood = true; + } + if (Item.isFiber(this.inventory.get().get(i).getItem()) && this.inventory.get().get(i).getNbItems() >= quantityNeeded) + secundGood = true; + } + if (firstGood && secundGood) + return true; + } + return false; + } + + public void createTool(int id) { + int quantityNeeded = 0; + if (id == 10) + inventory.getPlayer().pickup(new Block(BlockSet.ROCK, this.environment)); + + for (int i = 0; i < this.inventory.nbStacksIntoInventory(); i++) { + if (id <= 9) { + if (id <= 6) { + quantityNeeded = 2; + //TODO a changé le bois en stick + if (Item.isWood(this.inventory.get().get(i).getItem())) { + this.inventory.get().get(i).removeQuantity(quantityNeeded); + quantityNeeded = 3; + } + + } else { + quantityNeeded = 1; + if (Item.isWood(this.inventory.get().get(i).getItem()) && this.inventory.get().get(i).getNbItems() >= quantityNeeded) { + this.inventory.get().get(i).removeQuantity(quantityNeeded); + quantityNeeded = 2; + } + } + if (id % 3 == 1) { + if (Item.isWood(this.inventory.get().get(i).getItem())) { + this.inventory.get().get(i).removeQuantity(quantityNeeded); + } + } + if (id % 3 == 2) { + if (Item.isStone(this.inventory.get().get(i).getItem())) { + this.inventory.get().get(i).removeQuantity(quantityNeeded); + } + } + if (id % 3 == 0) { + if (Item.isIron(this.inventory.get().get(i).getItem())) { + this.inventory.get().get(i).removeQuantity(quantityNeeded); + } + } + } else if (id == 10) { + quantityNeeded = 3; + if (Item.isStone(this.inventory.get().get(i).getItem())) { + this.inventory.get().get(i).removeQuantity(quantityNeeded); + } + } else if (id == 11) { + quantityNeeded = 3; + if (Item.isWood(this.inventory.get().get(i).getItem())) { + this.inventory.get().get(i).removeQuantity(quantityNeeded); + quantityNeeded = 3; + } + if (Item.isFiber(this.inventory.get().get(i).getItem())) + this.inventory.get().get(i).removeQuantity(quantityNeeded); + } + + } + } +} diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java index 8197938..1aa820b 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java @@ -148,6 +148,7 @@ else if (key.equals(KeyCode.DIGIT9)) public int getPosCursor() { return this.posCursor.get(); } public ObservableList<Stack> get() { return this.value; } public Map<KeyCode, Boolean> getKeysInput() { return this.keysInput; } + public Player getPlayer() { return player; } public void setScroll(int newScroll) { this.scroll = newScroll; } } diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java index 7c54957..ec3cacd 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java @@ -91,6 +91,7 @@ public boolean isSameItem(StowableObjectType obj) public boolean isFull() { return this.getNbItems() >= Stack.MAX; } public void add() { if (this.getNbItems() < Stack.MAX) this.nbItems.set(this.getNbItems() + 1); } public void remove() { if (this.getNbItems() > 0) this.nbItems.set(this.getNbItems() - 1); } + public void removeQuantity(int quantity) { if (this.getNbItems() >= quantity) this.nbItems.set(this.getNbItems() - quantity);} @Override public String toString(){ if (item instanceof Block) diff --git a/src/main/resources/fr/sae/terraria/vue/menu.fxml b/src/main/resources/fr/sae/terraria/vue/menu.fxml index 5206fcf..2f4d6ec 100644 --- a/src/main/resources/fr/sae/terraria/vue/menu.fxml +++ b/src/main/resources/fr/sae/terraria/vue/menu.fxml @@ -59,40 +59,102 @@ prefHeight="900.0" prefWidth="640.0"> <HBox id="notAvailable" - fx:id="lexique1" + fx:id="lexiconPickaxe1" prefHeight="50.0" prefWidth="625.0"> <Text text="Pioche en fer" textAlignment="CENTER"/> <Text text="2 Bâtons | 3 Minerais de fer" textAlignment="CENTER"/> </HBox> - <Separator layoutY="50.0" prefHeight="5.0" prefWidth="625.0"/> + <Separator layoutY="75.0" prefHeight="5.0" prefWidth="625.0"/> <HBox id="notAvailable" - fx:id="lexique2" + fx:id="lexiconPickaxe2" + prefHeight="50.0" + prefWidth="625.0"> + <Text text="Pioche en pierre" textAlignment="CENTER"/> + <Text text="2 Bâtons | 3 pierre" textAlignment="CENTER"/> + </HBox> + <Separator layoutY="150.0" prefHeight="5.0" prefWidth="625.0"/> + <HBox id="notAvailable" + fx:id="lexiconPickaxe3" + prefHeight="50.0" + prefWidth="625.0"> + <Text text="Pioche en bois" textAlignment="CENTER"/> + <Text text="2 Bâtons | 3 bois" textAlignment="CENTER"/> + </HBox> + <Separator layoutY="225.0" prefHeight="5.0" prefWidth="625.0"/> + <HBox id="notAvailable" + fx:id="lexiconAxe1" layoutY="55.0" prefHeight="50.0" prefWidth="625.0"> <Text text="Hache en fer" textAlignment="CENTER"/> <Text text="2 Bâtons | 3 Minerais de fer" textAlignment="CENTER"/> </HBox> - <Separator layoutY="103.0" prefHeight="5.0" prefWidth="625.0"/> + <Separator layoutY="300.0" prefHeight="5.0" prefWidth="625.0"/> + <HBox id="notAvailable" + fx:id="lexiconAxe2" + layoutY="55.0" + prefHeight="50.0" + prefWidth="625.0"> + <Text text="Hache en pierre" textAlignment="CENTER"/> + <Text text="2 Bâtons | 3 pierre" textAlignment="CENTER"/> + </HBox> + <Separator layoutY="375.0" prefHeight="5.0" prefWidth="625.0"/> + <HBox id="notAvailable" + fx:id="lexiconAxe3" + layoutY="55.0" + prefHeight="50.0" + prefWidth="625.0"> + <Text text="Hache en bois" textAlignment="CENTER"/> + <Text text="2 Bâtons | 3 bois" textAlignment="CENTER"/> + </HBox> + <Separator layoutY="450.0" prefHeight="5.0" prefWidth="625.0"/> <HBox id="notAvailable" - fx:id="lexique3" + fx:id="lexiconSword1" layoutY="108.0" prefHeight="50.0" prefWidth="625.0"> <Text text="Epée en fer" textAlignment="CENTER"/> <Text text="1 Bâton | 2 Minerais de fer"/> </HBox> - <Separator layoutY="158.0" prefHeight="5.0" prefWidth="625.0"/> + <Separator layoutY="525.0" prefHeight="5.0" prefWidth="625.0"/> + <HBox id="notAvailable" + fx:id="lexiconSword2" + layoutY="108.0" + prefHeight="50.0" + prefWidth="625.0"> + <Text text="Epée en pierre" textAlignment="CENTER"/> + <Text text="1 Bâton | 2 pierre"/> + </HBox> + <Separator layoutY="600.0" prefHeight="5.0" prefWidth="625.0"/> + <HBox id="notAvailable" + fx:id="lexiconSword3" + layoutY="108.0" + prefHeight="50.0" + prefWidth="625.0"> + <Text text="Epée en bois" textAlignment="CENTER"/> + <Text text="1 Bâton | 2 bois"/> + </HBox> + <Separator layoutY="675.0" prefHeight="5.0" prefWidth="625.0"/> <HBox id="notAvailable" - fx:id="lexique4" + fx:id="lexiconStone" layoutY="163.0" prefHeight="50.0" prefWidth="625.0"> <Text text="1 Roche" textAlignment="CENTER"/> <Text text="3 pierres"/> </HBox> - <Separator layoutY="213.0" prefHeight="5.0" prefWidth="625.0"/> + <Separator layoutY="750.0" prefHeight="5.0" prefWidth="625.0"/> + <!--<HBox id="notAvailable" + fx:id="lexiconBow" + layoutY="163.0" + prefHeight="50.0" + prefWidth="625.0"> + <Text text="arc" textAlignment="CENTER"/> + <Text text="3 Bâton | 3 fibres"/> + </HBox> + <Separator layoutY="825.0" prefHeight="5.0" prefWidth="625.0"/> + --> </Pane> </ScrollPane> </center> From d42a0865a406e1fa027b4f92623448f3fc03d617 Mon Sep 17 00:00:00 2001 From: Tiago Lousa <tig2468.a@gmail.com> Date: Tue, 14 Jun 2022 12:26:11 +0200 Subject: [PATCH 75/97] =?UTF-8?q?oubli=20refreshStack=20quand=20un=20item?= =?UTF-8?q?=20est=20r=C3=A9cup=C3=A9r=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/fr/sae/terraria/modele/entities/player/Player.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java index 474b30c..990b098 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java @@ -123,6 +123,7 @@ public void interactWithBlock(final Rectangle2D rectangle) ((BreakableObjectType) entity).breaks(); if (entity instanceof CollapsibleObjectType) ((CollapsibleObjectType) entity).hit(); + this.inventory.refreshStack(); } } From 59e8db10402cc72b2f6cfca009f7ad3ccb1acfc5 Mon Sep 17 00:00:00 2001 From: theblackreaper <abouche0603@gmail.com> Date: Tue, 14 Jun 2022 13:55:34 +0200 Subject: [PATCH 76/97] fix craft --- .../modele/entities/player/inventory/Craft.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Craft.java b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Craft.java index 882e19a..c633f7b 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Craft.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Craft.java @@ -16,6 +16,7 @@ public class Craft { private Environment environment; public Craft(Inventory inventory, Environment environment) { this.inventory = inventory; + this.environment = environment; } public boolean possibleToCreateTool(int id) { @@ -79,6 +80,18 @@ else if (id == 10) { public void createTool(int id) { int quantityNeeded = 0; + if (id == 1) + inventory.getPlayer().pickup(new Tool(ToolSet.PICKAXE, MaterialSet.IRON)); + else if (id == 3) + inventory.getPlayer().pickup(new Tool(ToolSet.PICKAXE, MaterialSet.WOOD)); + else if (id == 4) + inventory.getPlayer().pickup(new Tool(ToolSet.AXE, MaterialSet.IRON)); + else if (id == 6) + inventory.getPlayer().pickup(new Tool(ToolSet.AXE, MaterialSet.WOOD)); + else if (id == 7) + inventory.getPlayer().pickup(new Tool(ToolSet.SWORD, MaterialSet.IRON)); + else if(id == 9) + inventory.getPlayer().pickup(new Tool(ToolSet.SWORD, MaterialSet.WOOD)); if (id == 10) inventory.getPlayer().pickup(new Block(BlockSet.ROCK, this.environment)); @@ -99,7 +112,7 @@ public void createTool(int id) { quantityNeeded = 2; } } - if (id % 3 == 1) { + if (id % 3 == 0) { if (Item.isWood(this.inventory.get().get(i).getItem())) { this.inventory.get().get(i).removeQuantity(quantityNeeded); } @@ -109,7 +122,7 @@ public void createTool(int id) { this.inventory.get().get(i).removeQuantity(quantityNeeded); } } - if (id % 3 == 0) { + if (id % 3 == 1) { if (Item.isIron(this.inventory.get().get(i).getItem())) { this.inventory.get().get(i).removeQuantity(quantityNeeded); } From ab8131870f769bc2eb04d0fe09547ccbd6e40219 Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Wed, 15 Jun 2022 13:15:24 +0200 Subject: [PATCH 77/97] Prototype structure craft --- .../terraria/controller/MenuController.java | 21 ++++----- .../sae/terraria/modele/entities/Slime.java | 6 ++- .../terraria/modele/entities/items/Item.java | 4 +- .../modele/entities/player/Player.java | 7 +-- .../player/{inventory => craft}/Craft.java | 46 +++++++++++++------ .../player/craft/recipes/PickaxeRecipe.java | 45 ++++++++++++++++++ .../player/craft/recipes/RockRecipe.java | 7 +++ .../entities/player/inventory/Stack.java | 11 ++++- .../modele/entities/tools/MaterialSet.java | 3 ++ src/main/java/module-info.java | 2 + .../resources/fr/sae/terraria/vue/menu.fxml | 26 +++++------ 11 files changed, 131 insertions(+), 47 deletions(-) rename src/main/java/fr/sae/terraria/modele/entities/player/{inventory => craft}/Craft.java (84%) create mode 100644 src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/PickaxeRecipe.java create mode 100644 src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/RockRecipe.java diff --git a/src/main/java/fr/sae/terraria/controller/MenuController.java b/src/main/java/fr/sae/terraria/controller/MenuController.java index 605993c..27901c2 100644 --- a/src/main/java/fr/sae/terraria/controller/MenuController.java +++ b/src/main/java/fr/sae/terraria/controller/MenuController.java @@ -6,6 +6,7 @@ import fr.sae.terraria.modele.entities.blocks.BlockSet; import fr.sae.terraria.modele.entities.items.Item; import fr.sae.terraria.modele.entities.player.Player; +import fr.sae.terraria.modele.entities.player.craft.Craft; import fr.sae.terraria.modele.entities.player.inventory.Stack; import javafx.animation.Animation; import javafx.animation.KeyFrame; @@ -30,12 +31,12 @@ public class MenuController implements Initializable @FXML public Pane displayInventory; @FXML public Pane displayLexique; @FXML public HBox HBoxText; - @FXML public HBox lexiconStone; - @FXML public HBox lexiconPickaxe1; - @FXML public HBox lexiconPickaxe2; - @FXML public HBox lexiconPickaxe3; + @FXML public HBox recipeRock; + @FXML public HBox recipeWoodPickaxe; + @FXML public HBox recipeStonePickaxe; + @FXML public HBox recipeIronPickaxe; @FXML public HBox lexiconAxe1; - @FXML public HBox lexiconAxe2; + @FXML public HBox recipeStoneAxe; @FXML public HBox lexiconAxe3; @FXML public HBox lexiconSword1; @FXML public HBox lexiconSword2; @@ -75,13 +76,9 @@ public MenuController(final Stage stage) this.loop.play(); // Craft de la roche à partir de 3 pierres - this.lexiconStone.addEventFilter(Event.ANY, ev -> { - if (ev.getEventType().getName().equalsIgnoreCase("MOUSE_PRESSED")) { - int i = this.player.getInventory().get().size()-1; - if (player.getCraft().possibleToCreateTool(10)) { - player.getCraft().createTool(10); - } - } + this.recipeRock.addEventFilter(Event.ANY, ev -> { + if (ev.getEventType().getName().equalsIgnoreCase("MOUSE_PRESSED")) + player.pickup(Craft.rock(this.environment)); }); } } diff --git a/src/main/java/fr/sae/terraria/modele/entities/Slime.java b/src/main/java/fr/sae/terraria/modele/entities/Slime.java index 21d6674..241fa32 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/Slime.java +++ b/src/main/java/fr/sae/terraria/modele/entities/Slime.java @@ -29,7 +29,8 @@ public Slime(Environment environment, int x, int y) public Slime(Environment environment) { this(environment, 0, 0); } - @Override public void updates() { + @Override public void updates() + { if (this.isIDLEonY() && !this.air) { this.gravity.xInit = this.x.get(); this.gravity.yInit = this.y.get(); @@ -55,7 +56,8 @@ else if (environment.getPlayer().getX() < this.x.getValue()) this.animation.loop(); } - @Override public void collide() { + @Override public void collide() + { Map<String, Boolean> whereCollide = super.collide(this.environment); if (!whereCollide.isEmpty()) diff --git a/src/main/java/fr/sae/terraria/modele/entities/items/Item.java b/src/main/java/fr/sae/terraria/modele/entities/items/Item.java index d458bf8..f4d9e69 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/items/Item.java +++ b/src/main/java/fr/sae/terraria/modele/entities/items/Item.java @@ -10,7 +10,8 @@ public enum Item implements StowableObjectType IRON, SILEX, STONE, - WOOD; + WOOD, + STICKS; public static boolean isCoal(StowableObjectType obj) { return obj == Item.COAL; } @@ -19,4 +20,5 @@ public enum Item implements StowableObjectType public static boolean isStone(StowableObjectType obj) { return obj == Item.STONE; } public static boolean isSilex(StowableObjectType obj) { return obj == Item.SILEX; } public static boolean isWood(StowableObjectType obj) { return obj == Item.WOOD; } + public static boolean isStick(StowableObjectType obj) { return obj == Item.STICKS; } } diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java index 990b098..3ff8a53 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java @@ -3,7 +3,7 @@ import fr.sae.terraria.modele.Environment; import fr.sae.terraria.modele.TileMaps; import fr.sae.terraria.modele.entities.entity.*; -import fr.sae.terraria.modele.entities.player.inventory.Craft; +import fr.sae.terraria.modele.entities.player.craft.Craft; import fr.sae.terraria.modele.entities.player.inventory.Inventory; import fr.sae.terraria.modele.entities.player.inventory.Stack; import fr.sae.terraria.vue.View; @@ -29,7 +29,6 @@ public class Player extends EntityMovable implements CollideObjectType, Collapsi private final Inventory inventory; private Stack stackSelected; - private Craft craft; public Player(final Environment environment) @@ -38,7 +37,6 @@ public Player(final Environment environment) this.drunk = new SimpleBooleanProperty(false); this.inventory = new Inventory(this); - this.craft = new Craft(this.inventory, environment); this.animation = new Animation(); this.keysInput = new EnumMap<>(KeyCode.class); @@ -161,7 +159,7 @@ else if (key == KeyCode.Q) }); } - public void pickup(StowableObjectType pickupObject) { this.inventory.put(pickupObject); } + public void pickup(StowableObjectType pickupObj) { if (!Objects.isNull(pickupObj)) this.inventory.put(pickupObj); } public SimpleBooleanProperty drunkProperty() { return drunk; } @@ -170,7 +168,6 @@ else if (key == KeyCode.Q) public Map<KeyCode, Boolean> getKeysInput() { return this.keysInput; } public Stack getStackSelected() { return this.stackSelected; } public Inventory getInventory() { return this.inventory; } - public Craft getCraft() { return craft; } public void setStackSelected(Stack stackSelected) { this.stackSelected = stackSelected; } } diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Craft.java b/src/main/java/fr/sae/terraria/modele/entities/player/craft/Craft.java similarity index 84% rename from src/main/java/fr/sae/terraria/modele/entities/player/inventory/Craft.java rename to src/main/java/fr/sae/terraria/modele/entities/player/craft/Craft.java index c633f7b..4df0243 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Craft.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/craft/Craft.java @@ -1,29 +1,24 @@ -package fr.sae.terraria.modele.entities.player.inventory; +package fr.sae.terraria.modele.entities.player.craft; import fr.sae.terraria.modele.Environment; import fr.sae.terraria.modele.entities.blocks.Block; import fr.sae.terraria.modele.entities.blocks.BlockSet; -import fr.sae.terraria.modele.entities.entity.StowableObjectType; import fr.sae.terraria.modele.entities.items.Item; -import fr.sae.terraria.modele.entities.player.Player; +import fr.sae.terraria.modele.entities.player.craft.recipes.RockRecipe; +import fr.sae.terraria.modele.entities.player.inventory.Inventory; +import fr.sae.terraria.modele.entities.player.inventory.Stack; import fr.sae.terraria.modele.entities.tools.*; -import java.util.Objects; -public class Craft { - private Inventory inventory; - private Environment environment; - public Craft(Inventory inventory, Environment environment) { - this.inventory = inventory; - this.environment = environment; - } +public class Craft +{ public boolean possibleToCreateTool(int id) { boolean firstGood = false; boolean secundGood = false; int quantityNeeded = 0; - for (int i = 0; i < this.inventory.NB_BOXES_MAX; i++) { + for (int i = 0; i < Inventory.NB_BOXES_MAX; i++) { if (id <= 9) { if (id <= 6) { quantityNeeded = 2; @@ -93,7 +88,7 @@ else if (id == 7) else if(id == 9) inventory.getPlayer().pickup(new Tool(ToolSet.SWORD, MaterialSet.WOOD)); if (id == 10) - inventory.getPlayer().pickup(new Block(BlockSet.ROCK, this.environment)); + inventory.getPlayer().pickup(new Block(BlockSet.ROCK, null)); for (int i = 0; i < this.inventory.nbStacksIntoInventory(); i++) { if (id <= 9) { @@ -144,4 +139,29 @@ else if(id == 9) } } + + + public static Block rock(final Environment environment) + { + Inventory inventory = environment.getPlayer().getInventory(); + + for (int i = 0; i < inventory.get().size(); i++) { + Stack stack = inventory.get().get(i); + if (Item.isStone(stack.getItem()) && stack.removeQuantity(RockRecipe.NB_STONES)) + return new Block(BlockSet.ROCK, environment); + } + return null; + } + + public static Block pickaxe(final Environment environment, final MaterialSet material) + { + Inventory inventory = environment.getPlayer().getInventory(); + + for (int i = 0; i < inventory.get().size(); i++) { + Stack stack = inventory.get().get(i); + + + } + return null; + } } diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/PickaxeRecipe.java b/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/PickaxeRecipe.java new file mode 100644 index 0000000..ba9128c --- /dev/null +++ b/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/PickaxeRecipe.java @@ -0,0 +1,45 @@ +package fr.sae.terraria.modele.entities.player.craft.recipes; + +import fr.sae.terraria.modele.entities.items.Item; +import fr.sae.terraria.modele.entities.player.inventory.Inventory; +import fr.sae.terraria.modele.entities.player.inventory.Stack; +import fr.sae.terraria.modele.entities.tools.MaterialSet; + + +public class PickaxeRecipe +{ + public static final class WOOD_RECIPE + { + public static final int NB_WOODS = 3; + public static final int NB_STICKS = 2; + + public static boolean apply(final Inventory inventory) + { + boolean haveEnoughForPickaxeHead = false; + boolean haveEnoughForPickaxeHandler = false; + + for (int i = 0; i < inventory.get().size(); i++) { + Stack stack = inventory.get().get(i); + if (Item.isWood(stack.getItem()) && stack.haveEnoughQuantity(NB_WOODS)) + haveEnoughForPickaxeHead = true; + if (Item.isStick(stack.getItem()) && stack.haveEnoughQuantity(NB_STICKS)) + haveEnoughForPickaxeHandler = true; + } + } + } + + public static final class STONE + { + public static final int NB_STONE = 3; + public static final int NB_STICK = 2; + } + + public static final class IRON + { + public static final int NB_IRONS = 3; + public static final int NB_STICKS = 2; + } + + + +} diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/RockRecipe.java b/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/RockRecipe.java new file mode 100644 index 0000000..d880339 --- /dev/null +++ b/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/RockRecipe.java @@ -0,0 +1,7 @@ +package fr.sae.terraria.modele.entities.player.craft.recipes; + + +public class RockRecipe +{ + public static final int NB_STONES = 4; +} diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java index ec3cacd..5819999 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java @@ -89,9 +89,18 @@ public boolean isSameItem(StowableObjectType obj) public IntegerProperty nbItemsProperty() { return this.nbItems; } public boolean isFull() { return this.getNbItems() >= Stack.MAX; } + public boolean haveEnoughQuantity(int quantity) { return this.getNbItems() >= quantity; } public void add() { if (this.getNbItems() < Stack.MAX) this.nbItems.set(this.getNbItems() + 1); } public void remove() { if (this.getNbItems() > 0) this.nbItems.set(this.getNbItems() - 1); } - public void removeQuantity(int quantity) { if (this.getNbItems() >= quantity) this.nbItems.set(this.getNbItems() - quantity);} + + public boolean removeQuantity(int quantity) + { + if (this.getNbItems() >= quantity) { + this.nbItems.set(this.getNbItems() - quantity); + return true; + } + return false; + } @Override public String toString(){ if (item instanceof Block) diff --git a/src/main/java/fr/sae/terraria/modele/entities/tools/MaterialSet.java b/src/main/java/fr/sae/terraria/modele/entities/tools/MaterialSet.java index 6def89c..93c4992 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/tools/MaterialSet.java +++ b/src/main/java/fr/sae/terraria/modele/entities/tools/MaterialSet.java @@ -5,4 +5,7 @@ public enum MaterialSet { WOOD, IRON; + + + public static boolean isWood(MaterialSet material) { return material == MaterialSet.IRON; } } diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index c9a249e..1676252 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -19,4 +19,6 @@ exports fr.sae.terraria.modele.entities.player.inventory; opens fr.sae.terraria.modele.entities.player.inventory to javafx.fxml; opens fr.sae.terraria.modele to javafx.fxml, javafx.graphics; + exports fr.sae.terraria.modele.entities.player.craft; + opens fr.sae.terraria.modele.entities.player.craft to javafx.fxml; } \ No newline at end of file diff --git a/src/main/resources/fr/sae/terraria/vue/menu.fxml b/src/main/resources/fr/sae/terraria/vue/menu.fxml index 2f4d6ec..4e59eb9 100644 --- a/src/main/resources/fr/sae/terraria/vue/menu.fxml +++ b/src/main/resources/fr/sae/terraria/vue/menu.fxml @@ -59,27 +59,27 @@ prefHeight="900.0" prefWidth="640.0"> <HBox id="notAvailable" - fx:id="lexiconPickaxe1" + fx:id="recipeWoodPickaxe" prefHeight="50.0" prefWidth="625.0"> - <Text text="Pioche en fer" textAlignment="CENTER"/> - <Text text="2 Bâtons | 3 Minerais de fer" textAlignment="CENTER"/> + <Text text="Pioche en bois" textAlignment="CENTER"/> + <Text text="2 Bâtons | 3 bois" textAlignment="CENTER"/> </HBox> - <Separator layoutY="75.0" prefHeight="5.0" prefWidth="625.0"/> + <Separator layoutY="150.0" prefHeight="5.0" prefWidth="625.0"/> <HBox id="notAvailable" - fx:id="lexiconPickaxe2" + fx:id="recipeStonePickaxe" prefHeight="50.0" prefWidth="625.0"> <Text text="Pioche en pierre" textAlignment="CENTER"/> <Text text="2 Bâtons | 3 pierre" textAlignment="CENTER"/> </HBox> - <Separator layoutY="150.0" prefHeight="5.0" prefWidth="625.0"/> + <Separator layoutY="75.0" prefHeight="5.0" prefWidth="625.0"/> <HBox id="notAvailable" - fx:id="lexiconPickaxe3" + fx:id="recipeIronPickaxe" prefHeight="50.0" prefWidth="625.0"> - <Text text="Pioche en bois" textAlignment="CENTER"/> - <Text text="2 Bâtons | 3 bois" textAlignment="CENTER"/> + <Text text="Pioche en fer" textAlignment="CENTER"/> + <Text text="2 Bâtons | 3 Minerais de fer" textAlignment="CENTER"/> </HBox> <Separator layoutY="225.0" prefHeight="5.0" prefWidth="625.0"/> <HBox id="notAvailable" @@ -92,8 +92,8 @@ </HBox> <Separator layoutY="300.0" prefHeight="5.0" prefWidth="625.0"/> <HBox id="notAvailable" - fx:id="lexiconAxe2" - layoutY="55.0" + fx:id="recipeStoneAxe" + layoutY="110.0" prefHeight="50.0" prefWidth="625.0"> <Text text="Hache en pierre" textAlignment="CENTER"/> @@ -102,7 +102,7 @@ <Separator layoutY="375.0" prefHeight="5.0" prefWidth="625.0"/> <HBox id="notAvailable" fx:id="lexiconAxe3" - layoutY="55.0" + layoutY="165.0" prefHeight="50.0" prefWidth="625.0"> <Text text="Hache en bois" textAlignment="CENTER"/> @@ -137,7 +137,7 @@ </HBox> <Separator layoutY="675.0" prefHeight="5.0" prefWidth="625.0"/> <HBox id="notAvailable" - fx:id="lexiconStone" + fx:id="recipeRock" layoutY="163.0" prefHeight="50.0" prefWidth="625.0"> From e2e3b2f3f92b0de379b3b774ae1efa5af9a5acdc Mon Sep 17 00:00:00 2001 From: Tiago Lousa <tig2468.a@gmail.com> Date: Wed, 15 Jun 2022 14:48:18 +0200 Subject: [PATCH 78/97] craft pickaxe --- .../modele/entities/player/craft/Craft.java | 142 ++---------------- .../player/craft/recipes/Ingredient.java | 14 ++ .../player/craft/recipes/PickaxeRecipe.java | 21 ++- 3 files changed, 39 insertions(+), 138 deletions(-) create mode 100644 src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/Ingredient.java diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/craft/Craft.java b/src/main/java/fr/sae/terraria/modele/entities/player/craft/Craft.java index 4df0243..49bebd8 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/craft/Craft.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/craft/Craft.java @@ -5,141 +5,19 @@ import fr.sae.terraria.modele.entities.blocks.BlockSet; import fr.sae.terraria.modele.entities.items.Item; +import fr.sae.terraria.modele.entities.player.craft.recipes.Ingredient; +import fr.sae.terraria.modele.entities.player.craft.recipes.PickaxeRecipe; import fr.sae.terraria.modele.entities.player.craft.recipes.RockRecipe; import fr.sae.terraria.modele.entities.player.inventory.Inventory; import fr.sae.terraria.modele.entities.player.inventory.Stack; import fr.sae.terraria.modele.entities.tools.*; +import java.util.Objects; + public class Craft { - public boolean possibleToCreateTool(int id) { - boolean firstGood = false; - boolean secundGood = false; - int quantityNeeded = 0; - for (int i = 0; i < Inventory.NB_BOXES_MAX; i++) { - if (id <= 9) { - if (id <= 6) { - quantityNeeded = 2; - //TODO a changé le bois en stick - if (Item.isWood(this.inventory.get().get(i).getItem()) && this.inventory.get().get(i).getNbItems() >= quantityNeeded) { - firstGood = true; - quantityNeeded = 3; - } - - } else { - quantityNeeded = 1; - //TODO a changé le bois en stick - if (Item.isWood(this.inventory.get().get(i).getItem()) && this.inventory.get().get(i).getNbItems() >= quantityNeeded) { - firstGood = true; - quantityNeeded = 2; - } - } - if (id % 3 == 1) { - if (Item.isWood(this.inventory.get().get(i).getItem()) && this.inventory.get().get(i).getNbItems() >= quantityNeeded) { - secundGood = true; - } - } - if (id % 3 == 2) { - if (Item.isStone(this.inventory.get().get(i).getItem()) && this.inventory.get().get(i).getNbItems() >= quantityNeeded) { - secundGood = true; - } - } - if (id % 3 == 0) { - if (Item.isIron(this.inventory.get().get(i).getItem()) && this.inventory.get().get(i).getNbItems() >= quantityNeeded) { - secundGood = true; - } - } - } - else if (id == 10) { - quantityNeeded = 3; - if (Item.isStone(this.inventory.get().get(i).getItem()) && this.inventory.get().get(i).getNbItems() >= quantityNeeded) { - firstGood = true; - secundGood = true; - } - } else if (id == 11) { - quantityNeeded = 3; - //TODO a changé le bois en stick - if (Item.isWood(this.inventory.get().get(i).getItem()) && this.inventory.get().get(i).getNbItems() >= quantityNeeded) { - firstGood = true; - } - if (Item.isFiber(this.inventory.get().get(i).getItem()) && this.inventory.get().get(i).getNbItems() >= quantityNeeded) - secundGood = true; - } - if (firstGood && secundGood) - return true; - } - return false; - } - - public void createTool(int id) { - int quantityNeeded = 0; - if (id == 1) - inventory.getPlayer().pickup(new Tool(ToolSet.PICKAXE, MaterialSet.IRON)); - else if (id == 3) - inventory.getPlayer().pickup(new Tool(ToolSet.PICKAXE, MaterialSet.WOOD)); - else if (id == 4) - inventory.getPlayer().pickup(new Tool(ToolSet.AXE, MaterialSet.IRON)); - else if (id == 6) - inventory.getPlayer().pickup(new Tool(ToolSet.AXE, MaterialSet.WOOD)); - else if (id == 7) - inventory.getPlayer().pickup(new Tool(ToolSet.SWORD, MaterialSet.IRON)); - else if(id == 9) - inventory.getPlayer().pickup(new Tool(ToolSet.SWORD, MaterialSet.WOOD)); - if (id == 10) - inventory.getPlayer().pickup(new Block(BlockSet.ROCK, null)); - - for (int i = 0; i < this.inventory.nbStacksIntoInventory(); i++) { - if (id <= 9) { - if (id <= 6) { - quantityNeeded = 2; - //TODO a changé le bois en stick - if (Item.isWood(this.inventory.get().get(i).getItem())) { - this.inventory.get().get(i).removeQuantity(quantityNeeded); - quantityNeeded = 3; - } - - } else { - quantityNeeded = 1; - if (Item.isWood(this.inventory.get().get(i).getItem()) && this.inventory.get().get(i).getNbItems() >= quantityNeeded) { - this.inventory.get().get(i).removeQuantity(quantityNeeded); - quantityNeeded = 2; - } - } - if (id % 3 == 0) { - if (Item.isWood(this.inventory.get().get(i).getItem())) { - this.inventory.get().get(i).removeQuantity(quantityNeeded); - } - } - if (id % 3 == 2) { - if (Item.isStone(this.inventory.get().get(i).getItem())) { - this.inventory.get().get(i).removeQuantity(quantityNeeded); - } - } - if (id % 3 == 1) { - if (Item.isIron(this.inventory.get().get(i).getItem())) { - this.inventory.get().get(i).removeQuantity(quantityNeeded); - } - } - } else if (id == 10) { - quantityNeeded = 3; - if (Item.isStone(this.inventory.get().get(i).getItem())) { - this.inventory.get().get(i).removeQuantity(quantityNeeded); - } - } else if (id == 11) { - quantityNeeded = 3; - if (Item.isWood(this.inventory.get().get(i).getItem())) { - this.inventory.get().get(i).removeQuantity(quantityNeeded); - quantityNeeded = 3; - } - if (Item.isFiber(this.inventory.get().get(i).getItem())) - this.inventory.get().get(i).removeQuantity(quantityNeeded); - } - - } - } - public static Block rock(final Environment environment) { @@ -153,14 +31,14 @@ public static Block rock(final Environment environment) return null; } - public static Block pickaxe(final Environment environment, final MaterialSet material) + public static Tool pickaxe(final Environment environment, final MaterialSet material) { Inventory inventory = environment.getPlayer().getInventory(); - - for (int i = 0; i < inventory.get().size(); i++) { - Stack stack = inventory.get().get(i); - - + Ingredient pickaxeIngredients = PickaxeRecipe.WOOD_RECIPE.apply(inventory); + if (!Objects.isNull(pickaxeIngredients)){ + ((Stack)pickaxeIngredients.get()[0].getItem()).removeQuantity(PickaxeRecipe.WOOD_RECIPE.NB_WOODS); + ((Stack)pickaxeIngredients.get()[1].getItem()).removeQuantity(PickaxeRecipe.WOOD_RECIPE.NB_STICKS); + return new Tool(ToolSet.PICKAXE, MaterialSet.IRON); } return null; } diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/Ingredient.java b/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/Ingredient.java new file mode 100644 index 0000000..e0bc76c --- /dev/null +++ b/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/Ingredient.java @@ -0,0 +1,14 @@ +package fr.sae.terraria.modele.entities.player.craft.recipes; + +import fr.sae.terraria.modele.entities.player.inventory.Stack; + + +public class Ingredient +{ + private final Stack[] ingredients; + + + public Ingredient(int nbIngredient) { this.ingredients = new Stack[nbIngredient]; } + + public Stack[] get() { return this.ingredients; } +} diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/PickaxeRecipe.java b/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/PickaxeRecipe.java index ba9128c..e93796d 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/PickaxeRecipe.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/PickaxeRecipe.java @@ -3,7 +3,6 @@ import fr.sae.terraria.modele.entities.items.Item; import fr.sae.terraria.modele.entities.player.inventory.Inventory; import fr.sae.terraria.modele.entities.player.inventory.Stack; -import fr.sae.terraria.modele.entities.tools.MaterialSet; public class PickaxeRecipe @@ -12,19 +11,29 @@ public static final class WOOD_RECIPE { public static final int NB_WOODS = 3; public static final int NB_STICKS = 2; + private static final int NB_INGREDIENTS = 2; - public static boolean apply(final Inventory inventory) + + public static Ingredient apply(final Inventory inventory) { + int i = 0; + Ingredient ingredient = new Ingredient(NB_INGREDIENTS); boolean haveEnoughForPickaxeHead = false; boolean haveEnoughForPickaxeHandler = false; - for (int i = 0; i < inventory.get().size(); i++) { - Stack stack = inventory.get().get(i); - if (Item.isWood(stack.getItem()) && stack.haveEnoughQuantity(NB_WOODS)) + for(Stack stack : inventory.get()){ + if (Item.isWood(stack.getItem()) && stack.haveEnoughQuantity(NB_WOODS) && !haveEnoughForPickaxeHead) { haveEnoughForPickaxeHead = true; - if (Item.isStick(stack.getItem()) && stack.haveEnoughQuantity(NB_STICKS)) + ingredient.get()[0] = stack; + i++; + } + if (Item.isStick(stack.getItem()) && stack.haveEnoughQuantity(NB_STICKS) && !haveEnoughForPickaxeHandler) { haveEnoughForPickaxeHandler = true; + ingredient.get()[1] = stack; + i++; + } } + return (i == ingredient.get().length) ? ingredient : null; } } From eceef3671fc61e0223005848fea3dc999d82b0c6 Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Wed, 15 Jun 2022 19:32:43 +0200 Subject: [PATCH 79/97] Pickaxe iron, stone, wood recipe implemented, Rock recipe get an updated --- .../terraria/controller/MenuController.java | 16 ++++ .../modele/entities/player/craft/Craft.java | 40 ++++++--- .../player/craft/recipes/Ingredient.java | 17 +++- .../player/craft/recipes/IngredientSet.java | 50 +++++++++++ .../player/craft/recipes/PickaxeRecipe.java | 88 ++++++++++++++----- .../player/craft/recipes/RockRecipe.java | 21 +++++ .../modele/entities/tools/MaterialSet.java | 3 + 7 files changed, 199 insertions(+), 36 deletions(-) create mode 100644 src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/IngredientSet.java diff --git a/src/main/java/fr/sae/terraria/controller/MenuController.java b/src/main/java/fr/sae/terraria/controller/MenuController.java index 27901c2..691f40e 100644 --- a/src/main/java/fr/sae/terraria/controller/MenuController.java +++ b/src/main/java/fr/sae/terraria/controller/MenuController.java @@ -8,6 +8,7 @@ import fr.sae.terraria.modele.entities.player.Player; import fr.sae.terraria.modele.entities.player.craft.Craft; import fr.sae.terraria.modele.entities.player.inventory.Stack; +import fr.sae.terraria.modele.entities.tools.MaterialSet; import javafx.animation.Animation; import javafx.animation.KeyFrame; import javafx.animation.Timeline; @@ -80,5 +81,20 @@ public MenuController(final Stage stage) if (ev.getEventType().getName().equalsIgnoreCase("MOUSE_PRESSED")) player.pickup(Craft.rock(this.environment)); }); + + this.recipeWoodPickaxe.addEventFilter(Event.ANY, ev -> { + if (ev.getEventType().getName().equalsIgnoreCase("MOUSE_PRESSED")) + player.pickup(Craft.pickaxe(this.environment, MaterialSet.WOOD)); + }); + + this.recipeStonePickaxe.addEventFilter(Event.ANY, ev -> { + if (ev.getEventType().getName().equalsIgnoreCase("MOUSE_PRESSED")) + player.pickup(Craft.pickaxe(this.environment, MaterialSet.STONE)); + }); + + this.recipeIronPickaxe.addEventFilter(Event.ANY, ev -> { + if (ev.getEventType().getName().equalsIgnoreCase("MOUSE_PRESSED")) + player.pickup(Craft.pickaxe(this.environment, MaterialSet.IRON)); + }); } } diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/craft/Craft.java b/src/main/java/fr/sae/terraria/modele/entities/player/craft/Craft.java index 49bebd8..70ac7b9 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/craft/Craft.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/craft/Craft.java @@ -23,23 +23,41 @@ public static Block rock(final Environment environment) { Inventory inventory = environment.getPlayer().getInventory(); - for (int i = 0; i < inventory.get().size(); i++) { - Stack stack = inventory.get().get(i); - if (Item.isStone(stack.getItem()) && stack.removeQuantity(RockRecipe.NB_STONES)) - return new Block(BlockSet.ROCK, environment); + Ingredient rockIngredients = RockRecipe.apply(inventory); + if (!Objects.isNull(rockIngredients)) { + Stack stack = rockIngredients.get()[0]; + stack.removeQuantity(RockRecipe.NB_STONES); } - return null; + + return (!Objects.isNull(rockIngredients)) ? new Block(BlockSet.ROCK, environment) : null; } public static Tool pickaxe(final Environment environment, final MaterialSet material) { Inventory inventory = environment.getPlayer().getInventory(); - Ingredient pickaxeIngredients = PickaxeRecipe.WOOD_RECIPE.apply(inventory); - if (!Objects.isNull(pickaxeIngredients)){ - ((Stack)pickaxeIngredients.get()[0].getItem()).removeQuantity(PickaxeRecipe.WOOD_RECIPE.NB_WOODS); - ((Stack)pickaxeIngredients.get()[1].getItem()).removeQuantity(PickaxeRecipe.WOOD_RECIPE.NB_STICKS); - return new Tool(ToolSet.PICKAXE, MaterialSet.IRON); + + Ingredient pickaxeIngredients = null; + if (MaterialSet.isWood(material)) + pickaxeIngredients = PickaxeRecipe.WOOD_RECIPE.apply(inventory); + else if (MaterialSet.isStone(material)) + pickaxeIngredients = PickaxeRecipe.STONE_RECIPE.apply(inventory); + else if (MaterialSet.isIron(material)) + pickaxeIngredients = PickaxeRecipe.IRON_RECIPE.apply(inventory); + + if (!Objects.isNull(pickaxeIngredients)) for (int i = 0; i < pickaxeIngredients.get().length; i++) { + Stack stack = (Stack) pickaxeIngredients.get()[i].getItem(); + + if (Item.isStick(stack.getItem())) + stack.removeQuantity(PickaxeRecipe.NB_STICKS); + + if (MaterialSet.isWood(material) && Item.isWood(stack.getItem())) + stack.removeQuantity(PickaxeRecipe.WOOD_RECIPE.NB_WOODS); + else if (MaterialSet.isStone(material) && Item.isStone(stack.getItem())) + stack.removeQuantity(PickaxeRecipe.STONE_RECIPE.NB_STONES); + else if (MaterialSet.isIron(material) && Item.isIron(stack.getItem())) + stack.removeQuantity(PickaxeRecipe.IRON_RECIPE.NB_IRONS); } - return null; + + return (!Objects.isNull(pickaxeIngredients)) ? new Tool(ToolSet.PICKAXE, material) : null; } } diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/Ingredient.java b/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/Ingredient.java index e0bc76c..6cbe7f3 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/Ingredient.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/Ingredient.java @@ -2,13 +2,28 @@ import fr.sae.terraria.modele.entities.player.inventory.Stack; +import java.util.Objects; + public class Ingredient { private final Stack[] ingredients; - public Ingredient(int nbIngredient) { this.ingredients = new Stack[nbIngredient]; } + public Ingredient(final int nbIngredient) { this.ingredients = new Stack[nbIngredient]; } + + public int nbStacks() + { + Stack stack; + int i = 0; + do { + stack = ingredients[i]; + i++; + } while (i < ingredients.length && !Objects.isNull(stack)); + + return i; + } + public Stack[] get() { return this.ingredients; } } diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/IngredientSet.java b/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/IngredientSet.java new file mode 100644 index 0000000..f2852ab --- /dev/null +++ b/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/IngredientSet.java @@ -0,0 +1,50 @@ +package fr.sae.terraria.modele.entities.player.craft.recipes; + +import fr.sae.terraria.modele.entities.items.Item; +import fr.sae.terraria.modele.entities.player.inventory.Stack; + + +public class IngredientSet +{ + + + + public static boolean sticks(final Ingredient ingredient, final Stack stack, final int nbSticks) + { + if (Item.isStick(stack.getItem()) && stack.haveEnoughQuantity(nbSticks)) { + ingredient.get()[ingredient.nbStacks()] = stack; + return true; + } + return false; + } + + public static boolean woods(final Ingredient ingredient, final Stack stack, final int nbWood) + { + if (Item.isWood(stack.getItem()) && stack.haveEnoughQuantity(nbWood)) { + ingredient.get()[ingredient.nbStacks()] = stack; + return true; + } + return false; + } + + public static boolean stones(final Ingredient ingredient, final Stack stack, final int nbStones) + { + if (Item.isStone(stack.getItem()) && stack.haveEnoughQuantity(nbStones)) { + if (ingredient.get().length == 1) + ingredient.get()[0] = stack; + else ingredient.get()[ingredient.nbStacks()] = stack; + + return true; + } + return false; + } + + public static boolean irons(final Ingredient ingredient, final Stack stack, final int nbStones) + { + if (Item.isIron(stack.getItem()) && stack.haveEnoughQuantity(nbStones)) { + ingredient.get()[ingredient.nbStacks()] = stack; + return true; + } + return false; + } +} diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/PickaxeRecipe.java b/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/PickaxeRecipe.java index e93796d..4c78808 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/PickaxeRecipe.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/PickaxeRecipe.java @@ -1,54 +1,94 @@ package fr.sae.terraria.modele.entities.player.craft.recipes; -import fr.sae.terraria.modele.entities.items.Item; import fr.sae.terraria.modele.entities.player.inventory.Inventory; import fr.sae.terraria.modele.entities.player.inventory.Stack; public class PickaxeRecipe { + private static final int NB_INGREDIENTS = 2; + + public static final int NB_STICKS = 2; + + public static final class WOOD_RECIPE { public static final int NB_WOODS = 3; - public static final int NB_STICKS = 2; - private static final int NB_INGREDIENTS = 2; public static Ingredient apply(final Inventory inventory) { - int i = 0; - Ingredient ingredient = new Ingredient(NB_INGREDIENTS); - boolean haveEnoughForPickaxeHead = false; + Ingredient ingredient = new Ingredient(PickaxeRecipe.NB_INGREDIENTS); boolean haveEnoughForPickaxeHandler = false; + boolean haveEnoughForPickaxeHead = false; + + int i = 0; + do { + Stack stack = inventory.get().get(i); + + if (!haveEnoughForPickaxeHead) + haveEnoughForPickaxeHead = IngredientSet.woods(ingredient, stack, NB_WOODS); + if (!haveEnoughForPickaxeHandler) + haveEnoughForPickaxeHandler = IngredientSet.sticks(ingredient, stack, NB_STICKS); + + i++; + } while (i < inventory.get().size() && (!haveEnoughForPickaxeHead || !haveEnoughForPickaxeHandler)); - for(Stack stack : inventory.get()){ - if (Item.isWood(stack.getItem()) && stack.haveEnoughQuantity(NB_WOODS) && !haveEnoughForPickaxeHead) { - haveEnoughForPickaxeHead = true; - ingredient.get()[0] = stack; - i++; - } - if (Item.isStick(stack.getItem()) && stack.haveEnoughQuantity(NB_STICKS) && !haveEnoughForPickaxeHandler) { - haveEnoughForPickaxeHandler = true; - ingredient.get()[1] = stack; - i++; - } - } return (i == ingredient.get().length) ? ingredient : null; } } - public static final class STONE + public static final class STONE_RECIPE { - public static final int NB_STONE = 3; - public static final int NB_STICK = 2; + public static final int NB_STONES = 3; + + + public static Ingredient apply(final Inventory inventory) + { + Ingredient ingredient = new Ingredient(PickaxeRecipe.NB_INGREDIENTS); + boolean haveEnoughForPickaxeHandler = false; + boolean haveEnoughForPickaxeHead = false; + + int i = 0; + do { + Stack stack = inventory.get().get(i); + + if (!haveEnoughForPickaxeHead) + haveEnoughForPickaxeHead = IngredientSet.stones(ingredient, stack, NB_STONES); + if (!haveEnoughForPickaxeHandler) + haveEnoughForPickaxeHandler = IngredientSet.sticks(ingredient, stack, NB_STICKS); + + i++; + } while (i < inventory.get().size() && (!haveEnoughForPickaxeHead || !haveEnoughForPickaxeHandler)); + + return (i == ingredient.get().length) ? ingredient : null; + } } - public static final class IRON + public static final class IRON_RECIPE { public static final int NB_IRONS = 3; - public static final int NB_STICKS = 2; - } + public static Ingredient apply(final Inventory inventory) + { + Ingredient ingredient = new Ingredient(PickaxeRecipe.NB_INGREDIENTS); + boolean haveEnoughForPickaxeHandler = false; + boolean haveEnoughForPickaxeHead = false; + + int i = 0; + do { + Stack stack = inventory.get().get(i); + + if (!haveEnoughForPickaxeHead) + haveEnoughForPickaxeHead = IngredientSet.irons(ingredient, stack, NB_IRONS); + if (!haveEnoughForPickaxeHandler) + haveEnoughForPickaxeHandler = IngredientSet.sticks(ingredient, stack, NB_STICKS); + i++; + } while (i < inventory.get().size() && (!haveEnoughForPickaxeHead || !haveEnoughForPickaxeHandler)); + + return (i == ingredient.get().length) ? ingredient : null; + } + } } diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/RockRecipe.java b/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/RockRecipe.java index d880339..0bc2ba9 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/RockRecipe.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/RockRecipe.java @@ -1,7 +1,28 @@ package fr.sae.terraria.modele.entities.player.craft.recipes; +import fr.sae.terraria.modele.entities.player.inventory.Inventory; +import fr.sae.terraria.modele.entities.player.inventory.Stack; + public class RockRecipe { + private static final int NB_INGREDIENTS = 1; public static final int NB_STONES = 4; + + + public static Ingredient apply(final Inventory inventory) + { + Ingredient ingredient = new Ingredient(RockRecipe.NB_INGREDIENTS); + boolean haveEnoughStone ; + + int i = 0; + do { + Stack stack = inventory.get().get(i); + haveEnoughStone = IngredientSet.stones(ingredient, stack, NB_STONES); + + i++; + } while (i < inventory.get().size() && !haveEnoughStone); + + return haveEnoughStone ? ingredient : null; + } } diff --git a/src/main/java/fr/sae/terraria/modele/entities/tools/MaterialSet.java b/src/main/java/fr/sae/terraria/modele/entities/tools/MaterialSet.java index 93c4992..8a155f3 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/tools/MaterialSet.java +++ b/src/main/java/fr/sae/terraria/modele/entities/tools/MaterialSet.java @@ -4,8 +4,11 @@ public enum MaterialSet { WOOD, + STONE, IRON; public static boolean isWood(MaterialSet material) { return material == MaterialSet.IRON; } + public static boolean isStone(MaterialSet material) { return material == MaterialSet.STONE; } + public static boolean isIron(MaterialSet material) { return material == MaterialSet.IRON; } } From 4ce19ff555c6d5dee72482f1b6c7d2c506c58840 Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Wed, 15 Jun 2022 19:52:14 +0200 Subject: [PATCH 80/97] Correction erreurs code dans les crafts --- .../modele/entities/player/craft/Craft.java | 12 ++++++------ .../player/craft/recipes/PickaxeRecipe.java | 13 ++++++------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/craft/Craft.java b/src/main/java/fr/sae/terraria/modele/entities/player/craft/Craft.java index 70ac7b9..20995e3 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/craft/Craft.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/craft/Craft.java @@ -38,11 +38,11 @@ public static Tool pickaxe(final Environment environment, final MaterialSet mate Ingredient pickaxeIngredients = null; if (MaterialSet.isWood(material)) - pickaxeIngredients = PickaxeRecipe.WOOD_RECIPE.apply(inventory); + pickaxeIngredients = PickaxeRecipe.WoodRecipe.apply(inventory); else if (MaterialSet.isStone(material)) - pickaxeIngredients = PickaxeRecipe.STONE_RECIPE.apply(inventory); + pickaxeIngredients = PickaxeRecipe.StoneRecipe.apply(inventory); else if (MaterialSet.isIron(material)) - pickaxeIngredients = PickaxeRecipe.IRON_RECIPE.apply(inventory); + pickaxeIngredients = PickaxeRecipe.IronRecipe.apply(inventory); if (!Objects.isNull(pickaxeIngredients)) for (int i = 0; i < pickaxeIngredients.get().length; i++) { Stack stack = (Stack) pickaxeIngredients.get()[i].getItem(); @@ -51,11 +51,11 @@ else if (MaterialSet.isIron(material)) stack.removeQuantity(PickaxeRecipe.NB_STICKS); if (MaterialSet.isWood(material) && Item.isWood(stack.getItem())) - stack.removeQuantity(PickaxeRecipe.WOOD_RECIPE.NB_WOODS); + stack.removeQuantity(PickaxeRecipe.WoodRecipe.NB_WOODS); else if (MaterialSet.isStone(material) && Item.isStone(stack.getItem())) - stack.removeQuantity(PickaxeRecipe.STONE_RECIPE.NB_STONES); + stack.removeQuantity(PickaxeRecipe.StoneRecipe.NB_STONES); else if (MaterialSet.isIron(material) && Item.isIron(stack.getItem())) - stack.removeQuantity(PickaxeRecipe.IRON_RECIPE.NB_IRONS); + stack.removeQuantity(PickaxeRecipe.IronRecipe.NB_IRONS); } return (!Objects.isNull(pickaxeIngredients)) ? new Tool(ToolSet.PICKAXE, material) : null; diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/PickaxeRecipe.java b/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/PickaxeRecipe.java index 4c78808..06eb144 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/PickaxeRecipe.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/PickaxeRecipe.java @@ -7,11 +7,10 @@ public class PickaxeRecipe { private static final int NB_INGREDIENTS = 2; - public static final int NB_STICKS = 2; - public static final class WOOD_RECIPE + public static final class WoodRecipe { public static final int NB_WOODS = 3; @@ -34,11 +33,11 @@ public static Ingredient apply(final Inventory inventory) i++; } while (i < inventory.get().size() && (!haveEnoughForPickaxeHead || !haveEnoughForPickaxeHandler)); - return (i == ingredient.get().length) ? ingredient : null; + return (haveEnoughForPickaxeHead && haveEnoughForPickaxeHandler) ? ingredient : null; } } - public static final class STONE_RECIPE + public static final class StoneRecipe { public static final int NB_STONES = 3; @@ -61,11 +60,11 @@ public static Ingredient apply(final Inventory inventory) i++; } while (i < inventory.get().size() && (!haveEnoughForPickaxeHead || !haveEnoughForPickaxeHandler)); - return (i == ingredient.get().length) ? ingredient : null; + return (haveEnoughForPickaxeHead && haveEnoughForPickaxeHandler) ? ingredient : null; } } - public static final class IRON_RECIPE + public static final class IronRecipe { public static final int NB_IRONS = 3; @@ -88,7 +87,7 @@ public static Ingredient apply(final Inventory inventory) i++; } while (i < inventory.get().size() && (!haveEnoughForPickaxeHead || !haveEnoughForPickaxeHandler)); - return (i == ingredient.get().length) ? ingredient : null; + return (haveEnoughForPickaxeHead && haveEnoughForPickaxeHandler) ? ingredient : null; } } } From 84ae506d19b57c05804e6a215cfb1e3c9e1a40e6 Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Wed, 15 Jun 2022 20:04:40 +0200 Subject: [PATCH 81/97] Opptimisation IngredientSet --- .../player/craft/recipes/IngredientSet.java | 39 ++++++++----------- .../player/craft/recipes/RockRecipe.java | 2 +- 2 files changed, 17 insertions(+), 24 deletions(-) diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/IngredientSet.java b/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/IngredientSet.java index f2852ab..14d565a 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/IngredientSet.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/IngredientSet.java @@ -8,43 +8,36 @@ public class IngredientSet { + private static boolean putStackIntoIngredientsList(final Ingredient ingredient, final Stack stack) + { + if (ingredient.get().length == 1) + ingredient.get()[0] = stack; + else ingredient.get()[ingredient.nbStacks()] = stack; + + return true; + } public static boolean sticks(final Ingredient ingredient, final Stack stack, final int nbSticks) { - if (Item.isStick(stack.getItem()) && stack.haveEnoughQuantity(nbSticks)) { - ingredient.get()[ingredient.nbStacks()] = stack; - return true; - } - return false; + boolean haveEnoughSticks = Item.isStick(stack.getItem()) && stack.haveEnoughQuantity(nbSticks); + return haveEnoughSticks && IngredientSet.putStackIntoIngredientsList(ingredient, stack); } public static boolean woods(final Ingredient ingredient, final Stack stack, final int nbWood) { - if (Item.isWood(stack.getItem()) && stack.haveEnoughQuantity(nbWood)) { - ingredient.get()[ingredient.nbStacks()] = stack; - return true; - } - return false; + boolean haveEnoughWoods = Item.isWood(stack.getItem()) && stack.haveEnoughQuantity(nbWood); + return haveEnoughWoods && IngredientSet.putStackIntoIngredientsList(ingredient, stack); } public static boolean stones(final Ingredient ingredient, final Stack stack, final int nbStones) { - if (Item.isStone(stack.getItem()) && stack.haveEnoughQuantity(nbStones)) { - if (ingredient.get().length == 1) - ingredient.get()[0] = stack; - else ingredient.get()[ingredient.nbStacks()] = stack; - - return true; - } - return false; + boolean haveEnoughStones = Item.isStone(stack.getItem()) && stack.haveEnoughQuantity(nbStones); + return haveEnoughStones && IngredientSet.putStackIntoIngredientsList(ingredient, stack); } public static boolean irons(final Ingredient ingredient, final Stack stack, final int nbStones) { - if (Item.isIron(stack.getItem()) && stack.haveEnoughQuantity(nbStones)) { - ingredient.get()[ingredient.nbStacks()] = stack; - return true; - } - return false; + boolean haveEnoughIrons = Item.isIron(stack.getItem()) && stack.haveEnoughQuantity(nbStones); + return haveEnoughIrons && IngredientSet.putStackIntoIngredientsList(ingredient, stack); } } diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/RockRecipe.java b/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/RockRecipe.java index 0bc2ba9..27178a3 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/RockRecipe.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/RockRecipe.java @@ -18,7 +18,7 @@ public static Ingredient apply(final Inventory inventory) int i = 0; do { Stack stack = inventory.get().get(i); - haveEnoughStone = IngredientSet.stones(ingredient, stack, NB_STONES); + haveEnoughStone = IngredientSet.stones(ingredient, stack, RockRecipe.NB_STONES); i++; } while (i < inventory.get().size() && !haveEnoughStone); From 04615a29ab7ac2c893845a4e15b59641c5e09597 Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Wed, 15 Jun 2022 20:41:46 +0200 Subject: [PATCH 82/97] Tree can drop stick, change hit sound for tree, add stick --- .../terraria/modele/entities/blocks/Block.java | 17 +++++++++++++---- .../terraria/modele/entities/blocks/Tree.java | 12 +----------- .../terraria/modele/entities/items/Item.java | 4 ++-- .../entities/player/inventory/Stack.java | 2 ++ .../fr/sae/terraria/vue/hud/InventoryView.java | 5 ++++- .../resources/fr/sae/terraria/loots/stick.png | Bin 0 -> 6110 bytes 6 files changed, 22 insertions(+), 18 deletions(-) create mode 100644 src/main/resources/fr/sae/terraria/loots/stick.png diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java index 2cdedf1..1f74001 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java +++ b/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java @@ -86,19 +86,28 @@ private void loots() } else if (Block.isTorch(this)) { player.pickup(new Block(BlockSet.TORCH, this.environment)); } else if (Block.isTree(this)) { - player.pickup(new Block(BlockSet.TREE, this.environment)); + player.pickup(Item.WOOD); + for (int i = 0; i < Tree.STICKS_DROP; i++) + player.pickup(Item.STICK); } } - @Override public void updates() { } - - @Override public void breaks() + private void playSound() { if (Block.isRock(this)) Environment.playSound("sound/brick" + ((int) (Math.random()*2)+1) + ".wav", false); else if (Block.isTallGrass(this)) Environment.playSound("sound/cut.wav", false); + else if (Block.isTree(this)) + Environment.playSound("sound/treeHit.wav", false); else Environment.playSound("sound/grassyStep.wav", false); + } + + @Override public void updates() { } + + @Override public void breaks() + { + this.playSound(); this.breakAnimation(); if (this.getPv() <= 0) { diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/Tree.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/Tree.java index 5271002..f48365b 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/Tree.java +++ b/src/main/java/fr/sae/terraria/modele/entities/blocks/Tree.java @@ -2,13 +2,13 @@ import fr.sae.terraria.modele.Environment; import fr.sae.terraria.modele.entities.entity.SpawnableObjectType; -import fr.sae.terraria.modele.entities.items.Item; public class Tree extends Block implements SpawnableObjectType { public static final double TREE_SPAWN_RATE = .2; public static final double TREE_CLUSTER = 10; + public static final int STICKS_DROP = 3; private final Environment environment; @@ -21,16 +21,6 @@ public Tree(final Environment environment, int x, int y) public Tree(final Environment environment) { this(environment, 0, 0); } - @Override public void updates() { /* TODO document why this method is empty */ } - - @Override public void breaks() - { - // Environment.playSound("sound/grassyStep.wav", false); - this.environment.getPlayer().pickup(Item.WOOD); - this.environment.getEntities().remove(this); - this.environment.getTrees().remove(this); - } - @Override public void spawn(int x, int y) { this.setX(x); diff --git a/src/main/java/fr/sae/terraria/modele/entities/items/Item.java b/src/main/java/fr/sae/terraria/modele/entities/items/Item.java index f4d9e69..3ef05a0 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/items/Item.java +++ b/src/main/java/fr/sae/terraria/modele/entities/items/Item.java @@ -11,7 +11,7 @@ public enum Item implements StowableObjectType SILEX, STONE, WOOD, - STICKS; + STICK; public static boolean isCoal(StowableObjectType obj) { return obj == Item.COAL; } @@ -20,5 +20,5 @@ public enum Item implements StowableObjectType public static boolean isStone(StowableObjectType obj) { return obj == Item.STONE; } public static boolean isSilex(StowableObjectType obj) { return obj == Item.SILEX; } public static boolean isWood(StowableObjectType obj) { return obj == Item.WOOD; } - public static boolean isStick(StowableObjectType obj) { return obj == Item.STICKS; } + public static boolean isStick(StowableObjectType obj) { return obj == Item.STICK; } } diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java index 5819999..00b5916 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java @@ -81,6 +81,8 @@ public boolean isSameItem(StowableObjectType obj) return true; if (Item.isWood(obj) && Item.isWood(this.item)) return true; + if (Item.isStick(obj) && Item.isStick(this.item)) + return true; } return false; diff --git a/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java b/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java index 8fbd19f..8145875 100644 --- a/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java +++ b/src/main/java/fr/sae/terraria/vue/hud/InventoryView.java @@ -73,7 +73,8 @@ public InventoryView(Inventory inventory, Pane display, double scaleMultiplicato /** * Applique une bordure de couleur noire autour de la barre d'inventaire */ - private Rectangle setFrameInventoryBar() { + private Rectangle setFrameInventoryBar() + { frameInventoryBar.setWidth(inventoryBarImg.getWidth() + (2 * scaleMultiplicatorWidth)); frameInventoryBar.setHeight(inventoryBarImg.getHeight() + (2 * scaleMultiplicatorHeight)); frameInventoryBar.setX(inventoryBarImgView.getX() - scaleMultiplicatorWidth); @@ -140,6 +141,8 @@ else if (Item.isSilex(item)) view.setImage(View.loadAnImage("loots/silex.png", itemInventoryWidth, itemInventoryHeight)); else if (Item.isWood(item)) view.setImage(View.loadAnImage("loots/wood.png", itemInventoryWidth, itemInventoryHeight)); + else if (Item.isStick(item)) + view.setImage(View.loadAnImage("loots/stick.png", itemInventoryWidth, itemInventoryHeight)); } // Actualise le nombre d'item à l'écran diff --git a/src/main/resources/fr/sae/terraria/loots/stick.png b/src/main/resources/fr/sae/terraria/loots/stick.png new file mode 100644 index 0000000000000000000000000000000000000000..926af2b5f43c5e5541aaef4035a4f92fd719e7e0 GIT binary patch literal 6110 zcmeHKc{r5o`yaB@gpe(wX(Ul&cC$p1u^UTN5+}1VjKRz>sANgm9U+w#S<*=d9ZR-s zp^!+b;~<jANkVm5<NJ>G>-YVq>-v5FYp&~^_kEw|bAO)u{@nNTyw4M3Z)+|MRt1AV zAZber(q7;$E4)@q0RNlbEmJ@siR=(3XZ~J_0OH5>WwO`|2tU}50bvBOm>^KlKe^6_ z&TQN+v*@8%EOr7E^K#O_BM{Mc8I;NpRE={64)vs2PNyndF)z(nUU<u0uGcOiDW`bq z5sn<C#%MWVx(DnG1=CY~Z<>q})_t77%62vdO&@#Aes?)^dQ)Il?EZO{<{SOaT{5Yj z3$ODM#v#w-#W5#+oY<N&f-rVu$m8jXYl}DbWXupW$nQh@YfAHQJ;Qcy9o%mx`^lU_ zocsI51GebolEhubg!rBQ;9FJHy>*6D*}78G4{QtV!b#q7sspz3VXgV5Zx{MKN~lFT zi!Jx&J{;|RyY065%d<;)DcLUDkB%Q6dTI5(WqzURNoN56q!N~SmYA_ONjEPlSlWC% z`>}CJydhe4FML$DT;aw<X2WDZ&h;W#ysmUxSEg0mNO0i4vdEKT5t(v()*U6LX{C0C ztNZsU{|RvoDiUo8bx+#(+h3i8ve}6Ttk@JuiWh`!mZ5z7NJXt%(UU-NXd(QNae-{v z&CShboB^bCbSEnNDs6CdezB(<C2P~$+G`4y>YY%6JxsEwlk{wEJTdyg_%ubWj)W%~ zt56}J?m@NG7VFh}#7uNS*JTa;q@-8dTTyo3lRbwndRUayEPn-!%?ab23Kc^`k_Y`o z+28|ViZs#VTXgYG&-uvQ)RZk`t;hEXBdNSI)sfUR_03wAN^)t?eFw9*w(DMZDLG@W zVvJ66&GFR9-GAZWO<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<$)=Jc66@q4_}~YwuR$PDNlTKk6TU6&w6&+BvBJsPiln~R zWK}g5d;7z^@ez>J*t1c&y3v)BQQMWF+qz7_TC20VP3x7x5%$qTS><x1qhX%;d)#^w z*7`VtMJ`*cJ(%j^@JBE?F~e+qhSJCVcP^Y;UR*xs0P=x6-xqr>9-+HUH@e5d%{loa zG@hRC4JwJufd@}lcBEWcpLk+-Yw7;qpV=N_7D(n)P;2EiHx+ei&FX85sY+=yy0t=g zxxd|-;=Cxi!HX{$-_-$~`E9txhUIGRzrYBuKViN7UP5`>qg1nEJUCNhm~!jRa7pJg zW^(mq%~v{!Z{PX9y1#MEv~raS=&<ocn-ORA{WdlVW5icQ6_1DS>?FtJB3t8-_IFPc zp4p|(E;`W8Ptt98+n@i%O%_>7w6|0keq|e1hTRJ4xQq2xlP-`RIp+ekQhW`|5oBly zlJKW%##@>h7Rw@+NnUuQ*P0SB<McWV1+#DXVX)DvJHeGRf3F?tE>RF4d&>o>T<YZC zKqF!IMlzoj;*X-+#uxj=Wg;LZ2Nq|g%KfzO&h|q8uuRa~!)t_e(<jSEJ3R8CqNuJH zt$F#Eb`;`e#m9OnEw2c6w!WoX%0z>Ct!Y<lO^Go25m|q)Yq!Fxt?*rPW`X9Zu6>NQ zGZKfE-W(iZi4m#>wjKiA2@CfSU$O?dN5*tVv1>Y%EWEqn*4S!ysa6e)u!t;8ZAk@t H+#~)2eA=mZ literal 0 HcmV?d00001 From c25a2232107fc99ff1abf67131d55b09ec764a6a Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Wed, 15 Jun 2022 20:46:41 +0200 Subject: [PATCH 83/97] change hit sound for tree --- .../resources/fr/sae/terraria/sound/treeHit.wav | Bin 0 -> 99618 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/main/resources/fr/sae/terraria/sound/treeHit.wav diff --git a/src/main/resources/fr/sae/terraria/sound/treeHit.wav b/src/main/resources/fr/sae/terraria/sound/treeHit.wav new file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}{N^#g^_VXzYec<HycZk3eVcuVTl08N)+^li&-B>Z zS{~caL?sB1zW+b_S@r+16*j)DpS9l)QF%EK8^e$Gwk$Ek6_K~JG0EkbuPm|66_vLY zS{UJ))s8{N=(<j;aNl)SP4_!_!hO?XvAo~cdB-DdFRq>16gX~qk1_8((>(9iypCzH zm`3yH;bFSkAh${$-;~Gk$1%;iEax^FCz}+EBc69WaXd4h<5z6VaojWg;Bm@h%O5&6 zS%+hp>5g62<Cx^uu|>J`(7CvyiD}mV^|5PDFsrV`y;b8{uJ5pi(MsvpZ-5jdQM-<W z9^F-$Z~9#t=iH8Qj$g+rws2?V=?50p^>q%!=2zjia&jOh`8b!Zs2GFqUjh!VSXvG^ zuTf7@+WcX@6N>|}x$KGctHNJXS`O?*7i;?uQ8_sf$Gjt?%FBaT{~vBECkHA*mloD} z{BR&@?^HJwQf1_UBVUNh&Vi_plYUMiRW2TscAgmK3po&SAml*Efsg|s2SN^n90)lO zav<bD$bpapAqPSZgd7Mt5ON^oK*)iR10e@O4ul*CIS_In<Uq)QkOLtHLJou+2ssdP zAml*Efsg|s2SN^n90)lOav<bD$bpapAqPSZgd7Mt5ON^oK*)iR10e@O4ul*CIS_In z<Uq)QiswKW^Iy4Q{ttfMzFh|&hx?U_9~IxbgjWbT5OUyH<v@?_{rabJbKQG&>D|58 zg+2W?_kf{ehoyBII%-5lo3z}aHxA2-48N{z+FR!8+&1{+N!)q;yZ3KHLJqxUN%4Tl z(8$=xut-{@6MLf~BUp&vk8J01bR+3`<m^9i;K2VY@UzJ1$WJ*jG%_+WByw%!Um{~D xHk$J##clZ>_E}#Q$Ox|R^#a4md>zGa3<`K32WrncOy*I+RfYvwqqh@@{4YQ98m0gM literal 0 HcmV?d00001 From 7cc5489422813e05275bd9d113a9a01ef4bdc970 Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Wed, 15 Jun 2022 21:06:38 +0200 Subject: [PATCH 84/97] fix display lexique --- .../terraria/controller/MenuController.java | 5 - .../fr/sae/terraria/emojies/confus.png | Bin 0 -> 193 bytes .../resources/fr/sae/terraria/vue/menu.fxml | 141 ++++++------------ 3 files changed, 45 insertions(+), 101 deletions(-) create mode 100644 src/main/resources/fr/sae/terraria/emojies/confus.png diff --git a/src/main/java/fr/sae/terraria/controller/MenuController.java b/src/main/java/fr/sae/terraria/controller/MenuController.java index 691f40e..7278dfa 100644 --- a/src/main/java/fr/sae/terraria/controller/MenuController.java +++ b/src/main/java/fr/sae/terraria/controller/MenuController.java @@ -2,12 +2,8 @@ import fr.sae.terraria.Terraria; import fr.sae.terraria.modele.Environment; -import fr.sae.terraria.modele.entities.blocks.Block; -import fr.sae.terraria.modele.entities.blocks.BlockSet; -import fr.sae.terraria.modele.entities.items.Item; import fr.sae.terraria.modele.entities.player.Player; import fr.sae.terraria.modele.entities.player.craft.Craft; -import fr.sae.terraria.modele.entities.player.inventory.Stack; import fr.sae.terraria.modele.entities.tools.MaterialSet; import javafx.animation.Animation; import javafx.animation.KeyFrame; @@ -23,7 +19,6 @@ import java.net.URL; import java.util.Objects; import java.util.ResourceBundle; -import java.util.concurrent.locks.ReentrantLock; public class MenuController implements Initializable diff --git a/src/main/resources/fr/sae/terraria/emojies/confus.png b/src/main/resources/fr/sae/terraria/emojies/confus.png new file mode 100644 index 0000000000000000000000000000000000000000..9eb95a33bdc74b421ccec3b5f753d02d0736845d GIT binary patch literal 193 zcmeAS@N?(olHy`uVBq!ia0vp^oFL4>1|%O$WD@{VjKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCf`#@Q5sCVBk9f!i-b3`J{n@VV*9IAsWHSfB0E=92C@#ur3NXu(<sG0h0(p zkAsU_%Mut<6vXQ})=c1xWb_b_Y&hch$tS>$%OSjH5y$MQ3Jl>amw1gCV-2~d9DAiV iLn3gWveFz035L#oW3!*z*#m$!FnGH9xvX<aXaWF3YBZGq literal 0 HcmV?d00001 diff --git a/src/main/resources/fr/sae/terraria/vue/menu.fxml b/src/main/resources/fr/sae/terraria/vue/menu.fxml index 4e59eb9..38fd511 100644 --- a/src/main/resources/fr/sae/terraria/vue/menu.fxml +++ b/src/main/resources/fr/sae/terraria/vue/menu.fxml @@ -1,150 +1,108 @@ <?xml version="1.0" encoding="UTF-8"?> - -<?import javafx.scene.control.*?> -<?import javafx.scene.layout.*?> -<?import javafx.scene.text.*?> <?import java.net.URL?> -<BorderPane fx:id="root" - maxHeight="-Infinity" maxWidth="-Infinity" +<?import javafx.scene.control.ScrollPane?> +<?import javafx.scene.control.Separator?> +<?import javafx.scene.control.SplitPane?> +<?import javafx.scene.layout.BorderPane?> +<?import javafx.scene.layout.HBox?> +<?import javafx.scene.layout.Pane?> +<?import javafx.scene.text.Font?> +<?import javafx.scene.text.Text?> + +<BorderPane fx:id="root" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="720" prefWidth="1280" xmlns="http://javafx.com/javafx/11" xmlns:fx="http://javafx.com/fxml/1"> <stylesheets> - <URL value="@./menu.css" /> + <URL value="@./menu.css"/> </stylesheets> <top> - <HBox id="textArea" - fx:id="HBoxText" - prefHeight="25.0" prefWidth="1280" - BorderPane.alignment="CENTER"> - <Text id="text" - text="Groupe: BOUCHE Antoine, CHRZASZCZ Naulan, NARCISO Tiago"/> + <HBox id="textArea" fx:id="HBoxText" prefHeight="25.0" prefWidth="1280" BorderPane.alignment="CENTER"> + <Text id="text" text="Groupe: BOUCHE Antoine, CHRZASZCZ Naulan, NARCISO Tiago"/> </HBox> </top> <center> - <SplitPane dividerPositions="0.5" - prefHeight="160.0" - prefWidth="200.0" - BorderPane.alignment="CENTER"> - <BorderPane prefHeight="200.0" - prefWidth="640.0"> + <SplitPane dividerPositions="0.5" prefHeight="160.0" prefWidth="200.0" BorderPane.alignment="CENTER"> + <BorderPane prefHeight="200.0" prefWidth="640.0"> <top> - <HBox fx:id="HBoxTitle" - prefHeight="25.0" - prefWidth="640.0" - BorderPane.alignment="CENTER"> - <Text fx:id="TextHBoxTitle" - strokeType="OUTSIDE" - strokeWidth="0.0" - text="Lexique" - textAlignment="CENTER" + <HBox fx:id="HBoxTitle" prefHeight="25.0" prefWidth="640.0" BorderPane.alignment="CENTER"> + <Text fx:id="TextHBoxTitle" stroke="WHITE" strokeType="OUTSIDE" strokeWidth="0.0" + text="Lexique des constructions" textAlignment="CENTER" underline="true" wrappingWidth="632.470703125"> <font> - <Font size="16.0"/> + <Font size="20.0"/> </font> </Text> </HBox> </top> <center> - <ScrollPane prefHeight="200.0" - prefWidth="640.0" - BorderPane.alignment="CENTER"> - <Pane fx:id="displayLexique" - prefHeight="900.0" - prefWidth="640.0"> - <HBox id="notAvailable" - fx:id="recipeWoodPickaxe" - prefHeight="50.0" + <ScrollPane prefHeight="200.0" prefWidth="640.0" BorderPane.alignment="CENTER"> + <Pane fx:id="displayLexique" prefHeight="900.0" prefWidth="640.0"> + <HBox id="notAvailable" fx:id="recipeWoodPickaxe" layoutY="240.0" prefHeight="50.0" prefWidth="625.0"> <Text text="Pioche en bois" textAlignment="CENTER"/> <Text text="2 Bâtons | 3 bois" textAlignment="CENTER"/> </HBox> <Separator layoutY="150.0" prefHeight="5.0" prefWidth="625.0"/> - <HBox id="notAvailable" - fx:id="recipeStonePickaxe" - prefHeight="50.0" + <HBox id="notAvailable" fx:id="recipeStonePickaxe" layoutY="314.0" prefHeight="50.0" prefWidth="625.0"> <Text text="Pioche en pierre" textAlignment="CENTER"/> <Text text="2 Bâtons | 3 pierre" textAlignment="CENTER"/> </HBox> <Separator layoutY="75.0" prefHeight="5.0" prefWidth="625.0"/> - <HBox id="notAvailable" - fx:id="recipeIronPickaxe" - prefHeight="50.0" + <HBox id="notAvailable" fx:id="recipeIronPickaxe" layoutY="387.0" prefHeight="50.0" prefWidth="625.0"> <Text text="Pioche en fer" textAlignment="CENTER"/> <Text text="2 Bâtons | 3 Minerais de fer" textAlignment="CENTER"/> </HBox> <Separator layoutY="225.0" prefHeight="5.0" prefWidth="625.0"/> - <HBox id="notAvailable" - fx:id="lexiconAxe1" - layoutY="55.0" - prefHeight="50.0" + <HBox id="notAvailable" fx:id="recipeWoodAxe" layoutY="14.0" prefHeight="50.0" prefWidth="625.0"> - <Text text="Hache en fer" textAlignment="CENTER"/> - <Text text="2 Bâtons | 3 Minerais de fer" textAlignment="CENTER"/> + <Text text="Hache en bois" textAlignment="CENTER"/> + <Text text="2 Bâtons | 3 bois" textAlignment="CENTER"/> </HBox> <Separator layoutY="300.0" prefHeight="5.0" prefWidth="625.0"/> - <HBox id="notAvailable" - fx:id="recipeStoneAxe" - layoutY="110.0" - prefHeight="50.0" + <HBox id="notAvailable" fx:id="recipeStoneAxe" layoutY="90.0" prefHeight="50.0" prefWidth="625.0"> <Text text="Hache en pierre" textAlignment="CENTER"/> <Text text="2 Bâtons | 3 pierre" textAlignment="CENTER"/> </HBox> <Separator layoutY="375.0" prefHeight="5.0" prefWidth="625.0"/> - <HBox id="notAvailable" - fx:id="lexiconAxe3" - layoutY="165.0" - prefHeight="50.0" + <HBox id="notAvailable" fx:id="recipeIronAxe" layoutY="167.0" prefHeight="50.0" prefWidth="625.0"> - <Text text="Hache en bois" textAlignment="CENTER"/> - <Text text="2 Bâtons | 3 bois" textAlignment="CENTER"/> + <Text text="Hache en fer" textAlignment="CENTER"/> + <Text text="2 Bâtons | 3 Minerais de fer" textAlignment="CENTER"/> </HBox> <Separator layoutY="450.0" prefHeight="5.0" prefWidth="625.0"/> - <HBox id="notAvailable" - fx:id="lexiconSword1" - layoutY="108.0" - prefHeight="50.0" - prefWidth="625.0"> - <Text text="Epée en fer" textAlignment="CENTER"/> - <Text text="1 Bâton | 2 Minerais de fer"/> - </HBox> <Separator layoutY="525.0" prefHeight="5.0" prefWidth="625.0"/> - <HBox id="notAvailable" - fx:id="lexiconSword2" - layoutY="108.0" - prefHeight="50.0" + <HBox id="notAvailable" fx:id="lexiconSword2" layoutY="537.0" prefHeight="50.0" prefWidth="625.0"> <Text text="Epée en pierre" textAlignment="CENTER"/> <Text text="1 Bâton | 2 pierre"/> </HBox> <Separator layoutY="600.0" prefHeight="5.0" prefWidth="625.0"/> - <HBox id="notAvailable" - fx:id="lexiconSword3" - layoutY="108.0" - prefHeight="50.0" + <HBox id="notAvailable" fx:id="lexiconSword3" layoutY="465.0" prefHeight="50.0" prefWidth="625.0"> <Text text="Epée en bois" textAlignment="CENTER"/> <Text text="1 Bâton | 2 bois"/> </HBox> <Separator layoutY="675.0" prefHeight="5.0" prefWidth="625.0"/> - <HBox id="notAvailable" - fx:id="recipeRock" - layoutY="163.0" - prefHeight="50.0" + <HBox id="notAvailable" fx:id="lexiconSword1" layoutY="613.0" prefHeight="50.0" + prefWidth="625.0"> + <Text text="Epée en fer" textAlignment="CENTER"/> + <Text text="1 Bâton | 2 Minerais de fer"/> + </HBox> + <HBox id="notAvailable" fx:id="recipeRock" layoutY="678.0" prefHeight="50.0" prefWidth="625.0"> - <Text text="1 Roche" textAlignment="CENTER"/> - <Text text="3 pierres"/> + <Text text="Roche" textAlignment="CENTER"/> + <Text text="3 Pierres"/> </HBox> - <Separator layoutY="750.0" prefHeight="5.0" prefWidth="625.0"/> <!--<HBox id="notAvailable" fx:id="lexiconBow" layoutY="163.0" @@ -160,16 +118,10 @@ </center> </BorderPane> - <BorderPane prefHeight="200.0" - prefWidth="640.0"> + <BorderPane prefHeight="200.0" prefWidth="640.0"> <top> - <HBox prefHeight="25.0" - prefWidth="640.0" - BorderPane.alignment="CENTER"> - <Text strokeType="OUTSIDE" - strokeWidth="0.0" - text="Inventaire" - textAlignment="CENTER" + <HBox prefHeight="25.0" prefWidth="640.0" BorderPane.alignment="CENTER"> + <Text strokeType="OUTSIDE" strokeWidth="0.0" text="Inventaire du joueur" textAlignment="CENTER" wrappingWidth="640"> <font> <Font size="16.0"/> @@ -179,10 +131,7 @@ </top> <center> - <Pane fx:id="displayInventory" - prefHeight="200.0" - prefWidth="640.0" - BorderPane.alignment="CENTER"/> + <Pane fx:id="displayInventory" prefHeight="200.0" prefWidth="640.0" BorderPane.alignment="CENTER"/> </center> </BorderPane> </SplitPane> From a7a683a573d4f81eace146527062876355604d65 Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Wed, 15 Jun 2022 21:08:49 +0200 Subject: [PATCH 85/97] Clear menu controller --- src/main/java/fr/sae/terraria/Terraria.java | 2 +- .../terraria/controller/MenuController.java | 41 ++----------------- 2 files changed, 5 insertions(+), 38 deletions(-) diff --git a/src/main/java/fr/sae/terraria/Terraria.java b/src/main/java/fr/sae/terraria/Terraria.java index 1185b3a..72fc71c 100644 --- a/src/main/java/fr/sae/terraria/Terraria.java +++ b/src/main/java/fr/sae/terraria/Terraria.java @@ -47,7 +47,7 @@ private FXMLLoader loadFXML(String path) public void start(Stage stage) throws IOException { GameController gameController = new GameController(stage); - MenuController menuController = new MenuController(stage); + MenuController menuController = new MenuController(); FXMLLoader fxmlLoader = this.loadFXML("vue/game.fxml"); fxmlLoader.setController(gameController); diff --git a/src/main/java/fr/sae/terraria/controller/MenuController.java b/src/main/java/fr/sae/terraria/controller/MenuController.java index 7278dfa..1edf0cf 100644 --- a/src/main/java/fr/sae/terraria/controller/MenuController.java +++ b/src/main/java/fr/sae/terraria/controller/MenuController.java @@ -31,65 +31,32 @@ public class MenuController implements Initializable @FXML public HBox recipeWoodPickaxe; @FXML public HBox recipeStonePickaxe; @FXML public HBox recipeIronPickaxe; - @FXML public HBox lexiconAxe1; - @FXML public HBox recipeStoneAxe; - @FXML public HBox lexiconAxe3; - @FXML public HBox lexiconSword1; - @FXML public HBox lexiconSword2; - @FXML public HBox lexiconSword3; - - - public Timeline loop; - private Stage stage; public Environment environment = null; public Player player = null; - public double scaleMultiplicatorWidth; - public double scaleMultiplicatorHeight; - - public MenuController(final Stage stage) - { - super(); - this.stage = stage; - } @Override public void initialize(URL location, ResourceBundle resources) { - this.scaleMultiplicatorWidth = (this.root.getPrefWidth() / Terraria.DISPLAY_RENDERING_WIDTH); - this.scaleMultiplicatorHeight = ((this.root.getPrefHeight()-this.HBoxText.getPrefHeight()) / Terraria.DISPLAY_RENDERING_HEIGHT); - - this.loop = new Timeline(); - this.loop.setCycleCount(Animation.INDEFINITE); - - KeyFrame keyFrame = new KeyFrame(Duration.seconds(Terraria.TARGET_FPS), (ev -> { - if (!Objects.isNull(this.player)) { - // System.out.println(this.player.getInventory()); - } - })); - - this.loop.getKeyFrames().add(keyFrame); - this.loop.play(); - // Craft de la roche à partir de 3 pierres this.recipeRock.addEventFilter(Event.ANY, ev -> { if (ev.getEventType().getName().equalsIgnoreCase("MOUSE_PRESSED")) - player.pickup(Craft.rock(this.environment)); + this.player.pickup(Craft.rock(this.environment)); }); this.recipeWoodPickaxe.addEventFilter(Event.ANY, ev -> { if (ev.getEventType().getName().equalsIgnoreCase("MOUSE_PRESSED")) - player.pickup(Craft.pickaxe(this.environment, MaterialSet.WOOD)); + this.player.pickup(Craft.pickaxe(this.environment, MaterialSet.WOOD)); }); this.recipeStonePickaxe.addEventFilter(Event.ANY, ev -> { if (ev.getEventType().getName().equalsIgnoreCase("MOUSE_PRESSED")) - player.pickup(Craft.pickaxe(this.environment, MaterialSet.STONE)); + this.player.pickup(Craft.pickaxe(this.environment, MaterialSet.STONE)); }); this.recipeIronPickaxe.addEventFilter(Event.ANY, ev -> { if (ev.getEventType().getName().equalsIgnoreCase("MOUSE_PRESSED")) - player.pickup(Craft.pickaxe(this.environment, MaterialSet.IRON)); + this.player.pickup(Craft.pickaxe(this.environment, MaterialSet.IRON)); }); } } From 9c80c261a6ef53c618790d4c4e437e5bdda033ee Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Wed, 15 Jun 2022 21:09:21 +0200 Subject: [PATCH 86/97] Fix error in Main file --- src/main/java/fr/sae/terraria/Terraria.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/java/fr/sae/terraria/Terraria.java b/src/main/java/fr/sae/terraria/Terraria.java index 72fc71c..d94ea92 100644 --- a/src/main/java/fr/sae/terraria/Terraria.java +++ b/src/main/java/fr/sae/terraria/Terraria.java @@ -82,25 +82,21 @@ public void start(Stage stage) throws IOException if (switchScene.get()) { if (!Objects.isNull(menuController.player)) { gameController.player = menuController.player; - menuController.loop.stop(); gameController.environment.getLoop().play(); } } else { if (!Objects.isNull(gameController.player)) { menuController.player = gameController.player; menuController.environment = gameController.environment; - menuController.loop.play(); gameController.environment.getLoop().stop(); } } })); stage.widthProperty().addListener((obs, oldV, newV) -> { gameController.scaleMultiplicatorWidth = (newV.intValue() / Terraria.DISPLAY_RENDERING_WIDTH); - menuController.scaleMultiplicatorWidth = (newV.intValue() / Terraria.DISPLAY_RENDERING_WIDTH); }); stage.heightProperty().addListener((obs, oldV, newV) -> { gameController.scaleMultiplicatorHeight = ((newV.intValue()-gameController.title.getPrefHeight()) / Terraria.DISPLAY_RENDERING_HEIGHT); - menuController.scaleMultiplicatorHeight = ((newV.intValue()-gameController.title.getPrefHeight()) / Terraria.DISPLAY_RENDERING_HEIGHT); }); stage.show(); From 63d9e26ab78c697031d2a18b83b36ceb46177565 Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Wed, 15 Jun 2022 21:20:01 +0200 Subject: [PATCH 87/97] Fix joueur dans le bloc --- .../sae/terraria/controller/MenuController.java | 12 ------------ .../java/fr/sae/terraria/modele/Environment.java | 15 +++++++-------- .../terraria/modele/entities/player/Player.java | 1 - .../modele/entities/player/craft/Craft.java | 5 +++-- 4 files changed, 10 insertions(+), 23 deletions(-) diff --git a/src/main/java/fr/sae/terraria/controller/MenuController.java b/src/main/java/fr/sae/terraria/controller/MenuController.java index 1edf0cf..e0cb83e 100644 --- a/src/main/java/fr/sae/terraria/controller/MenuController.java +++ b/src/main/java/fr/sae/terraria/controller/MenuController.java @@ -1,32 +1,20 @@ package fr.sae.terraria.controller; -import fr.sae.terraria.Terraria; import fr.sae.terraria.modele.Environment; import fr.sae.terraria.modele.entities.player.Player; import fr.sae.terraria.modele.entities.player.craft.Craft; import fr.sae.terraria.modele.entities.tools.MaterialSet; -import javafx.animation.Animation; -import javafx.animation.KeyFrame; -import javafx.animation.Timeline; import javafx.event.Event; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.layout.HBox; -import javafx.scene.layout.Pane; -import javafx.stage.Stage; -import javafx.util.Duration; import java.net.URL; -import java.util.Objects; import java.util.ResourceBundle; public class MenuController implements Initializable { - @FXML public Pane root; - @FXML public Pane displayInventory; - @FXML public Pane displayLexique; - @FXML public HBox HBoxText; @FXML public HBox recipeRock; @FXML public HBox recipeWoodPickaxe; @FXML public HBox recipeStonePickaxe; diff --git a/src/main/java/fr/sae/terraria/modele/Environment.java b/src/main/java/fr/sae/terraria/modele/Environment.java index c565965..672b5aa 100644 --- a/src/main/java/fr/sae/terraria/modele/Environment.java +++ b/src/main/java/fr/sae/terraria/modele/Environment.java @@ -88,17 +88,16 @@ public Environment(double scaleMultiplicatorWidth, double scaleMultiplicatorHeig this.player.spawn(5*widthTile, 3*heightTile); // Détecte si le joueur n'est pas dans un bloc lorsqu'il met un block au sol - this.entities.addListener((ListChangeListener<? super Entity>) c -> { + this.blocks.addListener((ListChangeListener<? super Block>) c -> { while (c.next()) if (c.wasAdded()) { - Entity entity = c.getList().get(0); - - if (!Objects.isNull(entity.getRect())) { + Block block = c.getAddedSubList().get(0); + if (!Objects.isNull(block.getRect())) { // Si on le pose sur le joueur - boolean isIntoABlock = player.getRect().collideRect(entity.getRect()); - - if (entity instanceof CollideObjectType && isIntoABlock) { + boolean isIntoABlock = player.getRect().collideRect(block.getRect()); + boolean isCollideBlock = Block.isDirt(block) || Block.isRock(block) || Block.isFloorLeft(block) || Block.isFloorRight(block) || Block.isFloorTop(block); + if (isCollideBlock && isIntoABlock) { // Place le joueur au-dessus du block posé. - player.setY(entity.getY() - player.getRect().getHeight()); + player.setY(block.getY() - player.getRect().getHeight()); player.getGravity().yInit = player.getY(); player.getGravity().xInit = player.getX(); } diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java index 3ff8a53..8343386 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java @@ -3,7 +3,6 @@ import fr.sae.terraria.modele.Environment; import fr.sae.terraria.modele.TileMaps; import fr.sae.terraria.modele.entities.entity.*; -import fr.sae.terraria.modele.entities.player.craft.Craft; import fr.sae.terraria.modele.entities.player.inventory.Inventory; import fr.sae.terraria.modele.entities.player.inventory.Stack; import fr.sae.terraria.vue.View; diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/craft/Craft.java b/src/main/java/fr/sae/terraria/modele/entities/player/craft/Craft.java index 20995e3..741696c 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/craft/Craft.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/craft/Craft.java @@ -4,13 +4,14 @@ import fr.sae.terraria.modele.entities.blocks.Block; import fr.sae.terraria.modele.entities.blocks.BlockSet; import fr.sae.terraria.modele.entities.items.Item; - import fr.sae.terraria.modele.entities.player.craft.recipes.Ingredient; import fr.sae.terraria.modele.entities.player.craft.recipes.PickaxeRecipe; import fr.sae.terraria.modele.entities.player.craft.recipes.RockRecipe; import fr.sae.terraria.modele.entities.player.inventory.Inventory; import fr.sae.terraria.modele.entities.player.inventory.Stack; -import fr.sae.terraria.modele.entities.tools.*; +import fr.sae.terraria.modele.entities.tools.MaterialSet; +import fr.sae.terraria.modele.entities.tools.Tool; +import fr.sae.terraria.modele.entities.tools.ToolSet; import java.util.Objects; From 23ee1139b94118f5f3052bc3dffd5dcc1c014f28 Mon Sep 17 00:00:00 2001 From: Tiago Lousa <tig2468.a@gmail.com> Date: Wed, 15 Jun 2022 22:18:13 +0200 Subject: [PATCH 88/97] fix craft --- src/main/java/fr/sae/terraria/controller/MenuController.java | 4 ++++ .../fr/sae/terraria/modele/entities/player/craft/Craft.java | 2 +- .../modele/entities/player/craft/recipes/IngredientSet.java | 2 +- .../modele/entities/player/craft/recipes/PickaxeRecipe.java | 2 -- .../fr/sae/terraria/modele/entities/tools/MaterialSet.java | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/fr/sae/terraria/controller/MenuController.java b/src/main/java/fr/sae/terraria/controller/MenuController.java index e0cb83e..f3ddf98 100644 --- a/src/main/java/fr/sae/terraria/controller/MenuController.java +++ b/src/main/java/fr/sae/terraria/controller/MenuController.java @@ -46,5 +46,9 @@ public class MenuController implements Initializable if (ev.getEventType().getName().equalsIgnoreCase("MOUSE_PRESSED")) this.player.pickup(Craft.pickaxe(this.environment, MaterialSet.IRON)); }); + this.recipeWoodPickaxe.addEventFilter(Event.ANY, ev -> { + if (ev.getEventType().getName().equalsIgnoreCase("MOUSE_PRESSED")) + this.player.pickup(Craft.pickaxe(this.environment, MaterialSet.WOOD)); + }); } } diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/craft/Craft.java b/src/main/java/fr/sae/terraria/modele/entities/player/craft/Craft.java index 741696c..2d5b093 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/craft/Craft.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/craft/Craft.java @@ -46,7 +46,7 @@ else if (MaterialSet.isIron(material)) pickaxeIngredients = PickaxeRecipe.IronRecipe.apply(inventory); if (!Objects.isNull(pickaxeIngredients)) for (int i = 0; i < pickaxeIngredients.get().length; i++) { - Stack stack = (Stack) pickaxeIngredients.get()[i].getItem(); + Stack stack = pickaxeIngredients.get()[i]; if (Item.isStick(stack.getItem())) stack.removeQuantity(PickaxeRecipe.NB_STICKS); diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/IngredientSet.java b/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/IngredientSet.java index 14d565a..6a608fe 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/IngredientSet.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/IngredientSet.java @@ -12,7 +12,7 @@ private static boolean putStackIntoIngredientsList(final Ingredient ingredient, { if (ingredient.get().length == 1) ingredient.get()[0] = stack; - else ingredient.get()[ingredient.nbStacks()] = stack; + else ingredient.get()[ingredient.nbStacks()-1] = stack; return true; } diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/PickaxeRecipe.java b/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/PickaxeRecipe.java index 06eb144..94802a1 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/PickaxeRecipe.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/PickaxeRecipe.java @@ -32,7 +32,6 @@ public static Ingredient apply(final Inventory inventory) i++; } while (i < inventory.get().size() && (!haveEnoughForPickaxeHead || !haveEnoughForPickaxeHandler)); - return (haveEnoughForPickaxeHead && haveEnoughForPickaxeHandler) ? ingredient : null; } } @@ -59,7 +58,6 @@ public static Ingredient apply(final Inventory inventory) i++; } while (i < inventory.get().size() && (!haveEnoughForPickaxeHead || !haveEnoughForPickaxeHandler)); - return (haveEnoughForPickaxeHead && haveEnoughForPickaxeHandler) ? ingredient : null; } } diff --git a/src/main/java/fr/sae/terraria/modele/entities/tools/MaterialSet.java b/src/main/java/fr/sae/terraria/modele/entities/tools/MaterialSet.java index 8a155f3..4c03141 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/tools/MaterialSet.java +++ b/src/main/java/fr/sae/terraria/modele/entities/tools/MaterialSet.java @@ -8,7 +8,7 @@ public enum MaterialSet IRON; - public static boolean isWood(MaterialSet material) { return material == MaterialSet.IRON; } + public static boolean isWood(MaterialSet material) { return material == MaterialSet.WOOD; } public static boolean isStone(MaterialSet material) { return material == MaterialSet.STONE; } public static boolean isIron(MaterialSet material) { return material == MaterialSet.IRON; } } From 832fa5d11734e3d63d3531bfc52f97e6fd405ca3 Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Thu, 16 Jun 2022 16:15:52 +0200 Subject: [PATCH 89/97] Jeux de test pour les constructions --- .../entities/player/inventory/Stack.java | 3 +- .../entities/player/craft/CraftTest.java | 110 ++++++++++++++++++ 2 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 src/test/java/fr/sae/terraria/modele/entities/player/craft/CraftTest.java diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java index 00b5916..0eaff13 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Stack.java @@ -104,7 +104,8 @@ public boolean removeQuantity(int quantity) return false; } - @Override public String toString(){ + @Override public String toString() + { if (item instanceof Block) return String.valueOf(((Block) item).getTypeOfBlock()); return item.toString(); diff --git a/src/test/java/fr/sae/terraria/modele/entities/player/craft/CraftTest.java b/src/test/java/fr/sae/terraria/modele/entities/player/craft/CraftTest.java new file mode 100644 index 0000000..1d8e340 --- /dev/null +++ b/src/test/java/fr/sae/terraria/modele/entities/player/craft/CraftTest.java @@ -0,0 +1,110 @@ +package fr.sae.terraria.modele.entities.player.craft; + +import fr.sae.terraria.modele.Environment; +import fr.sae.terraria.modele.entities.blocks.Block; +import fr.sae.terraria.modele.entities.items.Item; +import fr.sae.terraria.modele.entities.player.Player; +import fr.sae.terraria.modele.entities.player.craft.recipes.IngredientSet; +import fr.sae.terraria.modele.entities.player.craft.recipes.PickaxeRecipe; +import fr.sae.terraria.modele.entities.player.craft.recipes.RockRecipe; +import fr.sae.terraria.modele.entities.player.inventory.Stack; +import fr.sae.terraria.modele.entities.tools.MaterialSet; +import fr.sae.terraria.modele.entities.tools.Tool; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +import java.util.Objects; + +import static org.junit.jupiter.api.Assertions.*; + + +public class CraftTest +{ + private static Environment environment; + private static Player player; + + + public CraftTest() { super(); } + + @BeforeAll public static void init() + { + environment = new Environment(1., 1.); + player = environment.getPlayer(); + } + + @Test public final void stockTest() + { + player.pickup(Item.STONE); + player.pickup(Item.STONE); + player.pickup(Item.STONE); + player.pickup(Item.STONE); + + boolean haveEnoughStones = false; + for (Stack stack : player.getInventory().get()) + if (Item.isStone(stack.getItem()) && stack.haveEnoughQuantity(RockRecipe.NB_STONES)) + haveEnoughStones = true; + assertTrue(haveEnoughStones); + + Block block = Craft.rock(environment); + player.pickup(block); + + boolean haveRock = false; + for (Stack stack : player.getInventory().get()) + if (stack.getItem() instanceof Block && Block.isRock((Block) stack.getItem())) + haveRock = true; + assertTrue(haveRock); + + boolean dontHaveStones = true; + for (Stack stack : player.getInventory().get()) + if (Item.isStone(stack.getItem())) { + dontHaveStones = false; + break; + } + assertTrue(dontHaveStones); + } + + @Test public final void pickaxeTest() + { + player.pickup(Item.WOOD); + player.pickup(Item.WOOD); + player.pickup(Item.WOOD); + player.pickup(Item.STICK); + player.pickup(Item.STICK); + + boolean haveEnoughWoods = false; + boolean haveEnoughSticks = false; + for (Stack stack : player.getInventory().get()) { + if (Item.isWood(stack.getItem()) && stack.haveEnoughQuantity(PickaxeRecipe.WoodRecipe.NB_WOODS)) + haveEnoughWoods = true; + if (Item.isStick(stack.getItem()) && stack.haveEnoughQuantity(PickaxeRecipe.NB_STICKS)) + haveEnoughSticks = true; + } + + assertTrue(haveEnoughWoods); + assertTrue(haveEnoughSticks); + Tool woodPickaxe = Craft.pickaxe(environment, MaterialSet.WOOD); + assertTrue(!Objects.isNull(woodPickaxe) && Tool.isPickaxe(woodPickaxe) && MaterialSet.isWood(woodPickaxe.getMaterial())); + player.pickup(woodPickaxe); + + boolean havePickaxe = false; + for (Stack stack : player.getInventory().get()) + if (Tool.isPickaxe((Tool) stack.getItem())) + havePickaxe = true; + assertTrue(havePickaxe); + + + boolean dontHaveWoods = true; + boolean dontHaveSticks = true; + for (Stack stack : player.getInventory().get()) { + System.out.println(stack.getItem()); + if (!Item.isWood(stack.getItem()) && stack.haveEnoughQuantity(PickaxeRecipe.WoodRecipe.NB_WOODS)) { + dontHaveWoods = false; + break; + } else if (!Item.isStick(stack.getItem()) && stack.haveEnoughQuantity(PickaxeRecipe.NB_STICKS)) { + dontHaveSticks = false; + break; + } + } + assertTrue(dontHaveSticks && dontHaveWoods); + } +} From 9574eee23a3fbeeddfd63774e4caeaad21dd9afa Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Thu, 16 Jun 2022 21:20:51 +0200 Subject: [PATCH 90/97] Ajustement Lexique, ajout du craft de la torche --- .../terraria/controller/MenuController.java | 63 +++++++-- .../fr/sae/terraria/modele/Environment.java | 1 - .../modele/entities/player/craft/Craft.java | 18 +++ .../player/craft/recipes/IngredientSet.java | 6 + .../player/craft/recipes/RockRecipe.java | 2 +- .../player/craft/recipes/TorchRecipe.java | 32 +++++ .../resources/fr/sae/terraria/vue/menu.fxml | 122 ++++++++---------- 7 files changed, 160 insertions(+), 84 deletions(-) create mode 100644 src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/TorchRecipe.java diff --git a/src/main/java/fr/sae/terraria/controller/MenuController.java b/src/main/java/fr/sae/terraria/controller/MenuController.java index f3ddf98..5d523b4 100644 --- a/src/main/java/fr/sae/terraria/controller/MenuController.java +++ b/src/main/java/fr/sae/terraria/controller/MenuController.java @@ -16,10 +16,20 @@ public class MenuController implements Initializable { @FXML public HBox recipeRock; + @FXML public HBox recipeTorch; + @FXML public HBox recipeWoodPickaxe; @FXML public HBox recipeStonePickaxe; @FXML public HBox recipeIronPickaxe; + @FXML public HBox recipeWoodAxe; + @FXML public HBox recipeStoneAxe; + @FXML public HBox recipeIronAxe; + + @FXML public HBox recipeWoodSword; + @FXML public HBox recipeStoneSword; + @FXML public HBox recipeIronSword; + public Environment environment = null; public Player player = null; @@ -27,28 +37,59 @@ public class MenuController implements Initializable @Override public void initialize(URL location, ResourceBundle resources) { // Craft de la roche à partir de 3 pierres - this.recipeRock.addEventFilter(Event.ANY, ev -> { - if (ev.getEventType().getName().equalsIgnoreCase("MOUSE_PRESSED")) + this.recipeRock.addEventFilter(Event.ANY, event -> { + if (event.getEventType().getName().equalsIgnoreCase("MOUSE_PRESSED")) this.player.pickup(Craft.rock(this.environment)); }); - this.recipeWoodPickaxe.addEventFilter(Event.ANY, ev -> { - if (ev.getEventType().getName().equalsIgnoreCase("MOUSE_PRESSED")) + this.recipeTorch.addEventFilter(Event.ANY, event -> { + if (event.getEventType().getName().equalsIgnoreCase("MOUSE_PRESSED")) + this.player.pickup(Craft.torch(this.environment)); + }); + + + // LES PIOCHES + this.recipeWoodPickaxe.addEventFilter(Event.ANY, event -> { + if (event.getEventType().getName().equalsIgnoreCase("MOUSE_PRESSED")) this.player.pickup(Craft.pickaxe(this.environment, MaterialSet.WOOD)); }); - this.recipeStonePickaxe.addEventFilter(Event.ANY, ev -> { - if (ev.getEventType().getName().equalsIgnoreCase("MOUSE_PRESSED")) + this.recipeStonePickaxe.addEventFilter(Event.ANY, event -> { + if (event.getEventType().getName().equalsIgnoreCase("MOUSE_PRESSED")) this.player.pickup(Craft.pickaxe(this.environment, MaterialSet.STONE)); }); - this.recipeIronPickaxe.addEventFilter(Event.ANY, ev -> { - if (ev.getEventType().getName().equalsIgnoreCase("MOUSE_PRESSED")) + this.recipeIronPickaxe.addEventFilter(Event.ANY, event -> { + if (event.getEventType().getName().equalsIgnoreCase("MOUSE_PRESSED")) this.player.pickup(Craft.pickaxe(this.environment, MaterialSet.IRON)); }); - this.recipeWoodPickaxe.addEventFilter(Event.ANY, ev -> { - if (ev.getEventType().getName().equalsIgnoreCase("MOUSE_PRESSED")) - this.player.pickup(Craft.pickaxe(this.environment, MaterialSet.WOOD)); + + + // LES HACHES + this.recipeWoodAxe.addEventFilter(Event.ANY, event -> { + + }); + + this.recipeStoneAxe.addEventFilter(Event.ANY, event -> { + + }); + + this.recipeIronAxe.addEventFilter(Event.ANY, event -> { + + }); + + + // LES EPEES + this.recipeWoodSword.addEventFilter(Event.ANY, event -> { + + }); + + this.recipeStoneSword.addEventFilter(Event.ANY, event -> { + + }); + + this.recipeIronSword.addEventFilter(Event.ANY, event -> { + }); } } diff --git a/src/main/java/fr/sae/terraria/modele/Environment.java b/src/main/java/fr/sae/terraria/modele/Environment.java index 672b5aa..011e8fb 100644 --- a/src/main/java/fr/sae/terraria/modele/Environment.java +++ b/src/main/java/fr/sae/terraria/modele/Environment.java @@ -6,7 +6,6 @@ import fr.sae.terraria.modele.entities.blocks.Block; import fr.sae.terraria.modele.entities.blocks.BlockSet; import fr.sae.terraria.modele.entities.blocks.Tree; -import fr.sae.terraria.modele.entities.entity.CollideObjectType; import fr.sae.terraria.modele.entities.entity.Entity; import fr.sae.terraria.modele.entities.entity.ReproductiveObjectType; import fr.sae.terraria.modele.entities.items.Meat; diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/craft/Craft.java b/src/main/java/fr/sae/terraria/modele/entities/player/craft/Craft.java index 2d5b093..906c1df 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/craft/Craft.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/craft/Craft.java @@ -7,6 +7,7 @@ import fr.sae.terraria.modele.entities.player.craft.recipes.Ingredient; import fr.sae.terraria.modele.entities.player.craft.recipes.PickaxeRecipe; import fr.sae.terraria.modele.entities.player.craft.recipes.RockRecipe; +import fr.sae.terraria.modele.entities.player.craft.recipes.TorchRecipe; import fr.sae.terraria.modele.entities.player.inventory.Inventory; import fr.sae.terraria.modele.entities.player.inventory.Stack; import fr.sae.terraria.modele.entities.tools.MaterialSet; @@ -33,6 +34,23 @@ public static Block rock(final Environment environment) return (!Objects.isNull(rockIngredients)) ? new Block(BlockSet.ROCK, environment) : null; } + public static Block torch(final Environment environment) + { + Inventory inventory = environment.getPlayer().getInventory(); + + Ingredient torchIngredients = TorchRecipe.apply(inventory); + if (!Objects.isNull(torchIngredients)) for (int i = 0; i < torchIngredients.get().length; i++) { + Stack stack = torchIngredients.get()[i]; + + if (Item.isStick(stack.getItem())) + stack.removeQuantity(TorchRecipe.NB_STICKS); + if (Item.isCoal(stack.getItem())) + stack.removeQuantity(TorchRecipe.NB_COALS); + } + + return (!Objects.isNull(torchIngredients)) ? new Block(BlockSet.TORCH, environment) : null; + } + public static Tool pickaxe(final Environment environment, final MaterialSet material) { Inventory inventory = environment.getPlayer().getInventory(); diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/IngredientSet.java b/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/IngredientSet.java index 6a608fe..a307d78 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/IngredientSet.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/IngredientSet.java @@ -40,4 +40,10 @@ public static boolean irons(final Ingredient ingredient, final Stack stack, fina boolean haveEnoughIrons = Item.isIron(stack.getItem()) && stack.haveEnoughQuantity(nbStones); return haveEnoughIrons && IngredientSet.putStackIntoIngredientsList(ingredient, stack); } + + public static boolean coals(final Ingredient ingredient, final Stack stack, final int nbCoals) + { + boolean haveEnoughCoals = Item.isCoal(stack.getItem()) && stack.haveEnoughQuantity(nbCoals); + return haveEnoughCoals && IngredientSet.putStackIntoIngredientsList(ingredient, stack); + } } diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/RockRecipe.java b/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/RockRecipe.java index 27178a3..ac1e260 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/RockRecipe.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/RockRecipe.java @@ -13,7 +13,7 @@ public class RockRecipe public static Ingredient apply(final Inventory inventory) { Ingredient ingredient = new Ingredient(RockRecipe.NB_INGREDIENTS); - boolean haveEnoughStone ; + boolean haveEnoughStone; int i = 0; do { diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/TorchRecipe.java b/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/TorchRecipe.java new file mode 100644 index 0000000..6090c03 --- /dev/null +++ b/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/TorchRecipe.java @@ -0,0 +1,32 @@ +package fr.sae.terraria.modele.entities.player.craft.recipes; + +import fr.sae.terraria.modele.entities.player.inventory.Inventory; +import fr.sae.terraria.modele.entities.player.inventory.Stack; + + +public class TorchRecipe +{ + private static final int NB_INGREDIENTS = 2; + public static final int NB_COALS = 1; + public static final int NB_STICKS = 1; + + + public static Ingredient apply(final Inventory inventory) + { + Ingredient ingredient = new Ingredient(TorchRecipe.NB_INGREDIENTS); + boolean haveEnoughCoal = false; + boolean haveEnoughSticks = false; + + int i = 0; + do { + Stack stack = inventory.get().get(i); + + if (!haveEnoughCoal) + haveEnoughCoal = IngredientSet.coals(ingredient, stack, TorchRecipe.NB_COALS); + if (!haveEnoughSticks) + haveEnoughSticks = IngredientSet.sticks(ingredient, stack, TorchRecipe.NB_COALS); + } while (i < inventory.get().size() && (!haveEnoughCoal || !haveEnoughSticks)); + + return (haveEnoughCoal && haveEnoughSticks) ? ingredient : null; + } +} diff --git a/src/main/resources/fr/sae/terraria/vue/menu.fxml b/src/main/resources/fr/sae/terraria/vue/menu.fxml index 38fd511..ab8eee4 100644 --- a/src/main/resources/fr/sae/terraria/vue/menu.fxml +++ b/src/main/resources/fr/sae/terraria/vue/menu.fxml @@ -13,16 +13,15 @@ <BorderPane fx:id="root" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="720" prefWidth="1280" - xmlns="http://javafx.com/javafx/11" - xmlns:fx="http://javafx.com/fxml/1"> + xmlns="http://javafx.com/javafx/11" xmlns:fx="http://javafx.com/fxml/1"> <stylesheets> - <URL value="@./menu.css"/> + <URL value="@./menu.css" /> </stylesheets> <top> <HBox id="textArea" fx:id="HBoxText" prefHeight="25.0" prefWidth="1280" BorderPane.alignment="CENTER"> - <Text id="text" text="Groupe: BOUCHE Antoine, CHRZASZCZ Naulan, NARCISO Tiago"/> + <Text id="text" text="Groupe: BOUCHE Antoine, CHRZASZCZ Naulan, NARCISO Tiago" /> </HBox> </top> @@ -31,11 +30,9 @@ <BorderPane prefHeight="200.0" prefWidth="640.0"> <top> <HBox fx:id="HBoxTitle" prefHeight="25.0" prefWidth="640.0" BorderPane.alignment="CENTER"> - <Text fx:id="TextHBoxTitle" stroke="WHITE" strokeType="OUTSIDE" strokeWidth="0.0" - text="Lexique des constructions" textAlignment="CENTER" underline="true" - wrappingWidth="632.470703125"> + <Text fx:id="TextHBoxTitle" stroke="WHITE" strokeType="OUTSIDE" strokeWidth="0.0" text="Lexique des constructions" textAlignment="CENTER" underline="true" wrappingWidth="632.470703125"> <font> - <Font size="20.0"/> + <Font size="20.0" /> </font> </Text> </HBox> @@ -44,75 +41,59 @@ <center> <ScrollPane prefHeight="200.0" prefWidth="640.0" BorderPane.alignment="CENTER"> <Pane fx:id="displayLexique" prefHeight="900.0" prefWidth="640.0"> - <HBox id="notAvailable" fx:id="recipeWoodPickaxe" layoutY="240.0" prefHeight="50.0" - prefWidth="625.0"> - <Text text="Pioche en bois" textAlignment="CENTER"/> - <Text text="2 Bâtons | 3 bois" textAlignment="CENTER"/> + <HBox id="notAvailable" fx:id="recipeWoodPickaxe" layoutY="179.0" prefHeight="50.0" prefWidth="625.0"> + <Text text="PIOCHE EN BOIS " textAlignment="CENTER" underline="true" /> + <Text text="-- 2 Bâtons | 3 bois" textAlignment="CENTER" /> </HBox> - <Separator layoutY="150.0" prefHeight="5.0" prefWidth="625.0"/> - <HBox id="notAvailable" fx:id="recipeStonePickaxe" layoutY="314.0" prefHeight="50.0" - prefWidth="625.0"> - <Text text="Pioche en pierre" textAlignment="CENTER"/> - <Text text="2 Bâtons | 3 pierre" textAlignment="CENTER"/> + <Separator layoutY="119.0" prefHeight="5.0" prefWidth="625.0" /> + <HBox id="notAvailable" fx:id="recipeStonePickaxe" layoutY="234.0" prefHeight="50.0" prefWidth="625.0"> + <Text text="PIOCHE EN PIERRE " textAlignment="CENTER" underline="true" /> + <Text text="-- 2 Bâtons | 3 pierres" textAlignment="CENTER" /> </HBox> - <Separator layoutY="75.0" prefHeight="5.0" prefWidth="625.0"/> - <HBox id="notAvailable" fx:id="recipeIronPickaxe" layoutY="387.0" prefHeight="50.0" - prefWidth="625.0"> - <Text text="Pioche en fer" textAlignment="CENTER"/> - <Text text="2 Bâtons | 3 Minerais de fer" textAlignment="CENTER"/> + <Separator layoutY="64.0" prefHeight="5.0" prefWidth="625.0" /> + <HBox id="notAvailable" fx:id="recipeIronPickaxe" layoutY="289.0" prefHeight="50.0" prefWidth="625.0"> + <Text text="PIOCHE EN FER " textAlignment="CENTER" underline="true" /> + <Text text="-- 2 Bâtons | 3 Minerais de fer" textAlignment="CENTER" /> </HBox> - <Separator layoutY="225.0" prefHeight="5.0" prefWidth="625.0"/> - <HBox id="notAvailable" fx:id="recipeWoodAxe" layoutY="14.0" prefHeight="50.0" - prefWidth="625.0"> - <Text text="Hache en bois" textAlignment="CENTER"/> - <Text text="2 Bâtons | 3 bois" textAlignment="CENTER"/> + <Separator layoutY="174.0" prefHeight="5.0" prefWidth="625.0" /> + <HBox id="notAvailable" fx:id="recipeWoodAxe" layoutY="14.0" prefHeight="50.0" prefWidth="625.0"> + <Text text="HACHE EN BOIS " textAlignment="CENTER" underline="true" /> + <Text text="-- 2 Bâtons | 3 bois" textAlignment="CENTER" /> </HBox> - <Separator layoutY="300.0" prefHeight="5.0" prefWidth="625.0"/> - <HBox id="notAvailable" fx:id="recipeStoneAxe" layoutY="90.0" prefHeight="50.0" - prefWidth="625.0"> - <Text text="Hache en pierre" textAlignment="CENTER"/> - <Text text="2 Bâtons | 3 pierre" textAlignment="CENTER"/> + <Separator layoutY="229.0" prefHeight="5.0" prefWidth="625.0" /> + <HBox id="notAvailable" fx:id="recipeStoneAxe" layoutY="69.0" prefHeight="50.0" prefWidth="625.0"> + <Text text="HACHE EN PIERRE " textAlignment="CENTER" underline="true" /> + <Text text="-- 2 Bâtons | 3 pierres" textAlignment="CENTER" /> </HBox> - <Separator layoutY="375.0" prefHeight="5.0" prefWidth="625.0"/> - <HBox id="notAvailable" fx:id="recipeIronAxe" layoutY="167.0" prefHeight="50.0" - prefWidth="625.0"> - <Text text="Hache en fer" textAlignment="CENTER"/> - <Text text="2 Bâtons | 3 Minerais de fer" textAlignment="CENTER"/> + <Separator layoutY="284.0" prefHeight="5.0" prefWidth="625.0" /> + <HBox id="notAvailable" fx:id="recipeIronAxe" layoutY="124.0" prefHeight="50.0" prefWidth="625.0"> + <Text text="HACHE EN FER " textAlignment="CENTER" underline="true" /> + <Text text=" -- 2 Bâtons | 3 Minerais de fer" textAlignment="CENTER" /> </HBox> - <Separator layoutY="450.0" prefHeight="5.0" prefWidth="625.0"/> - <Separator layoutY="525.0" prefHeight="5.0" prefWidth="625.0"/> - <HBox id="notAvailable" fx:id="lexiconSword2" layoutY="537.0" prefHeight="50.0" - prefWidth="625.0"> - <Text text="Epée en pierre" textAlignment="CENTER"/> - <Text text="1 Bâton | 2 pierre"/> + <Separator layoutY="339.0" prefHeight="5.0" prefWidth="625.0" /> + <HBox id="notAvailable" fx:id="recipeStoneSword" layoutY="399.0" prefHeight="50.0" prefWidth="625.0"> + <Text text="EPEE EN PIERRE " textAlignment="CENTER" underline="true" /> + <Text text="-- 1 Bâton | 2 pierres" /> </HBox> - <Separator layoutY="600.0" prefHeight="5.0" prefWidth="625.0"/> - <HBox id="notAvailable" fx:id="lexiconSword3" layoutY="465.0" prefHeight="50.0" - prefWidth="625.0"> - <Text text="Epée en bois" textAlignment="CENTER"/> - <Text text="1 Bâton | 2 bois"/> + <Separator layoutY="450.0" prefHeight="5.0" prefWidth="625.0" /> + <HBox id="notAvailable" fx:id="recipeWoodSword" layoutY="344.0" prefHeight="50.0" prefWidth="625.0"> + <Text text="EPEE EN BOIS" textAlignment="CENTER" underline="true" /> + <Text text=" -- 1 Bâton | 2 bois" /> </HBox> - <Separator layoutY="675.0" prefHeight="5.0" prefWidth="625.0"/> - <HBox id="notAvailable" fx:id="lexiconSword1" layoutY="613.0" prefHeight="50.0" - prefWidth="625.0"> - <Text text="Epée en fer" textAlignment="CENTER"/> - <Text text="1 Bâton | 2 Minerais de fer"/> + <Separator layoutY="675.0" prefHeight="5.0" prefWidth="625.0" /> + <HBox id="notAvailable" fx:id="recipeIronSword" layoutY="455.0" prefHeight="50.0" prefWidth="625.0"> + <Text text="EPEE EN FER " textAlignment="CENTER" underline="true" /> + <Text text="-- 1 Bâton | 2 Minerais de fer" /> </HBox> - <HBox id="notAvailable" fx:id="recipeRock" layoutY="678.0" prefHeight="50.0" - prefWidth="625.0"> - <Text text="Roche" textAlignment="CENTER"/> - <Text text="3 Pierres"/> + <Separator layoutY="394.0" prefHeight="5.0" prefWidth="625.0" /> + <HBox id="notAvailable" fx:id="recipeRock" layoutY="511.0" prefHeight="50.0" prefWidth="625.0"> + <Text text="ROCHE " textAlignment="CENTER" underline="true" /> + <Text text="-- 3 Pierres" /> </HBox> - <!--<HBox id="notAvailable" - fx:id="lexiconBow" - layoutY="163.0" - prefHeight="50.0" - prefWidth="625.0"> - <Text text="arc" textAlignment="CENTER"/> - <Text text="3 Bâton | 3 fibres"/> - </HBox> - <Separator layoutY="825.0" prefHeight="5.0" prefWidth="625.0"/> - --> + <HBox id="notAvailable" fx:id="recipeTorch" layoutY="569.0" prefHeight="50.0" prefWidth="625.0"> + <Text text="TORCHE " underline="true" /> + <Text text="-- 1 Bâton | 1 Charbon" /> + </HBox> </Pane> </ScrollPane> </center> @@ -121,17 +102,16 @@ <BorderPane prefHeight="200.0" prefWidth="640.0"> <top> <HBox prefHeight="25.0" prefWidth="640.0" BorderPane.alignment="CENTER"> - <Text strokeType="OUTSIDE" strokeWidth="0.0" text="Inventaire du joueur" textAlignment="CENTER" - wrappingWidth="640"> + <Text strokeType="OUTSIDE" strokeWidth="0.0" text="Inventaire du joueur" textAlignment="CENTER" underline="true" wrappingWidth="640"> <font> - <Font size="16.0"/> + <Font size="20.0" /> </font> </Text> </HBox> </top> <center> - <Pane fx:id="displayInventory" prefHeight="200.0" prefWidth="640.0" BorderPane.alignment="CENTER"/> + <Pane fx:id="displayInventory" prefHeight="200.0" prefWidth="640.0" BorderPane.alignment="CENTER" /> </center> </BorderPane> </SplitPane> From ee6bc3b1ee083136baad6b264a9b8ea80d4268b6 Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Thu, 16 Jun 2022 21:24:49 +0200 Subject: [PATCH 91/97] =?UTF-8?q?Ajout=20des=20loots=20suppl=C3=A9mentaire?= =?UTF-8?q?=20des=20blocks=20de=20type=20Roche?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/fr/sae/terraria/modele/entities/blocks/Block.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java b/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java index 1f74001..e50455e 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java +++ b/src/main/java/fr/sae/terraria/modele/entities/blocks/Block.java @@ -76,6 +76,11 @@ private void loots() } else if (Block.isRock(this)) { for (int loot = 0; loot < Block.ROCK_NB_LOOTS; loot++) player.pickup(Item.STONE); + + if (Math.random() > .5) + player.pickup(Item.COAL); + if (Math.random() < .05) + player.pickup(Item.IRON); } else if (Block.isTallGrass(this)) { for (int loot = (int) (Math.random()*3)+1; loot <= TallGrass.LOOTS_FIBRE_MAX; loot++) player.pickup(Item.FIBER); From 8187ef48b00cc5f8acab99f48937a0b228b676f7 Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Thu, 16 Jun 2022 21:32:36 +0200 Subject: [PATCH 92/97] Fix pprobleme torche --- src/main/java/fr/sae/terraria/modele/Environment.java | 2 -- .../modele/entities/player/craft/recipes/TorchRecipe.java | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/fr/sae/terraria/modele/Environment.java b/src/main/java/fr/sae/terraria/modele/Environment.java index 011e8fb..b6cc2d6 100644 --- a/src/main/java/fr/sae/terraria/modele/Environment.java +++ b/src/main/java/fr/sae/terraria/modele/Environment.java @@ -121,8 +121,6 @@ private void gameLoop() KeyFrame keyFrame = new KeyFrame(Duration.seconds(Terraria.TARGET_FPS), (ev -> { // TODO TEST if (!caught[0]) { - this.player.pickup(new Block(BlockSet.TORCH, this)); - this.player.pickup(new Meat(this)); this.player.pickup(new Tool(ToolSet.PICKAXE, MaterialSet.IRON)); this.player.pickup(new Vodka(this)); this.player.pickup(new Tool(ToolSet.SWORD, MaterialSet.IRON)); diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/TorchRecipe.java b/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/TorchRecipe.java index 6090c03..b66ec31 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/TorchRecipe.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/craft/recipes/TorchRecipe.java @@ -25,6 +25,7 @@ public static Ingredient apply(final Inventory inventory) haveEnoughCoal = IngredientSet.coals(ingredient, stack, TorchRecipe.NB_COALS); if (!haveEnoughSticks) haveEnoughSticks = IngredientSet.sticks(ingredient, stack, TorchRecipe.NB_COALS); + i++; } while (i < inventory.get().size() && (!haveEnoughCoal || !haveEnoughSticks)); return (haveEnoughCoal && haveEnoughSticks) ? ingredient : null; From a4af44d25b567b3b2a7a9bb085ddd16c72778777 Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Fri, 17 Jun 2022 10:58:55 +0200 Subject: [PATCH 93/97] eat sound --- .../fr/sae/terraria/modele/Environment.java | 4 +--- .../terraria/modele/entities/items/Meat.java | 3 ++- .../terraria/modele/entities/items/Vodka.java | 2 ++ .../terraria/modele/entities/player/Player.java | 1 + .../entities/player/inventory/Inventory.java | 2 ++ .../resources/fr/sae/terraria/sound/hit.wav | Bin 0 -> 82240 bytes 6 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 src/main/resources/fr/sae/terraria/sound/hit.wav diff --git a/src/main/java/fr/sae/terraria/modele/Environment.java b/src/main/java/fr/sae/terraria/modele/Environment.java index b6cc2d6..f9a1282 100644 --- a/src/main/java/fr/sae/terraria/modele/Environment.java +++ b/src/main/java/fr/sae/terraria/modele/Environment.java @@ -4,11 +4,9 @@ import fr.sae.terraria.modele.entities.Rabbit; import fr.sae.terraria.modele.entities.Slime; import fr.sae.terraria.modele.entities.blocks.Block; -import fr.sae.terraria.modele.entities.blocks.BlockSet; import fr.sae.terraria.modele.entities.blocks.Tree; import fr.sae.terraria.modele.entities.entity.Entity; import fr.sae.terraria.modele.entities.entity.ReproductiveObjectType; -import fr.sae.terraria.modele.entities.items.Meat; import fr.sae.terraria.modele.entities.items.Vodka; import fr.sae.terraria.modele.entities.player.Player; import fr.sae.terraria.modele.entities.tools.MaterialSet; @@ -177,7 +175,7 @@ public static Clip playSound(String path, boolean loop) } catch (Exception e) { e.printStackTrace(); } if (!Objects.isNull(clip)) { - clip.loop((loop) ? Clip.LOOP_CONTINUOUSLY : 0); + clip.loop(loop ? Clip.LOOP_CONTINUOUSLY : 0); clip.start(); } diff --git a/src/main/java/fr/sae/terraria/modele/entities/items/Meat.java b/src/main/java/fr/sae/terraria/modele/entities/items/Meat.java index 831aeb4..37d8772 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/items/Meat.java +++ b/src/main/java/fr/sae/terraria/modele/entities/items/Meat.java @@ -19,8 +19,9 @@ public Meat(final Environment environment) @Override public void consumes() { - Player player = environment.getPlayer(); + Environment.playSound("sound/eat.wav", false); + Player player = environment.getPlayer(); if (player.getPv() < player.getPvMax()) player.setPv(player.getPv() + 1); } diff --git a/src/main/java/fr/sae/terraria/modele/entities/items/Vodka.java b/src/main/java/fr/sae/terraria/modele/entities/items/Vodka.java index de241fa..bb4871c 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/items/Vodka.java +++ b/src/main/java/fr/sae/terraria/modele/entities/items/Vodka.java @@ -28,6 +28,8 @@ public Vodka(final Environment environment) @Override public void consumes() { + Environment.playSound("sound/eat.wav", false); + Player player = environment.getPlayer(); Inventory inventory = player.getInventory(); inventory.get().get(inventory.getPosCursor()).remove(); diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java index 8343386..12fe97a 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java @@ -3,6 +3,7 @@ import fr.sae.terraria.modele.Environment; import fr.sae.terraria.modele.TileMaps; import fr.sae.terraria.modele.entities.entity.*; +import fr.sae.terraria.modele.entities.items.Item; import fr.sae.terraria.modele.entities.player.inventory.Inventory; import fr.sae.terraria.modele.entities.player.inventory.Stack; import fr.sae.terraria.vue.View; diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java index 76f4575..74714cb 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java @@ -1,10 +1,12 @@ package fr.sae.terraria.modele.entities.player.inventory; import fr.sae.terraria.modele.entities.entity.StowableObjectType; +import fr.sae.terraria.modele.entities.items.Item; import fr.sae.terraria.modele.entities.player.Player; import javafx.beans.property.IntegerProperty; import javafx.beans.property.SimpleIntegerProperty; import javafx.collections.FXCollections; +import javafx.collections.ListChangeListener; import javafx.collections.ObservableList; import javafx.scene.input.KeyCode; diff --git a/src/main/resources/fr/sae/terraria/sound/hit.wav b/src/main/resources/fr/sae/terraria/sound/hit.wav new file mode 100644 index 0000000000000000000000000000000000000000..8b0a14f6689afe0a34a95fc329cccd6b7fefd6b0 GIT binary patch literal 82240 zcmZ^r1(+1q)~?H|ZJZh09fG^NyF+k?0R|@!+@0X=4#8a$AXtDvaL?e3_e^_t+5OgZ z_&Mjl_wqjbNdg4AtM*>{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t&}a4eUu{9ZYCx5esZ&XMsq&(XXIW!`~9L#DXw3d zwNwU*`i6M~Mq29M&ZPL(`P|!l1v3+!7v5;SN|e<3*6(khpQ`^VoG*{?{OVj^->la! z!THvvwpj^Uv;^;$>>P{gh}s;b1!>UCB7h)JzOvMuybVIPz46m@^#ijovlMyD4pr z7%9cOxipHx*hBLOQ&~VMPo>(U`%Ccu|JG8Cr+21(pWEfXD(b|(OL6`ioopnU-^OtH z|6)-tq~-@uj{eV!dea{(|MPqO?|9zAYp5Y)6qf(cI#5q7q{12~tbxKBD6E0P8YrxR z!Wt;7f&ZKuNXLr`*Z=csK<lsYudoIRYoM?O3TvRS1`2DSum%cips)rCYv4bl2K4+C z{uS0hVGR`4Kw%C1r`ABB|NlQX2I4=p&lkRTVGR`4Kw%9O)<9tm6xKjt4HVWuVGR`4 zKw%9O)<9tm6xKjt4HVWuVGR`4Kw%9O)<9tm{Qp}61N#p?u_3S5e^8%e`w!}IOjXv0 zo;7x4-JWM%bU}j-o$59{Z}jCyT{Lpc_-3)u=d`Q4&SQJGizd0r7;<9&6Wg+(9p01t z<WMFh9Lr>mb(v7>ET$j4fCT&wOy%P=D}Dy~aweU+i2Y;uBxW<tI&s*rVJw<NC;Lsq zOWAoAyPae0V!j!35!=YmO*%VWr@x)h=r>Ln&B5nz`nc!>@A~WYTm8o27e)6O868~k I(PFXx1+KZ4GXMYp literal 0 HcmV?d00001 From c9ddd6d5c29aee37f2955bbfad54871be1f6af4c Mon Sep 17 00:00:00 2001 From: theblackreaper <abouche0603@gmail.com> Date: Fri, 17 Jun 2022 10:59:58 +0200 Subject: [PATCH 94/97] =?UTF-8?q?les=20slimes=20infligent=20des=20d=C3=A9g?= =?UTF-8?q?ats=20au=20joueur?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/fr/sae/terraria/Terraria.java | 3 +++ src/main/java/fr/sae/terraria/modele/entities/Slime.java | 9 +++++++++ .../fr/sae/terraria/modele/entities/player/Player.java | 9 ++++++++- .../fr/sae/terraria/modele/entities/tools/ToolSet.java | 2 +- 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/sae/terraria/Terraria.java b/src/main/java/fr/sae/terraria/Terraria.java index d94ea92..e7bd61d 100644 --- a/src/main/java/fr/sae/terraria/Terraria.java +++ b/src/main/java/fr/sae/terraria/Terraria.java @@ -98,6 +98,9 @@ public void start(Stage stage) throws IOException stage.heightProperty().addListener((obs, oldV, newV) -> { gameController.scaleMultiplicatorHeight = ((newV.intValue()-gameController.title.getPrefHeight()) / Terraria.DISPLAY_RENDERING_HEIGHT); }); + gameController.environment.getPlayer().pvProperty().addListener((obs, oldV, newV) ->{ + + }); stage.show(); } diff --git a/src/main/java/fr/sae/terraria/modele/entities/Slime.java b/src/main/java/fr/sae/terraria/modele/entities/Slime.java index 241fa32..f3f046c 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/Slime.java +++ b/src/main/java/fr/sae/terraria/modele/entities/Slime.java @@ -13,6 +13,7 @@ public class Slime extends EntityMovable implements CollideObjectType, Collapsib { public static final int WHEN_SPAWN_A_SLIME = 2_500; public static final double SLIME_SPAWN_RATE = .2; + public static final int TIME_BEFORE_HITTING_AGAIN_THE_PLAYER = 100; public Slime(Environment environment, int x, int y) @@ -63,6 +64,14 @@ else if (environment.getPlayer().getX() < this.x.getValue()) if (!whereCollide.isEmpty()) if (whereCollide.get("left").equals(Boolean.TRUE) || whereCollide.get("right").equals(Boolean.TRUE)) this.idleOnX(); + if (environment.getPlayer().getRect().collideRect(this.getRect()) && !environment.getPlayer().getHit()){ + environment.getPlayer().setHit(true); + environment.getPlayer().setPv(environment.getPlayer().getPv() -1 ); + environment.getPlayer().setInvicibilityFrame(this.environment.getTicks()); + } + if (environment.getPlayer().getHit() && this.environment.getTicks() - environment.getPlayer().getInvicibilityFrame() == TIME_BEFORE_HITTING_AGAIN_THE_PLAYER){ + environment.getPlayer().setHit(false); + } } @Override public void move() diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java index 8343386..0701a27 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java @@ -23,6 +23,8 @@ public class Player extends EntityMovable implements CollideObjectType, Collapsi private final EnumMap<KeyCode, Boolean> keysInput; private final EnumMap<MouseButton, Boolean> mouseInput; + private Boolean hit; + private int invicibilityFrame; private final SimpleBooleanProperty drunk; @@ -33,7 +35,8 @@ public class Player extends EntityMovable implements CollideObjectType, Collapsi public Player(final Environment environment) { super(environment, 0, 0); - + this.invicibilityFrame = 0; + this.hit = false; this.drunk = new SimpleBooleanProperty(false); this.inventory = new Inventory(this); @@ -167,6 +170,10 @@ else if (key == KeyCode.Q) public Map<KeyCode, Boolean> getKeysInput() { return this.keysInput; } public Stack getStackSelected() { return this.stackSelected; } public Inventory getInventory() { return this.inventory; } + public Boolean getHit() { return hit; } + public void setHit(Boolean hit) { this.hit = hit; } + public int getInvicibilityFrame() { return invicibilityFrame; } + public void setInvicibilityFrame(int ticks2) { this.invicibilityFrame = ticks2; } public void setStackSelected(Stack stackSelected) { this.stackSelected = stackSelected; } } diff --git a/src/main/java/fr/sae/terraria/modele/entities/tools/ToolSet.java b/src/main/java/fr/sae/terraria/modele/entities/tools/ToolSet.java index 4557712..93a14b9 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/tools/ToolSet.java +++ b/src/main/java/fr/sae/terraria/modele/entities/tools/ToolSet.java @@ -8,4 +8,4 @@ public enum ToolSet PICKAXE, SWORD, ARROW -} +} \ No newline at end of file From 395e471171490f0086db0cbdc54fce35f6ae9ef5 Mon Sep 17 00:00:00 2001 From: theblackreaper <abouche0603@gmail.com> Date: Fri, 17 Jun 2022 11:38:33 +0200 Subject: [PATCH 95/97] fix health bar --- src/main/java/fr/sae/terraria/Terraria.java | 4 +++- .../java/fr/sae/terraria/modele/entities/Slime.java | 8 ++++---- .../fr/sae/terraria/modele/entities/entity/Entity.java | 2 +- .../fr/sae/terraria/modele/entities/player/Player.java | 9 +++++---- .../java/fr/sae/terraria/vue/hud/HealthBarView.java | 10 ++++++++-- 5 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/main/java/fr/sae/terraria/Terraria.java b/src/main/java/fr/sae/terraria/Terraria.java index e7bd61d..7457810 100644 --- a/src/main/java/fr/sae/terraria/Terraria.java +++ b/src/main/java/fr/sae/terraria/Terraria.java @@ -99,7 +99,9 @@ public void start(Stage stage) throws IOException gameController.scaleMultiplicatorHeight = ((newV.intValue()-gameController.title.getPrefHeight()) / Terraria.DISPLAY_RENDERING_HEIGHT); }); gameController.environment.getPlayer().pvProperty().addListener((obs, oldV, newV) ->{ - + if (newV.longValue() == 0){ + stage.close(); + } }); stage.show(); diff --git a/src/main/java/fr/sae/terraria/modele/entities/Slime.java b/src/main/java/fr/sae/terraria/modele/entities/Slime.java index f3f046c..4864112 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/Slime.java +++ b/src/main/java/fr/sae/terraria/modele/entities/Slime.java @@ -64,14 +64,14 @@ else if (environment.getPlayer().getX() < this.x.getValue()) if (!whereCollide.isEmpty()) if (whereCollide.get("left").equals(Boolean.TRUE) || whereCollide.get("right").equals(Boolean.TRUE)) this.idleOnX(); + if (environment.getPlayer().getRect().collideRect(this.getRect()) && !environment.getPlayer().getHit()){ - environment.getPlayer().setHit(true); - environment.getPlayer().setPv(environment.getPlayer().getPv() -1 ); + environment.getPlayer().hit(); environment.getPlayer().setInvicibilityFrame(this.environment.getTicks()); } - if (environment.getPlayer().getHit() && this.environment.getTicks() - environment.getPlayer().getInvicibilityFrame() == TIME_BEFORE_HITTING_AGAIN_THE_PLAYER){ + + if (environment.getPlayer().getHit() && this.environment.getTicks() - environment.getPlayer().getInvicibilityFrame() == TIME_BEFORE_HITTING_AGAIN_THE_PLAYER) environment.getPlayer().setHit(false); - } } @Override public void move() diff --git a/src/main/java/fr/sae/terraria/modele/entities/entity/Entity.java b/src/main/java/fr/sae/terraria/modele/entities/entity/Entity.java index 77633cf..272702a 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/entity/Entity.java +++ b/src/main/java/fr/sae/terraria/modele/entities/entity/Entity.java @@ -68,7 +68,7 @@ protected Entity(int x, int y) public Animation getAnimation() { return this.animation; } public Rect getRect() { return this.rect; } - public double getPvMax() { return this.pv.get(); } + public double getPvMax() { return this.pvMax; } public double getPv() { return this.pv.get(); } public double getX() { return this.x.get(); } public double getY() { return this.y.get(); } diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java index 6a9dcf1..c476ec3 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java @@ -85,7 +85,8 @@ public Player(final Environment environment) @Override public void hit() { - this.setPv(this.getPv() - 1); + this.pv.set(this.getPv() - 1); + this.hit = true; } @Override public void spawn(int x, int y) @@ -171,10 +172,10 @@ else if (key == KeyCode.Q) public Map<KeyCode, Boolean> getKeysInput() { return this.keysInput; } public Stack getStackSelected() { return this.stackSelected; } public Inventory getInventory() { return this.inventory; } - public Boolean getHit() { return hit; } - public void setHit(Boolean hit) { this.hit = hit; } + public boolean getHit() { return this.hit; } public int getInvicibilityFrame() { return invicibilityFrame; } - public void setInvicibilityFrame(int ticks2) { this.invicibilityFrame = ticks2; } public void setStackSelected(Stack stackSelected) { this.stackSelected = stackSelected; } + public void setHit(boolean b) { this.hit = b; } + public void setInvicibilityFrame(int ticks2) { this.invicibilityFrame = ticks2; } } diff --git a/src/main/java/fr/sae/terraria/vue/hud/HealthBarView.java b/src/main/java/fr/sae/terraria/vue/hud/HealthBarView.java index 4d41b99..287d219 100644 --- a/src/main/java/fr/sae/terraria/vue/hud/HealthBarView.java +++ b/src/main/java/fr/sae/terraria/vue/hud/HealthBarView.java @@ -45,9 +45,15 @@ private void displayHealthBar(double inventoryBarX, double inventoryBarY) // Modifie le cœur selon la vie du joueur player.pvProperty().addListener((obs, oldPv, newPv) -> { - if (oldPv.intValue() >= 0) { - ImageView healthView = healths[oldPv.intValue()-1]; + ImageView healthView; + if (newPv.intValue() > oldPv.intValue()) { + healthView = healths[newPv.intValue()-1]; + Rectangle2D viewPort = new Rectangle2D((healthView.getImage().getWidth()/3)*2, 0, (healthView.getImage().getWidth()/3), healthView.getImage().getHeight()); + healthView.setViewport(viewPort); + } + if (newPv.intValue() < oldPv.intValue()) { + healthView = healths[oldPv.intValue()-1]; Rectangle2D viewPort = new Rectangle2D((healthView.getImage().getWidth()/3)*0, 0, (healthView.getImage().getWidth()/3), healthView.getImage().getHeight()); healthView.setViewport(viewPort); } From 1c5cc1b0000654d12025de30440511dfbd42ee71 Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Fri, 17 Jun 2022 11:50:09 +0200 Subject: [PATCH 96/97] Fix meat ne veux pas se supprimer --- .../java/fr/sae/terraria/modele/entities/items/Item.java | 4 +++- .../java/fr/sae/terraria/modele/entities/items/Meat.java | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/sae/terraria/modele/entities/items/Item.java b/src/main/java/fr/sae/terraria/modele/entities/items/Item.java index 3ef05a0..8ca86e9 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/items/Item.java +++ b/src/main/java/fr/sae/terraria/modele/entities/items/Item.java @@ -11,7 +11,8 @@ public enum Item implements StowableObjectType SILEX, STONE, WOOD, - STICK; + STICK, + MEAT; public static boolean isCoal(StowableObjectType obj) { return obj == Item.COAL; } @@ -21,4 +22,5 @@ public enum Item implements StowableObjectType public static boolean isSilex(StowableObjectType obj) { return obj == Item.SILEX; } public static boolean isWood(StowableObjectType obj) { return obj == Item.WOOD; } public static boolean isStick(StowableObjectType obj) { return obj == Item.STICK; } + public static boolean isMeat(StowableObjectType obj) { return obj == Item.MEAT; } } diff --git a/src/main/java/fr/sae/terraria/modele/entities/items/Meat.java b/src/main/java/fr/sae/terraria/modele/entities/items/Meat.java index 37d8772..e632d8d 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/items/Meat.java +++ b/src/main/java/fr/sae/terraria/modele/entities/items/Meat.java @@ -4,6 +4,8 @@ import fr.sae.terraria.modele.entities.entity.ConsumableObjectType; import fr.sae.terraria.modele.entities.entity.StowableObjectType; import fr.sae.terraria.modele.entities.player.Player; +import fr.sae.terraria.modele.entities.player.inventory.Inventory; +import fr.sae.terraria.modele.entities.player.inventory.Stack; public class Meat implements ConsumableObjectType, StowableObjectType @@ -21,8 +23,11 @@ public Meat(final Environment environment) { Environment.playSound("sound/eat.wav", false); - Player player = environment.getPlayer(); + Player player = this.environment.getPlayer(); if (player.getPv() < player.getPvMax()) player.setPv(player.getPv() + 1); + + Inventory inventory = player.getInventory(); + inventory.get().get(inventory.getPosCursor()).remove(); } } From 089f86527de2d32fd4e6c7128db00969168b5d50 Mon Sep 17 00:00:00 2001 From: NaulaN <nonochrzaszcz@gmail.com> Date: Fri, 17 Jun 2022 12:07:25 +0200 Subject: [PATCH 97/97] =?UTF-8?q?Ajout=20de=20l'animation=20d'invincibilit?= =?UTF-8?q?=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sae/terraria/modele/entities/Slime.java | 6 ++--- .../terraria/modele/entities/items/Meat.java | 1 - .../modele/entities/player/Player.java | 27 ++++++++++--------- .../entities/player/inventory/Inventory.java | 2 -- .../sae/terraria/vue/entities/PlayerView.java | 20 ++++++++++++++ 5 files changed, 38 insertions(+), 18 deletions(-) diff --git a/src/main/java/fr/sae/terraria/modele/entities/Slime.java b/src/main/java/fr/sae/terraria/modele/entities/Slime.java index 4864112..c2318be 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/Slime.java +++ b/src/main/java/fr/sae/terraria/modele/entities/Slime.java @@ -2,6 +2,7 @@ import fr.sae.terraria.modele.Environment; import fr.sae.terraria.modele.entities.entity.*; +import fr.sae.terraria.modele.entities.player.Player; import fr.sae.terraria.modele.entities.player.inventory.Stack; import fr.sae.terraria.modele.entities.tools.Tool; @@ -13,7 +14,6 @@ public class Slime extends EntityMovable implements CollideObjectType, Collapsib { public static final int WHEN_SPAWN_A_SLIME = 2_500; public static final double SLIME_SPAWN_RATE = .2; - public static final int TIME_BEFORE_HITTING_AGAIN_THE_PLAYER = 100; public Slime(Environment environment, int x, int y) @@ -67,10 +67,10 @@ else if (environment.getPlayer().getX() < this.x.getValue()) if (environment.getPlayer().getRect().collideRect(this.getRect()) && !environment.getPlayer().getHit()){ environment.getPlayer().hit(); - environment.getPlayer().setInvicibilityFrame(this.environment.getTicks()); + environment.getPlayer().setInvisibilityFrame(this.environment.getTicks()); } - if (environment.getPlayer().getHit() && this.environment.getTicks() - environment.getPlayer().getInvicibilityFrame() == TIME_BEFORE_HITTING_AGAIN_THE_PLAYER) + if (environment.getPlayer().getHit() && this.environment.getTicks() - environment.getPlayer().getInvisibilityFrame() == Player.TIME_BEFORE_HITTING_AGAIN_THE_PLAYER) environment.getPlayer().setHit(false); } diff --git a/src/main/java/fr/sae/terraria/modele/entities/items/Meat.java b/src/main/java/fr/sae/terraria/modele/entities/items/Meat.java index e632d8d..d5e8e8f 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/items/Meat.java +++ b/src/main/java/fr/sae/terraria/modele/entities/items/Meat.java @@ -5,7 +5,6 @@ import fr.sae.terraria.modele.entities.entity.StowableObjectType; import fr.sae.terraria.modele.entities.player.Player; import fr.sae.terraria.modele.entities.player.inventory.Inventory; -import fr.sae.terraria.modele.entities.player.inventory.Stack; public class Meat implements ConsumableObjectType, StowableObjectType diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java index c476ec3..4006313 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/Player.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/Player.java @@ -3,10 +3,10 @@ import fr.sae.terraria.modele.Environment; import fr.sae.terraria.modele.TileMaps; import fr.sae.terraria.modele.entities.entity.*; -import fr.sae.terraria.modele.entities.items.Item; import fr.sae.terraria.modele.entities.player.inventory.Inventory; import fr.sae.terraria.modele.entities.player.inventory.Stack; import fr.sae.terraria.vue.View; +import javafx.beans.property.BooleanProperty; import javafx.beans.property.SimpleBooleanProperty; import javafx.geometry.Rectangle2D; import javafx.scene.image.Image; @@ -20,24 +20,26 @@ public class Player extends EntityMovable implements CollideObjectType, CollapsibleObjectType, SpawnableObjectType { + public static final int TIME_BEFORE_HITTING_AGAIN_THE_PLAYER = 100; public static final int BREAK_BLOCK_DISTANCE = 1; private final EnumMap<KeyCode, Boolean> keysInput; private final EnumMap<MouseButton, Boolean> mouseInput; - private Boolean hit; - private int invicibilityFrame; - private final SimpleBooleanProperty drunk; + private final BooleanProperty drunk; + private final BooleanProperty hit; private final Inventory inventory; private Stack stackSelected; + private int invisibilityFrame; + public Player(final Environment environment) { super(environment, 0, 0); - this.invicibilityFrame = 0; - this.hit = false; + this.invisibilityFrame = 0; + this.hit = new SimpleBooleanProperty(false); this.drunk = new SimpleBooleanProperty(false); this.inventory = new Inventory(this); @@ -86,7 +88,7 @@ public Player(final Environment environment) @Override public void hit() { this.pv.set(this.getPv() - 1); - this.hit = true; + this.hit.set(true); } @Override public void spawn(int x, int y) @@ -165,17 +167,18 @@ else if (key == KeyCode.Q) public void pickup(StowableObjectType pickupObj) { if (!Objects.isNull(pickupObj)) this.inventory.put(pickupObj); } - public SimpleBooleanProperty drunkProperty() { return drunk; } + public BooleanProperty drunkProperty() { return this.drunk; } + public BooleanProperty hitProperty() { return this.hit; } public Map<MouseButton, Boolean> getMouseInput() { return this.mouseInput; } public Map<KeyCode, Boolean> getKeysInput() { return this.keysInput; } public Stack getStackSelected() { return this.stackSelected; } public Inventory getInventory() { return this.inventory; } - public boolean getHit() { return this.hit; } - public int getInvicibilityFrame() { return invicibilityFrame; } + public boolean getHit() { return this.hit.get(); } + public int getInvisibilityFrame() { return invisibilityFrame; } public void setStackSelected(Stack stackSelected) { this.stackSelected = stackSelected; } - public void setHit(boolean b) { this.hit = b; } - public void setInvicibilityFrame(int ticks2) { this.invicibilityFrame = ticks2; } + public void setHit(boolean b) { this.hit.set(b); } + public void setInvisibilityFrame(int ticks2) { this.invisibilityFrame = ticks2; } } diff --git a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java index 74714cb..76f4575 100644 --- a/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java +++ b/src/main/java/fr/sae/terraria/modele/entities/player/inventory/Inventory.java @@ -1,12 +1,10 @@ package fr.sae.terraria.modele.entities.player.inventory; import fr.sae.terraria.modele.entities.entity.StowableObjectType; -import fr.sae.terraria.modele.entities.items.Item; import fr.sae.terraria.modele.entities.player.Player; import javafx.beans.property.IntegerProperty; import javafx.beans.property.SimpleIntegerProperty; import javafx.collections.FXCollections; -import javafx.collections.ListChangeListener; import javafx.collections.ObservableList; import javafx.scene.input.KeyCode; diff --git a/src/main/java/fr/sae/terraria/vue/entities/PlayerView.java b/src/main/java/fr/sae/terraria/vue/entities/PlayerView.java index 8b2692a..82187d1 100644 --- a/src/main/java/fr/sae/terraria/vue/entities/PlayerView.java +++ b/src/main/java/fr/sae/terraria/vue/entities/PlayerView.java @@ -1,9 +1,13 @@ package fr.sae.terraria.vue.entities; +import fr.sae.terraria.Terraria; import fr.sae.terraria.modele.entities.player.Player; import fr.sae.terraria.vue.View; +import javafx.animation.KeyFrame; +import javafx.animation.Timeline; import javafx.geometry.Rectangle2D; import javafx.scene.image.Image; +import javafx.util.Duration; public class PlayerView extends EntityView @@ -27,6 +31,22 @@ public PlayerView(final Player player, double scaleMultiplicatorWidth, double sc this.widthPlayer = (int) this.playerIdleImg.getWidth(); this.heightPlayer = (int) this.playerIdleImg.getHeight(); + + boolean[] visible = new boolean[] {true}; + player.hitProperty().addListener((obs, oldBool, newBool) -> { + if (newBool.booleanValue()) { + Timeline timeLine = new Timeline(); + timeLine.setCycleCount(8); + + KeyFrame key = new KeyFrame(Duration.seconds((Player.TIME_BEFORE_HITTING_AGAIN_THE_PLAYER * Terraria.TARGET_FPS)/8), b -> { + visible[0] = !visible[0]; + this.imgView.setVisible(visible[0]); + }); + + timeLine.getKeyFrames().add(key); + timeLine.play(); + } + }); } @Override protected void animation(int frame)