Commit cd34735b authored by Lucas Delcros's avatar Lucas Delcros
parents bcb9d28b a8b4fe4c
......@@ -40,7 +40,11 @@ public class IGPEntity extends AbstractEntity {
int sX = relayer.getCharacter().getX();
int sY = relayer.getCharacter().getY();
Direction dir = AI.alpha_star(map,sX, sY, dX, dY,map.getWidth(),map.getHeight());
this.relayer.move(dir);
if (relayer.getCharacter().getCollisionBox().intersect(victim.getCollisionBox())) {
this.relayer.move(Direction.NONE);
} else {
this.relayer.move(dir);
}
this.relayer.tryToCastAbility(0);
break;
case "proteger":
......@@ -67,15 +71,20 @@ public class IGPEntity extends AbstractEntity {
}
}
}
int tardX = entityList.get(newvictim).getX();
int tardY = entityList.get(newvictim).getY();
Direction dir2 = AI.alpha_star(map,sX2, sY2, tardX, tardY,map.getWidth(),map.getHeight());
this.relayer.move(dir2);
this.relayer.tryToCastAbility(0);
if (newvictim != -1) {
int tardX = entityList.get(newvictim).getX();
int tardY = entityList.get(newvictim).getY();
Direction dir2 = AI.alpha_star(map,sX2, sY2, tardX, tardY,map.getWidth(),map.getHeight());
if (relayer.getCharacter().getCollisionBox().intersect(entityList.get(newvictim).getCollisionBox())) {
this.relayer.move(Direction.NONE);
} else {
this.relayer.move(dir2);
}
this.relayer.tryToCastAbility(0);
}
break;
case "soigner" :
/*TODO : Soigner victim */
break;
default:
Entity owner =null;
try {
......@@ -88,7 +97,11 @@ public class IGPEntity extends AbstractEntity {
int sX3 = relayer.getCharacter().getX();
int sY3 = relayer.getCharacter().getY();
Direction dir3 = AI.alpha_star(map,sX3, sY3, dX3, dY3,map.getWidth(),map.getHeight());
this.relayer.move(dir3);
if (relayer.getCharacter().getCollisionBox().intersect(owner.getCollisionBox())) {
this.relayer.move(Direction.NONE);
} else {
this.relayer.move(dir3);
}this.relayer.move(dir3);
}
}
}
......@@ -209,7 +209,8 @@ public class IGPpanel extends graphics.guiSkeleton.guiPanel.GUIPanel{
}
BehaviourHolder.getInstance().SetFollowerBehaviour(fob);
getGraphicsMaster().changeGUIStateTo(GraphicsMaster.GUIStates.MAIN_MENU);
BehaviourHolder.getInstance().GetFollowerBehaviour().PrintElements();
/* Print the instruction, used for tests
BehaviourHolder.getInstance().GetFollowerBehaviour().PrintElements(); */
}
};
......
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