v0.3.4: externalized potion strings
This commit is contained in:
committed by
Evan Debenham
parent
4b768ea85c
commit
5ab29b50fa
@@ -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;
|
||||
@@ -48,19 +49,10 @@ import com.watabou.utils.Bundle;
|
||||
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(){
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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 ) {
|
||||
@@ -55,13 +54,7 @@ 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();
|
||||
|
||||
+2
-13
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -32,10 +32,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire;
|
||||
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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -24,13 +24,10 @@ 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 ) {
|
||||
@@ -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();
|
||||
|
||||
@@ -28,10 +28,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ParalyticGas;
|
||||
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();
|
||||
|
||||
@@ -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;
|
||||
@@ -40,16 +41,9 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user