Fix missing javadoc tags

Make enemy AI a little bit slower

Signed-off-by: Chris Cromer <chris@cromer.cl>
This commit is contained in:
Chris Cromer 2019-10-21 14:52:47 -03:00
parent cbcb6d0d01
commit 7744b5ae6d
4 changed files with 20 additions and 24 deletions

View File

@ -82,21 +82,6 @@ plugins.withType(DistributionPlugin) {
} }
} }
task createDocs {
def docs = file("$buildDir/docs")
outputs.dir docs
}
distributions {
main {
contents {
from(createDocs) {
into 'docs'
}
}
}
}
wrapper { wrapper {
gradleVersion = '5.6.2' gradleVersion = '5.6.2'
} }

View File

@ -215,7 +215,7 @@ public class EnemyAI extends AI implements Runnable, Constants {
public void run() { public void run() {
while (getActive()) { while (getActive()) {
try { try {
Thread.sleep(600); Thread.sleep(700);
} }
catch (InterruptedException e) { catch (InterruptedException e) {
logger.info(e.getMessage()); logger.info(e.getMessage());

View File

@ -89,6 +89,7 @@ public interface PlayerAI extends Runnable, Constants {
* @return Returns the new sorted destinations * @return Returns the new sorted destinations
*/ */
default List<State> sortDestinations(List<State> destinations, State initial) { default List<State> sortDestinations(List<State> destinations, State initial) {
// TODO: make the AI look for the goal farthest from the enemy
destinations.sort((state1, state2) -> { destinations.sort((state1, state2) -> {
if (state1.getImportance() > state2.getImportance()) { if (state1.getImportance() > state2.getImportance()) {
// The first state is more important // The first state is more important

View File

@ -59,14 +59,16 @@ public class Player extends Object implements Constants {
super(scene, cell); super(scene, cell);
setLogger(getLogger(this.getClass(), LogLevel.PLAYER)); setLogger(getLogger(this.getClass(), LogLevel.PLAYER));
loadPlayerAnimation(); loadPlayerAnimation();
if (PLAYER_AI == PlayerAIType.ASTAR) { switch (PLAYER_AI) {
case ASTAR:
ai = new PlayerAStarAI(scene, this); ai = new PlayerAStarAI(scene, this);
} break;
else if (PLAYER_AI == PlayerAIType.BFS) { case BFS:
ai = new PlayerBreadthFirstAI(scene, this); ai = new PlayerBreadthFirstAI(scene, this);
} break;
else { default:
ai = null; ai = null;
break;
} }
} }
@ -130,6 +132,8 @@ public class Player extends Object implements Constants {
/** /**
* Move the player up * Move the player up
*
* @return Returns true if the player moved
*/ */
@Override @Override
protected boolean moveUp() { protected boolean moveUp() {
@ -188,6 +192,8 @@ public class Player extends Object implements Constants {
/** /**
* Move the player down * Move the player down
*
* @return Returns true if the player moved
*/ */
@Override @Override
protected boolean moveDown() { protected boolean moveDown() {
@ -241,6 +247,8 @@ public class Player extends Object implements Constants {
/** /**
* Move the player to the left * Move the player to the left
*
* @return Returns true if the player moved
*/ */
@Override @Override
protected boolean moveLeft() { protected boolean moveLeft() {
@ -294,6 +302,8 @@ public class Player extends Object implements Constants {
/** /**
* Move the player to the right * Move the player to the right
*
* @return Returns true if the player moved
*/ */
@Override @Override
protected boolean moveRight() { protected boolean moveRight() {