From ded85187420dbf09a933e21feadfae077d9a647b Mon Sep 17 00:00:00 2001 From: Elred19 <65461188+Elred19@users.noreply.github.com> Date: Thu, 21 May 2020 22:26:00 +0200 Subject: [PATCH] Adaptation magasin + methode checkdurability --- src/mob/Player.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/mob/Player.java b/src/mob/Player.java index f0362ba..0776aae 100644 --- a/src/mob/Player.java +++ b/src/mob/Player.java @@ -23,7 +23,7 @@ public Player(Game game, Vector position) { game.scene.addEventFilter(KeyEvent.KEY_PRESSED, keyPressedEventHandler); game.scene.addEventFilter(KeyEvent.KEY_RELEASED, keyReleasedEventHandler); - weapon = new Spear(); + weapon = new Spear(20); bag = new Bag(game); } @@ -53,7 +53,8 @@ public void openShop() { Shop shop = new Shop(10); Scene shopScene = new Scene(shop); shop.setGame(game); - shop.addGoodies(((Dealer) obj).getStore()); + shop.printStore(new Dealer(game,new Vector(0,0)), this.bag); + //shop.addGoodies(((Dealer) obj).getStore()); game.stage.setScene(shopScene); } } @@ -64,5 +65,15 @@ public void openShop() { public Vector move() { return new Vector((controls[2] - controls[0]) * speed, (controls[3] - controls[1]) * speed); } - + public Weapon getWeapon() { + return(this.weapon); + } + public Bag getBag() { + return(this.bag); + } + public void checkDurability(Weapon weapon) { + if(weapon.getDurability() == 0) { //Penser à enlever -1 en durabilité à chaque appel de la fonction attaquer() dans player + this.weapon = new Hand(); + } + } }