Skip to content
Snippets Groups Projects
Commit ed22d88d authored by CARION Baptiste's avatar CARION Baptiste
Browse files

Honnetement je suis pas sur de ce commit, mais je peux pas pull sans le faire

parents aae48ca5 0233c3e3
No related branches found
No related tags found
No related merge requests found
...@@ -24,7 +24,7 @@ public class Crown extends Items{ ...@@ -24,7 +24,7 @@ public class Crown extends Items{
this.setItemCase(null); this.setItemCase(null);
System.out.println(item.getName()); System.out.println(item.getName());
unite.setItem(item); unite.setItem(item);
unite.setSymbol('c'); unite.setSymbol('');
unite.getPlateau().getCase(unite.getX(), unite.getY()).setItem(null); unite.getPlateau().getCase(unite.getX(), unite.getY()).setItem(null);
} }
......
...@@ -104,7 +104,7 @@ public class Case { ...@@ -104,7 +104,7 @@ public class Case {
return "~ "; return "~ ";
} }
else if (this.getItem() != null && this.getItem().getName().equalsIgnoreCase("crown")) { else if (this.getItem() != null && this.getItem().getName().equalsIgnoreCase("crown")) {
return "c "; return " ";
} }
else if (this.type == Type.GRASS) { else if (this.type == Type.GRASS) {
return ". "; return ". ";
...@@ -114,6 +114,7 @@ public class Case { ...@@ -114,6 +114,7 @@ public class Case {
} }
else if (this.type == Type.FORT) { else if (this.type == Type.FORT) {
return "♜ "; return "♜ ";
//return "♖ ";
} }
else if (this.type == Type.CAMP) { else if (this.type == Type.CAMP) {
return "O "; return "O ";
......
package units; package units;
import java.util.List;
import java.util.Random; import java.util.Random;
import events.Evenements;
import items.Items; import items.Items;
import main.Case; import main.Case;
import main.Joueur; import main.Joueur;
...@@ -21,6 +23,7 @@ public abstract class Unite { ...@@ -21,6 +23,7 @@ public abstract class Unite {
private Joueur joueur; private Joueur joueur;
private Items item; private Items item;
private Type temp = Type.GRASS; private Type temp = Type.GRASS;
private Type temp2 = null;
public Unite(int x, int y, Plateau plateau, char symbol, int armor, int damage, Joueur joueur, int vision) { public Unite(int x, int y, Plateau plateau, char symbol, int armor, int damage, Joueur joueur, int vision) {
this.id = generalId; this.id = generalId;
...@@ -115,14 +118,21 @@ public abstract class Unite { ...@@ -115,14 +118,21 @@ public abstract class Unite {
public boolean updatePosition(int x,int y) { public boolean updatePosition(int x,int y) {
if(x>=0 && x<(plateau.getPlateau().length*plateau.getRegion(0, 0).region.length-1) && y>=0 && y<(plateau.getPlateau().length*plateau.getRegion(0, 0).region.length-1) ) { if(x>=0 && x<(plateau.getPlateau().length*plateau.getRegion(0, 0).region.length-1) && y>=0 && y<(plateau.getPlateau().length*plateau.getRegion(0, 0).region.length-1) ) {
this.plateau.getCase(x, y).setUnite(this); if(this.plateau.getCase(x, y).getType() != Type.MOUNTAIN) {
temp2 = temp;
temp = this.plateau.getCase(x, y).getType(); temp = this.plateau.getCase(x, y).getType();
this.plateau.getCase(x, y).setUnite(this);
System.out.println(temp);
this.plateau.getCase(x, y).setType(Type.UNITE); this.plateau.getCase(x, y).setType(Type.UNITE);
/*if(this.plateau.getCase(x, y).getEvents().length > 0){ if(this.plateau.getCase(x, y).getEvents().size() > 0){
System.out.println("oui"); List<Evenements> temp = this.plateau.getCase(x, y).getEvents();
}*/ for (Evenements evenements : temp) {
evenements.action(this.plateau.getCase(x, y));
}
}
return true; return true;
} }
}
return false; return false;
} }
//à voir le type //à voir le type
...@@ -142,7 +152,7 @@ public abstract class Unite { ...@@ -142,7 +152,7 @@ public abstract class Unite {
}*/ }*/
if (updatePosition(x+1,y)) { if (updatePosition(x+1,y)) {
this.plateau.getCase(x, y).setUnite(null); this.plateau.getCase(x, y).setUnite(null);
this.plateau.getCase(x, y).setType(temp); this.plateau.getCase(x, y).setType(temp2);
this.x+=1; this.x+=1;
updateDecouverte(this.plateau.getCase(x+1, y), this.vision); updateDecouverte(this.plateau.getCase(x+1, y), this.vision);
updateItem(); updateItem();
...@@ -152,7 +162,7 @@ public abstract class Unite { ...@@ -152,7 +162,7 @@ public abstract class Unite {
else if(c == 'd') { else if(c == 'd') {
if (updatePosition(x,y+1)) { if (updatePosition(x,y+1)) {
this.plateau.getCase(x, y).setUnite(null); this.plateau.getCase(x, y).setUnite(null);
this.plateau.getCase(x, y).setType(temp); this.plateau.getCase(x, y).setType(temp2);
this.y+=1; this.y+=1;
updateDecouverte(this.plateau.getCase(x, y+1), this.vision); updateDecouverte(this.plateau.getCase(x, y+1), this.vision);
updateItem(); updateItem();
...@@ -162,7 +172,7 @@ public abstract class Unite { ...@@ -162,7 +172,7 @@ public abstract class Unite {
else if(c == 'q') { else if(c == 'q') {
if (updatePosition(x,y-1)) { if (updatePosition(x,y-1)) {
this.plateau.getCase(x, y).setUnite(null); this.plateau.getCase(x, y).setUnite(null);
this.plateau.getCase(x, y).setType(temp); this.plateau.getCase(x, y).setType(temp2);
this.y-=1; this.y-=1;
updateDecouverte(this.plateau.getCase(x, y-1), this.vision); updateDecouverte(this.plateau.getCase(x, y-1), this.vision);
updateItem(); updateItem();
...@@ -172,7 +182,7 @@ public abstract class Unite { ...@@ -172,7 +182,7 @@ public abstract class Unite {
else if(c == 'z') { else if(c == 'z') {
if (updatePosition(x-1, y)) { if (updatePosition(x-1, y)) {
this.plateau.getCase(x, y).setUnite(null); this.plateau.getCase(x, y).setUnite(null);
this.plateau.getCase(x, y).setType(temp); this.plateau.getCase(x, y).setType(temp2);
this.x-=1; this.x-=1;
updateDecouverte(this.plateau.getCase(x-1, y), this.vision); updateDecouverte(this.plateau.getCase(x-1, y), this.vision);
updateItem(); updateItem();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment