v0.3.4: externalized artifacts part 1

This commit is contained in:
Evan Debenham
2016-01-09 05:24:48 -05:00
committed by Evan Debenham
parent 250029c19d
commit 33bef1c6cb
17 changed files with 231 additions and 306 deletions
@@ -56,24 +56,6 @@ import java.util.ArrayList;
public class LloydsBeacon extends Artifact {
private static final String TXT_PREVENTING =
"Strong magic aura of this place prevents you from using the lloyd's beacon!";
private static final String TXT_CREATURES =
"Psychic aura of neighbouring creatures doesn't allow you to use the lloyd's beacon at this moment.";
private static final String TXT_RETURN =
"The lloyd's beacon is successfully set at your current location, now you can return here anytime.";
private static final String TXT_INFO =
"Lloyd's beacon is an intricate magic device, which grants the user control of teleportation magics.\n" +
"\n" +
"The beacon can be used to return to a set location, but can also expel bursts of random teleportation " +
"magic once it has charged from being equipped. This magic can be directed at a target or at the user themselves.";
private static final String TXT_SET =
"\n\nThis beacon was set somewhere on the level %d of Pixel Dungeon.";
public static final float TIME_TO_USE = 1;
public static final String AC_ZAP = "ZAP";
@@ -132,13 +114,13 @@ public class LloydsBeacon extends Artifact {
if (Dungeon.bossLevel()) {
hero.spend( LloydsBeacon.TIME_TO_USE );
GLog.w( TXT_PREVENTING );
GLog.w( Messages.get(this, "preventing") );
return;
}
for (int i=0; i < Level.NEIGHBOURS8.length; i++) {
if (Actor.findChar( hero.pos + Level.NEIGHBOURS8[i] ) != null) {
GLog.w( TXT_CREATURES );
GLog.w( Messages.get(this, "creatures") );
return;
}
}
@@ -149,8 +131,8 @@ public class LloydsBeacon extends Artifact {
curUser = hero;
int chargesToUse = Dungeon.depth > 20 ? 2 : 1;
if (!isEquipped( hero )) GLog.i("You need to equip the beacon to do that.");
else if (charge < chargesToUse) GLog.i("Your beacon does not have enough energy right now.");
if (!isEquipped( hero )) GLog.i( Messages.get(Artifact.class, "need_to_equip") );
else if (charge < chargesToUse) GLog.i( Messages.get(this, "no_charge") );
else {
GameScene.selectCell(zapper);
}
@@ -166,7 +148,7 @@ public class LloydsBeacon extends Artifact {
hero.sprite.operate( hero.pos );
Sample.INSTANCE.play( Assets.SND_BEACON );
GLog.i( TXT_RETURN );
GLog.i( Messages.get(this, "return") );
} else if (action == AC_RETURN) {
@@ -243,7 +225,7 @@ public class LloydsBeacon extends Artifact {
} else if (ch.properties().contains(Char.Property.IMMOVABLE)) {
GLog.w("The teleportation magic fails.");
GLog.w( Messages.get(this, "tele_fail") );
} else {
@@ -266,7 +248,7 @@ public class LloydsBeacon extends Artifact {
@Override
public String prompt() {
return "Choose a location to zap.";
return Messages.get(this, "prompt");
}
};
@@ -277,14 +259,19 @@ public class LloydsBeacon extends Artifact {
@Override
public Item upgrade() {
if (level() == levelCap) return this;
chargeCap ++;
GLog.p( Messages.get(this, "levelup") );
return super.upgrade();
}
@Override
public String desc() {
return TXT_INFO + (returnDepth == -1 ? "" : Utils.format( TXT_SET, returnDepth ) );
String desc = super.desc();
if (returnDepth != -1){
desc += "\n\n" + Messages.get(this, "desc_set", returnDepth);
}
return desc;
}
public void reset() {