From bbc45c6dc965efcdae92535e8c23ed82052766cf Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sat, 28 May 2016 20:14:35 -0400 Subject: [PATCH] v0.4.0: refactored extra reach on weapons, adjusted statues to use new weapon properties --- .../shatteredpixeldungeon/actors/mobs/Statue.java | 10 ++++++++-- .../shatteredpixeldungeon/items/weapon/Weapon.java | 10 ++++++++-- .../items/weapon/melee/Glaive.java | 7 +------ .../items/weapon/melee/Spear.java | 7 +------ .../shatteredpixeldungeon/items/weapon/melee/Whip.java | 6 +----- 5 files changed, 19 insertions(+), 21 deletions(-) diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Statue.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Statue.java index 035256cae..9f084d3c9 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Statue.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Statue.java @@ -31,6 +31,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon.Enchantment; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Death; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Leech; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon; +import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.sprites.StatueSprite; import com.watabou.utils.Bundle; @@ -99,10 +100,15 @@ public class Statue extends Mob { protected float attackDelay() { return weapon.DLY; } - + + @Override + protected boolean canAttack(Char enemy) { + return Level.distance( pos, enemy.pos ) <= weapon.RCH; + } + @Override public int dr() { - return Dungeon.depth; + return Dungeon.depth + weapon.defenceFactor(null); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java index 721a40202..be5049e19 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java @@ -54,8 +54,9 @@ abstract public class Weapon extends KindOfWeapon { private static final String TXT_TO_STRING = "%s :%d"; - public float ACC = 1; // Accuracy modifier + public float ACC = 1f; // Accuracy modifier public float DLY = 1f; // Speed modifier + public int RCH = 1; // Reach modifier (only applies to melee hits) public enum Imbue { NONE, LIGHT, HEAVY @@ -145,7 +146,12 @@ abstract public class Weapon extends KindOfWeapon { return (encumrance > 0 ? (float)(DLY * Math.pow( 1.2, encumrance )) : DLY); } - + + @Override + public int reachFactor(Hero hero) { + return RCH; + } + @Override public int damageRoll( Hero hero ) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Glaive.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Glaive.java index af1f9d118..4a39dbce7 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Glaive.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Glaive.java @@ -20,7 +20,6 @@ */ package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee; -import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; public class Glaive extends MeleeWeapon { @@ -30,11 +29,7 @@ public class Glaive extends MeleeWeapon { tier = 5; DLY = 1.5f; //0.67x speed - } - - @Override - public int reachFactor(Hero hero) { - return 2; //extra reach + RCH = 2; //extra reach } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Spear.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Spear.java index 450758b5f..ddb706a74 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Spear.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Spear.java @@ -20,7 +20,6 @@ */ package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee; -import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; public class Spear extends MeleeWeapon { @@ -30,11 +29,7 @@ public class Spear extends MeleeWeapon { tier = 2; DLY = 1.5f; //0.67x speed - } - - @Override - public int reachFactor(Hero hero) { - return 2; //extra reach + RCH = 2; //extra reach } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Whip.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Whip.java index f002204c3..fbfe2dc93 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Whip.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Whip.java @@ -20,7 +20,6 @@ */ package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee; -import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; public class Whip extends MeleeWeapon { @@ -29,6 +28,7 @@ public class Whip extends MeleeWeapon { image = ItemSpriteSheet.WHIP; tier = 3; + RCH = 3; //lots of extra reach } @Override @@ -37,8 +37,4 @@ public class Whip extends MeleeWeapon { lvl*(tier); //+3 per level, down from +4 } - @Override - public int reachFactor(Hero hero) { - return 3; //lots of extra reach - } }