Commit a77cd37a authored by Arnaud Guerquin's avatar Arnaud Guerquin
Browse files

Merge branch 'master' of gitlab.crans.org:genie_logiciel_2015/the_dungeon_project

parents bf243270 175d7172
No preview for this file type
......@@ -43,6 +43,10 @@ public class AIControler {
break;
case Follower:
ai = new IGPEntity(gameContent,dmr);
break;
case Straight:
ai = new StraightEntity(gameContent,dmr);
break;
default:
LOGGER.severe("Trying to instanciate unrecognized type of AI.");
break;
......
......@@ -76,7 +76,7 @@ public abstract class AbstractEntity extends Thread {
*/
public int Choose_victim(){
float dmin =0 ;
float dmax = 10000000;
float dmax = 100000;
int victim = -1;
List<Entity> entityList=gameState.getAllEntities();
for (int i=0;i<entityList.size();i++) {
......@@ -118,11 +118,11 @@ public abstract class AbstractEntity extends Thread {
double r = random() % 2;
if(r==0){
this.relayer.move(Direction.LEFT);
System.out.print("pas mal");
System.out.println("pas mal");
}
else{
this.relayer.move(Direction.RIGHT);
System.out.print("pas mal");
System.out.println("pas mal");
}
}
}
......@@ -132,11 +132,11 @@ public abstract class AbstractEntity extends Thread {
double r = random() % 2;
if(r==0){
this.relayer.move(Direction.LEFT);
System.out.print("pas mal");
System.out.println("pas mal");
}
else{
this.relayer.move(Direction.RIGHT);
System.out.print("pas mal");
System.out.println("pas mal");
}
}
}
......@@ -196,6 +196,23 @@ public abstract class AbstractEntity extends Thread {
}
public void random_move(){
double r = random();
if(r<0.25){
this.relayer.move(Direction.RIGHT);
}
else {
if (r < 0.5) {
this.relayer.move(Direction.UP);
} else {
if (r < 0.75) {
this.relayer.move(Direction.DOWN);
} else {
this.relayer.move(Direction.LEFT);
}
}
}
}
/**
* This is the function sequentially called by run.
* The behaviour of the AI is implemented here.
......
......@@ -9,6 +9,8 @@ import logging.Logging;
import java.util.List;
import static java.lang.Math.random;
/**
* Created by Yann RAMUSAT on 30/12/15.
*/
......@@ -33,11 +35,11 @@ public class BasicEntity extends AbstractEntity {
public void act() {
// basic targeting and pathfinding
int victim_i = this.Choose_victim();
/*if (victim_i!=-1) {
this.move_to_victim(gameState.getAllEntities().get(this.Choose_victim()));
}*/
// A*
List<Entity> entityList=gameState.getAllEntities();
int dX = entityList.get(this.Choose_victim()).getX();
......
......@@ -7,5 +7,6 @@ public enum EnumBehaviourType {
Agressive,
Basic,
Defender,
Follower;
Follower,
Straight;
}
package artificial_intelligence.AIEntities;
import artificial_intelligence.AlphaStar.AI;
import core.gamestate.Entity;
import core.gamestate.GameContent;
import core.relayer.Relayer;
import core.zone.Direction;
import logging.Logging;
import java.util.List;
import static java.lang.Math.random;
/**
* Created by Yann RAMUSAT on 30/12/15.
*/
public class StraightEntity extends AbstractEntity {
/**
* Instanciate a basic AI given as context a GameContent and a Relayer to contact.
*
* This use the classes used by the network.
*
* @param gameContent the actual content of the game. Map + Entities.
* @param relayer the relayer to contact.
*/
public StraightEntity(GameContent gameContent, Relayer relayer) {
super(gameContent, relayer);
}
/**
* This is the function sequentially called by run.
* The behaviour of the basic AI is implemented here.
*/
@Override
public void act() {
// basic targeting and pathfinding
int victim_i = this.Choose_victim();
if (victim_i!=-1) {
double r = random();
if(r<0.9){
this.move_to_victim(gameState.getAllEntities().get(this.Choose_victim()));
}
else{
this.random_move();
}
}
// A*
/*List<Entity> entityList=gameState.getAllEntities();
int dX = entityList.get(this.Choose_victim()).getX();
int dY = entityList.get(this.Choose_victim()).getY();
int sX = relayer.getCharacter().getX();
int sY = relayer.getCharacter().getY();
Direction dir = AI.alpha_star(sX, sY, dX, dY,map.getWidth(),map.getHeight());
//Logging.getInstance().getLogger().info(dir.toString());
this.relayer.move(dir);*/
// attack
this.relayer.tryToCastAbility(0);
}
}
src/assets/firebolt.png

2.65 KB | W: | H:

src/assets/firebolt.png

2.65 KB | W: | H:

src/assets/firebolt.png
src/assets/firebolt.png
src/assets/firebolt.png
src/assets/firebolt.png
  • 2-up
  • Swipe
  • Onion skin
number of patterns : 4
number of monsters : 3
Ronflex
Ponyta
Diagla
id : 1
nom : fullMonster1
1
0
0
id : 2
nom : fullMonster2
0
1
0
id : 3
nom : fullMonster3
0
0
1
id : 4
nom : equilibria
1
1
1
\ No newline at end of file
......@@ -178,6 +178,4 @@ public class Being extends Entity {
boolean hackGamestate(GameState gameState) throws InterruptedException {
return gameState.addEntity(this);
}
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment