v0.3.4: externalized all plant strings

This commit is contained in:
Evan Debenham
2015-12-30 18:42:04 -05:00
committed by Evan Debenham
parent 7860a77789
commit 2776614cd1
15 changed files with 93 additions and 274 deletions
@@ -28,41 +28,23 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class BlandfruitBush extends Plant {
private static final String TXT_DESC =
"Distant cousin of the Rotberry, the pear-shaped produce of the Blandfruit bush tastes like caked dust. " +
"The fruit is gross and unsubstantial but isn't poisonous. perhaps it could be cooked.";
{
image = 8;
plantName = "Blandfruit";
}
@Override
public void activate() {
Char ch = Actor.findChar(pos);
Dungeon.level.drop( new Blandfruit(), pos ).sprite.drop();
}
@Override
public String desc() {
return TXT_DESC;
}
public static class Seed extends Plant.Seed {
{
plantName = "Blandfruit";
setPlant( BlandfruitBush.class );
name = "seed of " + plantName;
image = ItemSpriteSheet.SEED_BLANDFRUIT;
plantClass = BlandfruitBush.class;
alchemyClass = null;
}
@Override
public String desc() {
return TXT_DESC;
}
}
}
@@ -34,14 +34,9 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.utils.Random;
public class Blindweed extends Plant {
private static final String TXT_DESC =
"Upon being touched a Blindweed perishes in a bright flash of light. " +
"The flash is strong enough to disorient for several seconds.";
{
image = 3;
plantName = "Blindweed";
}
@Override
@@ -63,25 +58,13 @@ public class Blindweed extends Plant {
}
}
@Override
public String desc() {
return TXT_DESC;
}
public static class Seed extends Plant.Seed {
{
plantName = "Blindweed";
name = "seed of " + plantName;
setPlant(Blindweed.class);
image = ItemSpriteSheet.SEED_BLINDWEED;
plantClass = Blindweed.class;
alchemyClass = PotionOfInvisibility.class;
}
@Override
public String desc() {
return TXT_DESC;
}
}
}
@@ -34,19 +34,14 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Weakness;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfPurity;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
public class Dreamfoil extends Plant {
private static final String TXT_DESC =
"The Dreamfoil's prickly flowers contain a chemical which is known for its " +
"properties as a strong neutralizing agent. Most weaker creatures are overwhelmed " +
"and knocked unconscious, which gives the plant its namesake.";
{
image = 10;
plantName = "Dreamfoil";
}
@Override
@@ -57,7 +52,7 @@ public class Dreamfoil extends Plant {
if (ch instanceof Mob)
Buff.affect(ch, MagicalSleep.class);
else if (ch instanceof Hero){
GLog.i( "You feel refreshed." );
GLog.i( Messages.get(this, "refreshed") );
Buff.detach( ch, Poison.class );
Buff.detach( ch, Cripple.class );
Buff.detach( ch, Weakness.class );
@@ -65,29 +60,17 @@ public class Dreamfoil extends Plant {
Buff.detach( ch, Drowsy.class );
Buff.detach( ch, Slow.class );
Buff.detach( ch, Vertigo.class);
}
}
}
}
@Override
public String desc() {
return TXT_DESC;
}
public static class Seed extends Plant.Seed {
{
plantName = "Dreamfoil";
setPlant(Dreamfoil.class);
name = "seed of " + plantName;
image = ItemSpriteSheet.SEED_DREAMFOIL;
plantClass = Dreamfoil.class;
alchemyClass = PotionOfPurity.class;
}
@Override
public String desc() {
return TXT_DESC;
}
}
}
@@ -21,6 +21,7 @@
package com.shatteredpixel.shatteredpixeldungeon.plants;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.watabou.noosa.Camera;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
@@ -34,14 +35,9 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
import com.watabou.utils.Bundle;
public class Earthroot extends Plant {
private static final String TXT_DESC =
"When a creature touches an Earthroot, its roots " +
"create a kind of immobile natural armor around it.";
{
image = 5;
plantName = "Earthroot";
}
@Override
@@ -58,28 +54,16 @@ public class Earthroot extends Plant {
}
}
@Override
public String desc() {
return TXT_DESC;
}
public static class Seed extends Plant.Seed {
{
plantName = "Earthroot";
name = "seed of " + plantName;
setPlant( Earthroot.class );
image = ItemSpriteSheet.SEED_EARTHROOT;
plantClass = Earthroot.class;
alchemyClass = PotionOfParalyticGas.class;
bones = true;
}
@Override
public String desc() {
return TXT_DESC;
}
}
public static class Armor extends Buff {
@@ -131,19 +115,12 @@ public class Earthroot extends Plant {
@Override
public String toString() {
return Utils.format("Herbal armor", level);
return Messages.get(this, "name");
}
@Override
public String desc() {
return "A kind of natural, immobile armor is protecting you. " +
"The armor forms plates of bark and twine, wrapping around your body.\n" +
"\n" +
"This herbal armor will absorb 50% of all physical damage you take, " +
"until it eventually runs out of durability and collapses. The armor is also immobile, " +
"if you attempt to move it will break apart and be lost.\n" +
"\n" +
"The herbal armor can absorb " + level + " more damage before breaking.";
return Messages.get(this, "desc", level);
}
private static final String POS = "pos";
@@ -32,14 +32,9 @@ import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportat
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class Fadeleaf extends Plant {
private static final String TXT_DESC =
"Touching a Fadeleaf will teleport any creature " +
"to a random place on the current level.";
{
image = 6;
plantName = "Fadeleaf";
}
@Override
@@ -69,7 +64,7 @@ public class Fadeleaf extends Plant {
ch.sprite.visible = Dungeon.visible[pos];
}
}
if (Dungeon.visible[pos]) {
@@ -77,25 +72,13 @@ public class Fadeleaf extends Plant {
}
}
@Override
public String desc() {
return TXT_DESC;
}
public static class Seed extends Plant.Seed {
{
plantName = "Fadeleaf";
name = "seed of " + plantName;
setPlant( Fadeleaf.class );
image = ItemSpriteSheet.SEED_FADELEAF;
plantClass = Fadeleaf.class;
alchemyClass = PotionOfMindVision.class;
}
@Override
public String desc() {
return TXT_DESC;
}
}
}
@@ -30,12 +30,9 @@ import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class Firebloom extends Plant {
private static final String TXT_DESC = "When something touches a Firebloom, it bursts into flames.";
{
image = 0;
plantName = "Firebloom";
}
@Override
@@ -48,25 +45,13 @@ public class Firebloom extends Plant {
}
}
@Override
public String desc() {
return TXT_DESC;
}
public static class Seed extends Plant.Seed {
{
plantName = "Firebloom";
name = "seed of " + plantName;
setPlant( Firebloom.class );
image = ItemSpriteSheet.SEED_FIREBLOOM;
plantClass = Firebloom.class;
alchemyClass = PotionOfLiquidFlame.class;
}
@Override
public String desc() {
return TXT_DESC;
}
}
}
@@ -30,14 +30,9 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
import com.watabou.utils.PathFinder;
public class Icecap extends Plant {
private static final String TXT_DESC =
"Upon being touched, an Icecap lets out a puff of freezing pollen. " +
"The freezing effect is much stronger if the environment is wet.";
{
image = 1;
plantName = "Icecap";
}
@Override
@@ -54,25 +49,13 @@ public class Icecap extends Plant {
}
}
@Override
public String desc() {
return TXT_DESC;
}
public static class Seed extends Plant.Seed {
{
plantName = "Icecap";
name = "seed of " + plantName;
setPlant( Icecap.class );
image = ItemSpriteSheet.SEED_ICECAP;
plantClass = Icecap.class;
alchemyClass = PotionOfFrost.class;
}
@Override
public String desc() {
return TXT_DESC;
}
}
}
@@ -24,6 +24,7 @@ import java.util.ArrayList;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.SandalsOfNature;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.watabou.noosa.audio.Sample;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
@@ -47,7 +48,7 @@ import com.watabou.utils.Random;
public abstract class Plant implements Bundlable {
public String plantName;
public String plantName = Messages.get(this, "name");
public int image;
public int pos;
@@ -114,15 +115,11 @@ public abstract class Plant implements Bundlable {
}
public String desc() {
return null;
return Messages.get(this, "desc");
}
public static class Seed extends Item {
public static final String AC_PLANT = "PLANT";
private static final String TXT_INFO = "Throw this seed to the place where you want to grow %s.\n\n%s";
private static final float TIME_TO_PLANT = 1f;
{
@@ -134,11 +131,17 @@ public abstract class Plant implements Bundlable {
protected String plantName;
public Class<? extends Item> alchemyClass;
protected void setPlant(Class<? extends Plant> plantClass){
this.plantClass = plantClass;
plantName = Messages.get(plantClass, "name");
name = Messages.get(Seed.class, "seed_of", plantName);
}
@Override
public ArrayList<String> actions( Hero hero ) {
ArrayList<String> actions = super.actions( hero );
actions.add( AC_PLANT );
actions.add( Messages.get( Seed.class, "ac_plant" ) );
return actions;
}
@@ -153,7 +156,7 @@ public abstract class Plant implements Bundlable {
@Override
public void execute( Hero hero, String action ) {
if (action.equals( AC_PLANT )) {
if (action.equals( Messages.get( Seed.class, "ac_plant" ))) {
hero.spend( TIME_TO_PLANT );
hero.busy();
@@ -195,10 +198,15 @@ public abstract class Plant implements Bundlable {
public int price() {
return 10 * quantity;
}
@Override
public String desc() {
return Messages.get(plantClass, "desc");
}
@Override
public String info() {
return String.format( TXT_INFO, Utils.indefinite( plantName ), desc() );
return Messages.get( Seed.class, "info", Utils.indefinite( plantName ), desc() );
}
}
}
@@ -26,14 +26,8 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class Rotberry extends Plant {
private static final String TXT_DESC =
"The berries of a young rotberry shrub taste like sweet, sweet death.\n" +
"\n" +
"Given several days, this rotberry shrub will grow into another rot heart.";
{
image = 7;
plantName = "Rotberry";
}
@Override
@@ -41,25 +35,13 @@ public class Rotberry extends Plant {
Dungeon.level.drop( new Seed(), pos ).sprite.drop();
}
@Override
public String desc() {
return TXT_DESC;
}
public static class Seed extends Plant.Seed {
{
plantName = "Rotberry";
setPlant( Rotberry.class );
name = "seed of " + plantName;
image = ItemSpriteSheet.SEED_ROTBERRY;
plantClass = Rotberry.class;
alchemyClass = PotionOfStrength.class;
}
@Override
public String desc() {
return TXT_DESC;
}
}
}
@@ -32,12 +32,8 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class Sorrowmoss extends Plant {
private static final String TXT_DESC =
"A Sorrowmoss is a flower (not a moss) with razor-sharp petals, coated with a deadly venom.";
{
image = 2;
plantName = "Sorrowmoss";
}
@Override
@@ -53,25 +49,13 @@ public class Sorrowmoss extends Plant {
}
}
@Override
public String desc() {
return TXT_DESC;
}
public static class Seed extends Plant.Seed {
{
plantName = "Sorrowmoss";
name = "seed of " + plantName;
setPlant( Sorrowmoss.class );
image = ItemSpriteSheet.SEED_SORROWMOSS;
plantClass = Sorrowmoss.class;
alchemyClass = PotionOfToxicGas.class;
}
@Override
public String desc() {
return TXT_DESC;
}
}
}
@@ -31,13 +31,8 @@ import com.watabou.utils.Random;
public class Starflower extends Plant {
private static final String TXT_DESC =
"An extremely rare plant, " +
"Starflower is said to grant holy power to whomever touches it.";
{
image = 11;
plantName = "Starflower";
}
@Override
@@ -51,26 +46,14 @@ public class Starflower extends Plant {
}
}
@Override
public String desc() {
return TXT_DESC;
}
public static class Seed extends Plant.Seed{
{
plantName = "Starflower";
setPlant( Starflower.class );
name = "Seed of " + plantName;
image = ItemSpriteSheet.SEED_STARFLOWER;
plantClass = Starflower.class;
alchemyClass = PotionOfExperience.class;
}
@Override
public String desc() {
return TXT_DESC;
}
}
}
@@ -29,13 +29,8 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class Stormvine extends Plant {
private static final String TXT_DESC =
"Gravity affects the Stormvine plant strangely, allowing its whispy blue tendrils " +
"to 'hang' on the air. Anything caught in the vine is affected by this, and becomes disoriented.";
{
image = 9;
plantName = "Stormvine";
}
@Override
@@ -47,25 +42,13 @@ public class Stormvine extends Plant {
}
}
@Override
public String desc() {
return TXT_DESC;
}
public static class Seed extends Plant.Seed {
{
plantName = "Stormvine";
setPlant( Stormvine.class );
name = "seed of " + plantName;
image = ItemSpriteSheet.SEED_STORMVINE;
plantClass = Stormvine.class;
alchemyClass = PotionOfLevitation.class;
}
@Override
public String desc() {
return TXT_DESC;
}
}
}
@@ -29,17 +29,15 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShaftParticle;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
import com.watabou.utils.Bundle;
public class Sungrass extends Plant {
private static final String TXT_DESC = "Sungrass is renowned for its sap's slow but effective healing properties.";
{
image = 4;
plantName = "Sungrass";
}
@Override
@@ -55,28 +53,16 @@ public class Sungrass extends Plant {
}
}
@Override
public String desc() {
return TXT_DESC;
}
public static class Seed extends Plant.Seed {
{
plantName = "Sungrass";
name = "seed of " + plantName;
setPlant( Sungrass.class );
image = ItemSpriteSheet.SEED_SUNGRASS;
plantClass = Sungrass.class;
alchemyClass = PotionOfHealing.class;
bones = true;
}
@Override
public String desc() {
return TXT_DESC;
}
}
public static class Health extends Buff {
@@ -147,17 +133,12 @@ public class Sungrass extends Plant {
@Override
public String toString() {
return "Herbal Healing";
return Messages.get(this, "name");
}
@Override
public String desc() {
return "Sungrass possesses excellent healing properties, though its not as fast as a potion of healing.\n" +
"\n" +
"You are current slowly regenerating health from the sungrass plant. " +
"Taking damage while healing will reduce the healing effectiveness, and moving off the plant will break the healing effect.\n" +
"\n" +
"You can heal for " + level + " more health, or until your health is full.";
return Messages.get(this, "desc", level);
}
private static final String POS = "pos";