v0.3.4: externalized strings for sandals and unstable spellbook

This commit is contained in:
Evan Debenham
2016-01-17 22:14:14 -05:00
committed by Evan Debenham
parent adf41aee04
commit 6f3a770a30
3 changed files with 50 additions and 59 deletions
@@ -61,9 +61,8 @@ public class UnstableSpellbook extends Artifact {
public static final String AC_READ = "READ";
public static final String AC_ADD = "ADD";
private final ArrayList<Class> scrolls = new ArrayList<Class>();
private final ArrayList<Class> scrolls = new ArrayList<>();
protected String inventoryTitle = "Select a scroll";
protected WndBag.Mode mode = WndBag.Mode.SCROLL;
public UnstableSpellbook() {
@@ -95,10 +94,10 @@ public class UnstableSpellbook extends Artifact {
public void execute( Hero hero, String action ) {
if (action.equals( AC_READ )) {
if (hero.buff( Blindness.class ) != null) GLog.w("You cannot read from the book while blinded.");
if (hero.buff( Blindness.class ) != null) GLog.w( Messages.get(this, "blinded") );
else if (!isEquipped( hero )) GLog.i( Messages.get(Artifact.class, "need_to_equip") );
else if (charge == 0) GLog.i("Your spellbook is out of energy for now.");
else if (cursed) GLog.i("Your cannot read from a cursed spellbook.");
else if (charge == 0) GLog.i( Messages.get(this, "no_charge") );
else if (cursed) GLog.i( Messages.get(this, "cursed") );
else {
charge--;
@@ -116,7 +115,7 @@ public class UnstableSpellbook extends Artifact {
}
} else if (action.equals( AC_ADD )) {
GameScene.selectItem(itemSelector, mode, inventoryTitle);
GameScene.selectItem(itemSelector, mode, Messages.get(this, "prompt"));
} else
super.execute( hero, action );
}
@@ -139,36 +138,18 @@ public class UnstableSpellbook extends Artifact {
@Override
public String desc() {
String desc = "This Tome is in surprising good condition given its age. ";
if (level() < 3)
desc += "It emanates a strange chaotic energy. ";
else if (level() < 7)
desc += "It glows with a strange chaotic energy. ";
else
desc += "It fizzes and crackles as you move the pages, surging with unstable energy. ";
desc += "It seems to contains a list of spells, but the order and position of them in the index is " +
"constantly shifting. If you read from this book, there's no telling what spell you might cast.";
desc += "\n\n";
if (isEquipped (Dungeon.hero)) {
if (!cursed)
desc += "The book fits firmly at your side, sending you the occasional zip of static energy.";
else
desc += "The cursed book has bound itself to you, it is inhibiting your ability to use most scrolls.";
String desc = super.desc();
if (cursed && isEquipped (Dungeon.hero)){
desc += "\n\n" + Messages.get(this, "desc_cursed");
}
if (level() < levelCap)
if (scrolls.size() > 0) {
desc += "\n\n" + "The book's index points to the following blank pages:\n " + Messages.get(scrolls.get(0), "name");
if (scrolls.size() > 1) desc += "\n" + Messages.get(scrolls.get(1), "name");
}
else
desc += "The book's index is full, it doesn't look like you can add anything more to it.";
if (level() < levelCap)
if (scrolls.size() > 0) {
desc += "\n\n" + Messages.get(this, "desc_index");
desc += "\n" + Messages.get(scrolls.get(0), "name");
if (scrolls.size() > 1) desc += "\n" + Messages.get(scrolls.get(1), "name");
}
return desc;
}
@@ -236,14 +217,13 @@ public class UnstableSpellbook extends Artifact {
item.detach(hero.belongings.backpack);
upgrade();
GLog.i("You infuse the scroll's energy into the book.");
GLog.i( Messages.get(UnstableSpellbook.class, "infuse_scroll") );
return;
}
}
if (item != null)
GLog.w("You are unable to add this scroll to the book.");
GLog.w( Messages.get(UnstableSpellbook.class, "unable_scroll") );
} else if (item instanceof Scroll && !item.isIdentified())
GLog.w("You're not sure what type of scroll this is yet.");
GLog.w( Messages.get(UnstableSpellbook.class, "unknown_scroll") );
}
};
}