From 926db95ee63a5f85a4954a55f27a28f76c6bb152 Mon Sep 17 00:00:00 2001 From: Starla Insigna Date: Tue, 5 Jun 2012 18:31:40 -0400 Subject: Gave clothing attack and defense values --- src/com/fourisland/frigidearth/Game.java | 11 +++++++++- src/com/fourisland/frigidearth/Item.java | 25 ++++++++++++++++++++++ .../fourisland/frigidearth/MapViewGameState.java | 6 +++--- src/com/fourisland/frigidearth/mobs/Spider.java | 2 +- 4 files changed, 39 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/com/fourisland/frigidearth/Game.java b/src/com/fourisland/frigidearth/Game.java index fdd4110..621148c 100644 --- a/src/com/fourisland/frigidearth/Game.java +++ b/src/com/fourisland/frigidearth/Game.java @@ -15,7 +15,6 @@ public class Game { public int health = 15; public int maxHealth = 15; - public int defense = 0; public int level = 1; public int experience = 0; public List inventory = new ArrayList(); @@ -147,4 +146,14 @@ public class Game return true; } + + public int getAttackPower() + { + return (int) (Math.floor(Math.sqrt(level)) + (sword == null ? 0 : sword.getAttackPower())); + } + + public int getDefense() + { + return (helmet == null ? 0 : helmet.getDefense()) + (shield == null ? 0 : shield.getDefense()) + (shoes == null ? 0 : shoes.getDefense()); + } } diff --git a/src/com/fourisland/frigidearth/Item.java b/src/com/fourisland/frigidearth/Item.java index 4527cbe..63f2f02 100644 --- a/src/com/fourisland/frigidearth/Item.java +++ b/src/com/fourisland/frigidearth/Item.java @@ -70,6 +70,11 @@ public enum Item { return ItemType.Helmet; } + + public int getDefense() + { + return 1; + } }, WoodenSword { public String getItemName() @@ -91,6 +96,11 @@ public enum Item { return ItemType.Sword; } + + public int getAttackPower() + { + return 1; + } }, WoodenShield { public String getItemName() @@ -112,6 +122,11 @@ public enum Item { return ItemType.Shield; } + + public int getDefense() + { + return 1; + } }, RingOfRegeneration { public String getItemName() @@ -244,4 +259,14 @@ public enum Item return null; } + + public int getAttackPower() + { + return 0; + } + + public int getDefense() + { + return 0; + } } diff --git a/src/com/fourisland/frigidearth/MapViewGameState.java b/src/com/fourisland/frigidearth/MapViewGameState.java index 30a2c93..07df1d6 100644 --- a/src/com/fourisland/frigidearth/MapViewGameState.java +++ b/src/com/fourisland/frigidearth/MapViewGameState.java @@ -761,7 +761,7 @@ public class MapViewGameState implements GameState g.drawImage(SystemFont.getCharacter((char) 5, Color.GRAY), (healthText.length()+3)*TILE_WIDTH, 0, TILE_WIDTH, TILE_HEIGHT, null); int b = healthText.length()+4; - String defenseText = Integer.toString(Main.currentGame.defense); + String defenseText = Integer.toString(Main.currentGame.getDefense()); for (int i=0; i path = findPath(mob.getPosition(), new Point(playerx, playery)); diff --git a/src/com/fourisland/frigidearth/mobs/Spider.java b/src/com/fourisland/frigidearth/mobs/Spider.java index ac3eb9d..a3ee637 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 public int getAttackPower() { - return 1; + return Functions.rollDice(1,2); } public int getBaseExperience() -- cgit 1.4.1