Commit 51158618 authored by Theodore Lopez's avatar Theodore Lopez

minor changes and comment

parent ff03ce2b
package artificial_intelligence.AIEntities;
import core.gamestate.Being;
import core.gamestate.Entity;
import core.gamestate.GameContent;
import core.gamestate.GameState;
......@@ -79,9 +80,9 @@ public abstract class AbstractEntity extends Thread {
double dmin =0 ;
double dmax = 32*15; // tiles of length 32 : so 15 tiles
int victim = -1;
List<Entity> entityList=gameState.getAllEntities();
List<Being> entityList=gameState.getAllBeings();
for (int i=0;i<entityList.size();i++) {
Entity act_entity = entityList.get(i);
Being act_entity = entityList.get(i);
if (act_entity.getFaction() == 1) { // if act_entity is a player
//euclidian distance and distance of manathan
//double d = sqrt((act_entity.getX() - this.relayer.getCharacter().getX())*(act_entity.getX() - this.relayer.getCharacter().getX()) + (act_entity.getY() - this.relayer.getCharacter().getY())*(act_entity.getY() - this.relayer.getCharacter().getY()));
......@@ -119,7 +120,6 @@ public abstract class AbstractEntity extends Thread {
public void move_to_victim(Entity victim_i){
List<Entity> entityList=gameState.getAllEntities();
Entity victim= (victim_i);
// X is UP-DOWN
int Delta_x = this.relayer.getCharacter().getX()-victim.getX();
......@@ -145,7 +145,6 @@ public abstract class AbstractEntity extends Thread {
}
public void run_from_victim(Entity victim_i){ //same then move_to_victim we just inverted the directions
List<Entity> entityList=gameState.getAllEntities();
Entity victim= (victim_i);
// X is UP-DOWN
int Delta_x = this.relayer.getCharacter().getX()-victim.getX();
......
......@@ -5,8 +5,6 @@ import core.abilities.effects.*;
import core.gamestate.Entity;
import core.gamestate.EntityNotFoundExeption;
import core.gamestate.GameContent;
import core.gamestate.GameState;
import core.gamestate.Character;
import java.util.ArrayList;
import java.util.Arrays;
......
......@@ -3,10 +3,13 @@ package core.event;
import core.gamestate.GameContent;
import map_generation.map.Map;
/*
* This Event notify the client that the map has changed
* by Theodore LOPEZ and Arnaud Guerquin
* */
public class MapChangeEvent implements Event {
/**
*
*/
private static final long serialVersionUID = 1L;
Map map;
......
......@@ -10,6 +10,7 @@ import gameloop.DummyLocalGameLoop;
* Created by dupriez on 22/11/15.
*
* An Event that changes the map and the gameState
* Effectively used for creating the first map
*
*/
public class MapInit implements ClientEvent, Serializable {
......
package core.event;
import core.abilities.effects.Effect;
import core.gamestate.*;
import core.gamestate.Character;
import core.relayer.RelayerEntity;
import core.zone.Direction;
import core.zone.Point;
import core.zone.Translation;
import gameloop.DummyLocalGameLoop;
import java.util.List;
/**
* Created by hilaire on 06/01/16.
*
......@@ -28,9 +22,8 @@ public class SpawnGold implements ClientEvent,ServerEvent {
@Override
public boolean execute(GameContent gameContent) throws InterruptedException {
Entity target = null;
try {
target = gameContent.getGameState().getEntity(targetID);
gameContent.getGameState().getEntity(targetID);
Character charac = null;
try {
......@@ -44,15 +37,6 @@ public class SpawnGold implements ClientEvent,ServerEvent {
entity.setOwned_character(targetID);
gameContent.getGameState().addEntity(entity);
gameContent.addTriggerToCheck(entity);
RelayerEntity relayer = new RelayerEntity(entity.getID(),entity,gameContent);
entity.setRelayer(relayer);
if(DummyLocalGameLoop.getInstance().getFollowedRelayer().getDirection() != Direction.NONE) {
relayer.move(DummyLocalGameLoop.getInstance().getFollowedRelayer().getDirection());
}
else{
relayer.move(charac.getDirection());
}
relayer.start();
return true;
} catch (EntityNotFoundExeption entityNotFoundExeption) {
......
package core.event;
import core.gamestate.EntityNotFoundExeption;
import core.gamestate.GameContent;
/**
......
package core.event;
import artificial_intelligence.AIControler;
import core.gamestate.EntityNotFoundExeption;
import core.gamestate.GameContent;
/**
......
Markdown is supported
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