v0.3.4: i18n begins! Only changes to actors\hero right now

This commit is contained in:
Evan Debenham
2015-12-27 05:51:50 -05:00
committed by Evan Debenham
parent 9eb8759fe1
commit 18bcdd42cb
6 changed files with 174 additions and 86 deletions
@@ -33,6 +33,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey;
import com.shatteredpixel.shatteredpixeldungeon.items.keys.Key;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRemoveCurse;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.watabou.utils.Bundle;
import com.watabou.utils.Random;
@@ -53,7 +54,7 @@ public class Belongings implements Iterable<Item> {
this.owner = owner;
backpack = new Bag() {{
name = "backpack";
name = Messages.get(Bag.class, "name");
size = BACKPACK_SIZE;
}};
backpack.owner = owner;
@@ -94,6 +94,7 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.levels.features.AlchemyPot;
import com.shatteredpixel.shatteredpixeldungeon.levels.features.Chasm;
import com.shatteredpixel.shatteredpixeldungeon.levels.features.Sign;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.plants.Earthroot;
import com.shatteredpixel.shatteredpixeldungeon.plants.Sungrass;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
@@ -124,26 +125,11 @@ public class Hero extends Char {
actPriority = 0; //acts at priority 0, baseline for the rest of behaviour.
}
private static final String TXT_LEAVE = "One does not simply leave Pixel Dungeon.";
public static final int MAX_LEVEL = 30;
private static final String TXT_LEVEL_UP = "level up!";
private static final String TXT_NEW_LEVEL =
"Welcome to level %d! Now you are healthier and more focused. " +
"It's easier for you to hit enemies and dodge their attacks.";
private static final String TXT_LEVEL_CAP =
"You can't gain any more levels, but your experiences still give you a burst of energy!";
public static final String TXT_YOU_NOW_HAVE = "You now have %s";
private static final String TXT_SOMETHING_ELSE = "There is something else here";
private static final String TXT_LOCKED_CHEST = "This chest is locked and you don't have matching key";
private static final String TXT_LOCKED_DOOR = "You don't have a matching key";
private static final String TXT_NOTICED_SMTH = "You noticed something";
private static final String TXT_WAIT = "...";
private static final String TXT_SEARCH = "search";
//TODO: remove this static variable
public static final String TXT_YOU_NOW_HAVE = Messages.get(Hero.class, "you_now_have");
public static final int STARTING_STR = 10;
private static final float TIME_TO_REST = 1f;
@@ -636,7 +622,7 @@ public class Hero extends Char {
}
if (!heap.isEmpty()) {
GLog.i( TXT_SOMETHING_ELSE );
GLog.i( Messages.get(this, "something_else") );
}
curAction = null;
} else {
@@ -673,7 +659,7 @@ public class Hero extends Char {
theKey = belongings.getKey( GoldenKey.class, Dungeon.depth );
if (theKey == null) {
GLog.w( TXT_LOCKED_CHEST );
GLog.w( Messages.get(this, "locked_chest") );
ready();
return false;
}
@@ -735,7 +721,7 @@ public class Hero extends Char {
Sample.INSTANCE.play( Assets.SND_UNLOCK );
} else {
GLog.w( TXT_LOCKED_DOOR );
GLog.w( Messages.get(this, "locked_door") );
ready();
}
@@ -785,7 +771,7 @@ public class Hero extends Char {
if (Dungeon.depth == 1) {
if (belongings.getItem( Amulet.class ) == null) {
GameScene.show( new WndMessage( TXT_LEAVE ) );
GameScene.show( new WndMessage( Messages.get(this, "leave") ) );
ready();
} else {
Dungeon.win( ResultDescriptions.WIN );
@@ -852,7 +838,7 @@ public class Hero extends Char {
public void rest( boolean fullRest ) {
spendAndNext( TIME_TO_REST );
if (!fullRest) {
sprite.showStatus( CharSprite.DEFAULT, TXT_WAIT );
sprite.showStatus( CharSprite.DEFAULT, Messages.get(this, "wait") );
}
resting = fullRest;
}
@@ -913,7 +899,7 @@ public class Hero extends Char {
if (this.buff(Drowsy.class) != null){
Buff.detach(this, Drowsy.class);
GLog.w("The pain helps you resist the urge to sleep.");
GLog.w( Messages.get(this, "pain_resist") );
}
CapeOfThorns.Thorns thorns = buff( CapeOfThorns.Thorns.class );
@@ -1122,7 +1108,7 @@ public class Hero extends Char {
Buff.prolong(this, Bless.class, 30f);
this.exp = 0;
GLog.p( "You cannot grow stronger, but your experiences do give you a surge of power!");
GLog.p( Messages.get(this, "level_cap"));
Sample.INSTANCE.play( Assets.SND_LEVELUP );
}
@@ -1133,8 +1119,8 @@ public class Hero extends Char {
if (levelUp) {
GLog.p( TXT_NEW_LEVEL, lvl );
sprite.showStatus( CharSprite.POSITIVE, TXT_LEVEL_UP );
GLog.p( Messages.get(this, "new_level"), lvl );
sprite.showStatus( CharSprite.POSITIVE, Messages.get(Hero.class, "level_up") );
Sample.INSTANCE.play( Assets.SND_LEVELUP );
Badges.validateLevelReached();
@@ -1164,6 +1150,7 @@ public class Hero extends Char {
super.add( buff );
//TODO: need to do something with these so they can be i18n-ified
if (sprite != null) {
if (buff instanceof Burning) {
GLog.w( "You catch fire!" );
@@ -1475,10 +1462,10 @@ public class Hero extends Char {
if (intentional) {
sprite.showStatus( CharSprite.DEFAULT, TXT_SEARCH );
sprite.showStatus( CharSprite.DEFAULT, Messages.get(this, "search") );
sprite.operate( pos );
if (foresight != null && foresight.isCursed()){
GLog.n("You can't concentrate, searching takes a while.");
GLog.n(Messages.get(this, "search_distracted"));
spendAndNext(TIME_TO_SEARCH * 3);
} else {
spendAndNext(TIME_TO_SEARCH);
@@ -1487,7 +1474,7 @@ public class Hero extends Char {
}
if (smthFound) {
GLog.w( TXT_NOTICED_SMTH );
GLog.w( Messages.get(this, "noticed_smth") );
Sample.INSTANCE.play( Assets.SND_SECRET );
interrupt();
}
@@ -25,6 +25,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Challenges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClothArmor;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.CloakOfShadows;
import com.shatteredpixel.shatteredpixeldungeon.items.food.Food;
@@ -42,45 +43,49 @@ import com.watabou.utils.Bundle;
public enum HeroClass {
WARRIOR( "warrior" ), MAGE( "mage" ), ROGUE( "rogue" ), HUNTRESS( "huntress" );
WARRIOR( "warrior" ),
MAGE( "mage" ),
ROGUE( "rogue" ),
HUNTRESS( "huntress" );
private String title;
private HeroClass( String title ) {
HeroClass( String title ) {
this.title = title;
}
//TODO: need to make all these Messages references non-static
public static final String[] WAR_PERKS = {
"The Warrior starts with 11 points of Strength.",
"The Warrior starts with a unique short sword. This sword can be later \"reforged\" to upgrade another melee weapon.",
"The Warrior is less proficient with missile weapons.",
"Any piece of food restores some health when eaten.",
"Potions of Strength are identified from the beginning.",
Messages.get(HeroClass.class, "warrior_perk1"),
Messages.get(HeroClass.class, "warrior_perk2"),
Messages.get(HeroClass.class, "warrior_perk3"),
Messages.get(HeroClass.class, "warrior_perk4"),
Messages.get(HeroClass.class, "warrior_perk5"),
};
public static final String[] MAG_PERKS = {
"The Mage starts with a unique Staff, which can be imbued with the properties of a wand.",
"The Mage's staff can be used as a melee weapon or a more powerful wand.",
"The Mage partially identifies wands after using them.",
"When eaten, any piece of food restores 1 charge for all wands in the inventory.",
"Scrolls of Upgrade are identified from the beginning."
Messages.get(HeroClass.class, "mage_perk1"),
Messages.get(HeroClass.class, "mage_perk2"),
Messages.get(HeroClass.class, "mage_perk3"),
Messages.get(HeroClass.class, "mage_perk4"),
Messages.get(HeroClass.class, "mage_perk5"),
};
public static final String[] ROG_PERKS = {
"The Rogue starts with a unique Cloak of Shadows.",
"The Rogue identifies a type of a ring on equipping it.",
"The Rogue is proficient with light armor, dodging better with excess strength.",
"The Rogue is more proficient in detecting hidden doors and traps.",
"The Rogue can go without food longer.",
"Scrolls of Magic Mapping are identified from the beginning."
Messages.get(HeroClass.class, "rogue_perk1"),
Messages.get(HeroClass.class, "rogue_perk2"),
Messages.get(HeroClass.class, "rogue_perk3"),
Messages.get(HeroClass.class, "rogue_perk4"),
Messages.get(HeroClass.class, "rogue_perk5"),
Messages.get(HeroClass.class, "rogue_perk6"),
};
public static final String[] HUN_PERKS = {
"The Huntress starts with a unique upgradeable boomerang.",
"The Huntress is proficient with missile weapons, getting bonus damage from excess strength.",
"The Huntress is able to recover a single used missile weapon from each enemy.",
"The Huntress senses neighbouring monsters even if they are hidden behind obstacles.",
"Potions of Mind Vision are identified from the beginning."
Messages.get(HeroClass.class, "huntress_perk1"),
Messages.get(HeroClass.class, "huntress_perk2"),
Messages.get(HeroClass.class, "huntress_perk3"),
Messages.get(HeroClass.class, "huntress_perk4"),
Messages.get(HeroClass.class, "huntress_perk5"),
};
public void initHero( Hero hero ) {
@@ -183,7 +188,7 @@ public enum HeroClass {
}
public String title() {
return title;
return Messages.get(HeroClass.class, title);
}
public String spritesheet() {
@@ -20,53 +20,37 @@
*/
package com.shatteredpixel.shatteredpixeldungeon.actors.hero;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.watabou.utils.Bundle;
public enum HeroSubClass {
NONE( "none", null ),
NONE( null ),
GLADIATOR( "gladiator",
"A successful attack with a melee weapon allows the _Gladiator_ to start a combo, " +
"in which every next successful hit inflicts more damage." ),
BERSERKER( "berserker",
"When severely wounded, the _Berserker_ enters a state of wild fury " +
"significantly increasing his damage output." ),
GLADIATOR( "gladiator" ),
BERSERKER( "berserker" ),
WARLOCK( "warlock",
"When using wands on an enemy, the _Warlock_ has a chance to mark their soul. " +
"Marked enemies will heal him and restore his hunger whenever they take physical damage."),
BATTLEMAGE( "battlemage",
"When fighting with his staff, the _Battlemage_ conjures bonus effects depending on the wand " +
"his staff is imbued with. His staff will also gain charge through combat." ),
WARLOCK( "warlock" ),
BATTLEMAGE( "battlemage" ),
ASSASSIN( "assassin",
"When performing a surprise attack, the _Assassin_ inflicts additional damage to his target." ),
FREERUNNER( "freerunner",
"The _Freerunner_ moves faster when he unencumbered and not starving, " +
"if he is invisible, this speed boost is increased." ),
ASSASSIN( "assassin" ),
FREERUNNER( "freerunner" ),
SNIPER( "sniper",
"The _Sniper_ is able to detect weak points in an enemy's armor, " +
"effectively ignoring it when using a missile weapon." ),
WARDEN( "warden",
"Having a strong connection with forces of nature allows the _Warden_ to gain additional health from dew, " +
"armor from trampling grass, and seeds and dew from plants." );
SNIPER( "sniper" ),
WARDEN( "warden" );
private String title;
private String desc;
private HeroSubClass( String title, String desc ) {
HeroSubClass( String title ) {
this.title = title;
this.desc = desc;
}
public String title() {
return title;
return Messages.get(this, title);
}
public String desc() {
return desc;
return Messages.get(this, title+"_desc");
}
private static final String SUBCLASS = "subClass";