v0.3.4: externalized ring strings

This commit is contained in:
Evan Debenham 2016-01-02 07:04:08 -05:00 committed by Evan Debenham
parent 492e9069d2
commit fb2c6e3307
13 changed files with 56 additions and 137 deletions

View File

@ -32,6 +32,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass;
import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.ItemStatusHandler; import com.shatteredpixel.shatteredpixeldungeon.items.ItemStatusHandler;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils; import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
@ -45,13 +46,6 @@ public class Ring extends KindofMisc {
private static final float TIME_TO_EQUIP = 1f; private static final float TIME_TO_EQUIP = 1f;
private static final String TXT_IDENTIFY =
"you are now familiar enough with your %s to identify it. It is %s.";
private static final String TXT_UNEQUIP_TITLE = "Unequip one item";
private static final String TXT_UNEQUIP_MESSAGE =
"You can only wear two misc items at a time.";
protected Buff buff; protected Buff buff;
private static final Class<?>[] rings = { private static final Class<?>[] rings = {
@ -91,7 +85,7 @@ public class Ring extends KindofMisc {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static void initGems() { public static void initGems() {
handler = new ItemStatusHandler<Ring>( (Class<? extends Ring>[])rings, gems, images ); handler = new ItemStatusHandler<>( (Class<? extends Ring>[])rings, gems, images );
} }
public static void save( Bundle bundle ) { public static void save( Bundle bundle ) {
@ -100,7 +94,7 @@ public class Ring extends KindofMisc {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static void restore( Bundle bundle ) { public static void restore( Bundle bundle ) {
handler = new ItemStatusHandler<Ring>( (Class<? extends Ring>[])rings, gems, images, bundle ); handler = new ItemStatusHandler<>( (Class<? extends Ring>[])rings, gems, images, bundle );
} }
public Ring() { public Ring() {
@ -129,7 +123,8 @@ public class Ring extends KindofMisc {
final KindofMisc m2 = hero.belongings.misc2; final KindofMisc m2 = hero.belongings.misc2;
ShatteredPixelDungeon.scene().add( ShatteredPixelDungeon.scene().add(
new WndOptions(TXT_UNEQUIP_TITLE, TXT_UNEQUIP_MESSAGE, new WndOptions(Messages.get(Ring.class, "unequip_title"),
Messages.get(Ring.class, "unequip_message"),
Utils.capitalize(m1.toString()), Utils.capitalize(m1.toString()),
Utils.capitalize(m2.toString())) { Utils.capitalize(m2.toString())) {
@ -160,7 +155,7 @@ public class Ring extends KindofMisc {
cursedKnown = true; cursedKnown = true;
if (cursed) { if (cursed) {
equipCursed( hero ); equipCursed( hero );
GLog.n( "your " + this + " tightens around your finger painfully" ); GLog.n( Messages.get(this, "cursed", this) );
} }
hero.spendAndNext( TIME_TO_EQUIP ); hero.spendAndNext( TIME_TO_EQUIP );
@ -230,35 +225,33 @@ public class Ring extends KindofMisc {
Badges.validateAllRingsIdentified(); Badges.validateAllRingsIdentified();
} }
@Override public String gem() {
public String name() { return Messages.get(Ring.class, gem);
return isKnown() ? super.name() : gem + " ring";
} }
@Override @Override
public String desc() { public String name() {
return return isKnown() ? super.name() : Messages.get(this, "unknown_name", gem());
"This metal band is adorned with a large " + gem + " gem " +
"that glitters in the darkness. Who knows what effect it has when worn?";
} }
@Override @Override
public String info() { public String info() {
String desc = isKnown()? desc() : Messages.get(this, "unknown_desc", gem());
if (isEquipped( Dungeon.hero )) { if (isEquipped( Dungeon.hero )) {
return desc() + "\n\n" + "The " + name() + " is on your finger" + desc += Messages.get(Ring.class, "on_finger", name());
(cursed ? ", and because it is cursed, you are powerless to remove it." : "." ); if (cursed) desc += Messages.get(Ring.class, "cursed_worn");
} else if (cursed && cursedKnown) { } else if (cursed && cursedKnown) {
return desc() + "\n\nYou can feel a malevolent magic lurking within the " + name() + "."; desc += Messages.get(Ring.class, "curse_known", name());
} else {
return desc();
} }
return desc;
} }
@Override @Override
@ -336,8 +329,6 @@ public class Ring extends KindofMisc {
public class RingBuff extends Buff { public class RingBuff extends Buff {
private static final String TXT_KNOWN = "This is a %s";
public int level; public int level;
public RingBuff() { public RingBuff() {
level = Ring.this.level(); level = Ring.this.level();
@ -348,7 +339,7 @@ public class Ring extends KindofMisc {
if (target instanceof Hero && ((Hero)target).heroClass == HeroClass.ROGUE && !isKnown()) { if (target instanceof Hero && ((Hero)target).heroClass == HeroClass.ROGUE && !isKnown()) {
setKnown(); setKnown();
GLog.i( TXT_KNOWN, name() ); GLog.i( Messages.get(Ring.class, "known", name()) );
Badges.validateItemLevelAquired( Ring.this ); Badges.validateItemLevelAquired( Ring.this );
} }
@ -361,7 +352,7 @@ public class Ring extends KindofMisc {
if (!isIdentified() && --ticksToKnow <= 0) { if (!isIdentified() && --ticksToKnow <= 0) {
String gemName = name(); String gemName = name();
identify(); identify();
GLog.w( TXT_IDENTIFY, gemName, Ring.this.toString() ); GLog.w( Messages.get(Ring.class, "identify", gemName, Ring.this.toString()) );
Badges.validateItemLevelAquired( Ring.this ); Badges.validateItemLevelAquired( Ring.this );
} }

View File

@ -27,14 +27,6 @@ public class RingOfAccuracy extends Ring {
return new Accuracy(); return new Accuracy();
} }
@Override
public String desc() {
return isKnown() ?
"This ring increases your focus, reducing your enemy's ability to dodge your attacks. "+
"A degraded ring will instead make you easier to evade.":
super.desc();
}
public class Accuracy extends RingBuff { public class Accuracy extends RingBuff {
} }
} }

View File

@ -37,14 +37,6 @@ public class RingOfElements extends Ring {
protected RingBuff buff( ) { protected RingBuff buff( ) {
return new Resistance(); return new Resistance();
} }
@Override
public String desc() {
return isKnown() ?
"This ring provides resistance to different elements, such as fire, " +
"electricity, gases etc. Also it decreases duration of negative effects." :
super.desc();
}
private static final HashSet<Class<?>> EMPTY = new HashSet<Class<?>>(); private static final HashSet<Class<?>> EMPTY = new HashSet<Class<?>>();
private static final HashSet<Class<?>> FULL; private static final HashSet<Class<?>> FULL;

View File

@ -30,16 +30,6 @@ public class RingOfEvasion extends Ring {
protected RingBuff buff( ) { protected RingBuff buff( ) {
return new Evasion(); return new Evasion();
} }
@Override
public String desc() {
return isKnown() ?
"This ring obfuscates the true position of the wearer, making them harder to detect and attack. " +
"This ring is much stronger while the user remains undetected, and if the user is targeted the power of " +
"evasion will slowly fade away, remaining undetected will restore the ring's effectiveness. " +
"A degraded ring will instead make the user easier to detect and strike.":
super.desc();
}
//yup, the only ring in the game with logic inside of its class //yup, the only ring in the game with logic inside of its class
public class Evasion extends RingBuff { public class Evasion extends RingBuff {

View File

@ -29,24 +29,6 @@ public class RingOfForce extends Ring {
return new Force(); return new Force();
} }
@Override
public String desc() {
if (isKnown()){
String desc = "This ring enhances the force of the wearer's blows. " +
"This extra power is largely wasted when wielding weapons, " +
"but an unarmed attack will be made much stronger. " +
"A degraded ring will instead weaken the wearer's blows.\n\n" +
"When unarmed, at your current strength, ";
int str = Dungeon.hero.STR() - 8;
desc += levelKnown ?
"average damage with this ring is " + (str/2+level() + (int)(str*0.5f*level()) + str*2)/2 + " points per hit.":
"typical average damage with this ring is" + (str/2+1 + (int)(str*0.5f) + str*2)/2 + " points per hit.";
desc += " Wearing a second ring of force would enhance this.";
return desc;
} else
return super.desc();
}
public class Force extends RingBuff { public class Force extends RingBuff {
} }
} }

View File

@ -27,15 +27,6 @@ public class RingOfFuror extends Ring {
return new Furor(); return new Furor();
} }
@Override
public String desc() {
return isKnown() ?
"This ring grants the wearer an inner fury, allowing them to attack more rapidly. " +
"This fury works best in large bursts, so slow weapons benefit far more than fast ones. " +
"A degraded ring will instead slow the wearer's speed of attack." :
super.desc();
}
public class Furor extends RingBuff { public class Furor extends RingBuff {
} }
} }

View File

@ -27,14 +27,6 @@ public class RingOfHaste extends Ring {
return new Haste(); return new Haste();
} }
@Override
public String desc() {
return isKnown() ?
"This ring reduces the stress of movement on the wearer, allowing them to run " +
"at superhuman speeds. A degraded ring will instead weigh the wearer down.":
super.desc();
}
public class Haste extends RingBuff { public class Haste extends RingBuff {
} }
} }

View File

@ -27,14 +27,6 @@ public class RingOfMagic extends Ring {
return new Magic(); return new Magic();
} }
@Override
public String desc() {
return isKnown() ?
"Your wands will become more powerful in the arcane field " +
"that radiates from this ring. Degraded rings of magic will instead weaken your wands." :
super.desc();
}
public class Magic extends RingBuff { public class Magic extends RingBuff {
} }
} }

View File

@ -28,15 +28,6 @@ public class RingOfMight extends Ring {
return new Might(); return new Might();
} }
@Override
public String desc() {
return isKnown() ?
"This ring enhances the physical traits of the wearer, " +
"granting them greater physical strength and constitution. " +
"A degraded ring will weaken the wearer." :
super.desc();
}
public class Might extends RingBuff { public class Might extends RingBuff {
} }
} }

View File

@ -27,15 +27,6 @@ public class RingOfSharpshooting extends Ring {
return new Aim(); return new Aim();
} }
@Override
public String desc() {
return isKnown() ?
"This ring enhances the wearer's precision and aim, which will " +
"make all projectile weapons more accurate and durable. " +
"A degraded ring will have the opposite effect.":
super.desc();
}
public class Aim extends RingBuff { public class Aim extends RingBuff {
} }
} }

View File

@ -27,15 +27,6 @@ public class RingOfTenacity extends Ring {
return new Tenacity(); return new Tenacity();
} }
@Override
public String desc() {
return isKnown() ?
"When worn, this ring will allow the wearer to resist normally mortal strikes. " +
"The more injured the user is, the more resistant they will be to damage. " +
"A degraded ring will instead make it easier for enemies to execute the wearer." :
super.desc();
}
public class Tenacity extends RingBuff { public class Tenacity extends RingBuff {
} }
} }

View File

@ -27,15 +27,6 @@ public class RingOfWealth extends Ring {
return new Wealth(); return new Wealth();
} }
@Override
public String desc() {
return isKnown() ?
"It's not clear what this ring does exactly, good luck may influence " +
"the life of an adventurer in many subtle ways. " +
"Naturally a degraded ring would give bad luck." :
super.desc();
}
public class Wealth extends RingBuff { public class Wealth extends RingBuff {
} }
} }

