diff --git a/build/classes/dungeon/Dungeon$Mode.class b/build/classes/dungeon/Dungeon$Mode.class index 97af331..50eb143 100644 Binary files a/build/classes/dungeon/Dungeon$Mode.class and b/build/classes/dungeon/Dungeon$Mode.class differ diff --git a/build/classes/dungeon/Dungeon$Type.class b/build/classes/dungeon/Dungeon$Type.class index 3b16ae9..f0ca8fe 100644 Binary files a/build/classes/dungeon/Dungeon$Type.class and b/build/classes/dungeon/Dungeon$Type.class differ diff --git a/build/classes/dungeon/Dungeon.class b/build/classes/dungeon/Dungeon.class index aa0d111..c49f194 100644 Binary files a/build/classes/dungeon/Dungeon.class and b/build/classes/dungeon/Dungeon.class differ diff --git a/build/classes/dungeon/Enemy.class b/build/classes/dungeon/Enemy.class index 914eb6e..e2ff4ce 100644 Binary files a/build/classes/dungeon/Enemy.class and b/build/classes/dungeon/Enemy.class differ diff --git a/build/classes/dungeon/Room.class b/build/classes/dungeon/Room.class index eddd1ae..24aaabc 100644 Binary files a/build/classes/dungeon/Room.class and b/build/classes/dungeon/Room.class differ diff --git a/build/classes/main/DungeonGeneratorUI$1.class b/build/classes/main/DungeonGeneratorUI$1.class index 8282bbc..535b74e 100644 Binary files a/build/classes/main/DungeonGeneratorUI$1.class and b/build/classes/main/DungeonGeneratorUI$1.class differ diff --git a/build/classes/main/DungeonGeneratorUI$2.class b/build/classes/main/DungeonGeneratorUI$2.class index 8d441c3..1c1409f 100644 Binary files a/build/classes/main/DungeonGeneratorUI$2.class and b/build/classes/main/DungeonGeneratorUI$2.class differ diff --git a/build/classes/main/DungeonGeneratorUI$3.class b/build/classes/main/DungeonGeneratorUI$3.class index bf012e7..f249efd 100644 Binary files a/build/classes/main/DungeonGeneratorUI$3.class and b/build/classes/main/DungeonGeneratorUI$3.class differ diff --git a/build/classes/main/DungeonGeneratorUI$5.class b/build/classes/main/DungeonGeneratorUI$5.class index 9c36993..dec141f 100644 Binary files a/build/classes/main/DungeonGeneratorUI$5.class and b/build/classes/main/DungeonGeneratorUI$5.class differ diff --git a/build/classes/main/DungeonGeneratorUI$7.class b/build/classes/main/DungeonGeneratorUI$7.class index 68109d1..ad4aafa 100644 Binary files a/build/classes/main/DungeonGeneratorUI$7.class and b/build/classes/main/DungeonGeneratorUI$7.class differ diff --git a/build/classes/main/DungeonGeneratorUI$8.class b/build/classes/main/DungeonGeneratorUI$8.class index b71f2c3..eff3456 100644 Binary files a/build/classes/main/DungeonGeneratorUI$8.class and b/build/classes/main/DungeonGeneratorUI$8.class differ diff --git a/build/classes/main/DungeonGeneratorUI$9.class b/build/classes/main/DungeonGeneratorUI$9.class new file mode 100644 index 0000000..3bcef0a Binary files /dev/null and b/build/classes/main/DungeonGeneratorUI$9.class differ diff --git a/build/classes/main/DungeonGeneratorUI.class b/build/classes/main/DungeonGeneratorUI.class index 86a614e..a817a61 100644 Binary files a/build/classes/main/DungeonGeneratorUI.class and b/build/classes/main/DungeonGeneratorUI.class differ diff --git a/build/classes/main/DungeonGeneratorUI.form b/build/classes/main/DungeonGeneratorUI.form index 00895d6..c76f644 100644 --- a/build/classes/main/DungeonGeneratorUI.form +++ b/build/classes/main/DungeonGeneratorUI.form @@ -196,6 +196,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/dungeon/Dungeon.java b/src/dungeon/Dungeon.java index 1a00f43..17dc5f1 100644 --- a/src/dungeon/Dungeon.java +++ b/src/dungeon/Dungeon.java @@ -23,15 +23,15 @@ public class Dungeon { private final LinkedList toGenerate; private final Counter counter; - public Dungeon(int size, Type isNatural, Mode mode){ + public Dungeon(int size, Type type, Mode mode){ rooms = new ArrayList<>(); toGenerate = new LinkedList<>(); counter = new Counter(); - generate(size, isNatural, mode); + generate(size, type, mode); } - private void generate(int size, Type isNatural, Mode mode){ - toGenerate.add(Room.RandomRoom(true, Exit.Start(), counter, isNatural)); + private void generate(int size, Type type, Mode mode){ + toGenerate.add(Room.RandomRoom(true, Exit.Start(), counter, type)); while(!toGenerate.isEmpty() && rooms.size() < size){ Room next; switch(mode){ @@ -48,7 +48,7 @@ public class Dungeon { next = toGenerate.getFirst(); break; } - next.generate(counter, isNatural).stream().forEach((r) -> { + next.generate(counter, type).stream().forEach((r) -> { toGenerate.add(r); }); toGenerate.remove(next); @@ -77,14 +77,20 @@ public class Dungeon { return g; } + public static boolean Natural(Type n){ + return (n == Type.NATURAL || n == Type.EXP_NATURAL); + } + public static enum Mode{ STRAIGHT, BRANCHED, - RANDOM + RANDOM, } public static enum Type{ NATURAL, - ARTIFICIAL + ARTIFICIAL, + EXP_NATURAL, + EXP_ARTIFICIAL } } diff --git a/src/dungeon/Enemy.java b/src/dungeon/Enemy.java index a286775..243d98a 100644 --- a/src/dungeon/Enemy.java +++ b/src/dungeon/Enemy.java @@ -14,9 +14,9 @@ import main.Dice; public class Enemy{ private String enemy; - public Enemy(Dungeon.Type isNatural){ + public Enemy(Dungeon.Type type){ enemy = ""; - if(isNatural == Dungeon.Type.NATURAL){ + if(Dungeon.Natural(type)){ switch(Dice.Roll(20, 1)){ case 1: enemy = "Höhlendrache"; diff --git a/src/dungeon/Room.java b/src/dungeon/Room.java index c22f5c5..82f9cc9 100644 --- a/src/dungeon/Room.java +++ b/src/dungeon/Room.java @@ -17,44 +17,44 @@ import main.Dice; public class Room { public int number; public Exit[] exits; - public Dungeon.Type isNatural; + public Dungeon.Type type; public boolean isRoom, hasMonster, hasTrap, hasMagic, hasSpecial, hasTreasure = false; public Enemy monster; public Treasure treasure; public Trap trap; - public String type, magicPhenomenon, specialPhenomenon = null; + public String desc, magicPhenomenon, specialPhenomenon = null; - public Room(Exit predecessor, int numberOfExits, boolean room, String type, Counter c){ + public Room(Exit predecessor, int numberOfExits, boolean room, String desc, Counter c){ exits = new Exit[numberOfExits]; exits[0] = predecessor; this.isRoom = room; - this.type = type; + this.desc = desc; number = 0; } - public List generate(Counter c, Dungeon.Type isNatural){ + public List generate(Counter c, Dungeon.Type type){ number = c.Next(); List list = new LinkedList(); for(int i = 0; i < exits.length; i++){ if(exits[i] == null){ Exit predecessor = new Exit(this); - Room newRoom = RandomRoom(false, predecessor, c, isNatural); + Room newRoom = RandomRoom(false, predecessor, c, type); exits[i] = new Exit(newRoom, predecessor.type); list.add(newRoom); } } - SetContents(isNatural); + SetContents(type); return list; } - private void SetContents(Dungeon.Type isNatural){ + private void SetContents(Dungeon.Type type){ if(isRoom){ switch(Dice.Roll(6, 2)){ case 2: case 3: return; case 4: hasMonster = true; - monster = new Enemy(isNatural); + monster = new Enemy(type); return; case 5: hasTrap = true; @@ -74,19 +74,19 @@ public class Room { case 9: hasMonster = true; hasTrap = true; - monster = new Enemy(isNatural); + monster = new Enemy(type); trap = new Trap(); return; case 10: hasMonster = true; hasTreasure = true; - monster = new Enemy(isNatural); + monster = new Enemy(type); treasure = new Treasure(); return; case 11: hasMonster = true; hasMagic = true; - monster = new Enemy(isNatural); + monster = new Enemy(type); // TODO: generate magic here return; case 12: @@ -103,7 +103,7 @@ public class Room { case 3: return; case 4: hasMonster = true; - monster = new Enemy(isNatural); + monster = new Enemy(type); return; case 5: hasTrap = true; @@ -115,14 +115,14 @@ public class Room { return; } } - this.isNatural = isNatural; + this.type = type; } @Override public String toString(){ if(!isRoom){ return "Gang " + number; - } else if(isNatural == Dungeon.Type.NATURAL){ + } else if(Dungeon.Natural(type)){ return "Höhle " + number; } else { return "Raum " + number; @@ -136,7 +136,7 @@ public class Room { } else { out += "Gang "; } - out += "Nummer " + number + ": " + type + "\n" + + out += "Nummer " + number + ": " + desc + "\n" + "Ausgänge:\n"; for(Exit x : exits){ out += x.toLongString(); @@ -168,61 +168,61 @@ public class Room { } - public static Room RoomBigExits(Exit predecessor, Counter c, Dungeon.Type isNatural){ + public static Room RoomBigExits(Exit predecessor, Counter c, Dungeon.Type type){ int rand = Dice.Roll(3, 1); - if(isNatural == Dungeon.Type.NATURAL){ + if(Dungeon.Natural(type)){ return new Room(predecessor, rand + 1, true, "große Höhle mit " + rand + " Ausgängen", c); } else { return new Room(predecessor, rand + 1, true, "großer Raum mit " + rand + " Ausgängen", c); } } - public static Room RoomSmallExits(Exit predecessor, Counter c, Dungeon.Type isNatural){ + public static Room RoomSmallExits(Exit predecessor, Counter c, Dungeon.Type type){ int rand = Dice.Roll(3, 1); - if(isNatural == Dungeon.Type.NATURAL){ + if(Dungeon.Natural(type)){ return new Room(predecessor, rand + 1, true, "kleine Höhle mit " + rand + " Ausgängen", c); } else { return new Room(predecessor, rand + 1, true, "kleiner Raum mit " + rand + " Ausgängen", c); } } - public static Room RoomBigNoExits(Exit predecessor, Counter c, Dungeon.Type isNatural){ - if(isNatural == Dungeon.Type.NATURAL){ + public static Room RoomBigNoExits(Exit predecessor, Counter c, Dungeon.Type type){ + if(Dungeon.Natural(type)){ return new Room(predecessor, 1, true, "große Höhle ohne Ausgang", c); } else { return new Room(predecessor, 1, true, "großer Raum ohne Ausgang", c); } } - public static Room RoomBigExitsStair(Exit predecessor, Counter c, Dungeon.Type isNatural){ + public static Room RoomBigExitsStair(Exit predecessor, Counter c, Dungeon.Type type){ int rand = Dice.Roll(2, 1); - if(isNatural == Dungeon.Type.NATURAL){ + if(Dungeon.Natural(type)){ return new Room(predecessor, rand + 2, true, "große Höhle mit " + rand + " Ausgängen und einer Treppe", c); } else { return new Room(predecessor, rand + 2, true, "großer Raum mit " + rand + " Ausgängen und einer Treppe", c); } } - public static Room RoomSmallNoExits(Exit predecessor, Counter c, Dungeon.Type isNatural){ - if(isNatural == Dungeon.Type.NATURAL){ + public static Room RoomSmallNoExits(Exit predecessor, Counter c, Dungeon.Type type){ + if(Dungeon.Natural(type)){ return new Room(predecessor, 1, true, "kleine Höhle ohne Ausgang", c); } else { return new Room(predecessor, 1, true, "kleiner Raum ohne Ausgang", c); } } - public static Room RoomSmallExitsStair(Exit predecessor, Counter c, Dungeon.Type isNatural){ + public static Room RoomSmallExitsStair(Exit predecessor, Counter c, Dungeon.Type type){ int rand = Dice.Roll(2, 1); - if(isNatural == Dungeon.Type.NATURAL){ + if(Dungeon.Natural(type)){ return new Room(predecessor, rand + 2, true, "kleine Höhle mit " + rand + " Ausgängen und einer Treppe", c); } else { return new Room(predecessor, rand + 2, true, "kleiner Raum mit " + rand + " Ausgängen und einer Treppe", c); } } - public static Room RoomGiant(Exit predecessor, Counter c, Dungeon.Type isNatural){ + public static Room RoomGiant(Exit predecessor, Counter c, Dungeon.Type type){ int rand = Dice.Roll(2, 1); - if(isNatural == Dungeon.Type.NATURAL){ + if(Dungeon.Natural(type)){ return new Room(predecessor, rand + 1, true, "gigantische Höhle mit " + rand + " Ausgängen", c); } else { return new Room(predecessor, rand + 1, true, "gigantischer Raum mit " + rand + " Ausgängen", c); @@ -253,7 +253,7 @@ public class Room { return new Room(predecessor, 1, false, "Sackgasse", c); } - public static Room RandomRoom(boolean first, Exit predecessor, Counter c, Dungeon.Type isNatural){ + public static Room RandomRoom(boolean first, Exit predecessor, Counter c, Dungeon.Type type){ int number; if(first){ number = Dice.Roll(6, 1); @@ -263,18 +263,18 @@ public class Room { switch(number){ case 1: case 2: - case 3: return RoomBigExits(predecessor, c, isNatural); + case 3: return RoomBigExits(predecessor, c, type); case 4: case 5: - case 6: return RoomSmallExits(predecessor, c, isNatural); - case 7: return RoomBigNoExits(predecessor, c, isNatural); + case 6: return RoomSmallExits(predecessor, c, type); + case 7: return RoomBigNoExits(predecessor, c, type); case 8: - case 9: return RoomBigExitsStair(predecessor, c, isNatural); - case 10: return RoomSmallNoExits(predecessor, c, isNatural); + case 9: return RoomBigExitsStair(predecessor, c, type); + case 10: return RoomSmallNoExits(predecessor, c, type); case 11: - case 12: return RoomSmallExitsStair(predecessor, c, isNatural); + case 12: return RoomSmallExitsStair(predecessor, c, type); case 13: - case 14: return RoomGiant(predecessor, c, isNatural); + case 14: return RoomGiant(predecessor, c, type); case 15: return CorridorStraight(predecessor, c); case 16: return CorridorRight(predecessor, c); case 17: return CorridorLeft(predecessor, c); diff --git a/src/main/DungeonGeneratorUI.form b/src/main/DungeonGeneratorUI.form index 00895d6..c76f644 100644 --- a/src/main/DungeonGeneratorUI.form +++ b/src/main/DungeonGeneratorUI.form @@ -196,6 +196,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/DungeonGeneratorUI.java b/src/main/DungeonGeneratorUI.java index 92ee864..a8abece 100644 --- a/src/main/DungeonGeneratorUI.java +++ b/src/main/DungeonGeneratorUI.java @@ -70,6 +70,8 @@ public class DungeonGeneratorUI extends javax.swing.JFrame { jPanelSettings = new javax.swing.JPanel(); jLabel4 = new javax.swing.JLabel(); jSpinSize = new javax.swing.JSpinner(); + filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(1, 0), new java.awt.Dimension(1, 0), new java.awt.Dimension(1, 32767)); + jCheckBoxExp = new javax.swing.JCheckBox(); jLabel1 = new javax.swing.JLabel(); jComboBoxNatural = new javax.swing.JComboBox<>(); jLabel2 = new javax.swing.JLabel(); @@ -125,6 +127,15 @@ public class DungeonGeneratorUI extends javax.swing.JFrame { jSpinSize.setMaximumSize(new java.awt.Dimension(40, 30)); jSpinSize.setValue(1); jPanelSettings.add(jSpinSize); + jPanelSettings.add(filler1); + + jCheckBoxExp.setText("Experimenteller Modus"); + jCheckBoxExp.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jCheckBoxExpActionPerformed(evt); + } + }); + jPanelSettings.add(jCheckBoxExp); jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel1.setText("Wie ist der Dungeon entstanden?"); @@ -423,6 +434,10 @@ public class DungeonGeneratorUI extends javax.swing.JFrame { + "Icons made by Revicon from www.flaticon.com", "Über", JOptionPane.QUESTION_MESSAGE); }//GEN-LAST:event_jMenuItemAboutActionPerformed + private void jCheckBoxExpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxExpActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jCheckBoxExpActionPerformed + /** * @param args the command line arguments */ @@ -471,11 +486,23 @@ public class DungeonGeneratorUI extends javax.swing.JFrame { } private Dungeon.Type SelectedNatural() { - return jComboBoxNatural.getSelectedItem().equals("Künstlich") ? Dungeon.Type.ARTIFICIAL : Dungeon.Type.NATURAL; + if(jComboBoxNatural.getSelectedItem().equals("Künstlich")){ + if(jCheckBoxExp.isSelected()){ + return Dungeon.Type.EXP_ARTIFICIAL; + } + return Dungeon.Type.ARTIFICIAL; + } else { + if(jCheckBoxExp.isSelected()){ + return Dungeon.Type.EXP_NATURAL; + } + return Dungeon.Type.NATURAL; + } } // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.Box.Filler filler1; private javax.swing.JButton jButtonGenerate; + private javax.swing.JCheckBox jCheckBoxExp; private javax.swing.JComboBox jComboBoxMode; private javax.swing.JComboBox jComboBoxNatural; private javax.swing.JLabel jLabel1;