diff options
-rw-r--r-- | src/com/fourisland/frigidearth/Game.java | 18 | ||||
-rw-r--r-- | src/com/fourisland/frigidearth/Main.java | 1 | ||||
-rw-r--r-- | src/com/fourisland/frigidearth/MapViewGameState.java | 138 | ||||
-rw-r--r-- | src/com/fourisland/frigidearth/mobs/Spider.java | 2 |
4 files changed, 96 insertions, 63 deletions
diff --git a/src/com/fourisland/frigidearth/Game.java b/src/com/fourisland/frigidearth/Game.java new file mode 100644 index 0000000..5d669de --- /dev/null +++ b/src/com/fourisland/frigidearth/Game.java | |||
@@ -0,0 +1,18 @@ | |||
1 | /* | ||
2 | * To change this template, choose Tools | Templates | ||
3 | * and open the template in the editor. | ||
4 | */ | ||
5 | package com.fourisland.frigidearth; | ||
6 | |||
7 | /** | ||
8 | * | ||
9 | * @author hatkirby | ||
10 | */ | ||
11 | public class Game | ||
12 | { | ||
13 | public int health = 15; | ||
14 | public int maxHealth = 15; | ||
15 | public int defense = 0; | ||
16 | public int level = 1; | ||
17 | public int experience = 0; | ||
18 | } | ||
diff --git a/src/com/fourisland/frigidearth/Main.java b/src/com/fourisland/frigidearth/Main.java index ff81aad..09aa273 100644 --- a/src/com/fourisland/frigidearth/Main.java +++ b/src/com/fourisland/frigidearth/Main.java | |||
@@ -30,6 +30,7 @@ public class Main extends Canvas | |||
30 | { | 30 | { |
31 | public static final int CANVAS_WIDTH = 624; | 31 | public static final int CANVAS_WIDTH = 624; |
32 | public static final int CANVAS_HEIGHT = 480; | 32 | public static final int CANVAS_HEIGHT = 480; |
33 | public static Game currentGame = new Game(); | ||
33 | 34 | ||
34 | private static JFrame mainWindow; | 35 | private static JFrame mainWindow; |
35 | private static Color[][] grid; | 36 | private static Color[][] grid; |
diff --git a/src/com/fourisland/frigidearth/MapViewGameState.java b/src/com/fourisland/frigidearth/MapViewGameState.java index 62fc632..8419244 100644 --- a/src/com/fourisland/frigidearth/MapViewGameState.java +++ b/src/com/fourisland/frigidearth/MapViewGameState.java | |||
@@ -24,8 +24,6 @@ public class MapViewGameState implements GameState | |||
24 | { | 24 | { |
25 | private final int TILE_WIDTH = 12; | 25 | private final int TILE_WIDTH = 12; |
26 | private final int TILE_HEIGHT = 12; | 26 | private final int TILE_HEIGHT = 12; |
27 | private final int MAP_WIDTH = 100; | ||
28 | private final int MAP_HEIGHT = 100; | ||
29 | private final int MESSAGE_HEIGHT = 6; | 27 | private final int MESSAGE_HEIGHT = 6; |
30 | private final int VIEWPORT_WIDTH = Main.CANVAS_WIDTH / TILE_WIDTH; | 28 | private final int VIEWPORT_WIDTH = Main.CANVAS_WIDTH / TILE_WIDTH; |
31 | private final int VIEWPORT_HEIGHT = Main.CANVAS_HEIGHT / TILE_HEIGHT - MESSAGE_HEIGHT; | 29 | private final int VIEWPORT_HEIGHT = Main.CANVAS_HEIGHT / TILE_HEIGHT - MESSAGE_HEIGHT; |
@@ -36,6 +34,8 @@ public class MapViewGameState implements GameState | |||
36 | private final int MAX_CORRIDOR_LENGTH = 6; | 34 | private final int MAX_CORRIDOR_LENGTH = 6; |
37 | private final int MIN_CORRIDOR_LENGTH = 2; | 35 | private final int MIN_CORRIDOR_LENGTH = 2; |
38 | private final int[][] OCTET_MULTIPLIERS = new int[][] {new int[] {1,0,0,-1,-1,0,0,1}, new int[] {0,1,-1,0,0,-1,1,0}, new int[] {0,1,1,0,0,-1,-1,0}, new int[] {1,0,0,1,-1,0,0,-1}}; | 36 | private final int[][] OCTET_MULTIPLIERS = new int[][] {new int[] {1,0,0,-1,-1,0,0,1}, new int[] {0,1,-1,0,0,-1,1,0}, new int[] {0,1,1,0,0,-1,-1,0}, new int[] {1,0,0,1,-1,0,0,-1}}; |
37 | private int mapWidth = 60; | ||
38 | private int mapHeight = 60; | ||
39 | private Tile[][] grid; | 39 | private Tile[][] grid; |
40 | private boolean[][] gridLighting; | 40 | private boolean[][] gridLighting; |
41 | private String[] messages = new String[MESSAGE_HEIGHT]; | 41 | private String[] messages = new String[MESSAGE_HEIGHT]; |
@@ -45,9 +45,6 @@ public class MapViewGameState implements GameState | |||
45 | private int playery = 4; | 45 | private int playery = 4; |
46 | private int viewportx = 0; | 46 | private int viewportx = 0; |
47 | private int viewporty = 0; | 47 | private int viewporty = 0; |
48 | private int health = 15; | ||
49 | private int maxHealth = 15; | ||
50 | private int defense = 0; | ||
51 | private int keyx; | 48 | private int keyx; |
52 | private int keyy; | 49 | private int keyy; |
53 | private boolean haveKey = false; | 50 | private boolean haveKey = false; |
@@ -55,21 +52,22 @@ public class MapViewGameState implements GameState | |||
55 | private int heartbeat = 0; | 52 | private int heartbeat = 0; |
56 | private int floor; | 53 | private int floor; |
57 | private int spawnTimer = 0; | 54 | private int spawnTimer = 0; |
58 | private int level = 1; | ||
59 | private int experience = 0; | ||
60 | 55 | ||
61 | public MapViewGameState(int floor) | 56 | public MapViewGameState(int floor) |
62 | { | 57 | { |
63 | this.floor = floor; | 58 | this.floor = floor; |
64 | 59 | ||
65 | grid = new Tile[MAP_WIDTH][MAP_HEIGHT]; | 60 | mapWidth += (50 * floor); |
66 | gridLighting = new boolean[MAP_WIDTH][MAP_HEIGHT]; | 61 | mapHeight += (50 * floor); |
67 | 62 | ||
68 | for (int x=0; x<MAP_WIDTH; x++) | 63 | grid = new Tile[mapWidth][mapHeight]; |
64 | gridLighting = new boolean[mapWidth][mapHeight]; | ||
65 | |||
66 | for (int x=0; x<mapWidth; x++) | ||
69 | { | 67 | { |
70 | for (int y=0; y<MAP_HEIGHT; y++) | 68 | for (int y=0; y<mapHeight; y++) |
71 | { | 69 | { |
72 | if ((x == 0) || (x == MAP_WIDTH-1) || (y == 0) || (y == MAP_HEIGHT-1)) | 70 | if ((x == 0) || (x == mapWidth-1) || (y == 0) || (y == mapHeight-1)) |
73 | { | 71 | { |
74 | grid[x][y] = Tile.StoneWall; | 72 | grid[x][y] = Tile.StoneWall; |
75 | } else { | 73 | } else { |
@@ -83,23 +81,23 @@ public class MapViewGameState implements GameState | |||
83 | switch (keyRoomDirection) | 81 | switch (keyRoomDirection) |
84 | { | 82 | { |
85 | case North: | 83 | case North: |
86 | legalBounds = new Rectangle(0, 14, MAP_WIDTH, MAP_HEIGHT-14); | 84 | legalBounds = new Rectangle(0, 14, mapWidth, mapHeight-14); |
87 | break; | 85 | break; |
88 | 86 | ||
89 | case East: | 87 | case East: |
90 | legalBounds = new Rectangle(0, 0, MAP_WIDTH-14, MAP_HEIGHT); | 88 | legalBounds = new Rectangle(0, 0, mapWidth-14, mapHeight); |
91 | break; | 89 | break; |
92 | 90 | ||
93 | case South: | 91 | case South: |
94 | legalBounds = new Rectangle(0, 0, MAP_WIDTH, MAP_HEIGHT-14); | 92 | legalBounds = new Rectangle(0, 0, mapWidth, mapHeight-14); |
95 | break; | 93 | break; |
96 | 94 | ||
97 | case West: | 95 | case West: |
98 | legalBounds = new Rectangle(14, 0, MAP_WIDTH-14, MAP_HEIGHT); | 96 | legalBounds = new Rectangle(14, 0, mapWidth-14, mapHeight); |
99 | break; | 97 | break; |
100 | } | 98 | } |
101 | 99 | ||
102 | makeRoom(MAP_WIDTH/2, MAP_HEIGHT/2, Direction.getRandomDirection(), legalBounds); | 100 | makeRoom(mapWidth/2, mapHeight/2, Direction.getRandomDirection(), legalBounds); |
103 | 101 | ||
104 | int currentFeatures = 1; | 102 | int currentFeatures = 1; |
105 | int objects = 300; | 103 | int objects = 300; |
@@ -118,8 +116,8 @@ public class MapViewGameState implements GameState | |||
118 | Direction validTile = null; | 116 | Direction validTile = null; |
119 | for (int testing = 0; testing < 1000; testing++) | 117 | for (int testing = 0; testing < 1000; testing++) |
120 | { | 118 | { |
121 | newx = Functions.random(1, MAP_WIDTH-1); | 119 | newx = Functions.random(1, mapWidth-1); |
122 | newy = Functions.random(1, MAP_HEIGHT-1); | 120 | newy = Functions.random(1, mapHeight-1); |
123 | validTile = null; | 121 | validTile = null; |
124 | 122 | ||
125 | if ((grid[newx][newy] == Tile.DirtWall) || (grid[newx][newy] == Tile.Corridor)) | 123 | if ((grid[newx][newy] == Tile.DirtWall) || (grid[newx][newy] == Tile.Corridor)) |
@@ -198,8 +196,8 @@ public class MapViewGameState implements GameState | |||
198 | { | 196 | { |
199 | for (int testing = 0; testing < 1000; testing++) | 197 | for (int testing = 0; testing < 1000; testing++) |
200 | { | 198 | { |
201 | newx = Functions.random(1, MAP_WIDTH-1); | 199 | newx = Functions.random(1, mapWidth-1); |
202 | newy = Functions.random(1, MAP_HEIGHT-2); | 200 | newy = Functions.random(1, mapHeight-2); |
203 | ways = 4; | 201 | ways = 4; |
204 | 202 | ||
205 | for (Direction dir : Direction.values()) | 203 | for (Direction dir : Direction.values()) |
@@ -364,7 +362,7 @@ public class MapViewGameState implements GameState | |||
364 | 362 | ||
365 | if (legalBounds == null) | 363 | if (legalBounds == null) |
366 | { | 364 | { |
367 | bounds = new Rectangle(0, 0, MAP_WIDTH, MAP_HEIGHT); | 365 | bounds = new Rectangle(0, 0, mapWidth, mapHeight); |
368 | } else { | 366 | } else { |
369 | bounds = legalBounds; | 367 | bounds = legalBounds; |
370 | } | 368 | } |
@@ -463,7 +461,7 @@ public class MapViewGameState implements GameState | |||
463 | switch (direction) | 461 | switch (direction) |
464 | { | 462 | { |
465 | case North: | 463 | case North: |
466 | if ((x < 0) || (x > MAP_WIDTH)) | 464 | if ((x < 0) || (x > mapWidth)) |
467 | { | 465 | { |
468 | return false; | 466 | return false; |
469 | } else { | 467 | } else { |
@@ -472,7 +470,7 @@ public class MapViewGameState implements GameState | |||
472 | 470 | ||
473 | for (ytemp = y; ytemp > (y-length); ytemp--) | 471 | for (ytemp = y; ytemp > (y-length); ytemp--) |
474 | { | 472 | { |
475 | if ((ytemp < 0) || (ytemp > MAP_HEIGHT)) | 473 | if ((ytemp < 0) || (ytemp > mapHeight)) |
476 | { | 474 | { |
477 | return false; | 475 | return false; |
478 | } | 476 | } |
@@ -491,7 +489,7 @@ public class MapViewGameState implements GameState | |||
491 | break; | 489 | break; |
492 | 490 | ||
493 | case East: | 491 | case East: |
494 | if ((y < 0) || (y > MAP_HEIGHT)) | 492 | if ((y < 0) || (y > mapHeight)) |
495 | { | 493 | { |
496 | return false; | 494 | return false; |
497 | } else { | 495 | } else { |
@@ -500,7 +498,7 @@ public class MapViewGameState implements GameState | |||
500 | 498 | ||
501 | for (xtemp = x; xtemp < (x+length); xtemp++) | 499 | for (xtemp = x; xtemp < (x+length); xtemp++) |
502 | { | 500 | { |
503 | if ((xtemp < 0) || (xtemp > MAP_WIDTH)) | 501 | if ((xtemp < 0) || (xtemp > mapWidth)) |
504 | { | 502 | { |
505 | return false; | 503 | return false; |
506 | } | 504 | } |
@@ -519,7 +517,7 @@ public class MapViewGameState implements GameState | |||
519 | break; | 517 | break; |
520 | 518 | ||
521 | case South: | 519 | case South: |
522 | if ((x < 0) || (x > MAP_WIDTH)) | 520 | if ((x < 0) || (x > mapWidth)) |
523 | { | 521 | { |
524 | return false; | 522 | return false; |
525 | } else { | 523 | } else { |
@@ -528,7 +526,7 @@ public class MapViewGameState implements GameState | |||
528 | 526 | ||
529 | for (ytemp = y; ytemp < (y+length); ytemp++) | 527 | for (ytemp = y; ytemp < (y+length); ytemp++) |
530 | { | 528 | { |
531 | if ((ytemp < 0) || (ytemp > MAP_HEIGHT)) | 529 | if ((ytemp < 0) || (ytemp > mapHeight)) |
532 | { | 530 | { |
533 | return false; | 531 | return false; |
534 | } | 532 | } |
@@ -547,7 +545,7 @@ public class MapViewGameState implements GameState | |||
547 | break; | 545 | break; |
548 | 546 | ||
549 | case West: | 547 | case West: |
550 | if ((y < 0) || (y > MAP_HEIGHT)) | 548 | if ((y < 0) || (y > mapHeight)) |
551 | { | 549 | { |
552 | return false; | 550 | return false; |
553 | } else { | 551 | } else { |
@@ -556,7 +554,7 @@ public class MapViewGameState implements GameState | |||
556 | 554 | ||
557 | for (xtemp = x; xtemp > (x-length); xtemp--) | 555 | for (xtemp = x; xtemp > (x-length); xtemp--) |
558 | { | 556 | { |
559 | if ((xtemp < 0) || (xtemp > MAP_WIDTH)) | 557 | if ((xtemp < 0) || (xtemp > mapWidth)) |
560 | { | 558 | { |
561 | return false; | 559 | return false; |
562 | } | 560 | } |
@@ -580,9 +578,9 @@ public class MapViewGameState implements GameState | |||
580 | 578 | ||
581 | private void calculateFieldOfView() | 579 | private void calculateFieldOfView() |
582 | { | 580 | { |
583 | for (int x=0; x<MAP_WIDTH; x++) | 581 | for (int x=0; x<mapWidth; x++) |
584 | { | 582 | { |
585 | for (int y=0; y<MAP_HEIGHT; y++) | 583 | for (int y=0; y<mapHeight; y++) |
586 | { | 584 | { |
587 | gridLighting[x][y] = false; | 585 | gridLighting[x][y] = false; |
588 | } | 586 | } |
@@ -719,8 +717,8 @@ public class MapViewGameState implements GameState | |||
719 | 717 | ||
720 | // Render status bar | 718 | // Render status bar |
721 | g.drawImage(SystemFont.getCharacter((char) 3, Color.RED), TILE_WIDTH, 0, TILE_WIDTH, TILE_HEIGHT, null); | 719 | g.drawImage(SystemFont.getCharacter((char) 3, Color.RED), TILE_WIDTH, 0, TILE_WIDTH, TILE_HEIGHT, null); |
722 | String healthText = Integer.toString(health); | 720 | String healthText = Integer.toString(Main.currentGame.health); |
723 | double healthPercentage = ((double) health) / ((double) maxHealth); | 721 | double healthPercentage = ((double) Main.currentGame.health) / ((double) Main.currentGame.maxHealth); |
724 | Color healthColor = Color.WHITE; | 722 | Color healthColor = Color.WHITE; |
725 | if (healthPercentage < 0.2) | 723 | if (healthPercentage < 0.2) |
726 | { | 724 | { |
@@ -740,7 +738,7 @@ public class MapViewGameState implements GameState | |||
740 | 738 | ||
741 | g.drawImage(SystemFont.getCharacter((char) 5, Color.GRAY), (healthText.length()+3)*TILE_WIDTH, 0, TILE_WIDTH, TILE_HEIGHT, null); | 739 | g.drawImage(SystemFont.getCharacter((char) 5, Color.GRAY), (healthText.length()+3)*TILE_WIDTH, 0, TILE_WIDTH, TILE_HEIGHT, null); |
742 | int b = healthText.length()+4; | 740 | int b = healthText.length()+4; |
743 | String defenseText = Integer.toString(defense); | 741 | String defenseText = Integer.toString(Main.currentGame.defense); |
744 | for (int i=0; i<defenseText.length(); i++) | 742 | for (int i=0; i<defenseText.length(); i++) |
745 | { | 743 | { |
746 | g.drawImage(SystemFont.getCharacter(defenseText.charAt(i), Color.WHITE), (i+b)*TILE_WIDTH, 0, TILE_WIDTH, TILE_HEIGHT, null); | 744 | g.drawImage(SystemFont.getCharacter(defenseText.charAt(i), Color.WHITE), (i+b)*TILE_WIDTH, 0, TILE_WIDTH, TILE_HEIGHT, null); |
@@ -751,7 +749,7 @@ public class MapViewGameState implements GameState | |||
751 | g.drawImage(SystemFont.getCharacter('X', Color.WHITE), (b+1)*TILE_WIDTH, 0, TILE_WIDTH, TILE_HEIGHT, null); | 749 | g.drawImage(SystemFont.getCharacter('X', Color.WHITE), (b+1)*TILE_WIDTH, 0, TILE_WIDTH, TILE_HEIGHT, null); |
752 | g.drawImage(SystemFont.getCharacter('P', Color.WHITE), (b+2)*TILE_WIDTH, 0, TILE_WIDTH, TILE_HEIGHT, null); | 750 | g.drawImage(SystemFont.getCharacter('P', Color.WHITE), (b+2)*TILE_WIDTH, 0, TILE_WIDTH, TILE_HEIGHT, null); |
753 | b+=3; | 751 | b+=3; |
754 | String expText = Functions.padLeft(Integer.toString(experience), 3, '0'); | 752 | String expText = Functions.padLeft(Integer.toString(Main.currentGame.experience), 3, '0'); |
755 | for (int i=0; i<expText.length(); i++) | 753 | for (int i=0; i<expText.length(); i++) |
756 | { | 754 | { |
757 | g.drawImage(SystemFont.getCharacter(expText.charAt(i), Color.WHITE), (i+b)*TILE_WIDTH, 0, TILE_WIDTH, TILE_HEIGHT, null); | 755 | g.drawImage(SystemFont.getCharacter(expText.charAt(i), Color.WHITE), (i+b)*TILE_WIDTH, 0, TILE_WIDTH, TILE_HEIGHT, null); |
@@ -759,7 +757,7 @@ public class MapViewGameState implements GameState | |||
759 | b+=expText.length(); | 757 | b+=expText.length(); |
760 | g.drawImage(SystemFont.getCharacter(':', Color.WHITE), (b)*TILE_WIDTH, 0, TILE_WIDTH, TILE_HEIGHT, null); | 758 | g.drawImage(SystemFont.getCharacter(':', Color.WHITE), (b)*TILE_WIDTH, 0, TILE_WIDTH, TILE_HEIGHT, null); |
761 | b++; | 759 | b++; |
762 | String levelText = Integer.toString(level); | 760 | String levelText = Integer.toString(Main.currentGame.level); |
763 | for (int i=0; i<levelText.length(); i++) | 761 | for (int i=0; i<levelText.length(); i++) |
764 | { | 762 | { |
765 | g.drawImage(SystemFont.getCharacter(levelText.charAt(i), Color.WHITE), (i+b)*TILE_WIDTH, 0, TILE_WIDTH, TILE_HEIGHT, null); | 763 | g.drawImage(SystemFont.getCharacter(levelText.charAt(i), Color.WHITE), (i+b)*TILE_WIDTH, 0, TILE_WIDTH, TILE_HEIGHT, null); |
@@ -787,24 +785,24 @@ public class MapViewGameState implements GameState | |||
787 | if (mob.getPosition().equals(to)) | 785 | if (mob.getPosition().equals(to)) |
788 | { | 786 | { |
789 | printMessage("You hit the " + mob.getName().toLowerCase()); | 787 | printMessage("You hit the " + mob.getName().toLowerCase()); |
790 | mob.health -= (int) (Math.floor(Math.sqrt(level))); | 788 | mob.health -= (int) (Math.floor(Math.sqrt(Main.currentGame.level))); |
791 | 789 | ||
792 | if (mob.health <= 0) | 790 | if (mob.health <= 0) |
793 | { | 791 | { |
794 | printMessage("You killed the " + mob.getName().toLowerCase() + "!"); | 792 | printMessage("You killed the " + mob.getName().toLowerCase() + "!"); |
795 | experience += (mob.getBaseExperience()/(level*level)); | 793 | Main.currentGame.experience += (mob.getBaseExperience()/(Main.currentGame.level*Main.currentGame.level)); |
796 | mobs.remove(mob); | 794 | mobs.remove(mob); |
797 | 795 | ||
798 | if (experience >= 1000) | 796 | if (Main.currentGame.experience >= 1000) |
799 | { | 797 | { |
800 | level++; | 798 | Main.currentGame.level++; |
801 | experience -= 1000; | 799 | Main.currentGame.experience -= 1000; |
802 | 800 | ||
803 | int hpGain = Functions.rollDice(6, 2) + 3; | 801 | int hpGain = Functions.rollDice(6, 2) + 3; |
804 | health += hpGain; | 802 | Main.currentGame.health += hpGain; |
805 | maxHealth += hpGain; | 803 | Main.currentGame.maxHealth += hpGain; |
806 | 804 | ||
807 | printMessage("You grow to level " + level + "!"); | 805 | printMessage("You grow to level " + Main.currentGame.level + "!"); |
808 | } | 806 | } |
809 | } | 807 | } |
810 | 808 | ||
@@ -833,9 +831,9 @@ public class MapViewGameState implements GameState | |||
833 | printMessage("You get the key"); | 831 | printMessage("You get the key"); |
834 | printMessage("All the windows in the room shatter!"); | 832 | printMessage("All the windows in the room shatter!"); |
835 | 833 | ||
836 | for (int x=0; x<MAP_WIDTH; x++) | 834 | for (int x=0; x<mapWidth; x++) |
837 | { | 835 | { |
838 | for (int y=0; y<MAP_HEIGHT; y++) | 836 | for (int y=0; y<mapHeight; y++) |
839 | { | 837 | { |
840 | if (grid[x][y] == Tile.Window) | 838 | if (grid[x][y] == Tile.Window) |
841 | { | 839 | { |
@@ -851,6 +849,22 @@ public class MapViewGameState implements GameState | |||
851 | // Wait a turn | 849 | // Wait a turn |
852 | break; | 850 | break; |
853 | 851 | ||
852 | case KeyEvent.VK_PERIOD: | ||
853 | if (e.isShiftDown()) | ||
854 | { | ||
855 | if (grid[playerx][playery] == Tile.UpStairs) | ||
856 | { | ||
857 | if (haveKey) | ||
858 | { | ||
859 | Main.setGameState(new MapViewGameState(floor+1)); | ||
860 | } else { | ||
861 | printMessage("The stairs are locked! You need a key."); | ||
862 | } | ||
863 | } | ||
864 | |||
865 | break; | ||
866 | } | ||
867 | |||
854 | default: | 868 | default: |
855 | return; | 869 | return; |
856 | } | 870 | } |
@@ -865,7 +879,7 @@ public class MapViewGameState implements GameState | |||
865 | if (arePointsAdjacent(playerx, playery, mob.x, mob.y, false)) | 879 | if (arePointsAdjacent(playerx, playery, mob.x, mob.y, false)) |
866 | { | 880 | { |
867 | // Attack! | 881 | // Attack! |
868 | health -= (mob.getAttackPower() - defense); | 882 | Main.currentGame.health -= Math.max(mob.getAttackPower() - Main.currentGame.defense, 0); |
869 | printMessage(mob.getBattleMessage()); | 883 | printMessage(mob.getBattleMessage()); |
870 | } else { | 884 | } else { |
871 | List<Direction> path = findPath(mob.getPosition(), new Point(playerx, playery)); | 885 | List<Direction> path = findPath(mob.getPosition(), new Point(playerx, playery)); |
@@ -922,9 +936,9 @@ public class MapViewGameState implements GameState | |||
922 | // Move snow | 936 | // Move snow |
923 | if (snowGrow) | 937 | if (snowGrow) |
924 | { | 938 | { |
925 | for (int x=0; x<MAP_WIDTH; x++) | 939 | for (int x=0; x<mapWidth; x++) |
926 | { | 940 | { |
927 | for (int y=0; y<MAP_HEIGHT; y++) | 941 | for (int y=0; y<mapHeight; y++) |
928 | { | 942 | { |
929 | if (grid[x][y] == Tile.Snow) | 943 | if (grid[x][y] == Tile.Snow) |
930 | { | 944 | { |
@@ -940,9 +954,9 @@ public class MapViewGameState implements GameState | |||
940 | } | 954 | } |
941 | } | 955 | } |
942 | 956 | ||
943 | for (int x=0; x<MAP_WIDTH; x++) | 957 | for (int x=0; x<mapWidth; x++) |
944 | { | 958 | { |
945 | for (int y=0; y<MAP_HEIGHT; y++) | 959 | for (int y=0; y<mapHeight; y++) |
946 | { | 960 | { |
947 | if (grid[x][y] == Tile.ShatteredWindow) | 961 | if (grid[x][y] == Tile.ShatteredWindow) |
948 | { | 962 | { |
@@ -969,15 +983,15 @@ public class MapViewGameState implements GameState | |||
969 | { | 983 | { |
970 | if (grid[playerx][playery] == Tile.Snow) | 984 | if (grid[playerx][playery] == Tile.Snow) |
971 | { | 985 | { |
972 | health--; | 986 | Main.currentGame.health--; |
973 | } | 987 | } |
974 | } | 988 | } |
975 | 989 | ||
976 | if ((grid[playerx][playery] != Tile.Snow) && ((heartbeat == Functions.random(0, 7)) || (heartbeat == 8))) | 990 | if ((grid[playerx][playery] != Tile.Snow) && ((heartbeat == Functions.random(0, 7)) || (heartbeat == 8))) |
977 | { | 991 | { |
978 | if (health < maxHealth) | 992 | if (Main.currentGame.health < Main.currentGame.maxHealth) |
979 | { | 993 | { |
980 | health++; | 994 | Main.currentGame.health++; |
981 | } | 995 | } |
982 | } | 996 | } |
983 | 997 | ||
@@ -1010,7 +1024,7 @@ public class MapViewGameState implements GameState | |||
1010 | calculateFieldOfView(); | 1024 | calculateFieldOfView(); |
1011 | 1025 | ||
1012 | // Handle death | 1026 | // Handle death |
1013 | if (health <= 0) | 1027 | if (Main.currentGame.health <= 0) |
1014 | { | 1028 | { |
1015 | printMessage("You have died! Press [ENTER] to quit."); | 1029 | printMessage("You have died! Press [ENTER] to quit."); |
1016 | 1030 | ||
@@ -1031,11 +1045,11 @@ public class MapViewGameState implements GameState | |||
1031 | { | 1045 | { |
1032 | if (playerx > (VIEWPORT_WIDTH/2)) | 1046 | if (playerx > (VIEWPORT_WIDTH/2)) |
1033 | { | 1047 | { |
1034 | if (playerx < (MAP_WIDTH - (VIEWPORT_WIDTH/2-1))) | 1048 | if (playerx < (mapWidth - (VIEWPORT_WIDTH/2-1))) |
1035 | { | 1049 | { |
1036 | viewportx = playerx - (VIEWPORT_WIDTH/2); | 1050 | viewportx = playerx - (VIEWPORT_WIDTH/2); |
1037 | } else { | 1051 | } else { |
1038 | viewportx = MAP_WIDTH - VIEWPORT_WIDTH; | 1052 | viewportx = mapWidth - VIEWPORT_WIDTH; |
1039 | } | 1053 | } |
1040 | } else { | 1054 | } else { |
1041 | viewportx = 0; | 1055 | viewportx = 0; |
@@ -1043,11 +1057,11 @@ public class MapViewGameState implements GameState | |||
1043 | 1057 | ||
1044 | if (playery > (VIEWPORT_HEIGHT/2)) | 1058 | if (playery > (VIEWPORT_HEIGHT/2)) |
1045 | { | 1059 | { |
1046 | if (playery < (MAP_HEIGHT - (VIEWPORT_HEIGHT/2-1))) | 1060 | if (playery < (mapHeight - (VIEWPORT_HEIGHT/2-1))) |
1047 | { | 1061 | { |
1048 | viewporty = playery - (VIEWPORT_HEIGHT/2); | 1062 | viewporty = playery - (VIEWPORT_HEIGHT/2); |
1049 | } else { | 1063 | } else { |
1050 | viewporty = MAP_HEIGHT - VIEWPORT_HEIGHT; | 1064 | viewporty = mapHeight - VIEWPORT_HEIGHT; |
1051 | } | 1065 | } |
1052 | } else { | 1066 | } else { |
1053 | viewporty = 0; | 1067 | viewporty = 0; |
@@ -1057,9 +1071,9 @@ public class MapViewGameState implements GameState | |||
1057 | private boolean isValidPosition(int x, int y) | 1071 | private boolean isValidPosition(int x, int y) |
1058 | { | 1072 | { |
1059 | if (x < 0) return false; | 1073 | if (x < 0) return false; |
1060 | if (x > MAP_WIDTH) return false; | 1074 | if (x > mapWidth) return false; |
1061 | if (y < 0) return false; | 1075 | if (y < 0) return false; |
1062 | if (y > MAP_HEIGHT) return false; | 1076 | if (y > mapHeight) return false; |
1063 | 1077 | ||
1064 | return true; | 1078 | return true; |
1065 | } | 1079 | } |
diff --git a/src/com/fourisland/frigidearth/mobs/Spider.java b/src/com/fourisland/frigidearth/mobs/Spider.java index 58a554b..7d3330e 100644 --- a/src/com/fourisland/frigidearth/mobs/Spider.java +++ b/src/com/fourisland/frigidearth/mobs/Spider.java | |||
@@ -44,7 +44,7 @@ public class Spider extends Mob | |||
44 | 44 | ||
45 | public int getAttackPower() | 45 | public int getAttackPower() |
46 | { | 46 | { |
47 | return 2; | 47 | return 1; |
48 | } | 48 | } |
49 | 49 | ||
50 | public int getBaseExperience() | 50 | public int getBaseExperience() |