From e2bcaecea59bdf3a4092efdc4b9624b3f83f6fec Mon Sep 17 00:00:00 2001 From: mafaldo Date: Sun, 18 Nov 2018 22:29:05 +0100 Subject: initial commit --- Makefile | 28 +++++ bin/Actor.class | Bin 0 -> 1906 bytes bin/Battle$1.class | Bin 0 -> 664 bytes bin/Battle$Mode.class | Bin 0 -> 881 bytes bin/Battle.class | Bin 0 -> 7528 bytes bin/Map.class | Bin 0 -> 3969 bytes bin/MapEditor$1.class | Bin 0 -> 673 bytes bin/MapEditor.class | Bin 0 -> 6523 bytes bin/MapLoader.class | Bin 0 -> 1903 bytes bin/MapScene$1.class | Bin 0 -> 670 bytes bin/MapScene.class | Bin 0 -> 5222 bytes bin/Palette.class | Bin 0 -> 850 bytes bin/PathFinder.class | Bin 0 -> 2310 bytes bin/Scene.class | Bin 0 -> 3003 bytes bin/Sub$1.class | Bin 0 -> 375 bytes bin/Sub.class | Bin 0 -> 2389 bytes bin/TestScene$1.class | Bin 0 -> 673 bytes bin/TestScene.class | Bin 0 -> 6829 bytes bin/Tile$1.class | Bin 0 -> 648 bytes bin/Tile$Type.class | Bin 0 -> 964 bytes bin/Tile.class | Bin 0 -> 2013 bytes bin/Weapon.class | Bin 0 -> 1004 bytes bin/null.json | 1 + jar/Subconcious.jar | Bin 0 -> 270058 bytes lib/gson-2.6.2.jar | Bin 0 -> 229650 bytes src/Actor.java | 107 ++++++++++++++++++ src/Battle.java | 304 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/Map.java | 154 +++++++++++++++++++++++++ src/MapEditor.java | 226 +++++++++++++++++++++++++++++++++++++ src/MapLoader.java | 60 ++++++++++ src/MapScene.java | 229 +++++++++++++++++++++++++++++++++++++ src/Palette.java | 15 +++ src/Scene.java | 104 +++++++++++++++++ src/Sub.java | 80 +++++++++++++ src/Tile.java | 105 +++++++++++++++++ src/Weapon.java | 50 +++++++++ testmap.json | 1 + 37 files changed, 1464 insertions(+) create mode 100644 Makefile create mode 100644 bin/Actor.class create mode 100644 bin/Battle$1.class create mode 100644 bin/Battle$Mode.class create mode 100644 bin/Battle.class create mode 100644 bin/Map.class create mode 100644 bin/MapEditor$1.class create mode 100644 bin/MapEditor.class create mode 100644 bin/MapLoader.class create mode 100644 bin/MapScene$1.class create mode 100644 bin/MapScene.class create mode 100644 bin/Palette.class create mode 100644 bin/PathFinder.class create mode 100644 bin/Scene.class create mode 100644 bin/Sub$1.class create mode 100644 bin/Sub.class create mode 100644 bin/TestScene$1.class create mode 100644 bin/TestScene.class create mode 100644 bin/Tile$1.class create mode 100644 bin/Tile$Type.class create mode 100644 bin/Tile.class create mode 100644 bin/Weapon.class create mode 100644 bin/null.json create mode 100644 jar/Subconcious.jar create mode 100644 lib/gson-2.6.2.jar create mode 100644 src/Actor.java create mode 100644 src/Battle.java create mode 100644 src/Map.java create mode 100644 src/MapEditor.java create mode 100644 src/MapLoader.java create mode 100644 src/MapScene.java create mode 100644 src/Palette.java create mode 100644 src/Scene.java create mode 100644 src/Sub.java create mode 100644 src/Tile.java create mode 100644 src/Weapon.java create mode 100644 testmap.json diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1ad61a1 --- /dev/null +++ b/Makefile @@ -0,0 +1,28 @@ +MAINCLASS := Sub + +run: build + cd bin && java -Dawt.useSystemAAFontSettings=on -cp ../lib/gson-2.6.2.jar:. $(MAINCLASS) + +pack: build + echo "Main-Class: $(MAINCLASS)" > jar/manifest.txt + jar cvfm jar/$(MAINCLASS).jar jar/manifest.txt -C bin/ . + rm jar/manifest.txt + cp lib/gson-2.6.2.jar jar/ + cd jar && jar xf gson-2.6.2.jar + cd jar && rm META-INF -R + cd jar && jar xf Sub.jar + cd jar && rm gson-2.6.2.jar + cd jar && rm Sub.jar + cd jar && zip -r Subconcious.jar ./* + cd jar && find . ! -name 'Subconcious.jar' -type f -exec rm -f {} + + cd jar && rm -R com META-INF + +build: dirs + javac -cp lib/gson-2.6.2.jar:. -d bin/ src/*.java + +dirs: + mkdir -p src bin jar + +clean: + rm -R jar/* + rm bin/* diff --git a/bin/Actor.class b/bin/Actor.class new file mode 100644 index 0000000..0a81a44 Binary files /dev/null and b/bin/Actor.class differ diff --git a/bin/Battle$1.class b/bin/Battle$1.class new file mode 100644 index 0000000..a47f149 Binary files /dev/null and b/bin/Battle$1.class differ diff --git a/bin/Battle$Mode.class b/bin/Battle$Mode.class new file mode 100644 index 0000000..c078c93 Binary files /dev/null and b/bin/Battle$Mode.class differ diff --git a/bin/Battle.class b/bin/Battle.class new file mode 100644 index 0000000..726044f Binary files /dev/null and b/bin/Battle.class differ diff --git a/bin/Map.class b/bin/Map.class new file mode 100644 index 0000000..15d2af5 Binary files /dev/null and b/bin/Map.class differ diff --git a/bin/MapEditor$1.class b/bin/MapEditor$1.class new file mode 100644 index 0000000..326fd6b Binary files /dev/null and b/bin/MapEditor$1.class differ diff --git a/bin/MapEditor.class b/bin/MapEditor.class new file mode 100644 index 0000000..ba101ef Binary files /dev/null and b/bin/MapEditor.class differ diff --git a/bin/MapLoader.class b/bin/MapLoader.class new file mode 100644 index 0000000..fe96b1b Binary files /dev/null and b/bin/MapLoader.class differ diff --git a/bin/MapScene$1.class b/bin/MapScene$1.class new file mode 100644 index 0000000..f16cec4 Binary files /dev/null and b/bin/MapScene$1.class differ diff --git a/bin/MapScene.class b/bin/MapScene.class new file mode 100644 index 0000000..fb46fbb Binary files /dev/null and b/bin/MapScene.class differ diff --git a/bin/Palette.class b/bin/Palette.class new file mode 100644 index 0000000..ad2d3e8 Binary files /dev/null and b/bin/Palette.class differ diff --git a/bin/PathFinder.class b/bin/PathFinder.class new file mode 100644 index 0000000..758e45d Binary files /dev/null and b/bin/PathFinder.class differ diff --git a/bin/Scene.class b/bin/Scene.class new file mode 100644 index 0000000..da94577 Binary files /dev/null and b/bin/Scene.class differ diff --git a/bin/Sub$1.class b/bin/Sub$1.class new file mode 100644 index 0000000..9c6f4f1 Binary files /dev/null and b/bin/Sub$1.class differ diff --git a/bin/Sub.class b/bin/Sub.class new file mode 100644 index 0000000..de6d38d Binary files /dev/null and b/bin/Sub.class differ diff --git a/bin/TestScene$1.class b/bin/TestScene$1.class new file mode 100644 index 0000000..ee2fedf Binary files /dev/null and b/bin/TestScene$1.class differ diff --git a/bin/TestScene.class b/bin/TestScene.class new file mode 100644 index 0000000..15060c2 Binary files /dev/null and b/bin/TestScene.class differ diff --git a/bin/Tile$1.class b/bin/Tile$1.class new file mode 100644 index 0000000..3878e68 Binary files /dev/null and b/bin/Tile$1.class differ diff --git a/bin/Tile$Type.class b/bin/Tile$Type.class new file mode 100644 index 0000000..bb2f0b6 Binary files /dev/null and b/bin/Tile$Type.class differ diff --git a/bin/Tile.class b/bin/Tile.class new file mode 100644 index 0000000..7924000 Binary files /dev/null and b/bin/Tile.class differ diff --git a/bin/Weapon.class b/bin/Weapon.class new file mode 100644 index 0000000..cac12d2 Binary files /dev/null and b/bin/Weapon.class differ diff --git a/bin/null.json b/bin/null.json new file mode 100644 index 0000000..028bb26 --- /dev/null +++ b/bin/null.json @@ -0,0 +1 @@ +{"size":{"width":15,"height":15},"grid":[{"x":0,"y":0,"type":"GRASS","selected":false,"cost":1.0},{"x":0,"y":1,"type":"GRASS","selected":false,"cost":1.0},{"x":0,"y":2,"type":"GRASS","selected":false,"cost":1.0},{"x":0,"y":3,"type":"GRASS","selected":false,"cost":1.0},{"x":0,"y":4,"type":"GRASS","selected":false,"cost":1.0},{"x":0,"y":5,"type":"GRASS","selected":false,"cost":1.0},{"x":0,"y":6,"type":"GRASS","selected":false,"cost":1.0},{"x":0,"y":7,"type":"GRASS","selected":false,"cost":1.0},{"x":0,"y":8,"type":"MOUNTAIN","selected":false,"cost":4.0},{"x":0,"y":9,"type":"MOUNTAIN","selected":false,"cost":4.0},{"x":0,"y":10,"type":"GRASS","selected":false,"cost":1.0},{"x":0,"y":11,"type":"GRASS","selected":false,"cost":1.0},{"x":0,"y":12,"type":"GRASS","selected":false,"cost":1.0},{"x":0,"y":13,"type":"GRASS","selected":false,"cost":1.0},{"x":0,"y":14,"type":"GRASS","selected":false,"cost":1.0},{"x":1,"y":0,"type":"GRASS","selected":false,"cost":1.0},{"x":1,"y":1,"type":"GRASS","selected":false,"cost":1.0},{"x":1,"y":2,"type":"GRASS","selected":false,"cost":1.0},{"x":1,"y":3,"type":"GRASS","selected":false,"cost":1.0},{"x":1,"y":4,"type":"GRASS","selected":false,"cost":1.0},{"x":1,"y":5,"type":"GRASS","selected":false,"cost":1.0},{"x":1,"y":6,"type":"GRASS","selected":false,"cost":1.0},{"x":1,"y":7,"type":"GRASS","selected":false,"cost":1.0},{"x":1,"y":8,"type":"GRASS","selected":false,"cost":1.0},{"x":1,"y":9,"type":"GRASS","selected":false,"cost":1.0},{"x":1,"y":10,"type":"GRASS","selected":false,"cost":1.0},{"x":1,"y":11,"type":"GRASS","selected":false,"cost":1.0},{"x":1,"y":12,"type":"GRASS","selected":false,"cost":1.0},{"x":1,"y":13,"type":"GRASS","selected":false,"cost":1.0},{"x":1,"y":14,"type":"GRASS","selected":false,"cost":1.0},{"x":2,"y":0,"type":"GRASS","selected":false,"cost":1.0},{"x":2,"y":1,"type":"GRASS","selected":false,"cost":1.0},{"x":2,"y":2,"type":"MOUNTAIN","selected":false,"cost":4.0},{"x":2,"y":3,"type":"MOUNTAIN","selected":false,"cost":4.0},{"x":2,"y":4,"type":"GRASS","selected":false,"cost":1.0},{"x":2,"y":5,"type":"MOUNTAIN","selected":false,"cost":4.0},{"x":2,"y":6,"type":"GRASS","selected":false,"cost":1.0},{"x":2,"y":7,"type":"GRASS","selected":false,"cost":1.0},{"x":2,"y":8,"type":"MOUNTAIN","selected":false,"cost":4.0},{"x":2,"y":9,"type":"GRASS","selected":false,"cost":1.0},{"x":2,"y":10,"type":"GRASS","selected":false,"cost":1.0},{"x":2,"y":11,"type":"GRASS","selected":false,"cost":1.0},{"x":2,"y":12,"type":"MOUNTAIN","selected":false,"cost":4.0},{"x":2,"y":13,"type":"GRASS","selected":false,"cost":1.0},{"x":2,"y":14,"type":"GRASS","selected":false,"cost":1.0},{"x":3,"y":0,"type":"GRASS","selected":false,"cost":1.0},{"x":3,"y":1,"type":"GRASS","selected":false,"cost":1.0},{"x":3,"y":2,"type":"MOUNTAIN","selected":false,"cost":4.0},{"x":3,"y":3,"type":"GRASS","selected":false,"cost":1.0},{"x":3,"y":4,"type":"GRASS","selected":false,"cost":1.0},{"x":3,"y":5,"type":"GRASS","selected":false,"cost":1.0},{"x":3,"y":6,"type":"GRASS","selected":false,"cost":1.0},{"x":3,"y":7,"type":"GRASS","selected":false,"cost":1.0},{"x":3,"y":8,"type":"MOUNTAIN","selected":false,"cost":4.0},{"x":3,"y":9,"type":"MOUNTAIN","selected":false,"cost":4.0},{"x":3,"y":10,"type":"GRASS","selected":false,"cost":1.0},{"x":3,"y":11,"type":"GRASS","selected":false,"cost":1.0},{"x":3,"y":12,"type":"MOUNTAIN","selected":false,"cost":4.0},{"x":3,"y":13,"type":"GRASS","selected":false,"cost":1.0},{"x":3,"y":14,"type":"GRASS","selected":false,"cost":1.0},{"x":4,"y":0,"type":"GRASS","selected":false,"cost":1.0},{"x":4,"y":1,"type":"GRASS","selected":false,"cost":1.0},{"x":4,"y":2,"type":"GRASS","selected":false,"cost":1.0},{"x":4,"y":3,"type":"GRASS","selected":false,"cost":1.0},{"x":4,"y":4,"type":"GRASS","selected":false,"cost":1.0},{"x":4,"y":5,"type":"GRASS","selected":false,"cost":1.0},{"x":4,"y":6,"type":"GRASS","selected":false,"cost":1.0},{"x":4,"y":7,"type":"GRASS","selected":false,"cost":1.0},{"x":4,"y":8,"type":"GRASS","selected":false,"cost":1.0},{"x":4,"y":9,"type":"GRASS","selected":false,"cost":1.0},{"x":4,"y":10,"type":"GRASS","selected":false,"cost":1.0},{"x":4,"y":11,"type":"GRASS","selected":false,"cost":1.0},{"x":4,"y":12,"type":"MOUNTAIN","selected":false,"cost":4.0},{"x":4,"y":13,"type":"GRASS","selected":false,"cost":1.0},{"x":4,"y":14,"type":"GRASS","selected":false,"cost":1.0},{"x":5,"y":0,"type":"GRASS","selected":false,"cost":1.0},{"x":5,"y":1,"type":"GRASS","selected":false,"cost":1.0},{"x":5,"y":2,"type":"GRASS","selected":false,"cost":1.0},{"x":5,"y":3,"type":"GRASS","selected":false,"cost":1.0},{"x":5,"y":4,"type":"MOUNTAIN","selected":false,"cost":4.0},{"x":5,"y":5,"type":"MOUNTAIN","selected":false,"cost":4.0},{"x":5,"y":6,"type":"GRASS","selected":false,"cost":1.0},{"x":5,"y":7,"type":"GRASS","selected":false,"cost":1.0},{"x":5,"y":8,"type":"GRASS","selected":false,"cost":1.0},{"x":5,"y":9,"type":"GRASS","selected":false,"cost":1.0},{"x":5,"y":10,"type":"GRASS","selected":false,"cost":1.0},{"x":5,"y":11,"type":"GRASS","selected":false,"cost":1.0},{"x":5,"y":12,"type":"GRASS","selected":false,"cost":1.0},{"x":5,"y":13,"type":"GRASS","selected":false,"cost":1.0},{"x":5,"y":14,"type":"GRASS","selected":false,"cost":1.0},{"x":6,"y":0,"type":"GRASS","selected":false,"cost":1.0},{"x":6,"y":1,"type":"GRASS","selected":false,"cost":1.0},{"x":6,"y":2,"type":"GRASS","selected":false,"cost":1.0},{"x":6,"y":3,"type":"GRASS","selected":false,"cost":1.0},{"x":6,"y":4,"type":"GRASS","selected":false,"cost":1.0},{"x":6,"y":5,"type":"GRASS","selected":false,"cost":1.0},{"x":6,"y":6,"type":"GRASS","selected":false,"cost":1.0},{"x":6,"y":7,"type":"MOUNTAIN","selected":false,"cost":4.0},{"x":6,"y":8,"type":"MOUNTAIN","selected":false,"cost":4.0},{"x":6,"y":9,"type":"GRASS","selected":false,"cost":1.0},{"x":6,"y":10,"type":"GRASS","selected":false,"cost":1.0},{"x":6,"y":11,"type":"GRASS","selected":false,"cost":1.0},{"x":6,"y":12,"type":"GRASS","selected":false,"cost":1.0},{"x":6,"y":13,"type":"GRASS","selected":false,"cost":1.0},{"x":6,"y":14,"type":"GRASS","selected":false,"cost":1.0},{"x":7,"y":0,"type":"GRASS","selected":false,"cost":1.0},{"x":7,"y":1,"type":"GRASS","selected":false,"cost":1.0},{"x":7,"y":2,"type":"GRASS","selected":false,"cost":1.0},{"x":7,"y":3,"type":"GRASS","selected":false,"cost":1.0},{"x":7,"y":4,"type":"GRASS","selected":false,"cost":1.0},{"x":7,"y":5,"type":"MOUNTAIN","selected":false,"cost":4.0},{"x":7,"y":6,"type":"GRASS","selected":false,"cost":1.0},{"x":7,"y":7,"type":"MOUNTAIN","selected":false,"cost":4.0},{"x":7,"y":8,"type":"GRASS","selected":false,"cost":1.0},{"x":7,"y":9,"type":"GRASS","selected":false,"cost":1.0},{"x":7,"y":10,"type":"MOUNTAIN","selected":false,"cost":4.0},{"x":7,"y":11,"type":"GRASS","selected":false,"cost":1.0},{"x":7,"y":12,"type":"GRASS","selected":false,"cost":1.0},{"x":7,"y":13,"type":"GRASS","selected":false,"cost":1.0},{"x":7,"y":14,"type":"GRASS","selected":false,"cost":1.0},{"x":8,"y":0,"type":"GRASS","selected":false,"cost":1.0},{"x":8,"y":1,"type":"GRASS","selected":false,"cost":1.0},{"x":8,"y":2,"type":"GRASS","selected":false,"cost":1.0},{"x":8,"y":3,"type":"GRASS","selected":false,"cost":1.0},{"x":8,"y":4,"type":"GRASS","selected":false,"cost":1.0},{"x":8,"y":5,"type":"MOUNTAIN","selected":false,"cost":4.0},{"x":8,"y":6,"type":"GRASS","selected":false,"cost":1.0},{"x":8,"y":7,"type":"GRASS","selected":false,"cost":1.0},{"x":8,"y":8,"type":"GRASS","selected":false,"cost":1.0},{"x":8,"y":9,"type":"GRASS","selected":false,"cost":1.0},{"x":8,"y":10,"type":"MOUNTAIN","selected":false,"cost":4.0},{"x":8,"y":11,"type":"GRASS","selected":false,"cost":1.0},{"x":8,"y":12,"type":"GRASS","selected":false,"cost":1.0},{"x":8,"y":13,"type":"GRASS","selected":false,"cost":1.0},{"x":8,"y":14,"type":"GRASS","selected":false,"cost":1.0},{"x":9,"y":0,"type":"GRASS","selected":false,"cost":1.0},{"x":9,"y":1,"type":"MOUNTAIN","selected":false,"cost":4.0},{"x":9,"y":2,"type":"GRASS","selected":false,"cost":1.0},{"x":9,"y":3,"type":"GRASS","selected":false,"cost":1.0},{"x":9,"y":4,"type":"GRASS","selected":false,"cost":1.0},{"x":9,"y":5,"type":"CLEAR","selected":false,"cost":1.0E9},{"x":9,"y":6,"type":"GRASS","selected":false,"cost":1.0},{"x":9,"y":7,"type":"GRASS","selected":false,"cost":1.0},{"x":9,"y":8,"type":"GRASS","selected":false,"cost":1.0},{"x":9,"y":9,"type":"GRASS","selected":false,"cost":1.0},{"x":9,"y":10,"type":"MOUNTAIN","selected":false,"cost":4.0},{"x":9,"y":11,"type":"GRASS","selected":false,"cost":1.0},{"x":9,"y":12,"type":"GRASS","selected":false,"cost":1.0},{"x":9,"y":13,"type":"GRASS","selected":false,"cost":1.0},{"x":9,"y":14,"type":"GRASS","selected":false,"cost":1.0},{"x":10,"y":0,"type":"GRASS","selected":false,"cost":1.0},{"x":10,"y":1,"type":"MOUNTAIN","selected":false,"cost":4.0},{"x":10,"y":2,"type":"GRASS","selected":false,"cost":1.0},{"x":10,"y":3,"type":"GRASS","selected":false,"cost":1.0},{"x":10,"y":4,"type":"GRASS","selected":false,"cost":1.0},{"x":10,"y":5,"type":"MOUNTAIN","selected":false,"cost":4.0},{"x":10,"y":6,"type":"MOUNTAIN","selected":false,"cost":4.0},{"x":10,"y":7,"type":"GRASS","selected":false,"cost":1.0},{"x":10,"y":8,"type":"GRASS","selected":false,"cost":1.0},{"x":10,"y":9,"type":"GRASS","selected":false,"cost":1.0},{"x":10,"y":10,"type":"GRASS","selected":false,"cost":1.0},{"x":10,"y":11,"type":"GRASS","selected":false,"cost":1.0},{"x":10,"y":12,"type":"GRASS","selected":false,"cost":1.0},{"x":10,"y":13,"type":"GRASS","selected":false,"cost":1.0},{"x":10,"y":14,"type":"GRASS","selected":false,"cost":1.0},{"x":11,"y":0,"type":"GRASS","selected":false,"cost":1.0},{"x":11,"y":1,"type":"MOUNTAIN","selected":false,"cost":4.0},{"x":11,"y":2,"type":"MOUNTAIN","selected":false,"cost":4.0},{"x":11,"y":3,"type":"GRASS","selected":false,"cost":1.0},{"x":11,"y":4,"type":"GRASS","selected":false,"cost":1.0},{"x":11,"y":5,"type":"GRASS","selected":false,"cost":1.0},{"x":11,"y":6,"type":"GRASS","selected":false,"cost":1.0},{"x":11,"y":7,"type":"GRASS","selected":false,"cost":1.0},{"x":11,"y":8,"type":"GRASS","selected":false,"cost":1.0},{"x":11,"y":9,"type":"GRASS","selected":false,"cost":1.0},{"x":11,"y":10,"type":"GRASS","selected":false,"cost":1.0},{"x":11,"y":11,"type":"GRASS","selected":false,"cost":1.0},{"x":11,"y":12,"type":"GRASS","selected":false,"cost":1.0},{"x":11,"y":13,"type":"GRASS","selected":false,"cost":1.0},{"x":11,"y":14,"type":"GRASS","selected":false,"cost":1.0},{"x":12,"y":0,"type":"GRASS","selected":false,"cost":1.0},{"x":12,"y":1,"type":"GRASS","selected":false,"cost":1.0},{"x":12,"y":2,"type":"GRASS","selected":false,"cost":1.0},{"x":12,"y":3,"type":"GRASS","selected":false,"cost":1.0},{"x":12,"y":4,"type":"GRASS","selected":false,"cost":1.0},{"x":12,"y":5,"type":"GRASS","selected":false,"cost":1.0},{"x":12,"y":6,"type":"GRASS","selected":false,"cost":1.0},{"x":12,"y":7,"type":"GRASS","selected":false,"cost":1.0},{"x":12,"y":8,"type":"GRASS","selected":false,"cost":1.0},{"x":12,"y":9,"type":"GRASS","selected":false,"cost":1.0},{"x":12,"y":10,"type":"GRASS","selected":false,"cost":1.0},{"x":12,"y":11,"type":"GRASS","selected":false,"cost":1.0},{"x":12,"y":12,"type":"GRASS","selected":false,"cost":1.0},{"x":12,"y":13,"type":"GRASS","selected":false,"cost":1.0},{"x":12,"y":14,"type":"GRASS","selected":false,"cost":1.0},{"x":13,"y":0,"type":"GRASS","selected":false,"cost":1.0},{"x":13,"y":1,"type":"GRASS","selected":false,"cost":1.0},{"x":13,"y":2,"type":"GRASS","selected":false,"cost":1.0},{"x":13,"y":3,"type":"GRASS","selected":false,"cost":1.0},{"x":13,"y":4,"type":"GRASS","selected":false,"cost":1.0},{"x":13,"y":5,"type":"GRASS","selected":false,"cost":1.0},{"x":13,"y":6,"type":"GRASS","selected":false,"cost":1.0},{"x":13,"y":7,"type":"MOUNTAIN","selected":false,"cost":4.0},{"x":13,"y":8,"type":"MOUNTAIN","selected":false,"cost":4.0},{"x":13,"y":9,"type":"MOUNTAIN","selected":false,"cost":4.0},{"x":13,"y":10,"type":"GRASS","selected":false,"cost":1.0},{"x":13,"y":11,"type":"GRASS","selected":false,"cost":1.0},{"x":13,"y":12,"type":"GRASS","selected":false,"cost":1.0},{"x":13,"y":13,"type":"GRASS","selected":false,"cost":1.0},{"x":13,"y":14,"type":"GRASS","selected":false,"cost":1.0},{"x":14,"y":0,"type":"GRASS","selected":false,"cost":1.0},{"x":14,"y":1,"type":"GRASS","selected":false,"cost":1.0},{"x":14,"y":2,"type":"GRASS","selected":false,"cost":1.0},{"x":14,"y":3,"type":"GRASS","selected":false,"cost":1.0},{"x":14,"y":4,"type":"GRASS","selected":false,"cost":1.0},{"x":14,"y":5,"type":"GRASS","selected":false,"cost":1.0},{"x":14,"y":6,"type":"GRASS","selected":false,"cost":1.0},{"x":14,"y":7,"type":"GRASS","selected":false,"cost":1.0},{"x":14,"y":8,"type":"GRASS","selected":false,"cost":1.0},{"x":14,"y":9,"type":"GRASS","selected":false,"cost":1.0},{"x":14,"y":10,"type":"GRASS","selected":false,"cost":1.0},{"x":14,"y":11,"type":"GRASS","selected":false,"cost":1.0},{"x":14,"y":12,"type":"GRASS","selected":false,"cost":1.0},{"x":14,"y":13,"type":"GRASS","selected":false,"cost":1.0},{"x":14,"y":14,"type":"GRASS","selected":false,"cost":1.0}],"actors":[]} diff --git a/jar/Subconcious.jar b/jar/Subconcious.jar new file mode 100644 index 0000000..13b9cc9 Binary files /dev/null and b/jar/Subconcious.jar differ diff --git a/lib/gson-2.6.2.jar b/lib/gson-2.6.2.jar new file mode 100644 index 0000000..9d78626 Binary files /dev/null and b/lib/gson-2.6.2.jar differ diff --git a/src/Actor.java b/src/Actor.java new file mode 100644 index 0000000..ca3995a --- /dev/null +++ b/src/Actor.java @@ -0,0 +1,107 @@ +public class Actor { + private String name; + private boolean alive; + private boolean enemy; + private int hp; + private int agility; + private int strenght; + private int defense; + private int x; + private int y; + private Weapon weapon; + private int actionsLeft; + private int actions = 2; + + public Actor(String name, int hp, boolean enemy, int agility) { + this.name = name; + this.hp = hp; + this.enemy = enemy; + this.agility = agility; + this.weapon = new Weapon("fist", 1, 1, 10000000); + + this.alive = true; + this.resetActions(); + } + + public void resetActions() { + this.actionsLeft = this.actions; + } + + public int getActionsLeft() { + return this.actionsLeft; + } + + public boolean hit(Actor actor, Map map) { + if (this.actionsLeft > 0) { + if (this.weapon.damage(this, actor, map)) { + this.actionsLeft--; + return true; + } + } + return false; + } + + public Weapon getWeapon() { + return this.weapon; + } + + public void equipWeapon(Weapon weapon) { + this.weapon = weapon; + } + + public boolean isAlive() { + return this.alive; + } + + public void setHP(int hp) { + this.hp = hp; + if (this.hp <= 0) { + this.alive = false; + } + } + + public void damage(int dmg) { + this.hp -= dmg; + if (this.hp <= 0) { + this.alive = false; + } + } + + public int getAgility() { + return this.agility; + } + + public String getName() { + return this.name; + } + + public int getHP() { + return this.hp; + } + + public int getX() { + return this.x; + } + + public int getY() { + return this.y; + } + + public boolean isEnemy() { + return this.enemy; + } + + public void move(int x, int y) { + if (this.actionsLeft > 0) { + this.x = x; + this.y = y; + this.actionsLeft--; + } + } + + public void place(int x, int y) { + this.x = x; + this.y = y; + + } +} diff --git a/src/Battle.java b/src/Battle.java new file mode 100644 index 0000000..d7b63cc --- /dev/null +++ b/src/Battle.java @@ -0,0 +1,304 @@ +import java.util.ArrayList; +import java.util.Collections; +import java.awt.Canvas; +import java.awt.Graphics2D; +import java.awt.Dimension; +import java.awt.BorderLayout; +import java.awt.GridLayout; +import java.awt.event.KeyEvent; +import java.awt.event.MouseEvent; +import java.awt.event.MouseWheelEvent; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.image.BufferStrategy; +import java.awt.geom.Point2D; +import java.awt.geom.NoninvertibleTransformException; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JButton; + +public class Battle extends MapScene { + + private enum Mode { + NONE, ATTACK, MOVE + }; + + private Sub main; + private int previousX = -1; + private int previousY = -1; + private Actor selectedActor; + private Actor lastActor; + private Mode mode; + private boolean actorClicked = false; + private int realX = 0; + private int realY = 0; + + public Battle(JFrame frame, Sub sub) { + super(frame, sub); + this.main = sub; + + MapLoader mapLoader = new MapLoader("../testmap.json"); + this.map = mapLoader.getMap(); + + this.selectedActor = this.map.getNextActor(); + + this.setLayout(new BorderLayout()); + + JPanel bottomPanel = new JPanel(); + bottomPanel.setLayout(new GridLayout(1,4)); + + JButton moveButton = new JButton("Move"); + moveButton.setActionCommand("move"); + JButton attackButton = new JButton("Attack"); + attackButton.setActionCommand("attack"); + JButton nextButton = new JButton("Next"); + nextButton.setActionCommand("next"); + JButton passButton = new JButton("Pass"); + passButton.setActionCommand("pass"); + + moveButton.addActionListener(this); + attackButton.addActionListener(this); + nextButton.addActionListener(this); + passButton.addActionListener(this); + + bottomPanel.add(moveButton); + bottomPanel.add(attackButton); + bottomPanel.add(nextButton); + bottomPanel.add(passButton); + + this.add(bottomPanel, BorderLayout.PAGE_END); + this.add(this.canvas, BorderLayout.CENTER); + } + + @Override + protected void absoluteRender(Graphics2D g) { + //draw cursor + //g.setColor(Palette.BLUE); + //g.fillOval(this.realX-10*this.guiSize, this.realY-10*this.guiSize, 20*this.guiSize, 20*this.guiSize); + //g.setColor(Palette.ORANGE); + //g.drawOval(this.realX-10*this.guiSize, this.realY-10*this.guiSize, 20*this.guiSize, 20*this.guiSize); + + //draw panels + g.setColor(Palette.WHITE_T); + g.fillRect(this.WIDTH-100*this.guiSize, this.HEIGHT-100*this.guiSize, + 100*this.guiSize, 100*this.guiSize); + g.fillRect(0, this.HEIGHT-100*this.guiSize, 150*this.guiSize, 100*this.guiSize); + + g.setColor(Palette.BLACK); + g.setFont(g.getFont().deriveFont(12.0F*this.guiSize)); + Tile tile = null; + try{ + tile = this.map.getTile(this.previousX, this.previousY); + switch (tile.getType()) { + case CLEAR: + break; + case GRASS: + g.drawString("Grass", this.WIDTH-90*this.guiSize, this.HEIGHT-80*this.guiSize); + break; + case WATER: + g.drawString("Water", this.WIDTH-90*this.guiSize, this.HEIGHT-80*this.guiSize); + break; + case MOUNTAIN: + g.drawString("Mountain", this.WIDTH-90*this.guiSize, this.HEIGHT-80*this.guiSize); + break; + } + + g.setFont(g.getFont().deriveFont(8.0F*this.guiSize)); + if (this.actorClicked && this.lastActor != null) { + g.setColor(Palette.WHITE_T); + g.fillRect(0, 0, 100*this.guiSize, 150*this.guiSize); + g.fillRect(this.WIDTH-100*this.guiSize, 0, 100*this.guiSize, 100*this.guiSize); + + g.setColor(Palette.BLACK); + g.drawString(this.lastActor.getName(), 5*this.guiSize, 15*this.guiSize); + + g.drawString("HP", 5*this.guiSize, 30*this.guiSize); + g.setColor(Palette.RED); + g.fillRect(20*this.guiSize, 22*this.guiSize, 70*this.guiSize, 10*this.guiSize); + g.setColor(Palette.DARKGREEN); + g.fillRect(20*this.guiSize, 22*this.guiSize, 70*this.guiSize*this.lastActor.getHP()/10, 10*this.guiSize); + + g.setColor(Palette.BLACK); + g.drawString("Agility: " + Integer.toString(this.lastActor.getAgility()), + 5*this.guiSize, 45*this.guiSize); + } else if (this.actorClicked) { + g.setColor(Palette.WHITE_T); + g.fillRect(0, 0, 100*this.guiSize, 150*this.guiSize); + g.fillRect(this.WIDTH-100*this.guiSize, 0, 100*this.guiSize, 100*this.guiSize); + + g.setColor(Palette.BLACK); + g.drawString("None left", 5*this.guiSize, 15*this.guiSize); + } + } catch (ArrayIndexOutOfBoundsException ex) { + } catch (NullPointerException ext) { + System.out.println("map non existent"); + ext.printStackTrace(); + } + } + + @Override + protected void update(int deltaTime) { + ArrayList actorsToRemove = new ArrayList<>(); + int enemyCounter = 0; + + for (Actor actor : this.map.getActors()) { + if (!actor.isAlive()) { + actorsToRemove.add(actor); + } + if (actor.isEnemy()) { + enemyCounter++; + } + } + + for (Actor actor : actorsToRemove) { + this.map.removeActor(actor); + } + + if (selectedActor != null) { + this.map.setCursor(selectedActor.getX(), selectedActor.getY()); + } else { + this.map.setCursor(-1, -1); + } + + if (enemyCounter == 0) { + //win + this.main.backToMenu(); + } + } + + private void aiPlay() { + //TODO write AI + //controll back to the player + this.map.resetActors(); + this.selectedActor = this.map.getNextActor(); + this.lastActor = this.selectedActor; + this.actorClicked = true; + } + + @Override + public void mouseClicked(MouseEvent e) { + int tileSize = this.maxSize/10; + Point2D p = new Point2D.Double(e.getX(), e.getY()); + try { + p = this.tx.inverseTransform(p, null); + } catch (NoninvertibleTransformException ex) {} + try { + int x = (int) (p.getX()/tileSize); + int y = (int) (p.getY()/tileSize); + Tile tile = this.map.getTile(x, y); + Actor actor = null; + for (Actor i : this.map.getActors()) { + if (x == i.getX() && y == i.getY()) { + actor = i; + break; + } + } + + if (actor != null) { + this.actorClicked = true; + this.lastActor = actor; + } else { + this.actorClicked = false; + } + + if (this.mode == Mode.MOVE) { + if (tile.isSelected()) { + this.selectedActor.move(x, y); + this.mode = Mode.NONE; + this.map.clearSelected(); + if (this.selectedActor.getActionsLeft() <= 0) { + this.selectedActor = this.map.getNextActor(); + this.lastActor = this.selectedActor; + this.actorClicked = true; + } + } + } else if (this.mode == Mode.ATTACK) { + if (actor != null) { + this.selectedActor.hit(actor, this.map); + if (this.selectedActor.getActionsLeft() <= 0) { + this.selectedActor = this.map.getNextActor(); + this.lastActor = this.selectedActor; + this.actorClicked = true; + } + } + this.mode = Mode.NONE; + this.map.clearSelected(); + } + } catch (ArrayIndexOutOfBoundsException ex) { + System.out.println("no tile clicked"); + } catch (NullPointerException ext) { + //ext.printStackTrace(); + System.out.println("map non existent"); + } + } + + @Override + public void mouseMoved(MouseEvent e) { + this.realX = e.getX(); + this.realY = e.getY(); + int tileSize = this.maxSize/10; + Point2D p = new Point2D.Double(e.getX(), e.getY()); + try { + p = this.tx.inverseTransform(p, null); + } catch (NoninvertibleTransformException ex) {} + int x = (int) (p.getX()/tileSize); + int y = (int) (p.getY()/tileSize); + try { + Tile tile = this.map.getTile(x, y); + if (x != this.previousX || y != this.previousY) { + if (this.mode == Mode.MOVE) { + this.map.clearSelected(); + ArrayList path = this.map.getPath(this.selectedActor, x, y); + Collections.reverse(path); + for (int i=0; i=0 && + x+r < this.map.getSize() && + y+c >= 0 && + y+c < this.map.getSize()) { + this.map.getTile(x+r, y+c).setSelected(true); + } + } + } + this.mode = Mode.ATTACK; + } else if ("next".equals(e.getActionCommand())) { + this.map.clearSelected(); + this.selectedActor = this.map.getNextActor(); + this.lastActor = this.selectedActor; + this.actorClicked = true; + } + + } +} diff --git a/src/Map.java b/src/Map.java new file mode 100644 index 0000000..7b178cf --- /dev/null +++ b/src/Map.java @@ -0,0 +1,154 @@ +import java.awt.Dimension; +import java.util.ArrayList; + +public class Map { + private final Dimension size; + private final Tile grid[]; + private ArrayList actors = new ArrayList(); + private int actorIndex = -1; + private int selectedX; + private int selectedY; + + public Map(Dimension size) { + this.size = size; + + this.grid = new Tile[(int) this.size.getWidth() * (int) this.size.getHeight()]; + for (int x = 0; x < this.size.getWidth(); x++) { + for (int y = 0; y < this.size.getHeight(); y++) { + this.grid[x * (int) this.size.getWidth() + y] = new Tile(Tile.Type.GRASS, x, y); + } + } + } + + public ArrayList getPath(Actor actor, int x, int y) { + ArrayList unsettled = new ArrayList(); + ArrayList settled = new ArrayList(); + Tile startTile = this.getTile(actor.getX(), actor.getY()); + + for (Tile i : this.getGrid()) { + i.setDistance(10000000); + } + + startTile.setDistance(0); + unsettled.add(startTile); + settled.add(startTile); + + boolean stop = false; + while (unsettled.size() != 0) { + Tile workingTile = unsettled.get(0); + unsettled.remove(workingTile); + for (Tile i : workingTile.getAdjacent(this)) { + if (settled.contains(i)) { + continue; + } + i.setDistance(i.getCost(actor) + workingTile.getDistance()); + unsettled.add(i); + settled.add(i); + } + } + ArrayList out = new ArrayList(); + Tile workingTile = this.getTile(x, y); + double bestDistance = 1000000000; + Tile bestTile = workingTile; + while (true) { + for (Tile i : workingTile.getAdjacent(this)) { + if (i.getDistance() < bestDistance) { + bestDistance = i.getDistance(); + bestTile = i; + } + } + out.add(workingTile); + if (workingTile.getX() == startTile.getX() && workingTile.getY() == startTile.getY()) { + break; + } + workingTile = bestTile; + bestDistance = 1000000000; + } + + return out; + } + + public void update(ArrayList actorsList, Tile[] tileGrid) { + for (Actor actor : actorsList) { + Actor newActor = new Actor(actor.getName(), actor.getHP(), actor.isEnemy(), actor.getAgility()); + newActor.place(actor.getX(), actor.getY()); + this.actors.add(newActor); + } + + for (int x = 0; x < this.size.getWidth(); x++) { + for (int y = 0; y < this.size.getHeight(); y++) { + Tile.Type oldTileType = tileGrid[x * (int) this.size.getWidth() + y].getType(); + this.grid[x * (int) this.size.getWidth() + y] = new Tile(oldTileType, x, y); + } + } + } + + public void resetActors() { + for (Actor actor : this.actors) { + if (!actor.isEnemy()) { + actor.resetActions(); + } + } + } + + public Actor getNextActor() { + int counter = 0; + this.actorIndex++; + if (this.actorIndex >= this.actors.size()) { + this.actorIndex = 0; + } + Actor actor = this.actors.get(this.actorIndex); + while (actor.isEnemy() || actor.getActionsLeft() <= 0) { + this.actorIndex++; + if (this.actorIndex >= this.actors.size()) { + this.actorIndex = 0; + } + actor = this.actors.get(this.actorIndex); + if (counter > this.actors.size()*2) { + return null; + } + counter++; + } + return actor; + } + + public void setCursor(int x, int y) { + this.getTile(this.selectedX, this.selectedY).setCursor(false); + if (x == -1 && y == -1) { + return; + } + this.getTile(x, y).setCursor(true); + this.selectedX = x; + this.selectedY = y; + } + + public Tile[] getGrid() { + return this.grid; + } + + public Tile getTile(int x, int y) { + return this.grid[x * (int) this.size.getWidth() + y]; + } + + public int getSize() { + return (int) this.size.getWidth(); + } + + public ArrayList getActors() { + return this.actors; + } + + public void removeActor(Actor actor) { + this.actors.remove(actor); + } + + public void addActor(Actor actor) { + this.actors.add(actor); + } + + public void clearSelected() { + for (Tile tile : this.grid) { + tile.setSelected(false); + } + } +} diff --git a/src/MapEditor.java b/src/MapEditor.java new file mode 100644 index 0000000..864fab7 --- /dev/null +++ b/src/MapEditor.java @@ -0,0 +1,226 @@ +import java.util.ArrayList; +import java.awt.Canvas; +import java.awt.Graphics2D; +import java.awt.Dimension; +import java.awt.BorderLayout; +import java.awt.GridLayout; +import java.awt.event.KeyEvent; +import java.awt.event.MouseEvent; +import java.awt.event.MouseWheelEvent; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.image.BufferStrategy; +import java.awt.geom.AffineTransform; +import java.awt.geom.Point2D; +import java.awt.geom.NoninvertibleTransformException; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JButton; +import javax.swing.JComponent; +import javax.swing.JOptionPane; +import javax.swing.JLabel; +import javax.swing.JTextField; +import javax.swing.JFileChooser; +import javax.swing.JCheckBox; +import java.lang.Integer; + +public class MapEditor extends MapScene { + private Tile.Type placingTile = Tile.Type.CLEAR; + private Actor placingActor = new Actor("", 0, false, 0); + private ArrayList actorFields = new ArrayList<>(); + private JFrame actorFrame; + private boolean nukeActor = false; + + public MapEditor(JFrame frame, Sub sub) { + super(frame, sub); + this.setLayout(new BorderLayout()); + + JPanel bottomPanel = new JPanel(); + bottomPanel.setLayout(new GridLayout(1,5)); + + JButton newButton = new JButton("New"); + newButton.setActionCommand("new"); + JButton tileButton = new JButton("Placing selector"); + tileButton.setActionCommand("tile"); + JButton exportButton = new JButton("Export"); + exportButton.setActionCommand("export"); + JButton importButton = new JButton("Import"); + importButton.setActionCommand("import"); + JButton actorButton = new JButton("Actors"); + actorButton.setActionCommand("actors"); + + newButton.addActionListener(this); + tileButton.addActionListener(this); + actorButton.addActionListener(this); + exportButton.addActionListener(this); + importButton.addActionListener(this); + + bottomPanel.add(newButton); + bottomPanel.add(tileButton); + bottomPanel.add(actorButton); + bottomPanel.add(exportButton); + bottomPanel.add(importButton); + + this.add(bottomPanel, BorderLayout.PAGE_END); + this.add(this.canvas, BorderLayout.CENTER); + } + + @Override + public void mouseClicked(MouseEvent e) { + int tileSize = this.maxSize/10; + Point2D p = new Point2D.Double(e.getX(), e.getY()); + try { + p = this.tx.inverseTransform(p, null); + } catch (NoninvertibleTransformException ex) {} + try { + int x = (int) p.getX()/tileSize; + int y = (int) p.getY()/tileSize; + this.map.getTile(x, y); + if (this.placingTile != Tile.Type.NONE) { + this.map.getTile(x, y).setType(this.placingTile); + } else { + if (!this.nukeActor) { + Actor actor = this.placingActor; + actor.place(x, y); + this.map.addActor(actor); + } else { + Actor toNuke = this.placingActor; + for (Actor actor : this.map.getActors()) { + if (x == actor.getX() && y == actor.getY()) { + toNuke = actor; + } + } + this.map.removeActor(toNuke); + } + } + } catch (ArrayIndexOutOfBoundsException ex) { + System.out.println("no tile clicked"); + } catch (NullPointerException ext) { + System.out.println("map non existent"); + } + } + + @Override + public void actionPerformed(ActionEvent e) { + if ("new".equals(e.getActionCommand())) { + JTextField size = new JTextField(); + + JComponent[] inputs = new JComponent[] { + new JLabel("Size"), + size, + }; + + int result = JOptionPane.showConfirmDialog(null, inputs, "New map", JOptionPane.DEFAULT_OPTION); + if (result == JOptionPane.OK_OPTION) { + int sizeN = Integer.parseInt(size.getText()); + this.map = new Map(new Dimension(sizeN, sizeN)); + } + } else if ("tile".equals(e.getActionCommand())) { + String[] values = {"Clear", "Grass", "Water", "Mountain", "Actor", "Remove Actor"}; + + Object result = JOptionPane.showInputDialog(null, "Tile Type", "Tile Type Selector", JOptionPane.DEFAULT_OPTION, null, values, "0"); + if (result != null) { + String selected = result.toString(); + switch (selected) { + case "Clear": + this.placingTile = Tile.Type.CLEAR; + break; + case "Grass": + this.placingTile = Tile.Type.GRASS; + break; + case "Water": + this.placingTile = Tile.Type.WATER; + break; + case "Mountain": + this.placingTile = Tile.Type.MOUNTAIN; + break; + case "Actor": + this.placingTile = Tile.Type.NONE; + this.nukeActor = false; + break; + case "Remove Actor": + this.placingTile = Tile.Type.NONE; + this.nukeActor = true; + break; + + } + } + } else if ("export".equals(e.getActionCommand())) { + JFileChooser fc = new JFileChooser(); + fc.showSaveDialog(null); + + MapLoader mapLoader = new MapLoader(fc.getSelectedFile()); + mapLoader.saveMap(this.map); + } else if ("import".equals(e.getActionCommand())) { + JFileChooser fc = new JFileChooser(); + fc.showOpenDialog(null); + + MapLoader mapLoader = new MapLoader(fc.getSelectedFile()); + this.map = mapLoader.getMap(); + } else if ("actors".equals(e.getActionCommand())) { + JFrame actorFrame = new JFrame("Actors"); + actorFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + actorFrame.setSize(new Dimension(300, 400)); + actorFrame.setLocationRelativeTo(null); + + JPanel panel = new JPanel(); + panel.setLayout(new GridLayout(5,2)); + + JLabel lName = new JLabel("Name"); + JTextField name = new JTextField(); + JLabel lAgility = new JLabel("Agility"); + JTextField agility = new JTextField(); + JLabel lHp = new JLabel("max HP"); + JTextField hp = new JTextField(); + JCheckBox enemy = new JCheckBox("Enemy"); + JLabel empty = new JLabel(); + JButton ok = new JButton("Confirm"); + ok.setActionCommand("actOk"); + JButton cancel = new JButton("Cancel"); + cancel.setActionCommand("actCancel"); + + ArrayList actorFields = new ArrayList<>(); + actorFields.add(name); + actorFields.add(hp); + actorFields.add(agility); + actorFields.add(enemy); + this.actorFields = actorFields; + + ok.addActionListener(this); + cancel.addActionListener(this); + + panel.add(lName); + panel.add(name); + panel.add(lAgility); + panel.add(agility); + panel.add(lHp); + panel.add(hp); + panel.add(enemy); + panel.add(empty); + panel.add(ok); + panel.add(cancel); + + actorFrame.add(panel); + actorFrame.pack(); + actorFrame.setVisible(true); + + this.actorFrame = actorFrame; + } else if ("actOk".equals(e.getActionCommand())) { + JTextField nameField = (JTextField) this.actorFields.get(0); + String name = nameField.getText(); + JTextField hpField = (JTextField) this.actorFields.get(1); + int hp = Integer.parseInt(hpField.getText()); + JTextField agilityField = (JTextField) this.actorFields.get(2); + int agility = Integer.parseInt(agilityField.getText()); + JCheckBox enemyBox = (JCheckBox) this.actorFields.get(3); + Actor actor = new Actor(name, hp, enemyBox.isSelected(), agility); + this.placingActor = actor; + this.actorFrame.setVisible(false); + this.actorFrame.dispose(); + } else if ("actCancel".equals(e.getActionCommand())) { + this.actorFrame.setVisible(false); + this.actorFrame.dispose(); + } + + } +} diff --git a/src/MapLoader.java b/src/MapLoader.java new file mode 100644 index 0000000..6478961 --- /dev/null +++ b/src/MapLoader.java @@ -0,0 +1,60 @@ +import java.lang.String; +import java.io.File; +import java.io.PrintWriter; +import java.io.FileReader; +import java.io.BufferedReader; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.awt.Dimension; +import com.google.gson.Gson; + +class MapLoader { + File path; + + public MapLoader(Object path) { + if (path instanceof java.io.File) { + this.path = (File) path; + } else { + this.path = new File((String) path); + } + } + + public Map getMap() { + String mapText = ""; + String line = null; + FileReader fr = null; + BufferedReader bf = null; + + try { + fr = new FileReader(this.path); + bf = new BufferedReader(fr); + while ((line = bf.readLine()) != null) { + mapText = mapText + line; + } + bf.close(); + } catch (IOException ex) { + ex.printStackTrace(); + } + + Gson gson = new Gson(); + Map importMap = gson.fromJson(mapText, Map.class); + + //update map with new classes + Map map = new Map(new Dimension(importMap.getSize(), importMap.getSize())); + map.update(importMap.getActors(), importMap.getGrid()); + return map; + } + + public void saveMap(Map map) { + Gson gson = new Gson(); + String mapText = gson.toJson(map); + PrintWriter out = null; + try { + out = new PrintWriter(this.path + ".json"); + } catch (FileNotFoundException ex) { + ex.printStackTrace(); + } + out.println(mapText); + out.close(); + } +} diff --git a/src/MapScene.java b/src/MapScene.java new file mode 100644 index 0000000..41ad546 --- /dev/null +++ b/src/MapScene.java @@ -0,0 +1,229 @@ +import java.awt.Canvas; +import java.awt.Graphics2D; +import java.awt.BasicStroke; +import java.awt.Dimension; +import java.awt.BorderLayout; +import java.awt.GridLayout; +import java.awt.event.KeyEvent; +import java.awt.event.MouseEvent; +import java.awt.event.MouseWheelEvent; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.image.BufferStrategy; +import java.awt.geom.AffineTransform; +import java.awt.geom.Point2D; +import java.awt.geom.NoninvertibleTransformException; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JButton; +import java.io.FileReader; +import java.io.BufferedReader; +import java.io.IOException; +import com.google.gson.Gson; + +public class MapScene extends Scene implements ActionListener { + protected Map map; + protected int panX = 0; + protected int panY = 0; + protected boolean panning = false; + protected double zoom = 1; + protected int mouseX; + protected int mouseY; + protected boolean zooming = false; + protected int maxSize; + protected AffineTransform tx = new AffineTransform(); + + public MapScene(JFrame frame, Sub sub) { + super(frame, sub); + + //this.map = new Map(new Dimension(10, 10)); + } + + @Override + protected void render() { + if (this.WIDTH < this.HEIGHT) { + this.maxSize = WIDTH; + } else { + this.maxSize = HEIGHT; + } + if (this.map != null) { + Graphics2D g = (Graphics2D) this.buffer.getDrawGraphics(); + //clear + g.setColor(Palette.BLACK); + g.fillRect(0, 0, this.WIDTH, this.HEIGHT); + + //zoom and pan + if (this.zooming) { + Point2D p1 = new Point2D.Double(this.mouseX, this.mouseY); + Point2D p2 = null; + try { + p2 = tx.inverseTransform(p1, null); + } catch (NoninvertibleTransformException ex) {} + this.tx.setToIdentity(); + this.tx.translate(p1.getX(), p1.getY()); + this.tx.scale(this.zoom, this.zoom); + this.tx.translate(-p2.getX(), -p2.getY()); + this.zooming = false; + } + if (this.panning) { + this.tx.translate(this.panX/this.zoom, this.panY/this.zoom); + this.panning = false; + this.panX = 0; + this.panY = 0; + } + + g.transform(this.tx); + + //draw tiles + int tileSize = this.maxSize / 10; + for (Tile tile : this.map.getGrid()) { + switch (tile.getType()) { + case CLEAR: + continue; + case GRASS: + g.setColor(Palette.GREEN); + break; + case WATER: + g.setColor(Palette.BLUE); + break; + case MOUNTAIN: + g.setColor(Palette.BROWN); + break; + } + + g.fillRect( + tileSize * tile.getX(), tileSize * tile.getY(), + tileSize, tileSize); + + if (tile.isSelected()) { + g.setColor(Palette.ORANGE_T); + //g.fillRect(tileSize * tile.getX() + tileSize/4, tileSize * tile.getY() + tileSize/4, + // tileSize/2, tileSize/2); + g.fillRect( + tileSize * tile.getX(), tileSize * tile.getY(), + tileSize, tileSize); + } + + //TODO set as class variables the storkes + if (tile.cursorOnIt()) { + BasicStroke oldStroke = (BasicStroke) g.getStroke(); + g.setStroke(new BasicStroke( + 10.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL + )); + g.setColor(Palette.ORANGE); + g.drawRect( + tileSize * tile.getX(), tileSize * tile.getY(), + tileSize, tileSize); + g.setStroke(oldStroke); + } + + + g.setPaint(Palette.BLACK); + g.drawRect( + tileSize * tile.getX(), tileSize * tile.getY(), + tileSize, tileSize); + } + + g.setColor(Palette.ORANGE); + int maxBound = this.map.getSize()*tileSize; + g.drawRect(0, 0, maxBound, maxBound); + + //draw actors + g.setFont(g.getFont().deriveFont(g.getFont().getSize()*2.0F)); + for (Actor actor: this.map.getActors()) { + if (actor.isEnemy()) { + g.setColor(Palette.RED); + } else { + g.setColor(Palette.BLUE); + } + g.fillRect(tileSize * actor.getX() + tileSize/5, tileSize * actor.getY() + tileSize/5, + 3*tileSize/5, 3*tileSize/5); + g.setColor(Palette.BLACK); + g.drawString(actor.getName(), tileSize*actor.getX() + tileSize/5, tileSize*actor.getY()-tileSize/20); + g.setColor(Palette.RED); + g.fillRect(tileSize*actor.getX() + tileSize/5, tileSize*actor.getY()-tileSize/20+tileSize/30, + (tileSize*4/5), tileSize/10); + g.setColor(Palette.DARKGREEN); + g.fillRect(tileSize*actor.getX() + tileSize/5, tileSize*actor.getY()-tileSize/20+tileSize/30, + (tileSize*4/5)*actor.getHP()/10, tileSize/10); + } + + + AffineTransform invertTx = null; + try { + invertTx = this.tx.createInverse(); + } catch (NoninvertibleTransformException ex) {} + + g.transform(invertTx); + this.absoluteRender(g); + + g.dispose(); + this.buffer.show(); + } + } + + protected void absoluteRender(Graphics2D g) { + + } + + @Override + protected void update(int deltaTime) { + } + + @Override + public void keyPressed(KeyEvent e) { + int keyCode = e.getKeyCode(); + switch (keyCode) { + case KeyEvent.VK_UP: + this.panY += 10; + break; + case KeyEvent.VK_DOWN: + this.panY -= 10; + break; + case KeyEvent.VK_LEFT: + this.panX += 10; + break; + case KeyEvent.VK_RIGHT: + this.panX -= 10; + break; + } + } + + @Override + public void mousePressed(MouseEvent e) { + this.mouseX = e.getX(); + this.mouseY = e.getY(); + } + + @Override + public void mouseClicked(MouseEvent e) { + } + + @Override + public void mouseDragged(MouseEvent e) { + int x = e.getX(); + int y = e.getY(); + this.panX += x - this.mouseX; + this.panY += y - this.mouseY; + this.mouseX = x; + this.mouseY = y; + this.panning = true; + } + + @Override + public void mouseMoved(MouseEvent e) { + } + + @Override + public void mouseWheelMoved(MouseWheelEvent e) { + this.mouseX = e.getX(); + this.mouseY = e.getY(); + if (this.zoom > 0.3 || e.getWheelRotation() < 0) { + this.zoom -= ((double) e.getWheelRotation())/5; + } + this.zooming = true; + } + + @Override + public void actionPerformed(ActionEvent e) {} +} diff --git a/src/Palette.java b/src/Palette.java new file mode 100644 index 0000000..ee4d747 --- /dev/null +++ b/src/Palette.java @@ -0,0 +1,15 @@ +import java.awt.Color; + +public class Palette { + public final static Color BLACK = new Color(29, 31, 33); + public final static Color WHITE = new Color(197, 200, 198); + public final static Color WHITE_T = new Color(197, 200, 198, 200); + public final static Color RED = new Color(165, 66, 66); + public final static Color YELLOW = new Color(250, 198, 116); + public final static Color GREEN = new Color(181, 189, 104); + public final static Color DARKGREEN = new Color(140, 148, 64); + public final static Color BLUE = new Color(95, 129, 157); + public final static Color ORANGE = new Color(222, 147, 95); + public final static Color ORANGE_T = new Color(222, 147, 95, 100); + public final static Color BROWN = new Color(51, 41, 33); +} diff --git a/src/Scene.java b/src/Scene.java new file mode 100644 index 0000000..dcc3e5e --- /dev/null +++ b/src/Scene.java @@ -0,0 +1,104 @@ +import java.awt.Canvas; +import java.awt.Graphics2D; +import java.awt.Dimension; +import java.awt.BorderLayout; +import java.awt.event.KeyListener; +import java.awt.event.KeyEvent; +import java.awt.event.MouseListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionListener; +import java.awt.event.MouseWheelListener; +import java.awt.event.MouseWheelEvent; +import java.awt.image.BufferStrategy; +import javax.swing.JFrame; +import javax.swing.JPanel; + +public class Scene extends JPanel implements Runnable, KeyListener, MouseListener, MouseMotionListener, MouseWheelListener { + protected int WIDTH; + protected int HEIGHT; + protected BufferStrategy buffer; + protected long desiredFPS = 60; + protected long desiredDeltaLoop = (1000*1000*1000)/desiredFPS; + protected JFrame frame; + protected boolean running; + protected Canvas canvas; + protected int guiSize = 2; + + protected Scene(JFrame frame, Sub sub) { + this.frame = frame; + //getting window size + this.WIDTH = (int) this.frame.getSize().getWidth(); + this.HEIGHT = (int) this.frame.getSize().getHeight(); + + this.canvas = new Canvas(); + + this.canvas.setBounds(0, 0, this.WIDTH, this.HEIGHT); + this.canvas.setIgnoreRepaint(true); + + this.canvas.addKeyListener(this); + this.canvas.addMouseListener(this); + this.canvas.addMouseMotionListener(this); + this.canvas.addMouseWheelListener(this); + } + + public void start() { + this.canvas.createBufferStrategy(2); + this.buffer = this.canvas.getBufferStrategy(); + + this.canvas.requestFocus(); + this.running = true; + new Thread(this).start(); + } + + public void run() { + long beginLoopTime; + long endLoopTime; + long currentUpdateTime = System.nanoTime(); + long lastUpdateTime; + long deltaLoop; + + while (running) { + beginLoopTime = System.nanoTime(); + + //getting window size + this.WIDTH = (int) this.frame.getSize().getWidth(); + this.HEIGHT = (int) this.frame.getSize().getHeight(); + + this.render(); + + lastUpdateTime = currentUpdateTime; + currentUpdateTime = System.nanoTime(); + this.update((int) ((currentUpdateTime - lastUpdateTime)/(1000*1000))); + + endLoopTime = System.nanoTime(); + deltaLoop = endLoopTime - beginLoopTime; + + if (deltaLoop > this.desiredDeltaLoop) { + //late + } else { + try { + Thread.sleep((this.desiredDeltaLoop - deltaLoop)/(1000*1000)); + } catch (InterruptedException e ) { + + } + } + } + } + + protected void render() {} + protected void update(int deltaTime) {} + + @Override + public void keyTyped(KeyEvent e) {} + public void keyPressed(KeyEvent e) {} + public void keyReleased(KeyEvent e) {} + public void mouseClicked(MouseEvent e) {} + public void mouseEntered(MouseEvent e) {} + public void mouseExited(MouseEvent e) {} + public void mousePressed(MouseEvent e) {} + public void mouseReleased(MouseEvent e) {} + public void mouseDragged(MouseEvent e) {} + public void mouseMoved(MouseEvent e) {} + public void mouseWheelMoved(MouseWheelEvent e) {} + +} diff --git a/src/Sub.java b/src/Sub.java new file mode 100644 index 0000000..06e59c2 --- /dev/null +++ b/src/Sub.java @@ -0,0 +1,80 @@ +import java.awt.Dimension; +import java.awt.GridLayout; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JButton; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public class Sub implements ActionListener { + public static final Dimension WINDOW_SIZE = new Dimension(600, 400); + + private JFrame frame; + private JPanel menu; + + public Sub() { + this.frame = new JFrame("Sub"); + + this.frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + this.frame.setSize(WINDOW_SIZE); + this.frame.setPreferredSize(WINDOW_SIZE); + this.frame.setLocationRelativeTo(null); + + JPanel menu = new JPanel(); + menu.setLayout(new GridLayout(3, 1)); + JButton editor = new JButton("Editor"); + editor.setActionCommand("editor"); + JButton battle = new JButton("Battle"); + battle.setActionCommand("battle"); + JButton exit = new JButton("Exit"); + exit.setActionCommand("exit"); + + editor.addActionListener(this); + battle.addActionListener(this); + exit.addActionListener(this); + + menu.add(editor); + menu.add(battle); + menu.add(exit); + + this.menu = menu; + + this.frame.add(this.menu); + this.frame.pack(); + + this.frame.setVisible(true); + } + + @Override + public void actionPerformed(ActionEvent e) { + if ("editor".equals(e.getActionCommand())) { + MapEditor test = new MapEditor(frame, this); + this.frame.getContentPane().removeAll(); + this.frame.getContentPane().invalidate(); + this.frame.getContentPane().add(test); + this.frame.getContentPane().revalidate(); + test.start(); + } else if ("battle".equals(e.getActionCommand())) { + Battle test = new Battle(frame, this); + this.frame.getContentPane().removeAll(); + this.frame.getContentPane().invalidate(); + this.frame.getContentPane().add(test); + this.frame.getContentPane().revalidate(); + test.start(); + } else if ("exit".equals(e.getActionCommand())) { + this.frame.setVisible(false); + this.frame.dispose(); + } + } + + public void backToMenu() { + this.frame.getContentPane().removeAll(); + this.frame.getContentPane().invalidate(); + this.frame.getContentPane().add(this.menu); + this.frame.getContentPane().revalidate(); + } + + public static void main(String[] args) { + Sub sub = new Sub(); + } +} diff --git a/src/Tile.java b/src/Tile.java new file mode 100644 index 0000000..f2548f7 --- /dev/null +++ b/src/Tile.java @@ -0,0 +1,105 @@ +import java.util.ArrayList; + +public class Tile { + public enum Type { + CLEAR, GRASS, WATER, MOUNTAIN, NONE + }; + + private final int x, y; + private Type type; + private boolean selected; + private boolean cursorOnIt; + private double cost; + private double distance; + + public Tile(Type type, int x, int y) { + this.setType(type); + this.x = x; + this.y = y; + } + + public ArrayList getAdjacent(Map map) { + ArrayList out = new ArrayList<>(); + + if (this.getX() > 0) { + out.add(map.getTile(this.getX()-1, this.getY())); + } + + if (this.getX() < map.getSize()-1) { + out.add(map.getTile(this.getX()+1, this.getY())); + } + + if (this.getY() > 0) { + out.add(map.getTile(this.getX(), this.getY()-1)); + } + + if (this.getY() < map.getSize()-1) { + out.add(map.getTile(this.getX(), this.getY()+1)); + } + + return out; + } + + public boolean cursorOnIt() { + return this.cursorOnIt; + } + + public void setCursor(boolean cursor) { + this.cursorOnIt = cursor; + } + + public double getDistance() { + return this.distance; + } + + public void setDistance(double distance) { + this.distance = distance; + } + + public double getCost(Actor actor) { + return this.cost; + } + + public Type getType() { + return this.type; + } + + public void setType(Type type) { + this.type = type; + switch (this.type) { + case CLEAR: + this.cost = 1000000000.0; + break; + case GRASS: + this.cost = 1.0; + break; + case WATER: + this.cost = 3.0; + break; + case MOUNTAIN: + this.cost = 8.0; + break; + } + } + + public int getX() { + return this.x; + } + + public int getY() { + return this.y; + } + + public void setSelected(boolean set) { + this.selected = set; + } + + public boolean toggleSelect() { + this.selected = !this.selected; + return this.selected; + } + + public boolean isSelected() { + return this.selected; + } +} diff --git a/src/Weapon.java b/src/Weapon.java new file mode 100644 index 0000000..36c2ab7 --- /dev/null +++ b/src/Weapon.java @@ -0,0 +1,50 @@ +public class Weapon { + private boolean broken; + private int damage; + private int durability; + private int range; + private String name; + + public Weapon(String name, int damage, int range, int durability) { + this.name = name; + this.damage = damage; + this.range = range; + this.durability = durability; + + this.broken = false; + } + + public String getName() { + return this.name; + } + + public int getDamage() { + return this.damage; + } + + public boolean damage(Actor attacker, Actor attacked, Map map) { + if (this.broken) { + return false; + } + + this.durability--; + if (this.durability <= 0) { + this.broken = true; + } + + if (map.getTile(attacked.getX(), attacked.getY()).isSelected()) { + attacked.damage(this.damage); + return true; + } else { + return false; + } + } + + public int getRange() { + return this.range; + } + + public int getDurability() { + return this.durability; + } +} diff --git a/testmap.json b/testmap.json new file mode 100644 index 0000000..1bfb65e --- /dev/null +++ b/testmap.json @@ -0,0 +1 @@ +{"size":{"width":15,"height":15},"grid":[{"x":0,"y":0,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":0,"y":1,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":0,"y":2,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":0,"y":3,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":0,"y":4,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":0,"y":5,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":0,"y":6,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":0,"y":7,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":0,"y":8,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":0,"y":9,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":0,"y":10,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":0,"y":11,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":0,"y":12,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":0,"y":13,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":0,"y":14,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":1,"y":0,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":1,"y":1,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":1,"y":2,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":1,"y":3,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":1,"y":4,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":1,"y":5,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":1,"y":6,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":1,"y":7,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":1,"y":8,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":1,"y":9,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":1,"y":10,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":1,"y":11,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":1,"y":12,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":1,"y":13,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":1,"y":14,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":2,"y":0,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":2,"y":1,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":2,"y":2,"type":"MOUNTAIN","selected":false,"cost":8.0,"distance":0.0},{"x":2,"y":3,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":2,"y":4,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":2,"y":5,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":2,"y":6,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":2,"y":7,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":2,"y":8,"type":"MOUNTAIN","selected":false,"cost":8.0,"distance":0.0},{"x":2,"y":9,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":2,"y":10,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":2,"y":11,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":2,"y":12,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":2,"y":13,"type":"MOUNTAIN","selected":false,"cost":8.0,"distance":0.0},{"x":2,"y":14,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":3,"y":0,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":3,"y":1,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":3,"y":2,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":3,"y":3,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":3,"y":4,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":3,"y":5,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":3,"y":6,"type":"MOUNTAIN","selected":false,"cost":8.0,"distance":0.0},{"x":3,"y":7,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":3,"y":8,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":3,"y":9,"type":"MOUNTAIN","selected":false,"cost":8.0,"distance":0.0},{"x":3,"y":10,"type":"MOUNTAIN","selected":false,"cost":8.0,"distance":0.0},{"x":3,"y":11,"type":"MOUNTAIN","selected":false,"cost":8.0,"distance":0.0},{"x":3,"y":12,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":3,"y":13,"type":"MOUNTAIN","selected":false,"cost":8.0,"distance":0.0},{"x":3,"y":14,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":4,"y":0,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":4,"y":1,"type":"WATER","selected":false,"cost":3.0,"distance":0.0},{"x":4,"y":2,"type":"WATER","selected":false,"cost":3.0,"distance":0.0},{"x":4,"y":3,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":4,"y":4,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":4,"y":5,"type":"MOUNTAIN","selected":false,"cost":8.0,"distance":0.0},{"x":4,"y":6,"type":"MOUNTAIN","selected":false,"cost":8.0,"distance":0.0},{"x":4,"y":7,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":4,"y":8,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":4,"y":9,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":4,"y":10,"type":"MOUNTAIN","selected":false,"cost":8.0,"distance":0.0},{"x":4,"y":11,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":4,"y":12,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":4,"y":13,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":4,"y":14,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":5,"y":0,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":5,"y":1,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":5,"y":2,"type":"WATER","selected":false,"cost":3.0,"distance":0.0},{"x":5,"y":3,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":5,"y":4,"type":"MOUNTAIN","selected":false,"cost":8.0,"distance":0.0},{"x":5,"y":5,"type":"MOUNTAIN","selected":false,"cost":8.0,"distance":0.0},{"x":5,"y":6,"type":"MOUNTAIN","selected":false,"cost":8.0,"distance":0.0},{"x":5,"y":7,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":5,"y":8,"type":"MOUNTAIN","selected":false,"cost":8.0,"distance":0.0},{"x":5,"y":9,"type":"MOUNTAIN","selected":false,"cost":8.0,"distance":0.0},{"x":5,"y":10,"type":"WATER","selected":false,"cost":3.0,"distance":0.0},{"x":5,"y":11,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":5,"y":12,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":5,"y":13,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":5,"y":14,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":6,"y":0,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":6,"y":1,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":6,"y":2,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":6,"y":3,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":6,"y":4,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":6,"y":5,"type":"MOUNTAIN","selected":false,"cost":8.0,"distance":0.0},{"x":6,"y":6,"type":"MOUNTAIN","selected":false,"cost":8.0,"distance":0.0},{"x":6,"y":7,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":6,"y":8,"type":"WATER","selected":false,"cost":3.0,"distance":0.0},{"x":6,"y":9,"type":"WATER","selected":false,"cost":3.0,"distance":0.0},{"x":6,"y":10,"type":"WATER","selected":false,"cost":3.0,"distance":0.0},{"x":6,"y":11,"type":"WATER","selected":false,"cost":3.0,"distance":0.0},{"x":6,"y":12,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":6,"y":13,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":6,"y":14,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":7,"y":0,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":7,"y":1,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":7,"y":2,"type":"MOUNTAIN","selected":false,"cost":8.0,"distance":0.0},{"x":7,"y":3,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":7,"y":4,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":7,"y":5,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":7,"y":6,"type":"MOUNTAIN","selected":false,"cost":8.0,"distance":0.0},{"x":7,"y":7,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":7,"y":8,"type":"WATER","selected":false,"cost":3.0,"distance":0.0},{"x":7,"y":9,"type":"WATER","selected":false,"cost":3.0,"distance":0.0},{"x":7,"y":10,"type":"WATER","selected":false,"cost":3.0,"distance":0.0},{"x":7,"y":11,"type":"WATER","selected":false,"cost":3.0,"distance":0.0},{"x":7,"y":12,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":7,"y":13,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":7,"y":14,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":8,"y":0,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":8,"y":1,"type":"MOUNTAIN","selected":false,"cost":8.0,"distance":0.0},{"x":8,"y":2,"type":"MOUNTAIN","selected":false,"cost":8.0,"distance":0.0},{"x":8,"y":3,"type":"MOUNTAIN","selected":false,"cost":8.0,"distance":0.0},{"x":8,"y":4,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":8,"y":5,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":8,"y":6,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":8,"y":7,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":8,"y":8,"type":"WATER","selected":false,"cost":3.0,"distance":0.0},{"x":8,"y":9,"type":"WATER","selected":false,"cost":3.0,"distance":0.0},{"x":8,"y":10,"type":"WATER","selected":false,"cost":3.0,"distance":0.0},{"x":8,"y":11,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":8,"y":12,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":8,"y":13,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":8,"y":14,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":9,"y":0,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":9,"y":1,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":9,"y":2,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":9,"y":3,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":9,"y":4,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":9,"y":5,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":9,"y":6,"type":"MOUNTAIN","selected":false,"cost":8.0,"distance":0.0},{"x":9,"y":7,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":9,"y":8,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":9,"y":9,"type":"WATER","selected":false,"cost":3.0,"distance":0.0},{"x":9,"y":10,"type":"WATER","selected":false,"cost":3.0,"distance":0.0},{"x":9,"y":11,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":9,"y":12,"type":"MOUNTAIN","selected":false,"cost":8.0,"distance":0.0},{"x":9,"y":13,"type":"MOUNTAIN","selected":false,"cost":8.0,"distance":0.0},{"x":9,"y":14,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":10,"y":0,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":10,"y":1,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":10,"y":2,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":10,"y":3,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":10,"y":4,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":10,"y":5,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":10,"y":6,"type":"MOUNTAIN","selected":false,"cost":8.0,"distance":0.0},{"x":10,"y":7,"type":"MOUNTAIN","selected":false,"cost":8.0,"distance":0.0},{"x":10,"y":8,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":10,"y":9,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":10,"y":10,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":10,"y":11,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":10,"y":12,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":10,"y":13,"type":"MOUNTAIN","selected":false,"cost":8.0,"distance":0.0},{"x":10,"y":14,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":11,"y":0,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":11,"y":1,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":11,"y":2,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":11,"y":3,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":11,"y":4,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":11,"y":5,"type":"MOUNTAIN","selected":false,"cost":8.0,"distance":0.0},{"x":11,"y":6,"type":"MOUNTAIN","selected":false,"cost":8.0,"distance":0.0},{"x":11,"y":7,"type":"MOUNTAIN","selected":false,"cost":8.0,"distance":0.0},{"x":11,"y":8,"type":"MOUNTAIN","selected":false,"cost":8.0,"distance":0.0},{"x":11,"y":9,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":11,"y":10,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":11,"y":11,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":11,"y":12,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":11,"y":13,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":11,"y":14,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":12,"y":0,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":12,"y":1,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":12,"y":2,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":12,"y":3,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":12,"y":4,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":12,"y":5,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":12,"y":6,"type":"MOUNTAIN","selected":false,"cost":8.0,"distance":0.0},{"x":12,"y":7,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":12,"y":8,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":12,"y":9,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":12,"y":10,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":12,"y":11,"type":"MOUNTAIN","selected":false,"cost":8.0,"distance":0.0},{"x":12,"y":12,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":12,"y":13,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":12,"y":14,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":13,"y":0,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":13,"y":1,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":13,"y":2,"type":"MOUNTAIN","selected":false,"cost":8.0,"distance":0.0},{"x":13,"y":3,"type":"MOUNTAIN","selected":false,"cost":8.0,"distance":0.0},{"x":13,"y":4,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":13,"y":5,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":13,"y":6,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":13,"y":7,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":13,"y":8,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":13,"y":9,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":13,"y":10,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":13,"y":11,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":13,"y":12,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":13,"y":13,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":13,"y":14,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":14,"y":0,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":14,"y":1,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":14,"y":2,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":14,"y":3,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":14,"y":4,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":14,"y":5,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":14,"y":6,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":14,"y":7,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":14,"y":8,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":14,"y":9,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":14,"y":10,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":14,"y":11,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":14,"y":12,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":14,"y":13,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0},{"x":14,"y":14,"type":"GRASS","selected":false,"cost":1.0,"distance":0.0}],"actors":[{"name":"marc","alive":true,"enemy":true,"hp":10,"agility":10,"strenght":0,"defense":0,"x":12,"y":13},{"name":"bob","alive":true,"enemy":false,"hp":10,"agility":10,"strenght":0,"defense":0,"x":1,"y":4},{"name":"mike","alive":true,"enemy":false,"hp":10,"agility":10,"strenght":0,"defense":0,"x":8,"y":4},{"name":"jack","alive":true,"enemy":false,"hp":10,"agility":10,"strenght":0,"defense":0,"x":1,"y":10}],"actorIndex":-1} -- cgit v1.2.1