Finalisation des classes DeployShield, DropBomb et DropMine
This commit is contained in:
parent
ce39edaead
commit
d6f2217554
@ -1,6 +1,7 @@
|
|||||||
package fr.lnl.game.server.games.action;
|
package fr.lnl.game.server.games.action;
|
||||||
|
|
||||||
import fr.lnl.game.server.games.Game;
|
import fr.lnl.game.server.games.Game;
|
||||||
|
import fr.lnl.game.server.games.player.Player;
|
||||||
|
|
||||||
public class DeployShield extends AbstractAction {
|
public class DeployShield extends AbstractAction {
|
||||||
public DeployShield(Game game){
|
public DeployShield(Game game){
|
||||||
@ -9,8 +10,9 @@ public class DeployShield extends AbstractAction {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doAction(){
|
public void doAction(){
|
||||||
getGame().getCurrentPlayer().setShieldDeploy(true);
|
Player player = getGame().getCurrentPlayer();
|
||||||
//TO-DO retirer les point du player
|
player.setShieldDeploy(true);
|
||||||
|
player.decrementEnergy(player.getClassPlayer().getShieldCost());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
package fr.lnl.game.server.games.action;
|
package fr.lnl.game.server.games.action;
|
||||||
|
|
||||||
import fr.lnl.game.server.games.Game;
|
import fr.lnl.game.server.games.Game;
|
||||||
|
import fr.lnl.game.server.games.grid.Bomb;
|
||||||
|
import fr.lnl.game.server.games.grid.Mine;
|
||||||
|
import fr.lnl.game.server.games.player.Player;
|
||||||
import fr.lnl.game.server.utils.Point;
|
import fr.lnl.game.server.utils.Point;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class DropBomb extends DropObject {
|
public class DropBomb extends DropObject {
|
||||||
|
|
||||||
@ -11,9 +15,15 @@ public class DropBomb extends DropObject {
|
|||||||
super(game);
|
super(game);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//voir pour la redondance de code au niveau de DropBomb,DropObject,DropMine
|
||||||
@Override
|
@Override
|
||||||
public void doAction() {
|
public void doAction() {
|
||||||
|
List<Point> points = getValidPoint();
|
||||||
|
Random random = new Random();
|
||||||
|
Point point = points.get(random.nextInt(0,points.size()-1));
|
||||||
|
getGame().getGrid().getBoard().get(point).setB(new Bomb());
|
||||||
|
Player player = getGame().getCurrentPlayer();
|
||||||
|
player.decrementEnergy(player.getClassPlayer().getBombCost());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -2,6 +2,7 @@ package fr.lnl.game.server.games.action;
|
|||||||
|
|
||||||
import fr.lnl.game.server.games.Game;
|
import fr.lnl.game.server.games.Game;
|
||||||
import fr.lnl.game.server.games.grid.Mine;
|
import fr.lnl.game.server.games.grid.Mine;
|
||||||
|
import fr.lnl.game.server.games.player.Player;
|
||||||
import fr.lnl.game.server.utils.Point;
|
import fr.lnl.game.server.utils.Point;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -16,9 +17,9 @@ public class DropMine extends DropObject {
|
|||||||
List<Point> points = getValidPoint();
|
List<Point> points = getValidPoint();
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
Point point = points.get(random.nextInt(0,points.size()-1));
|
Point point = points.get(random.nextInt(0,points.size()-1));
|
||||||
Mine mine = new Mine();
|
getGame().getGrid().getBoard().get(point).setB(new Mine());
|
||||||
getGame().getGrid().getBoard().get(point).setB(mine);
|
Player player = getGame().getCurrentPlayer();
|
||||||
//TO-DO : retirer les points au player
|
player.decrementEnergy(player.getClassPlayer().getMineCost());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user