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
@@ -57,7 +57,6 @@ public class SandalsOfNature extends Artifact {
public static final String AC_FEED = "FEED";
public static final String AC_ROOT = "ROOT";
protected String inventoryTitle = "Select a seed";
protected WndBag.Mode mode = WndBag.Mode.SEED;
public ArrayList<Class> seeds = new ArrayList<>();
@@ -76,11 +75,11 @@ public class SandalsOfNature extends Artifact {
public void execute( Hero hero, String action ) {
super.execute(hero, action);
if (action.equals(AC_FEED)){
GameScene.selectItem(itemSelector, mode, inventoryTitle);
GameScene.selectItem(itemSelector, mode, Messages.get(this, "prompt"));
} else if (action.equals(AC_ROOT) && level() > 0){
if (!isEquipped( hero )) GLog.i( Messages.get(Artifact.class, "need_to_equip") );
else if (charge == 0) GLog.i("They have no energy right now.");
else if (charge == 0) GLog.i( Messages.get(this, "no_charge") );
else {
Buff.prolong(hero, Roots.class, 5);
Buff.affect(hero, Earthroot.Armor.class).level(charge);
@@ -99,33 +98,22 @@ public class SandalsOfNature extends Artifact {
@Override
public String desc() {
String desc = "";
if (level() == 0)
desc += "What initially seem like sandals made of twine are actually two plants! They seem very weak and pale, perhaps they need to be given nutrients?";
else if (level() == 1)
desc += "The footwear has grown and now more closely resemble two tailored shoes. Some colour has returned to them, perhaps they can still grow further?";
else if (level() == 2)
desc += "The plants have grown again and now resembles a pair of solid boots made from bark.The plants seem to have " +
"regained their strength, but perhaps they can still grow further";
else
desc += "The plants seem to have reached their maximum size, they resemble a pair of armored greaves. The greaves are a deep brown " +
"and resemble a very sturdy tree.";
String desc = Messages.get(this, "desc_" + (level()+1));
if ( isEquipped ( Dungeon.hero ) ){
desc += "\n\n";
if (!cursed)
desc += " You feel more attuned with nature while wearing this artifact.";
desc += Messages.get(this, "desc_hint");
else
desc += " The cursed sandals are blocking any attunement with nature.";
desc += Messages.get(this, "desc_cursed");
if (level() > 0)
desc += "\n\nThe footwear has gained the ability to form up into a sort of immobile natural armour, " +
"but will need to charge up for it.";
desc += "\n\n" + Messages.get(this, "desc_ability");
}
if (!seeds.isEmpty()){
desc += "\n\nYou have fed the footwear " + seeds.size() + " seeds.";
desc += "\n\n" + Messages.get(this, "desc_seeds", seeds.size());
}
return desc;
@@ -177,7 +165,7 @@ public class SandalsOfNature extends Artifact {
public void onSelect( Item item ) {
if (item != null && item instanceof Plant.Seed) {
if (seeds.contains(item.getClass())){
GLog.w("Your footwear have already gained nutrients from that seed recently.");
GLog.w( Messages.get(SandalsOfNature.class, "already_fed") );
} else {
seeds.add(item.getClass());
@@ -190,11 +178,11 @@ public class SandalsOfNature extends Artifact {
seeds.clear();
upgrade();
if (level() >= 1 && level() <= 3) {
GLog.p("Your footwear surges in size, they are now " + name + "!");
GLog.p( Messages.get(SandalsOfNature.class, "levelup") );
}
} else {
GLog.i("The footwear absorbs the seed, they seem healthier.");
GLog.i( Messages.get(SandalsOfNature.class, "absorb_seed") );
}
item.detach(hero.belongings.backpack);
}
@@ -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") );
}
};
}