-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
91cebe7
commit 0daf866
Showing
14 changed files
with
157 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package Model.Map.Etage_Strategy; | ||
|
||
import Model.Map.Cell; | ||
import Model.Map.Etage; | ||
import Model.Utils.Position; | ||
import Model.Utils.Procedure; | ||
import Model.Utils.Tools; | ||
|
||
import java.util.ArrayList; | ||
|
||
public abstract class EtageStrategy { | ||
|
||
public abstract void composeEtage(Etage etage); | ||
|
||
protected void RoomFusion(Etage etage){ | ||
//Trace du chemin | ||
for (int i = 0; i < etage.getRooms().size()-1; i++) { | ||
Position pos1= Procedure.getRandomPosition(etage.getRooms().get(i)); | ||
Position pos2= Procedure.getRandomPosition(etage.getRooms().get(i+1)); | ||
Tools.ligne(etage, pos1, pos2, Cell.CellType.NORMAL,Procedure.getRandomInt(6,0)); | ||
} | ||
|
||
//Ajout des murs aux chemins | ||
for (int y = 0; y < etage.getHeigth(); y++) { | ||
for (int x = 0; x < etage.getWidth(); x++) { | ||
Position pos=new Position(x, y); | ||
if (etage.get(pos).getType().equals(Cell.CellType.VOID)) { | ||
ArrayList<Position> voisins = pos.voisins(etage); | ||
for (Position p : voisins) { | ||
if (etage.get(p).getType().equals(Cell.CellType.NORMAL)) { | ||
etage.get(x,y).updateCell(false, Cell.CellType.BORDER); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
//Suppression des murs inutiles | ||
for (int y = 0; y < etage.getHeigth(); y++) { | ||
for (int x = 0; x < etage.getWidth(); x++) { | ||
Position pos=new Position(x, y); | ||
ArrayList<Position> voisins = pos.voisins(etage); | ||
if(voisins.size()>6){ | ||
boolean isUseless=true; | ||
for(Position p : voisins){ | ||
if(etage.get(p).getType().equals(Cell.CellType.VOID)){ | ||
isUseless=false; | ||
break; | ||
} | ||
} | ||
if(isUseless){ | ||
etage.get(pos).updateCell(true, Cell.CellType.NORMAL); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
public abstract int getNbrMaxRoom(); | ||
|
||
} |
36 changes: 36 additions & 0 deletions
36
src/main/java/Model/Map/Etage_Strategy/NormalEtageStrategy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package Model.Map.Etage_Strategy; | ||
|
||
import Model.Map.Cell; | ||
import Model.Map.Etage; | ||
import Model.Map.RoomFactory; | ||
import Model.Utils.Position; | ||
import Model.Utils.Procedure; | ||
import Model.Utils.Tools; | ||
|
||
import java.util.ArrayList; | ||
|
||
public class NormalEtageStrategy extends EtageStrategy{ | ||
|
||
|
||
@Override | ||
public void composeEtage(Etage etage) { | ||
Procedure.setRandomRooms(etage, this, RoomFactory.roomType.NORMAL); | ||
RoomFusion(etage); | ||
Procedure.setRandomChest(etage,3); | ||
Procedure.setRandomUPnDOWN(etage); | ||
Position accesibleRandomPosition = Procedure.getAccesibleRandomPosition(false, etage); | ||
etage.get(accesibleRandomPosition).updateCell(true, Cell.CellType.TRAP_ROOM); | ||
Procedure.setRandomMob(etage); | ||
} | ||
|
||
@Override | ||
public void RoomFusion(Etage etage) { | ||
super.RoomFusion(etage); | ||
} | ||
|
||
@Override | ||
public int getNbrMaxRoom() { | ||
return 8; | ||
} | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
src/main/java/Model/Map/Etage_Strategy/TrapEtageStrategy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package Model.Map.Etage_Strategy; | ||
|
||
import Model.Map.Etage; | ||
import Model.Map.RoomFactory; | ||
import Model.Utils.Procedure; | ||
|
||
public class TrapEtageStrategy extends EtageStrategy{ | ||
@Override | ||
public void composeEtage(Etage etage) { | ||
Procedure.setRandomRooms(etage,this, RoomFactory.roomType.TRAP); | ||
RoomFusion(etage); | ||
Procedure.setRandomUP(etage); | ||
Procedure.setRandomMob(etage); | ||
} | ||
|
||
@Override | ||
public void RoomFusion(Etage etage) { | ||
super.RoomFusion(etage); | ||
} | ||
|
||
@Override | ||
public int getNbrMaxRoom() { | ||
return 3; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../Model/Map/Strategy/LabyRoomStrategy.java → ...l/Map/Room_Strategy/LabyRoomStrategy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package Model.Map.Strategy; | ||
package Model.Map.Room_Strategy; | ||
|
||
import Model.Map.Etage; | ||
import Model.Map.Room; | ||
|
2 changes: 1 addition & 1 deletion
2
...el/Map/Strategy/MarchandRoomStrategy.java → ...p/Room_Strategy/MarchandRoomStrategy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package Model.Map.Strategy; | ||
package Model.Map.Room_Strategy; | ||
|
||
import Model.Map.Cell; | ||
import Model.Map.Etage; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...java/Model/Map/Strategy/RoomStrategy.java → ...Model/Map/Room_Strategy/RoomStrategy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package Model.Map.Strategy; | ||
package Model.Map.Room_Strategy; | ||
|
||
import Model.Map.Cell; | ||
import Model.Map.Etage; | ||
|
2 changes: 1 addition & 1 deletion
2
...odel/Map/Strategy/TresorRoomStrategy.java → ...Map/Room_Strategy/TresorRoomStrategy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package Model.Map.Strategy; | ||
package Model.Map.Room_Strategy; | ||
|
||
import Model.Map.Cell; | ||
import Model.Map.Etage; | ||
|
Oops, something went wrong.