v0.3.4: externalized armor strings

This commit is contained in:
Evan Debenham 2016-01-02 22:25:03 -05:00 committed by Evan Debenham
parent fb2c6e3307
commit 26b5fd7ac4
12 changed files with 66 additions and 165 deletions

View File

@ -43,15 +43,8 @@ public class Armor extends EquipableItem {
private static final int HITS_TO_KNOW = 10;
private static final String TXT_EQUIP_CURSED = "your %s constricts around you painfully";
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_TO_STRING = "%s :%d";
private static final String TXT_INCOMPATIBLE =
"Interaction of different types of magic has erased the glyph on this armor!";
public int tier;
public int STR;
@ -104,7 +97,7 @@ public class Armor extends EquipableItem {
cursedKnown = true;
if (cursed) {
equipCursed( hero );
GLog.n( TXT_EQUIP_CURSED, toString() );
GLog.n( Messages.get(Armor.class, "equip_cursed", toString()) );
}
((HeroSprite)hero.sprite).updateArmor();
@ -159,7 +152,7 @@ public class Armor extends EquipableItem {
if (glyph != null) {
if (!inscribe && Random.Int( level() ) > 0) {
GLog.w( TXT_INCOMPATIBLE );
GLog.w( Messages.get(Armor.class, "incompatible") );
inscribe( null );
}
} else {
@ -189,7 +182,7 @@ public class Armor extends EquipableItem {
if (!levelKnown) {
if (--hitsToKnow <= 0) {
levelKnown = true;
GLog.w( TXT_IDENTIFY, name(), toString() );
GLog.w( Messages.get(Armor.class, "identify", name(), toString()) );
Badges.validateItemLevelAquired( this );
}
}
@ -210,49 +203,33 @@ public class Armor extends EquipableItem {
@Override
public String info() {
String name = name();
StringBuilder info = new StringBuilder( desc() );
String info = desc();
if (levelKnown) {
info.append(
"\n\nThis " + name + " provides damage absorption up to " +
"" + Math.max( DR(), 0 ) + " points per attack. " );
info += Messages.get(Armor.class, "curr_absorb", name, Math.max( DR(), 0 ));
if (STR > Dungeon.hero.STR()) {
if (isEquipped( Dungeon.hero )) {
info.append(
"\n\nBecause of your inadequate strength your " +
"movement speed and defense skill is decreased. " );
} else {
info.append(
"\n\nBecause of your inadequate strength wearing this armor " +
"will decrease your movement speed and defense skill. " );
}
info += Messages.get(Armor.class, "too_heavy");
}
} else {
info.append(
"\n\nTypical " + name + " provides damage absorption up to " + typicalDR() + " points per attack " +
" and requires " + typicalSTR() + " points of strength. " );
info += Messages.get(Armor.class, "avg_absorb", name, typicalDR(), typicalSTR());
if (typicalSTR() > Dungeon.hero.STR()) {
info.append( "Probably this armor is too heavy for you. " );
info += Messages.get(Armor.class, "probably_too_heavy");
}
}
if (glyph != null) {
info.append( "It is inscribed." );
info += Messages.get(Armor.class, "inscribed", glyph.name());
}
if (isEquipped( Dungeon.hero )) {
info.append( "\n\nYou are wearing the " + name +
(cursed ? ", and because it is cursed, you are powerless to remove it." : ".") );
} else {
if (cursedKnown && cursed) {
info.append( "\n\nYou can feel a malevolent magic lurking within the " + name + "." );
}
if (cursed && isEquipped( Dungeon.hero )) {
info += Messages.get(Armor.class, "cursed_word");
} else if (cursedKnown && cursed) {
info += Messages.get(Armor.class, "cursed");
}
return info.toString();
return info;
}
@Override

View File

@ -22,6 +22,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.armor;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.utils.Bundle;
@ -104,9 +105,9 @@ abstract public class ClassArmor extends Armor {
if (action == special()) {
if (hero.HP < 3) {
GLog.w( TXT_LOW_HEALTH );
GLog.w( Messages.get(this, "low_hp") );
} else if (!isEquipped( hero )) {
GLog.w( TXT_NOT_EQUIPPED );
GLog.w( Messages.get(this, "not_equipped") );
} else {
curUser = hero;
Invisibility.dispel();
@ -141,8 +142,4 @@ abstract public class ClassArmor extends Armor {
return 0;
}
@Override
public String desc() {
return "The thing looks awesome!";
}
}

View File

@ -34,8 +34,4 @@ public class ClothArmor extends Armor {
super( 1 );
}
@Override
public String desc() {
return "This lightweight armor offers basic protection.";
}
}

View File

@ -29,6 +29,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Shuriken;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.sprites.MissileSprite;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
@ -36,9 +37,6 @@ import com.watabou.utils.Callback;
public class HuntressArmor extends ClassArmor {
private static final String TXT_NO_ENEMIES = "No enemies in sight";
private static final String TXT_NOT_HUNTRESS = "Only huntresses can use this armor!";
private static final String AC_SPECIAL = "SPECTRAL BLADES";
{
@ -79,7 +77,7 @@ public class HuntressArmor extends ClassArmor {
}
if (targets.size() == 0) {
GLog.w( TXT_NO_ENEMIES );
GLog.w( Messages.get(this, "no_enemies") );
return;
}
@ -89,21 +87,4 @@ public class HuntressArmor extends ClassArmor {
curUser.busy();
}
@Override
public boolean doEquip( Hero hero ) {
if (hero.heroClass == HeroClass.HUNTRESS) {
return super.doEquip( hero );
} else {
GLog.w( TXT_NOT_HUNTRESS );
return false;
}
}
@Override
public String desc() {
return
"A huntress in such cloak can create a fan of spectral blades. Each of these blades " +
"will target a single enemy in the huntress's field of view, inflicting damage depending " +
"on her currently equipped melee weapon.";
}
}

View File

@ -32,8 +32,4 @@ public class LeatherArmor extends Armor {
super( 2 );
}
@Override
public String desc() {
return "Armor made from tanned monster hide. Not as light as cloth armor but provides better protection.";
}
}

View File

@ -39,8 +39,6 @@ public class MageArmor extends ClassArmor {
private static final String AC_SPECIAL = "MOLTEN EARTH";
private static final String TXT_NOT_MAGE = "Only mages can use this armor!";
{
image = ItemSpriteSheet.ARMOR_MAGE;
}
@ -50,13 +48,6 @@ public class MageArmor extends ClassArmor {
return AC_SPECIAL;
}
@Override
public String desc() {
return
"Wearing this gorgeous robe, a mage can cast a spell of molten earth: all the enemies " +
"in his field of view will be set on fire and unable to move at the same time.";
}
@Override
public void doSpecial() {
@ -77,13 +68,4 @@ public class MageArmor extends ClassArmor {
Sample.INSTANCE.play( Assets.SND_READ );
}
@Override
public boolean doEquip( Hero hero ) {
if (hero.heroClass == HeroClass.MAGE) {
return super.doEquip( hero );
} else {
GLog.w( TXT_NOT_MAGE );
return false;
}
}
}

View File

@ -32,9 +32,4 @@ public class MailArmor extends Armor {
super( 3 );
}
@Override
public String desc() {
return
"Interlocking metal links make for a tough but flexible suit of armor.";
}
}

View File

@ -32,10 +32,4 @@ public class PlateArmor extends Armor {
super( 5 );
}
@Override
public String desc() {
return
"Enormous plates of metal are joined together into a suit that provides " +
"unmatched protection to any adventurer strong enough to bear its staggering weight.";
}
}

View File

@ -21,6 +21,7 @@
package com.shatteredpixel.shatteredpixeldungeon.items.armor;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.watabou.noosa.audio.Sample;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
@ -40,9 +41,6 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
public class RogueArmor extends ClassArmor {
private static final String TXT_FOV = "You can only jump to an empty location in your field of view";
private static final String TXT_NOT_ROGUE = "Only rogues can use this armor!";
private static final String AC_SPECIAL = "SMOKE BOMB";
{
@ -59,23 +57,6 @@ public class RogueArmor extends ClassArmor {
GameScene.selectCell( teleporter );
}
@Override
public boolean doEquip( Hero hero ) {
if (hero.heroClass == HeroClass.ROGUE) {
return super.doEquip( hero );
} else {
GLog.w( TXT_NOT_ROGUE );
return false;
}
}
@Override
public String desc() {
return
"Wearing this dark garb, a rogue can perform a trick, that is called \"smoke bomb\" " +
"(though no real explosives are used): he blinds enemies who could see him and jumps aside.";
}
protected static CellSelector.Listener teleporter = new CellSelector.Listener() {
@Override
@ -86,7 +67,7 @@ public class RogueArmor extends ClassArmor {
!(Level.passable[target] || Level.avoid[target]) ||
Actor.findChar( target ) != null) {
GLog.w( TXT_FOV );
GLog.w( Messages.get(RogueArmor.class, "fov") );
return;
}
@ -112,7 +93,7 @@ public class RogueArmor extends ClassArmor {
@Override
public String prompt() {
return "Choose a location to jump to";
return Messages.get(RogueArmor.class, "prompt");
}
};
}

View File

@ -32,9 +32,4 @@ public class ScaleArmor extends Armor {
super( 4 );
}
@Override
public String desc() {
return
"The metal scales sewn onto a leather vest create a flexible, yet protective armor.";
}
}

View File

@ -20,6 +20,7 @@
*/
package com.shatteredpixel.shatteredpixeldungeon.items.armor;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.watabou.noosa.Camera;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
@ -46,8 +47,6 @@ public class WarriorArmor extends ClassArmor {
private static final String AC_SPECIAL = "HEROIC LEAP";
private static final String TXT_NOT_WARRIOR = "Only warriors can use this armor!";
{
image = ItemSpriteSheet.ARMOR_WARRIOR;
}
@ -62,23 +61,6 @@ public class WarriorArmor extends ClassArmor {
GameScene.selectCell( leaper );
}
@Override
public boolean doEquip( Hero hero ) {
if (hero.heroClass == HeroClass.WARRIOR) {
return super.doEquip( hero );
} else {
GLog.w( TXT_NOT_WARRIOR );
return false;
}
}
@Override
public String desc() {
return
"While this armor looks heavy, it allows a warrior to perform heroic leap towards " +
"a targeted location, slamming down to stun all neighbouring enemies.";
}
protected static CellSelector.Listener leaper = new CellSelector.Listener() {
@Override
@ -127,7 +109,7 @@ public class WarriorArmor extends ClassArmor {
@Override
public String prompt() {
return "Choose direction to leap";
return Messages.get(WarriorArmor.class, "prompt");
}
};
}

View File

@ -412,17 +412,42 @@ items.armor.glyphs.viscosity.deferred=deferred %d
items.armor.glyphs.viscosity$defereddamage.name=Deferred damage
items.armor.glyphs.viscosity$defereddamage.desc=While your armor's glyph has protected you from damage, it seems to be slowly paying you back for it.\n\nDamage is being dealt to you over time instead of immediately. You will take one damage per turn until there is no damage left.\n\nThere is %d deferred damage left.
items.armor.clotharmor.name=cloth armor
items.armor.huntressarmor.name=huntress cloak
items.armor.leatherarmor.name=leather armor
items.armor.magearmor.name=mage robe
items.armor.mailarmor.name=mail armor
items.armor.platearmor.name=plate armor
items.armor.roguearmor.name=rogue garb
items.armor.scalearmor.name=scale armor
items.armor.warriorarmor.name=warrior suit of armor
items.armor.armor.equip_cursed=your %s constricts around you painfully
items.armor.armor.identify=you are now familiar enough with your %s to identify it. It is %s.
items.armor.armor.incompatible=Interaction of different types of magic has erased the glyph on this armor!
items.armor.armor.curr_absorb=\n\nThis %s provides damage absorption up to %s points per attack.
items.armor.armor.avg_absorb=\n\nTypical %s provides damage absorption up to %d points per attack and requires %d points of strength.
items.armor.armor.too_heavy=\n\nBecause of your inadequate strength wearing this armor will decrease your movement speed and defense skill.
items.armor.armor.probably_too_heavy=\n\nProbably this armor is too heavy for you.
items.armor.armor.inscribed=\n\nIt is inscribed with a %s.
items.armor.armor.cursed_word=\n\nBecause this armor is cursed, you are powerless to remove it.
items.armor.armor.cursed=\n\nYou can feel a malevolent magic lurking within this armor.
items.armor.armor$glyph.glyph=glyph
items.armor.armor$glyph.killed=%s killed you...
items.armor.classarmor.low_hp=Your health is too low!
items.armor.classarmor.not_equipped=You need to be wearing this armor to use its special power!
items.armor.clotharmor.name=cloth armor
items.armor.clotharmor.desc=This lightweight armor offers basic protection.
items.armor.huntressarmor.name=huntress cloak
items.armor.huntressarmor.no_enemies=No enemies in sight
items.armor.huntressarmor.desc=A huntress in such cloak can create a fan of spectral blades. Each of these blades will target a single enemy in the huntress's field of view, inflicting damage depending on her currently equipped melee weapon.
items.armor.leatherarmor.name=leather armor
items.armor.leatherarmor.desc=Armor made from tanned monster hide. Not as light as cloth armor but provides better protection.
items.armor.magearmor.name=mage robe
items.armor.magearmor.desc=Wearing this gorgeous robe, a mage can cast a spell of molten earth: all the enemies in his field of view will be set on fire and unable to move at the same time.
items.armor.mailarmor.name=mail armor
items.armor.mailarmor.desc=Interlocking metal links make for a tough but flexible suit of armor.
items.armor.platearmor.name=plate armor
items.armor.platearmor.desc=Enormous plates of metal are joined together into a suit that provides unmatched protection to any adventurer strong enough to bear its staggering weight.
items.armor.roguearmor.name=rogue garb
items.armor.roguearmor.fov=You can only jump to an empty location in your field of view
items.armor.roguearmor.prompt=Choose a location to jump to
items.armor.roguearmor.desc=Wearing this dark garb, a rogue can perform a trick, that is called "smoke bomb": he blinds enemies who could see him and jumps aside.
items.armor.scalearmor.name=scale armor
items.armor.scalearmor.desc=The metal scales sewn onto a leather vest create a flexible, yet protective armor.
items.armor.warriorarmor.name=warrior suit of armor
items.armor.warriorarmor.prompt=Choose direction to leap
items.armor.warriorarmor.desc=While this armor looks heavy, it allows a warrior to perform heroic leap towards a targeted location, slamming down to stun all neighbouring enemies.
items.artifacts.alchemiststoolkit.name=alchemists toolkit
items.artifacts.capeofthorns.name=cape of Thorns