Skip to content

Commit

Permalink
Implémentation des difficultés
Browse files Browse the repository at this point in the history
  • Loading branch information
tetelie committed Apr 15, 2024
1 parent b12af17 commit 778c42c
Showing 1 changed file with 27 additions and 23 deletions.
50 changes: 27 additions & 23 deletions src/main/java/fr/hashimiste/impl/gui/component/GameComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,15 @@ protected void paintComponent(Graphics g) {
for (Bridge bridge : bridges) {

// barrer les iles complètes
if(isIsleFull(bridge.getIle1())) // ile1
{
g2.draw(new Line2D.Float(zeroX + cell_size * bridge.getIle1().getX()+cell_size/5, zeroY +cell_size *bridge.getIle1().getY()+cell_size/5, zeroX + cell_size * bridge.getIle1().getX()+cell_size-cell_size/5, zeroY +cell_size *bridge.getIle1().getY()+cell_size-cell_size/5));
}
if(isIsleFull(bridge.getIle2())) // ile2
{
g2.draw(new Line2D.Float(zeroX + cell_size * bridge.getIle2().getX()+cell_size/5, zeroY +cell_size *bridge.getIle2().getY()+cell_size/5, zeroX + cell_size * bridge.getIle2().getX()+cell_size-cell_size/5, zeroY +cell_size *bridge.getIle2().getY()+cell_size-cell_size/5));
if(getGrille().getDifficulte() != Difficulte.DIFFICILE) {
if (isIsleFull(bridge.getIle1())) // ile1
{
g2.draw(new Line2D.Float(zeroX + cell_size * bridge.getIle1().getX() + cell_size / 5, zeroY + cell_size * bridge.getIle1().getY() + cell_size / 5, zeroX + cell_size * bridge.getIle1().getX() + cell_size - cell_size / 5, zeroY + cell_size * bridge.getIle1().getY() + cell_size - cell_size / 5));
}
if (isIsleFull(bridge.getIle2())) // ile2
{
g2.draw(new Line2D.Float(zeroX + cell_size * bridge.getIle2().getX() + cell_size / 5, zeroY + cell_size * bridge.getIle2().getY() + cell_size / 5, zeroX + cell_size * bridge.getIle2().getX() + cell_size - cell_size / 5, zeroY + cell_size * bridge.getIle2().getY() + cell_size - cell_size / 5));
}
}

if (bridge.n == 2) { // si pont double
Expand Down Expand Up @@ -188,23 +190,25 @@ public void refreshBridge(int souris_x, int souris_y) {
potentialsBridges.add(b);
}
} else {
for (Bridge bridge : bridges) {
if ((bridge.ile1 == ile || bridge.ile2 == ile) && bridge.n != 2) {
potentialsBridges.add(bridge);
break;
if (getGrille().getDifficulte() == Difficulte.FACILE) {
for (Bridge bridge : bridges) {
if ((bridge.ile1 == ile || bridge.ile2 == ile) && bridge.n != 2) {
potentialsBridges.add(bridge);
break;
}
}
if (ileOuest != null) {
potentialsBridges.add(new Bridge(ileOuest, ile, -1));
}
if (ileEst != null) {
potentialsBridges.add(new Bridge(ile, ileEst, -1));
}
if (ileSud != null) {
potentialsBridges.add(new Bridge(ile, ileSud, -1));
}
if (ileNord != null) {
potentialsBridges.add(new Bridge(ileNord, ile, -1));
}
}
if (ileOuest != null) {
potentialsBridges.add(new Bridge(ileOuest, ile, -1));
}
if (ileEst != null) {
potentialsBridges.add(new Bridge(ile, ileEst, -1));
}
if (ileSud != null) {
potentialsBridges.add(new Bridge(ile, ileSud, -1));
}
if (ileNord != null) {
potentialsBridges.add(new Bridge(ileNord, ile, -1));
}
}
}
Expand Down

0 comments on commit 778c42c

Please sign in to comment.