updated javadoc syntax in some places, add javadoc to game.player and game.weapon

This commit is contained in:
Quentin Legot 2021-12-08 19:09:58 +01:00
parent 8415739d18
commit 848fccbefd
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)
*/ */
List<Point> getValidPoint(); List<Point> getValidPoint();

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

@ -86,7 +86,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

@ -3,11 +3,18 @@ package fr.lnl.game.server.games.player;
import fr.lnl.game.server.games.action.Action; import fr.lnl.game.server.games.action.Action;
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 abstract Action choseAction(); public abstract Action choseAction();
} }

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

@ -12,6 +12,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 choseAction() { public Action choseAction() {
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;