v0.4.0: refactoring for enchant/glyph referencing
This commit is contained in:
committed by
Evan Debenham
parent
4c8bcade38
commit
912fd447d0
@@ -83,7 +83,7 @@ public class Stylus extends Item {
|
||||
if (!armor.isIdentified() ){
|
||||
GLog.w( Messages.get(this, "identify"));
|
||||
return;
|
||||
} else if (armor.cursed || (armor.glyph != null && armor.glyph.curse())){
|
||||
} else if (armor.cursed || armor.hasCurseGlyph()){
|
||||
GLog.w( Messages.get(this, "cursed"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -355,10 +355,10 @@ public class Armor extends EquipableItem {
|
||||
@Override
|
||||
public int price() {
|
||||
int price = 10 * (1 << (tier - 1));
|
||||
if (glyph != null) {
|
||||
if (hasCurseGlyph()) {
|
||||
price *= 1.5;
|
||||
}
|
||||
if (cursed && cursedKnown) {
|
||||
if (cursedKnown && (cursed || hasCurseGlyph())) {
|
||||
price /= 2;
|
||||
}
|
||||
if (levelKnown) {
|
||||
|
||||
@@ -40,7 +40,7 @@ public class RingOfEvasion extends Ring {
|
||||
public boolean attachTo( Char target ) {
|
||||
|
||||
pos = target.pos;
|
||||
effectiveLevel = Math.min(0, level);
|
||||
effectiveLevel = Math.min(0, level());
|
||||
return super.attachTo(target);
|
||||
}
|
||||
|
||||
@@ -56,12 +56,12 @@ public class RingOfEvasion extends Ring {
|
||||
}
|
||||
}
|
||||
|
||||
if (level < 1){
|
||||
effectiveLevel = level;
|
||||
if (level() < 1){
|
||||
effectiveLevel = level();
|
||||
} else if (seen) {
|
||||
effectiveLevel = Math.max(effectiveLevel - 1, 0);
|
||||
} else {
|
||||
effectiveLevel = Math.min(effectiveLevel + 1, level);
|
||||
effectiveLevel = Math.min(effectiveLevel + 1, level());
|
||||
}
|
||||
|
||||
return super.act();
|
||||
|
||||
@@ -75,7 +75,7 @@ public class ScrollOfUpgrade extends InventoryScroll {
|
||||
|
||||
a.upgrade();
|
||||
|
||||
if (hadCursedGlyph && a.glyph == null){
|
||||
if (hadCursedGlyph && !a.hasCurseGlyph()){
|
||||
removeCurse( Dungeon.hero );
|
||||
} else if (wasCursed && !a.cursed){
|
||||
weakenCurse( Dungeon.hero );
|
||||
|
||||
@@ -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) {
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user