diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml index 8db778d..83bd967 100644 --- a/nbproject/build-impl.xml +++ b/nbproject/build-impl.xml @@ -20,6 +20,7 @@ is divided into following sections: --> + diff --git a/nbproject/build-native.xml b/nbproject/build-native.xml new file mode 100644 index 0000000..1aa10a0 --- /dev/null +++ b/nbproject/build-native.xml @@ -0,0 +1,951 @@ + + + + + + + + + Native Packager Ant calls based on SE support in JavaFX packager + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + self.addMappedName( + (source.indexOf("jfxrt.jar") >= 0) || + (source.indexOf("deploy.jar") >= 0) || + (source.indexOf("javaws.jar") >= 0) || + (source.indexOf("plugin.jar") >= 0) + ? "" : source + ); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties index e3a6632..650939c 100644 --- a/nbproject/genfiles.properties +++ b/nbproject/genfiles.properties @@ -3,6 +3,6 @@ build.xml.script.CRC32=4709d7a9 build.xml.stylesheet.CRC32=8064a381@1.79.1.48 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=111761a0 -nbproject/build-impl.xml.script.CRC32=d4c056a9 +nbproject/build-impl.xml.data.CRC32=857ef569 +nbproject/build-impl.xml.script.CRC32=6e9dc783 nbproject/build-impl.xml.stylesheet.CRC32=05530350@1.79.1.48 diff --git a/nbproject/private/private.xml b/nbproject/private/private.xml index d6c266a..d7d311b 100644 --- a/nbproject/private/private.xml +++ b/nbproject/private/private.xml @@ -3,6 +3,7 @@ + file:/C:/Users/MrMcX/ownCloud/Rollenspiel/DSA/Meister/DungeonGenerator/build.xml file:/C:/Users/MrMcX/ownCloud/Rollenspiel/DSA/Meister/DungeonGenerator/src/main/DungeonGeneratorUI.java diff --git a/nbproject/project.xml b/nbproject/project.xml index bce8947..88e4ce0 100644 --- a/nbproject/project.xml +++ b/nbproject/project.xml @@ -2,6 +2,9 @@ org.netbeans.modules.java.j2seproject + + + DungeonGenerator diff --git a/src/dungeon/Dungeon.java b/src/dungeon/Dungeon.java index 17dc5f1..ec786ad 100644 --- a/src/dungeon/Dungeon.java +++ b/src/dungeon/Dungeon.java @@ -1,21 +1,39 @@ /* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. + * The MIT License + * + * Copyright 2016 MrMcX. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. */ package dungeon; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; -import main.Counter; -import main.Dice; +import util.Counter; +import util.Dice; import org.jgraph.graph.DefaultEdge; import org.jgrapht.UndirectedGraph; import org.jgrapht.graph.SimpleGraph; /** - * + * Stores all information about the dungeon * @author MrMcX */ public class Dungeon { @@ -23,6 +41,12 @@ public class Dungeon { private final LinkedList toGenerate; private final Counter counter; + /** + * Stanard constructor, creates a new dungeon and then generates the contens + * @param size maximum number of rooms + * @param type how the rooms are to construct + * @param mode determines room generation sequence + */ public Dungeon(int size, Type type, Mode mode){ rooms = new ArrayList<>(); toGenerate = new LinkedList<>(); @@ -61,6 +85,10 @@ public class Dungeon { return rooms.stream().map((r) -> r.toLongString() + "\n").reduce("", String::concat); } + /** + * Creates a graph from the dungeon + * @return UndirectedGraph from JGraphT + */ public UndirectedGraph toGraph(){ UndirectedGraph g = new SimpleGraph(DefaultEdge.class); rooms.stream().forEach((r) -> { @@ -77,20 +105,59 @@ public class Dungeon { return g; } + /** + * Checks whether a type is natural + * @param n + * @return is natural + */ public static boolean Natural(Type n){ return (n == Type.NATURAL || n == Type.EXP_NATURAL); } + /** + * Different room generation sequence modes + */ public static enum Mode{ + + /** + * FILO -> straight dungeon + */ STRAIGHT, + + /** + * FIFO -> branched dungeon + */ BRANCHED, + + /** + * Random -> balanced dungeon + */ RANDOM, } + /** + * The type of rooms to generate + */ public static enum Type{ + + /** + * Nature-made rooms + */ NATURAL, + + /** + * "Human"-made rooms + */ ARTIFICIAL, + + /** + * Nature-made rooms in experimental mode + */ EXP_NATURAL, + + /** + * "Human"-made rooms in experimental mode + */ EXP_ARTIFICIAL } } diff --git a/src/dungeon/Enemy.java b/src/dungeon/Enemy.java index 243d98a..63474ef 100644 --- a/src/dungeon/Enemy.java +++ b/src/dungeon/Enemy.java @@ -1,19 +1,41 @@ /* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. + * The MIT License + * + * Copyright 2016 MrMcX. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. */ package dungeon; -import main.Dice; +import util.Dice; /** - * + * Stores information about enemies * @author MrMcX */ public class Enemy{ private String enemy; + /** + * Constructs a new random enemy in a given type of room + * @param type + */ public Enemy(Dungeon.Type type){ enemy = ""; if(Dungeon.Natural(type)){ diff --git a/src/dungeon/Exit.java b/src/dungeon/Exit.java index b3d0496..f2f012e 100644 --- a/src/dungeon/Exit.java +++ b/src/dungeon/Exit.java @@ -1,28 +1,74 @@ /* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. + * The MIT License + * + * Copyright 2016 MrMcX. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. */ package dungeon; -import main.Dice; +import util.Dice; /** * * @author MrMcX */ public class Exit { + + /** + * The room this exit leads to + */ public Room room; + + /** + * The type of exit + */ public String type; + + /** + * If the exit is start + */ public boolean isStart; + + /** + * If there is a trap in this exit + */ public boolean isTrap; + + /** + * Type of trap + */ public String trap; - + /** + * Constructs a random exit to a given room + * @param room + */ public Exit(Room room){ this(room, GetRandomType(), false); } + /** + * Constructs a exit of a give type to a room + * @param room + * @param type + */ public Exit(Room room, String type){ this(room, type, false); } @@ -44,6 +90,10 @@ public class Exit { return type; } + /** + * Gives this exits description + * @return + */ public String toLongString(){ String out = "- "; if(isStart){ @@ -60,6 +110,10 @@ public class Exit { return out; } + /** + * Gives the entry + * @return + */ public static Exit Start(){ return new Exit(null, null, true); } diff --git a/src/dungeon/Magic.java b/src/dungeon/Magic.java new file mode 100644 index 0000000..d729e92 --- /dev/null +++ b/src/dungeon/Magic.java @@ -0,0 +1,32 @@ +/* + * The MIT License + * + * Copyright 2016 MrMcX. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +package dungeon; + +/** + * + * @author MrMcX + */ +public class Magic { + +} diff --git a/src/dungeon/Room.java b/src/dungeon/Room.java index 82f9cc9..07ab5ee 100644 --- a/src/dungeon/Room.java +++ b/src/dungeon/Room.java @@ -1,29 +1,122 @@ /* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. + * The MIT License + * + * Copyright 2016 MrMcX. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. */ package dungeon; import java.util.LinkedList; import java.util.List; -import main.Counter; -import main.Dice; +import util.Counter; +import util.Dice; /** * * @author MrMcX */ public class Room { + + /** + * The unique number of the room + */ public int number; + + /** + * The list of exits in this room + */ public Exit[] exits; + + /** + * The room generation type + */ public Dungeon.Type type; - public boolean isRoom, hasMonster, hasTrap, hasMagic, hasSpecial, hasTreasure = false; + + /** + * Whether it is a room or a corridor + */ + public boolean isRoom, + + /** + * Whether it has monsters, + */ + hasMonster, + + /** + * traps, + */ + hasTrap, + + /** + * magic, + */ + hasMagic, + + /** + * specials, + */ + hasSpecial, + + /** + * or treasures + */ + hasTreasure = false; + + /** + * The enemy in this room + */ public Enemy monster; + + /** + * The treasure in this room + */ public Treasure treasure; + + /** + * The trap in this room + */ public Trap trap; - public String desc, magicPhenomenon, specialPhenomenon = null; + /** + * Room description + */ + public String desc, + + /** + * magic description + */ + magicPhenomenon, + + /** + * special description + */ + specialPhenomenon = null; + + /** + * Constructs a room with a given predecessor, number of exits, description and counter + * @param predecessor + * @param numberOfExits + * @param room + * @param desc + * @param c + */ public Room(Exit predecessor, int numberOfExits, boolean room, String desc, Counter c){ exits = new Exit[numberOfExits]; exits[0] = predecessor; @@ -32,6 +125,12 @@ public class Room { number = 0; } + /** + * Generates the content of the room + * @param c + * @param type + * @return Returns more rooms to generate + */ public List generate(Counter c, Dungeon.Type type){ number = c.Next(); List list = new LinkedList(); @@ -129,6 +228,10 @@ public class Room { } } + /** + * Returns a long description + * @return + */ public String toLongString(){ String out = ""; if(isRoom){ @@ -159,6 +262,10 @@ public class Room { return out; } + /** + * Returns a short description + * @return + */ public String toShortString(){ if(isRoom){ return "Raum Nummer " + number; @@ -167,8 +274,7 @@ public class Room { } } - - public static Room RoomBigExits(Exit predecessor, Counter c, Dungeon.Type type){ + private static Room RoomBigExits(Exit predecessor, Counter c, Dungeon.Type type){ int rand = Dice.Roll(3, 1); if(Dungeon.Natural(type)){ return new Room(predecessor, rand + 1, true, "große Höhle mit " + rand + " Ausgängen", c); @@ -177,7 +283,7 @@ public class Room { } } - public static Room RoomSmallExits(Exit predecessor, Counter c, Dungeon.Type type){ + private static Room RoomSmallExits(Exit predecessor, Counter c, Dungeon.Type type){ int rand = Dice.Roll(3, 1); if(Dungeon.Natural(type)){ return new Room(predecessor, rand + 1, true, "kleine Höhle mit " + rand + " Ausgängen", c); @@ -186,7 +292,7 @@ public class Room { } } - public static Room RoomBigNoExits(Exit predecessor, Counter c, Dungeon.Type type){ + private 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 { @@ -194,7 +300,7 @@ public class Room { } } - public static Room RoomBigExitsStair(Exit predecessor, Counter c, Dungeon.Type type){ + private static Room RoomBigExitsStair(Exit predecessor, Counter c, Dungeon.Type type){ int rand = Dice.Roll(2, 1); if(Dungeon.Natural(type)){ return new Room(predecessor, rand + 2, true, "große Höhle mit " + rand + " Ausgängen und einer Treppe", c); @@ -203,7 +309,7 @@ public class Room { } } - public static Room RoomSmallNoExits(Exit predecessor, Counter c, Dungeon.Type type){ + private 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 { @@ -211,7 +317,7 @@ public class Room { } } - public static Room RoomSmallExitsStair(Exit predecessor, Counter c, Dungeon.Type type){ + private static Room RoomSmallExitsStair(Exit predecessor, Counter c, Dungeon.Type type){ int rand = Dice.Roll(2, 1); if(Dungeon.Natural(type)){ return new Room(predecessor, rand + 2, true, "kleine Höhle mit " + rand + " Ausgängen und einer Treppe", c); @@ -220,7 +326,7 @@ public class Room { } } - public static Room RoomGiant(Exit predecessor, Counter c, Dungeon.Type type){ + private static Room RoomGiant(Exit predecessor, Counter c, Dungeon.Type type){ int rand = Dice.Roll(2, 1); if(Dungeon.Natural(type)){ return new Room(predecessor, rand + 1, true, "gigantische Höhle mit " + rand + " Ausgängen", c); @@ -229,30 +335,38 @@ public class Room { } } - public static Room CorridorStraight(Exit predecessor, Counter c){ + private static Room CorridorStraight(Exit predecessor, Counter c){ return new Room(predecessor, 2, false, "gerader Gang", c); } - public static Room CorridorRight(Exit predecessor, Counter c){ + private static Room CorridorRight(Exit predecessor, Counter c){ return new Room(predecessor, 2, false, "rechts abbiegender Gang", c); } - public static Room CorridorLeft(Exit predecessor, Counter c){ + private static Room CorridorLeft(Exit predecessor, Counter c){ return new Room(predecessor, 2, false, "links abbiegender Gang", c); } - public static Room CrossingT(Exit predecessor, Counter c){ + private static Room CrossingT(Exit predecessor, Counter c){ return new Room(predecessor, 3, false, "T-Kreuzung mit Abzweigungen nach links und rechts", c); } - public static Room Crossing(Exit predecessor, Counter c){ + private static Room Crossing(Exit predecessor, Counter c){ return new Room(predecessor, 4, false, "Kreuzung, die in alle Richtungen weitergeht", c); } - public static Room DeadEnd(Exit predecessor, Counter c){ + private static Room DeadEnd(Exit predecessor, Counter c){ return new Room(predecessor, 1, false, "Sackgasse", c); } + /** + * Generates a random room + * @param first + * @param predecessor + * @param c + * @param type + * @return random room + */ public static Room RandomRoom(boolean first, Exit predecessor, Counter c, Dungeon.Type type){ int number; if(first){ diff --git a/src/dungeon/Trap.java b/src/dungeon/Trap.java index c81a686..17f0f47 100644 --- a/src/dungeon/Trap.java +++ b/src/dungeon/Trap.java @@ -1,20 +1,41 @@ /* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. + * The MIT License + * + * Copyright 2016 MrMcX. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. */ package dungeon; -import main.Dice; +import util.Dice; /** - * + * Stores information about a trap * @author MrMcX */ public class Trap { private String trap; + /** + * Constructs a random trap + */ public Trap() { trap = ""; switch (Dice.Roll(20, 1)) { diff --git a/src/dungeon/Treasure.java b/src/dungeon/Treasure.java index ec56c91..ca63960 100644 --- a/src/dungeon/Treasure.java +++ b/src/dungeon/Treasure.java @@ -1,19 +1,40 @@ /* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. + * The MIT License + * + * Copyright 2016 MrMcX. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. */ package dungeon; -import main.Dice; +import util.Dice; /** - * + * Stores information about a treasure * @author MrMcX */ public class Treasure { private String treasure; + /** + * Constructs a random treasure + */ public Treasure(){ treasure = ""; switch(Dice.Roll(20, 1)){ diff --git a/src/main/Counter.java b/src/main/Counter.java deleted file mode 100644 index f088bcc..0000000 --- a/src/main/Counter.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package main; - -/** - * - * @author MrMcX - */ -public class Counter { - private int counter; - - public Counter(){ - counter = 0; - } - - public int Next(){ - counter++; - return counter; - } - - public int Peek(){ - return counter; - } -} diff --git a/src/main/Dice.java b/src/main/Dice.java deleted file mode 100644 index e31cc0f..0000000 --- a/src/main/Dice.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package main; - -import java.util.Random; - -/** - * - * @author MrMcX - */ -public class Dice { - public static int Roll(int sides, int times){ - Random r = new Random(); - int sum = 0; - for(int i = 0; i < times; i++){ - sum += r.nextInt(sides)+1; - } - return sum; - } -} diff --git a/src/main/DungeonGeneratorUI.form b/src/main/DungeonGeneratorUI.form index c76f644..da0ae9b 100644 --- a/src/main/DungeonGeneratorUI.form +++ b/src/main/DungeonGeneratorUI.form @@ -2,12 +2,6 @@
- - - - - - diff --git a/src/main/DungeonGeneratorUI.java b/src/main/DungeonGeneratorUI.java index ee22aad..01afe65 100644 --- a/src/main/DungeonGeneratorUI.java +++ b/src/main/DungeonGeneratorUI.java @@ -1,7 +1,25 @@ /* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. + * The MIT License + * + * Copyright 2016 MrMcX. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. */ package main; @@ -63,7 +81,6 @@ public class DungeonGeneratorUI extends javax.swing.JFrame { // //GEN-BEGIN:initComponents private void initComponents() { - jPopupMenu1 = new javax.swing.JPopupMenu(); jPanelCards = new javax.swing.JPanel(); jPanelCardNew = new javax.swing.JPanel(); jButtonGenerate = new javax.swing.JButton(); @@ -529,7 +546,6 @@ public class DungeonGeneratorUI extends javax.swing.JFrame { private javax.swing.JPanel jPanelDraw; private javax.swing.JPanel jPanelSettings; private javax.swing.JPanel jPanelStatus; - private javax.swing.JPopupMenu jPopupMenu1; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane jScrollPane2; private javax.swing.JPopupMenu.Separator jSeparator1; diff --git a/src/util/Counter.java b/src/util/Counter.java new file mode 100644 index 0000000..84925d4 --- /dev/null +++ b/src/util/Counter.java @@ -0,0 +1,56 @@ +/* + * The MIT License + * + * Copyright 2016 MrMcX. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +package util; + +/** + * Stores a counter to give rooms unique numbers + * @author MrMcX + */ +public class Counter { + private int counter; + + /** + * Constructs the counter with 0 + */ + public Counter(){ + counter = 0; + } + + /** + * Gives the next number (first increase. then return) + * @return + */ + public int Next(){ + counter++; + return counter; + } + + /** + * Shows the current number without increasing it + * @return + */ + public int Peek(){ + return counter; + } +} diff --git a/src/util/Dice.java b/src/util/Dice.java new file mode 100644 index 0000000..43f3351 --- /dev/null +++ b/src/util/Dice.java @@ -0,0 +1,48 @@ +/* + * The MIT License + * + * Copyright 2016 MrMcX. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +package util; + +import java.util.Random; + +/** + * This class gives random dices + * @author MrMcX + */ +public class Dice { + + /** + * Rolls a dice somes times, adds everything up and returns it + * @param sides Number of sides of the dice + * @param times Number of times to roll the dice + * @return Sum of results + */ + public static int Roll(int sides, int times){ + Random r = new Random(); + int sum = 0; + for(int i = 0; i < times; i++){ + sum += r.nextInt(sides)+1; + } + return sum; + } +} diff --git a/src/version.properties b/src/version.properties index 7eb14fe..cb8a49a 100644 --- a/src/version.properties +++ b/src/version.properties @@ -1,4 +1,4 @@ -#Sat, 10 Sep 2016 16:30:34 +0200 -BUILDNUMBER=8 -BUILDDATE=2016-09-10 16\:30\:34 MESZ +#Sat, 10 Sep 2016 19:10:07 +0200 +BUILDNUMBER=9 +BUILDDATE=2016-09-10 19\:10\:07 MESZ