about summary refs log tree commit diff stats
path: root/src/com/fourisland
diff options
context:
space:
mode:
authorStarla Insigna <hatkirby@fourisland.com>2012-06-05 08:28:20 -0400
committerStarla Insigna <hatkirby@fourisland.com>2012-06-05 08:28:20 -0400
commit6677e63c84447eae786b9b645adb97302206fbde (patch)
tree83feea2c0696dce8d8fd188da4500f22bd2c652a /src/com/fourisland
parent6a2d1d894db801c7212d745f83bfb29557836659 (diff)
downloadfrigidearth-6677e63c84447eae786b9b645adb97302206fbde.tar.gz
frigidearth-6677e63c84447eae786b9b645adb97302206fbde.tar.bz2
frigidearth-6677e63c84447eae786b9b645adb97302206fbde.zip
Added item Wooden Helmet (no use yet) and added ability to drop items
Diffstat (limited to 'src/com/fourisland')
-rw-r--r--src/com/fourisland/frigidearth/InventoryOverlay.java9
-rw-r--r--src/com/fourisland/frigidearth/Item.java28
-rw-r--r--src/com/fourisland/frigidearth/ItemType.java8
-rw-r--r--src/com/fourisland/frigidearth/MapViewGameState.java16
4 files changed, 58 insertions, 3 deletions
diff --git a/src/com/fourisland/frigidearth/InventoryOverlay.java b/src/com/fourisland/frigidearth/InventoryOverlay.java index 21f2194..0d7a5ba 100644 --- a/src/com/fourisland/frigidearth/InventoryOverlay.java +++ b/src/com/fourisland/frigidearth/InventoryOverlay.java
@@ -111,6 +111,15 @@ public class InventoryOverlay implements Renderable, Inputable
111 111
112 return; 112 return;
113 } 113 }
114
115 case KeyEvent.VK_D:
116 ((MapViewGameState) Main.getGameState()).dropItemAtPlayer(Main.currentGame.inventory.get(id));
117 Main.currentGame.inventory.remove(id);
118 ((MapViewGameState) Main.getGameState()).tick();
119 Main.removeRenderable(this);
120 Main.removeInputable(this);
121
122 return;
114 } 123 }
115 } 124 }
116 125
diff --git a/src/com/fourisland/frigidearth/Item.java b/src/com/fourisland/frigidearth/Item.java index 1fe4027..8881b6c 100644 --- a/src/com/fourisland/frigidearth/Item.java +++ b/src/com/fourisland/frigidearth/Item.java
@@ -50,6 +50,34 @@ public enum Item
50 return true; 50 return true;
51 } 51 }
52 }, 52 },
53 WoodenHelmet {
54 public String getItemName()
55 {
56 return "Wooden Helmet";
57 }
58
59 public char getDisplayCharacter()
60 {
61 return '^';
62 }
63
64 public Color getDisplayColor()
65 {
66 return new Color(128, 42, 42);
67 }
68
69 public ItemType getItemType()
70 {
71 return ItemType.Helmet;
72 }
73
74 public boolean useItem()
75 {
76 // Nope not yet
77
78 return true;
79 }
80 },
53 Key { 81 Key {
54 public String getItemName() 82 public String getItemName()
55 { 83 {
diff --git a/src/com/fourisland/frigidearth/ItemType.java b/src/com/fourisland/frigidearth/ItemType.java index d9bf9c5..f870fc6 100644 --- a/src/com/fourisland/frigidearth/ItemType.java +++ b/src/com/fourisland/frigidearth/ItemType.java
@@ -10,10 +10,16 @@ package com.fourisland.frigidearth;
10 */ 10 */
11public enum ItemType 11public enum ItemType
12{ 12{
13 Helmet {
14 public double getRarity()
15 {
16 return 0.75;
17 }
18 },
13 Scroll { 19 Scroll {
14 public double getRarity() 20 public double getRarity()
15 { 21 {
16 return 1; 22 return 0.25;
17 } 23 }
18 }, 24 },
19 Special { 25 Special {
diff --git a/src/com/fourisland/frigidearth/MapViewGameState.java b/src/com/fourisland/frigidearth/MapViewGameState.java index bbfb9ac..a61d0ee 100644 --- a/src/com/fourisland/frigidearth/MapViewGameState.java +++ b/src/com/fourisland/frigidearth/MapViewGameState.java
@@ -55,8 +55,8 @@ public class MapViewGameState implements GameState
55 { 55 {
56 this.floor = floor; 56 this.floor = floor;
57 57
58 mapWidth += (50 * floor); 58 mapWidth += (50 * (floor-1));
59 mapHeight += (50 * floor); 59 mapHeight += (50 * (floor-1));
60 60
61 grid = new Tile[mapWidth][mapHeight]; 61 grid = new Tile[mapWidth][mapHeight];
62 gridLighting = new boolean[mapWidth][mapHeight]; 62 gridLighting = new boolean[mapWidth][mapHeight];
@@ -891,6 +891,8 @@ public class MapViewGameState implements GameState
891 { 891 {
892 Main.currentGame.inventory.remove(Item.Key); 892 Main.currentGame.inventory.remove(Item.Key);
893 Main.setGameState(new MapViewGameState(floor+1)); 893 Main.setGameState(new MapViewGameState(floor+1));
894
895 return;
894 } else { 896 } else {
895 printMessage("The stairs are locked! You need a key."); 897 printMessage("The stairs are locked! You need a key.");
896 } 898 }
@@ -1372,4 +1374,14 @@ public class MapViewGameState implements GameState
1372 return null; 1374 return null;
1373 } 1375 }
1374 } 1376 }
1377
1378 public void dropItemAtPlayer(Item item)
1379 {
1380 ItemInstance ii = new ItemInstance();
1381 ii.item = item;
1382 ii.x = playerx;
1383 ii.y = playery;
1384
1385 items.add(ii);
1386 }
1375} 1387}