v0.3.4: externalized potion strings

This commit is contained in:
Evan Debenham 2016-01-02 04:15:12 -05:00 committed by Evan Debenham
parent 4b768ea85c
commit 5ab29b50fa
14 changed files with 92 additions and 168 deletions

View File

@ -28,6 +28,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.watabou.noosa.audio.Sample;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Badges;
@ -49,18 +50,9 @@ public class Potion extends Item {
public static final String AC_DRINK = "DRINK";
private static final String TXT_HARMFUL = "Harmful potion!";
private static final String TXT_BENEFICIAL = "Beneficial potion";
private static final String TXT_YES = "Yes, I know what I'm doing";
private static final String TXT_NO = "No, I changed my mind";
private static final String TXT_R_U_SURE_DRINK =
"Are you sure you want to drink it? In most cases you should throw such potions at your enemies.";
private static final String TXT_R_U_SURE_THROW =
"Are you sure you want to throw it? In most cases it makes sense to drink it.";
private static final float TIME_TO_DRINK = 1f;
protected String initials;
protected String initials = Messages.get(this, "initials");
private static final Class<?>[] potions = {
PotionOfHealing.class,
@ -106,7 +98,7 @@ public class Potion extends Item {
@SuppressWarnings("unchecked")
public static void initColors() {
handler = new ItemStatusHandler<Potion>( (Class<? extends Potion>[])potions, colors, images );
handler = new ItemStatusHandler<>( (Class<? extends Potion>[])potions, colors, images );
}
public static void save( Bundle bundle ) {
@ -115,7 +107,7 @@ public class Potion extends Item {
@SuppressWarnings("unchecked")
public static void restore( Bundle bundle ) {
handler = new ItemStatusHandler<Potion>( (Class<? extends Potion>[])potions, colors, images, bundle );
handler = new ItemStatusHandler<>( (Class<? extends Potion>[])potions, colors, images, bundle );
}
public Potion() {
@ -146,7 +138,9 @@ public class Potion extends Item {
this instanceof PotionOfParalyticGas)) {
GameScene.show(
new WndOptions( TXT_HARMFUL, TXT_R_U_SURE_DRINK, TXT_YES, TXT_NO ) {
new WndOptions( Messages.get(Potion.class, "harmful"),
Messages.get(Potion.class, "sure_drink"),
Messages.get(Potion.class, "yes"), Messages.get(Potion.class, "no") ) {
@Override
protected void onSelect(int index) {
if (index == 0) {
@ -179,7 +173,9 @@ public class Potion extends Item {
this instanceof PotionOfMight)) {
GameScene.show(
new WndOptions( TXT_BENEFICIAL, TXT_R_U_SURE_THROW, TXT_YES, TXT_NO ) {
new WndOptions( Messages.get(Potion.class, "beneficial"),
Messages.get(Potion.class, "sure_throw"),
Messages.get(Potion.class, "yes"), Messages.get(Potion.class, "no") ) {
@Override
protected void onSelect(int index) {
if (index == 0) {
@ -226,7 +222,7 @@ public class Potion extends Item {
public void shatter( int cell ) {
if (Dungeon.visible[cell]) {
GLog.i( "The flask shatters and " + color() + " liquid splashes harmlessly" );
GLog.i( Messages.get(Potion.class, "shatter", color()) );
Sample.INSTANCE.play( Assets.SND_SHATTER );
splash( cell );
}
@ -259,20 +255,19 @@ public class Potion extends Item {
}
protected String color() {
return color;
return Messages.get(Potion.class, color);
}
@Override
public String name() {
return isKnown() ? name : color + " potion";
return isKnown() ? super.name() : Messages.get(Potion.class, "unknown_name", color());
}
@Override
public String info() {
return isKnown() ?
desc() :
"This flask contains a swirling " + color + " liquid. " +
"Who knows what it will do when drunk or thrown?";
Messages.get(Potion.class, "unknown_desc", color());
}
public String initials(){

View File

@ -25,8 +25,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
public class PotionOfExperience extends Potion {
{
initials = "Ex";
bones = true;
}
@ -36,13 +34,6 @@ public class PotionOfExperience extends Potion {
hero.earnExp( hero.maxExp() );
}
@Override
public String desc() {
return
"The storied experiences of multitudes of battles reduced to liquid form, " +
"this draught will instantly raise your experience level.";
}
@Override
public int price() {
return isKnown() ? 80 * quantity : super.price();

View File

@ -33,10 +33,6 @@ public class PotionOfFrost extends Potion {
private static final int DISTANCE = 2;
{
initials = "Fr";
}
@Override
public void shatter( int cell ) {
@ -59,14 +55,6 @@ public class PotionOfFrost extends Potion {
}
}
@Override
public String desc() {
return
"Upon exposure to open air this chemical will evaporate into a freezing cloud, causing " +
"any creature that contacts it to be frozen in place unable to act and move. " +
"The freezing effect is much stronger if the environment is wet.";
}
@Override
public int price() {
return isKnown() ? 50 * quantity : super.price();

View File

@ -28,13 +28,12 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Poison;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Weakness;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
public class PotionOfHealing extends Potion {
{
initials = "He";
bones = true;
}
@ -42,7 +41,7 @@ public class PotionOfHealing extends Potion {
public void apply( Hero hero ) {
setKnown();
heal( Dungeon.hero );
GLog.p( "Your wounds heal completely." );
GLog.p( Messages.get(this, "heal") );
}
public static void heal( Hero hero ) {
@ -56,12 +55,6 @@ public class PotionOfHealing extends Potion {
hero.sprite.emitter().start( Speck.factory( Speck.HEALING ), 0.4f, 4 );
}
@Override
public String desc() {
return
"An elixir that will instantly return you to full health and cure poison.";
}
@Override
public int price() {
return isKnown() ? 30 * quantity : super.price();

View File

@ -20,6 +20,7 @@
*/
package com.shatteredpixel.shatteredpixeldungeon.items.potions;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.watabou.noosa.audio.Sample;
import com.watabou.noosa.tweeners.AlphaTweener;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
@ -33,26 +34,14 @@ public class PotionOfInvisibility extends Potion {
private static final float ALPHA = 0.4f;
{
initials = "In";
}
@Override
public void apply( Hero hero ) {
setKnown();
Buff.affect( hero, Invisibility.class, Invisibility.DURATION );
GLog.i( "You see your hands turn invisible!" );
GLog.i( Messages.get(this, "invisble") );
Sample.INSTANCE.play( Assets.SND_MELD );
}
@Override
public String desc() {
return
"Drinking this potion will render you temporarily invisible. While invisible, " +
"enemies will be unable to see you. Attacking an enemy, as well as using a wand or a scroll " +
"before enemy's eyes, will dispel the effect.";
}
@Override
public int price() {
return isKnown() ? 40 * quantity : super.price();

View File

@ -27,16 +27,13 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ConfusionGas;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Levitation;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
public class PotionOfLevitation extends Potion {
{
initials = "Le";
}
@Override
public void shatter( int cell ) {
@ -54,15 +51,7 @@ public class PotionOfLevitation extends Potion {
public void apply( Hero hero ) {
setKnown();
Buff.affect( hero, Levitation.class, Levitation.DURATION );
GLog.i( "You float into the air!" );
}
@Override
public String desc() {
return
"Drinking this curious liquid will cause you to hover in the air, " +
"able to drift effortlessly over traps and pits. Throwing this potion " +
"will create a cloud of unrefined gas, disorienting anything caught in it.";
GLog.i( Messages.get(this, "float") );
}
@Override

View File

@ -33,10 +33,6 @@ import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
public class PotionOfLiquidFlame extends Potion {
{
initials = "LF";
}
@Override
public void shatter( int cell ) {
@ -62,13 +58,6 @@ public class PotionOfLiquidFlame extends Potion {
}
}
@Override
public String desc() {
return
"This flask contains an unstable compound which will burst " +
"violently into flame upon exposure to open air.";
}
@Override
public int price() {
return isKnown() ? 40 * quantity : super.price();

View File

@ -22,14 +22,13 @@ package com.shatteredpixel.shatteredpixeldungeon.items.potions;
import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
public class PotionOfMight extends Potion {
{
initials = "Mi";
bones = true;
}
@ -40,19 +39,12 @@ public class PotionOfMight extends Potion {
hero.STR++;
hero.HT += 5;
hero.HP += 5;
hero.sprite.showStatus( CharSprite.POSITIVE, "+1 str, +5 hp" );
GLog.p( "Newfound strength surges through your body." );
hero.sprite.showStatus( CharSprite.POSITIVE, Messages.get(this, "msg_1") );
GLog.p( Messages.get(this, "msg_2") );
Badges.validateStrengthAttained();
}
@Override
public String desc() {
return
"This powerful liquid will course through your muscles, permanently " +
"increasing your strength by one point and health by five points.";
}
@Override
public int price() {
return isKnown() ? 200 * quantity : super.price();

View File

@ -24,14 +24,11 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MindVision;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
public class PotionOfMindVision extends Potion {
{
initials = "MV";
}
@Override
public void apply( Hero hero ) {
setKnown();
@ -39,20 +36,12 @@ public class PotionOfMindVision extends Potion {
Dungeon.observe();
if (Dungeon.level.mobs.size() > 0) {
GLog.i( "You can somehow feel the presence of other creatures' minds!" );
GLog.i( Messages.get(this, "see_mobs") );
} else {
GLog.i( "You can somehow tell that you are alone on this level at the moment." );
GLog.i( Messages.get(this, "see_none") );
}
}
@Override
public String desc() {
return
"After drinking this, your mind will become attuned to the psychic signature " +
"of distant creatures, enabling you to sense biological presences through walls. " +
"Also this potion will permit you to see through nearby walls and doors.";
}
@Override
public int price() {
return isKnown() ? 35 * quantity : super.price();

View File

@ -29,10 +29,6 @@ import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
public class PotionOfParalyticGas extends Potion {
{
initials = "PG";
}
@Override
public void shatter( int cell ) {
@ -46,15 +42,6 @@ public class PotionOfParalyticGas extends Potion {
GameScene.add( Blob.seed( cell, 1000, ParalyticGas.class ) );
}
@Override
public String desc() {
return
"Upon exposure to open air, the liquid in this flask will vaporize " +
"into a numbing yellow haze. Anyone who inhales the cloud will be paralyzed " +
"instantly, unable to move for some time after the cloud dissipates. This " +
"item can be thrown at distant enemies to catch them within the effect of the gas.";
}
@Override
public int price() {
return isKnown() ? 40 * quantity : super.price();

View File

@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.potions;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ConfusionGas;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.StenchGas;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.VenomGas;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.watabou.noosa.audio.Sample;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
@ -41,15 +42,8 @@ import com.watabou.utils.PathFinder;
public class PotionOfPurity extends Potion {
private static final String TXT_FRESHNESS = "You feel uncommon freshness in the air.";
private static final String TXT_NO_SMELL = "You've stopped sensing any smells!";
private static final int DISTANCE = 5;
{
initials = "Pu";
}
@Override
public void shatter( int cell ) {
@ -103,7 +97,7 @@ public class PotionOfPurity extends Potion {
setKnown();
if (heroAffected) {
GLog.p( TXT_FRESHNESS );
GLog.p( Messages.get(this, "freshness") );
}
} else {
@ -111,7 +105,7 @@ public class PotionOfPurity extends Potion {
super.shatter( cell );
if (heroAffected) {
GLog.i( TXT_FRESHNESS );
GLog.i( Messages.get(this, "freshness") );
setKnown();
}
@ -120,18 +114,11 @@ public class PotionOfPurity extends Potion {
@Override
public void apply( Hero hero ) {
GLog.w( TXT_NO_SMELL );
GLog.w( Messages.get(this, "no_smell") );
Buff.prolong( hero, GasesImmunity.class, GasesImmunity.DURATION );
setKnown();
}
@Override
public String desc() {
return
"This reagent will quickly neutralize all harmful gases in the area of effect. " +
"Drinking it will give you a temporary immunity to such gases.";
}
@Override
public int price() {
return isKnown() ? 50 * quantity : super.price();

View File

@ -22,14 +22,13 @@ package com.shatteredpixel.shatteredpixeldungeon.items.potions;
import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
public class PotionOfStrength extends Potion {
{
initials = "St";
bones = true;
}
@ -38,19 +37,12 @@ public class PotionOfStrength extends Potion {
setKnown();
hero.STR++;
hero.sprite.showStatus( CharSprite.POSITIVE, "+1 str" );
GLog.p( "Newfound strength surges through your body." );
hero.sprite.showStatus( CharSprite.POSITIVE, Messages.get(this, "msg_1") );
GLog.p( Messages.get(this, "msg_2") );
Badges.validateStrengthAttained();
}
@Override
public String desc() {
return
"This powerful liquid will course through your muscles, " +
"permanently increasing your strength by one point.";
}
@Override
public int price() {
return isKnown() ? 100 * quantity : super.price();

View File

@ -29,10 +29,6 @@ import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
public class PotionOfToxicGas extends Potion {
{
initials = "TG";
}
@Override
public void shatter( int cell ) {
@ -46,15 +42,6 @@ public class PotionOfToxicGas extends Potion {
GameScene.add( Blob.seed( cell, 1000, ToxicGas.class ) );
}
@Override
public String desc() {
return
"Uncorking or shattering this pressurized glass will cause " +
"its contents to explode into a deadly cloud of toxic green gas. " +
"You might choose to fling this potion at distant enemies " +
"instead of uncorking it by hand.";
}
@Override
public int price() {
return isKnown() ? 40 * quantity : super.price();

View File

@ -503,18 +503,74 @@ items.keys.ironkey.desc=The notches on this ancient iron key are well worn; its
items.keys.skeletonkey.name=skeleton key
items.keys.skeletonkey.desc=This key looks serious: its head is shaped like a skull. Probably it can open some serious door.
items.potions.potion.turquoise=turquoise
items.potions.potion.crimson=crimson
items.potions.potion.azure=azure
items.potions.potion.jade=jade
items.potions.potion.golden=golden
items.potions.potion.magenta=magenta
items.potions.potion.charcoal=charcoal
items.potions.potion.ivory=ivory
items.potions.potion.amber=amber
items.potions.potion.bistre=bistre
items.potions.potion.indigo=indigo
items.potions.potion.silver=silver
items.potions.potion.unknown_name=%s potion
items.potions.potion.unknown_desc=This flask contains a swirling %s liquid. Who knows what it will do when drunk or thrown?
items.potions.potion.harmful=Harmful potion!
items.potions.potion.beneficial=Beneficial potion
items.potions.potion.yes=Yes, I know what I'm doing
items.potions.potion.no=No, I changed my mind
items.potions.potion.sure_drink=Are you sure you want to drink it? In most cases you should throw such potions at your enemies.
items.potions.potion.sure_throw=Are you sure you want to throw it? In most cases it makes sense to drink it.
items.potions.potion.shatter=The flask shatters and %s liquid splashes harmlessly
items.potions.potionofexperience.name=potion of experience
items.potions.potionofexperience.initials=Ex
items.potions.potionofexperience.desc=The storied experiences of multitudes of battles reduced to liquid form, this draught will instantly raise your experience level.
items.potions.potionoffrost.name=potion of frost
items.potions.potionoffrost.initials=Fr
items.potions.potionoffrost.desc=Upon exposure to open air this chemical will evaporate into a freezing cloud, causing any creature that contacts it to be frozen in place unable to act and move. The freezing effect is much stronger if the environment is wet.
items.potions.potionofhealing.name=potion of healing
items.potions.potionofhealing.initials=He
items.potions.potionofhealing.heal=Your wounds heal completely.
items.potions.potionofhealing.desc=An elixir that will instantly return you to full health and cure poison.
items.potions.potionofinvisibility.name=potion of invisibility
items.potions.potionofinvisibility.initials=In
items.potions.potionofinvisibility.invisible=You see your hands turn invisible!
items.potions.potionofinvisibility.desc=Drinking this potion will render you temporarily invisible. While invisible, enemies will be unable to see you. Attacking an enemy, as well as using a wand or a scroll before enemy's eyes, will dispel the effect.
items.potions.potionoflevitation.name=potion of levitation
items.potions.potionoflevitation.initials=Le
items.potions.potionoflevitation.float=You float into the air!
items.potions.potionoflevitation.desc=Drinking this curious liquid will cause you to hover in the air, able to drift effortlessly over traps and pits. Throwing this potion will create a cloud of unrefined gas, disorienting anything caught in it.
items.potions.potionofliquidflame.name=potion of liquid flame
items.potions.potionofliquidflame.initials=LF
items.potions.potionofliquidflame.desc=This flask contains an unstable compound which will burst violently into flame upon exposure to open air.
items.potions.potionofmight.name=potion of might
items.potions.potionofmight.initials=Mi
items.potions.potionofmight.msg_1=+1 str, +5 hp
items.potions.potionofmight.msg_2=Newfound strength surges through your body.
items.potions.potionofmight.desc=This powerful liquid will course through your muscles, permanently increasing your strength by one point and health by five points.
items.potions.potionofmindvision.name=potion of mind vision
items.potions.potionofmindvision.initials=MV
items.potions.potionofmindvision.see_mobs=You can somehow feel the presence of other creatures' minds!
items.potions.potionofmindvision.see_none=You can somehow tell that you are alone on this level at the moment.
items.potions.potionofmindvision.desc=After drinking this, your mind will become attuned to the psychic signature of distant creatures, enabling you to sense biological presences through walls. Also this potion will permit you to see through nearby walls and doors.
items.potions.potionofparalyticgas.name=potion of paralytic gas
items.potions.potionofparalyticgas.initials=PG
items.potions.potionofparalyticgas.desc=Upon exposure to open air, the liquid in this flask will vaporize into a numbing yellow haze. Anyone who inhales the cloud will be paralyzed instantly, unable to move for some time after the cloud dissipates. This item can be thrown at distant enemies to catch them within the effect of the gas.
items.potions.potionofpurity.name=potion of purification
items.potions.potionofpurity.initials=Pu
items.potions.potionofpurity.freshness=You feel uncommon freshness in the air.
items.potions.potionofpurity.no_smell=You've stopped sensing any smells!
items.potions.potionofpurity.desc=This reagent will quickly neutralize all harmful gases in the area of effect. Drinking it will give you a temporary immunity to such gases.
items.potions.potionofstrength.name=potion of strength
items.potions.potionofstrength.initials=St
items.potions.potionofstrength.msg_1=+1 str
items.potions.potionofstrength.msg_2=Newfound strength surges through your body.
items.potions.potionofstrength.desc=This powerful liquid will course through your muscles, permanently increasing your strength by one point.
items.potions.potionoftoxicgas.name=potion of toxic gas
items.potions.potionoftoxicgas.initials=TG
items.potions.potionoftoxicgas.desc=Uncorking or shattering this pressurized glass will cause its contents to explode into a deadly cloud of toxic green gas. You might choose to fling this potion at distant enemies instead of uncorking it by hand.
items.quest.ceremonialcandle.name=ceremonial candle
items.quest.ceremonialcandle.desc=A set of candles, melted down and fused together through use.\n\nAlone they are worthless, but used with other candles in a pattern, they can focus the energy for a summoning ritual.