|
|
@ -21,24 +21,24 @@ public class Labyrinthe {
|
|
|
|
labyrinthe1();
|
|
|
|
labyrinthe1();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public void labyrinthe1() {
|
|
|
|
public void labyrinthe1() {
|
|
|
|
Arme arme=new Arme("Epee en bois",5,10,2);
|
|
|
|
Arme arme=new Arme("Epee en bois",25,10,2);
|
|
|
|
listeArme.add(arme);
|
|
|
|
listeArme.add(arme);
|
|
|
|
Arme arme1=new Arme("Epee en acier",15,10,4);
|
|
|
|
Arme arme1=new Arme("Epee en acier",100,10,4);
|
|
|
|
listeArme.add(arme1);
|
|
|
|
listeArme.add(arme1);
|
|
|
|
Arme arme2=new Arme("Epee en acier solide",25,20,4);
|
|
|
|
Arme arme2=new Arme("Epee en acier solide",200,20,4);
|
|
|
|
listeArme.add(arme2);
|
|
|
|
listeArme.add(arme2);
|
|
|
|
Arme arme3=new Arme("Epee de cristal",30,5,7);
|
|
|
|
Arme arme3=new Arme("Epee de cristal",150,5,7);
|
|
|
|
listeArme.add(arme3);
|
|
|
|
listeArme.add(arme3);
|
|
|
|
Arme arme4=new Arme("Lame Blanche",200,30,10);
|
|
|
|
Arme arme4=new Arme("Lame Blanche",500,30,10);
|
|
|
|
listeArme.add(arme4);
|
|
|
|
listeArme.add(arme4);
|
|
|
|
|
|
|
|
|
|
|
|
Armure armure1=new Armure("armure de cuir",10,10,5);
|
|
|
|
Armure armure1=new Armure("armure de cuir",70,10,5);
|
|
|
|
listeArmure.add(armure1);
|
|
|
|
listeArmure.add(armure1);
|
|
|
|
Armure armure=new Armure("armure en papier",5,5,2);
|
|
|
|
Armure armure=new Armure("armure en papier",30,5,2);
|
|
|
|
listeArmure.add(armure);
|
|
|
|
listeArmure.add(armure);
|
|
|
|
Armure armure2=new Armure("armure de fer",30,10,5);
|
|
|
|
Armure armure2=new Armure("armure de fer",100,10,5);
|
|
|
|
listeArmure.add(armure2);
|
|
|
|
listeArmure.add(armure2);
|
|
|
|
Armure armure3=new Armure("Le kevlar",150,15,8);
|
|
|
|
Armure armure3=new Armure("Le kevlar",300,15,8);
|
|
|
|
listeArmure.add(armure3);
|
|
|
|
listeArmure.add(armure3);
|
|
|
|
|
|
|
|
|
|
|
|
Personnage perso=new Personnage("Aramis",10,1);
|
|
|
|
Personnage perso=new Personnage("Aramis",10,1);
|
|
|
@ -107,7 +107,146 @@ public class Labyrinthe {
|
|
|
|
Porte po6= new Porte(true,salle5,salle3);
|
|
|
|
Porte po6= new Porte(true,salle5,salle3);
|
|
|
|
listePorte.add(po6);
|
|
|
|
listePorte.add(po6);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public void test(int nb){
|
|
|
|
|
|
|
|
int nbSalle =nb;
|
|
|
|
|
|
|
|
Arme arme=new Arme("Epee en bois",5,10,2);
|
|
|
|
|
|
|
|
listeArme.add(arme);
|
|
|
|
|
|
|
|
Arme arme1=new Arme("Epee en acier",15,10,4);
|
|
|
|
|
|
|
|
listeArme.add(arme1);
|
|
|
|
|
|
|
|
Arme arme2=new Arme("Epee en acier solide",25,20,4);
|
|
|
|
|
|
|
|
listeArme.add(arme2);
|
|
|
|
|
|
|
|
Arme arme3=new Arme("Epee de cristal",30,5,7);
|
|
|
|
|
|
|
|
listeArme.add(arme3);
|
|
|
|
|
|
|
|
Arme arme4=new Arme("Lame Blanche",200,30,10);
|
|
|
|
|
|
|
|
listeArme.add(arme4);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Armure armure1=new Armure("armure de cuir",10,10,5);
|
|
|
|
|
|
|
|
listeArmure.add(armure1);
|
|
|
|
|
|
|
|
Armure armure=new Armure("armure en papier",5,5,2);
|
|
|
|
|
|
|
|
listeArmure.add(armure);
|
|
|
|
|
|
|
|
Armure armure2=new Armure("armure de fer",30,10,5);
|
|
|
|
|
|
|
|
listeArmure.add(armure2);
|
|
|
|
|
|
|
|
Armure armure3=new Armure("Le kevlar",150,15,8);
|
|
|
|
|
|
|
|
listeArmure.add(armure3);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Personnage perso=new Personnage("Aramis",10,1);
|
|
|
|
|
|
|
|
listePersonnage.add(perso);
|
|
|
|
|
|
|
|
Personnage perso2=new Personnage("Boromis",8,2);
|
|
|
|
|
|
|
|
listePersonnage.add(perso2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Monstre mons = new Monstre("pantin en bois",5, 1);
|
|
|
|
|
|
|
|
this.listeMonstre.add(mons);
|
|
|
|
|
|
|
|
mons=new Monstre("araignee geante agressive",7, 2);
|
|
|
|
|
|
|
|
this.listeMonstre.add(mons);
|
|
|
|
|
|
|
|
mons=new Monstre("Golem de Sable",20, 3);
|
|
|
|
|
|
|
|
this.listeMonstre.add(mons);
|
|
|
|
|
|
|
|
mons=new Monstre("Petit dragon",20,5);
|
|
|
|
|
|
|
|
this.listeMonstre.add(mons);
|
|
|
|
|
|
|
|
mons=new Monstre("Grand Dragon",40,5);
|
|
|
|
|
|
|
|
this.listeMonstre.add(mons);
|
|
|
|
|
|
|
|
mons=new Monstre("Chat sauvage",9, 1);
|
|
|
|
|
|
|
|
this.listeMonstre.add(mons);
|
|
|
|
|
|
|
|
mons= new Monstre("araignee geante agressive", 7, 5);
|
|
|
|
|
|
|
|
this.listeMonstre.add(mons);
|
|
|
|
|
|
|
|
mons=new Monstre("pantin de fer",20,1);
|
|
|
|
|
|
|
|
this.listeMonstre.add(mons);
|
|
|
|
|
|
|
|
mons = new Monstre("Golem de Jade",40, 3);
|
|
|
|
|
|
|
|
this.listeMonstre.add(mons);
|
|
|
|
|
|
|
|
mons= new Monstre("Neltharion le Gardeterre",100,10);
|
|
|
|
|
|
|
|
this.listeMonstre.add(mons);
|
|
|
|
|
|
|
|
mons = new Monstre("Neltharion, le Destructeur", 80,20);
|
|
|
|
|
|
|
|
this.listeMonstre.add(mons);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Marche marche = new Marche();
|
|
|
|
|
|
|
|
List<Salle> ListSalle=new ArrayList<Salle>();
|
|
|
|
|
|
|
|
ListSalle.add(marche);
|
|
|
|
|
|
|
|
List<Integer>table;
|
|
|
|
|
|
|
|
Salle salle;
|
|
|
|
|
|
|
|
Salle deRelais;
|
|
|
|
|
|
|
|
Porte porte;
|
|
|
|
|
|
|
|
boolean ok=true;
|
|
|
|
|
|
|
|
Random rd= new Random();
|
|
|
|
|
|
|
|
table= new ArrayList<Integer>();
|
|
|
|
|
|
|
|
table.add(0);
|
|
|
|
|
|
|
|
table.add(1);
|
|
|
|
|
|
|
|
salle=new Salle(0,1,false,table);
|
|
|
|
|
|
|
|
ListSalle.add(salle);
|
|
|
|
|
|
|
|
porte=new Porte(true,marche,salle);
|
|
|
|
|
|
|
|
listePorte.add(porte);
|
|
|
|
|
|
|
|
salle=new Salle(0,-1,false,table);
|
|
|
|
|
|
|
|
ListSalle.add(salle);
|
|
|
|
|
|
|
|
porte= new Porte(true, marche, salle);
|
|
|
|
|
|
|
|
listePorte.add(porte);
|
|
|
|
|
|
|
|
salle=new Salle(1,0,false,table);
|
|
|
|
|
|
|
|
ListSalle.add(salle);
|
|
|
|
|
|
|
|
listePorte.add(porte);
|
|
|
|
|
|
|
|
for (int i = 0; i < nbSalle-4;i++) {
|
|
|
|
|
|
|
|
table= new ArrayList<Integer>();
|
|
|
|
|
|
|
|
for (int j = 0; j<rd.nextInt(4);j++) {
|
|
|
|
|
|
|
|
table.add(rd.nextInt(this.listeMonstre.size()-3));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
deRelais=ListSalle.get(rd.nextInt(ListSalle.size()));
|
|
|
|
|
|
|
|
if(rd.nextInt(1)==0) {
|
|
|
|
|
|
|
|
salle=new Salle( deRelais.getCoordonnes().getKey()+puissance(-1, rd.nextInt(1)),deRelais.getCoordonnes().getValue() ,false,table);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
salle=new Salle( deRelais.getCoordonnes().getKey(),deRelais.getCoordonnes().getValue()+puissance(-1, rd.nextInt(1)) ,false,table);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ListSalle.contains(salle)) {
|
|
|
|
|
|
|
|
nbSalle++;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
ListSalle.add(salle);
|
|
|
|
|
|
|
|
porte=new Porte(false, deRelais, salle);
|
|
|
|
|
|
|
|
listePorte.add(porte);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
while (ok) {
|
|
|
|
|
|
|
|
table= new ArrayList<Integer>();
|
|
|
|
|
|
|
|
for (int j = 0; j<2;j++) {
|
|
|
|
|
|
|
|
table.add(this.listeMonstre.size()-2+j);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
deRelais=ListSalle.get(rd.nextInt(ListSalle.size()));
|
|
|
|
|
|
|
|
if(rd.nextInt(1)==0) {
|
|
|
|
|
|
|
|
salle=new Salle( deRelais.getCoordonnes().getKey()+puissance(-1, rd.nextInt(1)),deRelais.getCoordonnes().getValue() ,false,table);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
salle=new Salle( deRelais.getCoordonnes().getKey(),deRelais.getCoordonnes().getValue()+puissance(-1, rd.nextInt(1)) ,false,table);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ListSalle.contains(salle)) ok = true;
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
porte=new Porte(false, deRelais, salle);
|
|
|
|
|
|
|
|
listePorte.add(porte);
|
|
|
|
|
|
|
|
ok= false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static int puissance(int a, int p)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int result = 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(int i = 0; i < p; i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
result = result * a;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return(result);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public void restore() {
|
|
|
|
|
|
|
|
Random rd =new Random();
|
|
|
|
|
|
|
|
for (Porte p : listePorte) {
|
|
|
|
|
|
|
|
if (p.getSalle1().estVide() && !p.getSalle1().getType().contentEquals("Marche")) {
|
|
|
|
|
|
|
|
for (int i =0; i<rd.nextInt(4);i++) {
|
|
|
|
|
|
|
|
p.getSalle1().getListeEnnemie().add(rd.nextInt(listeMonstre.size()-3));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p.getSalle1().estVide() && !p.getSalle1().getType().contentEquals("Marche")) {
|
|
|
|
|
|
|
|
for (int i =0; i<rd.nextInt(4);i++) {
|
|
|
|
|
|
|
|
p.getSalle1().getListeEnnemie().add(rd.nextInt(listeMonstre.size()-3));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|