v0.4.0: refactoring for enchant/glyph referencing

This commit is contained in:
Evan Debenham
2016-06-15 03:03:27 -04:00
committed by Evan Debenham
parent 4c8bcade38
commit 912fd447d0
11 changed files with 24 additions and 28 deletions
@@ -141,7 +141,7 @@ abstract public class Weapon extends KindOfWeapon {
int encumbrance = STRReq() - hero.STR();
if (enchantment instanceof Wayward)
if (hasEnchant(Wayward.class))
encumbrance = Math.max(3, encumbrance+3);
float ACC = this.ACC;
@@ -180,7 +180,7 @@ abstract public class Weapon extends KindOfWeapon {
@Override
public int reachFactor(Hero hero) {
return enchantment instanceof Projecting ? RCH+1 : RCH;
return hasEnchant(Projecting.class) ? RCH+1 : RCH;
}
@Override
@@ -106,10 +106,10 @@ public class MeleeWeapon extends Weapon {
@Override
public int price() {
int price = 20 * (1 << (tier - 1));
if (enchantment != null) {
if (hasGoodEnchant()) {
price *= 1.5;
}
if (cursed && cursedKnown) {
if (cursedKnown && (cursed || hasCurseEnchant())) {
price /= 2;
}
if (levelKnown) {
@@ -58,7 +58,7 @@ abstract public class MissileWeapon extends Weapon {
protected int throwPos(Hero user, int dst) {
int defaultPos = super.throwPos(user, dst);
if (defaultPos == dst) return dst;
else if (enchantment instanceof Projecting){
else if (hasEnchant(Projecting.class)){
Ballistica ProjectingTrajectory = new Ballistica( user.pos, dst, Ballistica.STOP_TARGET );
if (ProjectingTrajectory.dist <= 4) return ProjectingTrajectory.collisionPos;
else return super.throwPos(user, dst);