Merge pull request #2 from quentinlegot/conflit-2

updated javadoc syntax in some places, add javadoc to game.player and…
This commit is contained in:
Quentin Legot 2021-12-08 19:11:45 +01:00 committed by GitHub
commit 66cdda1304
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 47 additions and 2 deletions

View File

@ -19,7 +19,7 @@ public interface Action {
boolean isPossible(); boolean isPossible();
/** /**
* Used by {@link Move}, {@link Shot} and {@link DropObject} to list all direction when the action is possible * Used by {@link Move}, {@link Shot} and {@link DropObject} to list all direction where the action is possible
* @return a list a point where the action is possible (not block by a wall per example) * @return a list a point where the action is possible (not block by a wall per example)
*/ */
Point getPoint(); Point getPoint();

View File

@ -0,0 +1,4 @@
/**
* Package containing all about Grid construction
*/
package fr.lnl.game.server.games.grid.build;

View File

@ -0,0 +1,4 @@
/**
* Package containing all the elements that can be arranged in a grid
*/
package fr.lnl.game.server.games.grid.elements;

View File

@ -0,0 +1,4 @@
/**
* Package containing all about Grid components
*/
package fr.lnl.game.server.games.grid;

View File

@ -107,7 +107,7 @@ public abstract class AbstractPlayer implements Player {
@Override @Override
public void setPosition(Point position){ public void setPosition(/* NotNull */ Point position){
if(position == null){ if(position == null){
throw new IllegalArgumentException("Position is null"); throw new IllegalArgumentException("Position is null");
} }

View File

@ -3,6 +3,9 @@ package fr.lnl.game.server.games.player;
import fr.lnl.game.server.games.weapon.Firearm; import fr.lnl.game.server.games.weapon.Firearm;
import fr.lnl.game.server.games.weapon.Weapon; import fr.lnl.game.server.games.weapon.Weapon;
/**
* ClassPlayer contains all data about the cost of an action or the cost of a damage
*/
public enum ClassPlayer { public enum ClassPlayer {
DEFAULT(800, 25, 20, 30, 40, 10, 80, 40, 20, 15, new Firearm()), DEFAULT(800, 25, 20, 30, 40, 10, 80, 40, 20, 15, new Firearm()),

View File

@ -5,12 +5,19 @@ import fr.lnl.game.server.games.action.Action;
import fr.lnl.game.server.games.action.Nothing; import fr.lnl.game.server.games.action.Nothing;
import fr.lnl.game.server.utils.Point; import fr.lnl.game.server.utils.Point;
/**
* Super class of all Computer players
*/
public abstract class ComputerPlayer extends AbstractPlayer { public abstract class ComputerPlayer extends AbstractPlayer {
public ComputerPlayer(Integer id, Point point, ClassPlayer classPlayer) { public ComputerPlayer(Integer id, Point point, ClassPlayer classPlayer) {
super(id, point, false, classPlayer); super(id, point, false, classPlayer);
} }
/**
* Call when an AI need to choose an action to execute
* @return the chosen action
*/
public Action choseAction(Game game){ public Action choseAction(Game game){
Action action; Action action;
switch (getActions().size()){ switch (getActions().size()){

View File

@ -2,6 +2,11 @@ package fr.lnl.game.server.games.player;
import fr.lnl.game.server.utils.Point; import fr.lnl.game.server.utils.Point;
/**
* Instance of Human Player.<br>
* A human player choose an action to execute by using mouse or keyboard.<br>
* Human Player don't implement choseAction cause this method is executed on client part
*/
public class HumanPlayer extends AbstractPlayer { public class HumanPlayer extends AbstractPlayer {
public HumanPlayer(Integer id, Point point, ClassPlayer classPlayer) { public HumanPlayer(Integer id, Point point, ClassPlayer classPlayer) {

View File

@ -14,6 +14,10 @@ public class RandomComputerPlayer extends ComputerPlayer {
super(id,point, classPlayer); super(id,point, classPlayer);
} }
/**
* Choose an action fully randomly
* @return an action between all available
*/
@Override @Override
public Action strategy(Game game) { public Action strategy(Game game) {
Action action = null; Action action = null;

View File

@ -0,0 +1,4 @@
/**
* Package storing all players classes and as well AI behavior
*/
package fr.lnl.game.server.games.player;

View File

@ -4,8 +4,14 @@ public interface Weapon {
int getBullet(); int getBullet();
/**
* @return distance a bullet can go horizontally
*/
int getHorizontalDistance(); int getHorizontalDistance();
/**
* @return distance a bullet can go vertically
*/
int getVerticalDistance(); int getVerticalDistance();
} }

View File

@ -0,0 +1,4 @@
/**
* Package containing all bout player's weapons
*/
package fr.lnl.game.server.games.weapon;