v0.3.4: i18n begins! Only changes to actors\hero right now
This commit is contained in:
parent
9eb8759fe1
commit
18bcdd42cb
|
@ -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";
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Pixel Dungeon
|
||||
* Copyright (C) 2012-2015 Oleg Dolya
|
||||
*
|
||||
* Shattered Pixel Dungeon
|
||||
* Copyright (C) 2014-2015 Evan Debenham
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.messages;
|
||||
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
public class Messages {
|
||||
|
||||
private static ResourceBundle strings =
|
||||
ResourceBundle.getBundle("com.shatteredpixel.shatteredpixeldungeon.messages.messages");
|
||||
|
||||
public static String get(String key){
|
||||
return get(null, key);
|
||||
}
|
||||
|
||||
//stuffing static variables with results from this means the app needs to restart for locale changes to take effect.
|
||||
//so be careful with where you're calling this, never assign its result to a static value (including enum variables)
|
||||
public static String get(Object o, String k){
|
||||
return get(o.getClass(), k);
|
||||
}
|
||||
|
||||
public static String get(Class c, String k){
|
||||
String key;
|
||||
if (c != null){
|
||||
key = c.getName().replace("com.shatteredpixel.shatteredpixeldungeon.", "");
|
||||
key += "." + k;
|
||||
} else
|
||||
key = k;
|
||||
return strings.getString(key.toLowerCase());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
actors.hero.hero.leave=One does not simply leave Pixel Dungeon.
|
||||
actors.hero.hero.level_up=level up!
|
||||
actors.hero.hero.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.
|
||||
actors.hero.hero.level_cap=You cannot grow stronger, but your experiences do give you a surge of power!
|
||||
actors.hero.hero.you_now_have=You now have %s
|
||||
actors.hero.hero.something_else=There is something else here
|
||||
actors.hero.hero.locked_chest=This chest is locked and you don't have matching key
|
||||
actors.hero.hero.locked_door=You don't have a matching key
|
||||
actors.hero.hero.noticed_smth=You noticed something
|
||||
actors.hero.hero.wait=...
|
||||
actors.hero.hero.search=search
|
||||
actors.hero.hero.search_distracted=You can't concentrate, searching takes a while
|
||||
actors.hero.hero.pain_resist=The pain helps you resist the urge to sleep
|
||||
|
||||
actors.hero.heroclass.warrior=warrior
|
||||
actors.hero.heroclass.warrior_perk1=The Warrior starts with 11 points of Strength.
|
||||
actors.hero.heroclass.warrior_perk2=The Warrior starts with a unique short sword. This sword can later be "reforged" to upgrade another melee weapon.
|
||||
actors.hero.heroclass.warrior_perk3=The Warrior is less proficient with missile weapons.
|
||||
actors.hero.heroclass.warrior_perk4=Any piece of food restores some health when eaten.
|
||||
actors.hero.heroclass.warrior_perk5=Potions of Strength are identified from the beginning.
|
||||
|
||||
actors.hero.heroclass.mage=mage
|
||||
actors.hero.heroclass.mage_perk1=The Mage starts with a unique Staff, which can be imbued with the properties of a wand.
|
||||
actors.hero.heroclass.mage_perk2=The Mage's staff can be used as a melee weapon or a more powerful wand.
|
||||
actors.hero.heroclass.mage_perk3=The Mage partially identifies wands after using them.
|
||||
actors.hero.heroclass.mage_perk4=When eaten, any piece of food restores 1 charge for all wands in the inventory.
|
||||
actors.hero.heroclass.mage_perk5=Scrolls of Upgrade are identified from the beginning.
|
||||
|
||||
actors.hero.heroclass.rogue=rogue
|
||||
actors.hero.heroclass.rogue_perk1=The Rogue starts with a unique Cloak of Shadows.
|
||||
actors.hero.heroclass.rogue_perk2=The Rogue identifies a type of a ring on equipping it.
|
||||
actors.hero.heroclass.rogue_perk3=The Rogue is proficient with light armor, dodging better with excess strength.
|
||||
actors.hero.heroclass.rogue_perk4=The Rogue is more proficient in detecting hidden doors and traps.
|
||||
actors.hero.heroclass.rogue_perk5=The Rogue can go without food longer.
|
||||
actors.hero.heroclass.rogue_perk6=Scrolls of Magic Mapping are identified from the beginning.
|
||||
|
||||
actors.hero.heroclass.huntress=huntress
|
||||
actors.hero.heroclass.huntress_perk1=The Huntress starts with a unique upgradeable boomerang.
|
||||
actors.hero.heroclass.huntress_perk2=The Huntress is proficient with missile weapons, getting bonus damage from excess strength.
|
||||
actors.hero.heroclass.huntress_perk3=The Huntress is able to recover a single used missile weapon from each enemy.
|
||||
actors.hero.heroclass.huntress_perk4=The Huntress senses neighbouring monsters even if they are hidden behind obstacles.
|
||||
actors.hero.heroclass.huntress_perk5=Potions of Mind Vision are identified from the beginning.
|
||||
|
||||
actors.hero.herosubclass.gladiator=gladiator
|
||||
actors.hero.herosubclass.gladiator_desc=A successful attack with a melee weapon allows the _Gladiator_ to start a combo, in which every next successful hit inflicts more damage.
|
||||
actors.hero.herosubclass.berserker=berserker
|
||||
actors.hero.herosubclass.berserker_desc=When severely wounded, the _Berserker_ enters a state of wild fury significantly increasing his damage output.
|
||||
actors.hero.herosubclass.warlock=warlock
|
||||
actors.hero.herosubclass.warlock_desc=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.
|
||||
actors.hero.herosubclass.battlemage=battlemage
|
||||
actors.hero.herosubclass.battlemage_desc=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.
|
||||
actors.hero.herosubclass.assassin=assassin
|
||||
actors.hero.herosubclass.assassin_desc=When performing a surprise attack, the _Assassin_ inflicts additional damage to his target.
|
||||
actors.hero.herosubclass.freerunner=freerunner
|
||||
actors.hero.herosubclass.freerunner_desc=The _Freerunner_ moves faster when he unencumbered and not starving, if he is invisible, this speed boost is increased.
|
||||
actors.hero.herosubclass.sniper=sniper
|
||||
actors.hero.herosubclass.sniper_desc=The _Sniper_ is able to detect weak points in an enemy's armor, effectively ignoring it when using a missile weapon.
|
||||
actors.hero.herosubclass.warden=warden
|
||||
actors.hero.herosubclass.warden_desc=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.
|
||||
|
||||
items.bags.bag.name=backpack
|
Loading…
Reference in New Issue
Block a user