View File

@ -590,17 +590,50 @@ items.quest.pickaxe.desc=This is a large and sturdy tool for breaking rocks. Pro
items.quest.ratskull.name=giant rat skull items.quest.ratskull.name=giant rat skull
items.quest.ratskull.desc=A surprisingly large rat skull. It would make a great hunting trophy, if you had a wall to mount it on. items.quest.ratskull.desc=A surprisingly large rat skull. It would make a great hunting trophy, if you had a wall to mount it on.
items.rings.ring.diamond=diamond
items.rings.ring.opal=opal
items.rings.ring.garnet=garnet
items.rings.ring.ruby=ruby
items.rings.ring.amethyst=amethyst
items.rings.ring.topaz=topaz
items.rings.ring.onyx=onyx
items.rings.ring.tourmaline=tourmaline
items.rings.ring.emerald=emerald
items.rings.ring.sapphire=sapphire
items.rings.ring.quartz=quartz
items.rings.ring.agate=agate
items.rings.ring.cursed=your %s tightens around your finger painfully
items.rings.ring.unknown_name=%s ring
items.rings.ring.unknown_desc=This metal band is adorned with a large %s gem that glitters in the darkness. Who knows what effect it has when worn?
items.rings.ring.known=This is a %s
items.rings.ring.identify=You are now familiar enough with your %s to identify it. It is %s.
items.rings.ring.on_finger=\n\nThe %s is on your finger.
items.rings.ring.cursed_worn=Because it is cursed, you are powerless to remove it.
items.rings.ring.curse_known=\n\nYou can feel a malevolent magic lurking within the %s.
items.rings.ring.unequip_title=Unequip one item
items.rings.ring.unequip_message=You can only wear two misc items at a time.
items.rings.ringofaccuracy.name=ring of accuracy items.rings.ringofaccuracy.name=ring of accuracy
items.rings.ringofaccuracy.desc=This ring increases your focus, reducing your enemy's ability to dodge your attacks. A degraded ring will instead make you easier to evade.
items.rings.ringofelements.name=ring of elements items.rings.ringofelements.name=ring of elements
items.rings.ringofelements.desc=This ring provides resistance to different elements, such as fire, electricity, gases etc. Also it decreases duration of negative effects.
items.rings.ringofevasion.name=ring of evasion items.rings.ringofevasion.name=ring of evasion
items.rings.ringofevasion.desc=This ring obfuscates the true position of the wearer, making them harder to detect and attack. This ring is much stronger while the user remains undetected, and if the user is targeted the power of evasion will slowly fade away, remaining undetected will restore the ring's effectiveness. A degraded ring will instead make the user easier to detect and strike.
items.rings.ringofforce.name=ring of force items.rings.ringofforce.name=ring of force
items.rings.ringofforce.desc=This ring enhances the force of the wearer's blows. This extra power is largely wasted when wielding weapons, but an unarmed attack will be made much stronger. A degraded ring will instead weaken the wearer's blows.
items.rings.ringoffuror.name=ring of furor items.rings.ringoffuror.name=ring of furor
items.rings.ringoffuror.desc=This ring grants the wearer an inner fury, allowing them to attack more rapidly. This fury works best in large bursts, so slow weapons benefit far more than fast ones. A degraded ring will instead slow the wearer's speed of attack.
items.rings.ringofhaste.name=ring of haste items.rings.ringofhaste.name=ring of haste
items.rings.ringofhaste.desc=This ring reduces the stress of movement on the wearer, allowing them to run at superhuman speeds. A degraded ring will instead weigh the wearer down.
items.rings.ringofmagic.name=ring of magic items.rings.ringofmagic.name=ring of magic
items.rings.ringofmagic.desc=Your wands will become more powerful in the arcane field that radiates from this ring. Degraded rings of magic will instead weaken your wands.
items.rings.ringofmight.name=ring of might items.rings.ringofmight.name=ring of might
items.rings.ringofmight.desc=This ring enhances the physical traits of the wearer, granting them greater physical strength and constitution. A degraded ring will weaken the wearer.
items.rings.ringofsharpshooting.name=ring of sharpshooting items.rings.ringofsharpshooting.name=ring of sharpshooting
items.rings.ringofsharpshooting.desc=This ring enhances the wearer's precision and aim, which will make all projectile weapons more accurate and durable. A degraded ring will have the opposite effect.
items.rings.ringoftenacity.name=ring of tenacity items.rings.ringoftenacity.name=ring of tenacity
items.rings.ringoftenacity.desc=When worn, this ring will allow the wearer to resist normally mortal strikes. The more injured the user is, the more resistant they will be to damage. A degraded ring will instead make it easier for enemies to execute the wearer.
items.rings.ringofwealth.name=ring of wealth items.rings.ringofwealth.name=ring of wealth
items.rings.ringofwealth.desc=It's not clear what this ring does exactly, good luck may influence the life of an adventurer in many subtle ways. Naturally a degraded ring would give bad luck.
items.scrolls.scroll.kaunan=KAUNAN items.scrolls.scroll.kaunan=KAUNAN
items.scrolls.scroll.sowilo=SOWILO items.scrolls.scroll.sowilo=SOWILO