v0.4.0: refactored extra reach on weapons, adjusted statues to use new weapon properties

This commit is contained in:
Evan Debenham 2016-05-28 20:14:35 -04:00
parent 256cca2e7e
commit bbc45c6dc9
5 changed files with 19 additions and 21 deletions

View File

@ -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.Death;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Leech; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Leech;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.StatueSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.StatueSprite;
import com.watabou.utils.Bundle; import com.watabou.utils.Bundle;
@ -100,9 +101,14 @@ public class Statue extends Mob {
return weapon.DLY; return weapon.DLY;
} }
@Override
protected boolean canAttack(Char enemy) {
return Level.distance( pos, enemy.pos ) <= weapon.RCH;
}
@Override @Override
public int dr() { public int dr() {
return Dungeon.depth; return Dungeon.depth + weapon.defenceFactor(null);
} }
@Override @Override

View File

@ -54,8 +54,9 @@ abstract public class Weapon extends KindOfWeapon {
private static final String TXT_TO_STRING = "%s :%d"; 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 float DLY = 1f; // Speed modifier
public int RCH = 1; // Reach modifier (only applies to melee hits)
public enum Imbue { public enum Imbue {
NONE, LIGHT, HEAVY NONE, LIGHT, HEAVY
@ -146,6 +147,11 @@ abstract public class Weapon extends KindOfWeapon {
(encumrance > 0 ? (float)(DLY * Math.pow( 1.2, encumrance )) : DLY); (encumrance > 0 ? (float)(DLY * Math.pow( 1.2, encumrance )) : DLY);
} }
@Override
public int reachFactor(Hero hero) {
return RCH;
}
@Override @Override
public int damageRoll( Hero hero ) { public int damageRoll( Hero hero ) {

View File

@ -20,7 +20,6 @@
*/ */
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee; package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class Glaive extends MeleeWeapon { public class Glaive extends MeleeWeapon {
@ -30,11 +29,7 @@ public class Glaive extends MeleeWeapon {
tier = 5; tier = 5;
DLY = 1.5f; //0.67x speed DLY = 1.5f; //0.67x speed
} RCH = 2; //extra reach
@Override
public int reachFactor(Hero hero) {
return 2; //extra reach
} }
@Override @Override

View File

@ -20,7 +20,6 @@
*/ */
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee; package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class Spear extends MeleeWeapon { public class Spear extends MeleeWeapon {
@ -30,11 +29,7 @@ public class Spear extends MeleeWeapon {
tier = 2; tier = 2;
DLY = 1.5f; //0.67x speed DLY = 1.5f; //0.67x speed
} RCH = 2; //extra reach
@Override
public int reachFactor(Hero hero) {
return 2; //extra reach
} }
@Override @Override

View File

@ -20,7 +20,6 @@
*/ */
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee; package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class Whip extends MeleeWeapon { public class Whip extends MeleeWeapon {
@ -29,6 +28,7 @@ public class Whip extends MeleeWeapon {
image = ItemSpriteSheet.WHIP; image = ItemSpriteSheet.WHIP;
tier = 3; tier = 3;
RCH = 3; //lots of extra reach
} }
@Override @Override
@ -37,8 +37,4 @@ public class Whip extends MeleeWeapon {
lvl*(tier); //+3 per level, down from +4 lvl*(tier); //+3 per level, down from +4
} }
@Override
public int reachFactor(Hero hero) {
return 3; //lots of extra reach
}
} }