Skip to content

Commit

Permalink
#43: Localized WndGame and HeroClass (perks)
Browse files Browse the repository at this point in the history
  • Loading branch information
Arcnor committed Oct 14, 2014
1 parent 77b7802 commit a1d98f1
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 64 deletions.
38 changes: 37 additions & 1 deletion android/assets/i18n/l10n.properties
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ hero_buff_roots = You can't move!
hero_buff_weakness = You feel weakened!
hero_buff_blindness = You are blinded!
hero_buff_fury = You become furious!
hero_buff_fury_status = furious
hero_buff_charm = You are charmed!
hero_buff_cripple = You are crippled!
hero_buff_bleeding = You are bleeding!
Expand Down Expand Up @@ -250,10 +251,45 @@ blog_fire_desc = A fire is raging here.
blob_foliage_desc = Shafts of light pierce the gloom of the underground garden.
blob_paralytic_gas_desc = A cloud of paralytic gas is swirling here.
blob_toxic_gas_desc = A greenish cloud of toxic gas is swirling here.
blob_toxic_gas_death = You died from a toxic gas..
blob_water_aware_desc = Power of knowledge radiates from the water of this well. Take a sip from it to reveal all secrets of equipped items.
blob_water_aware_proceed = As you take a sip, you feel the knowledge pours into your mind. \
Now you know everything about your equipped items. Also you sense all items on the level and know all its secrets.
blob_water_health_desc = Power of health radiates from the water of this well. Take a sip from it to heal your wounds and satisfy hunger.
blob_water_health_proceed = As you take a sip, you feel your wounds heal completely.
blob_water_transmute_desc = Power of change radiates from the water of this well. Throw an item into the well to turn it into something else.
blob_web_desc = Everything is covered with a thick web here.
blob_web_desc = Everything is covered with a thick web here.

# Perks
perk_war_0 = Warriors start with 11 points of Strength.
perk_war_1 = Warriors start with a unique short sword. This sword can be later "reforged" to upgrade another melee weapon.
perk_war_2 = Warriors are less proficient with missile weapons.
perk_war_3 = Any piece of food restores some health when eaten.
perk_war_4 = Potions of Strength are identified from the beginning.

perk_mag_0 = Mages start with a unique Wand of Magic Missile. This wand can be later "disenchanted" to upgrade another wand.
perk_mag_1 = Mages recharge their wands faster.
perk_mag_2 = When eaten, any piece of food restores 1 charge for all wands in the inventory.
perk_mag_3 = Mages can use wands as a melee weapon.
perk_mag_4 = Scrolls of Identify are identified from the beginning.

perk_rog_0 = Rogues start with a Ring of Shadows+1.
perk_rog_1 = Rogues identify a type of a ring on equipping it.
perk_rog_2 = Rogues are proficient with light armor, dodging better while wearing one.
perk_rog_3 = Rogues are proficient in detecting hidden doors and traps.
perk_rog_4 = Rogues can go without food longer.
perk_rog_5 = Scrolls of Magic Mapping are identified from the beginning.

perk_hun_0 = Huntresses start with 15 points of Health.
perk_hun_1 = Huntresses start with a unique upgradeable boomerang.
perk_hun_2 = Huntresses are proficient with missile weapons and get damage bonus for excessive strength when using them.
perk_hun_3 = Huntresses gain more health from dewdrops.
perk_hun_4 = Huntresses sense neighbouring monsters even if they are hidden behind obstacles.

# WndGame
wgame_settings = Settings
wgame_rankings = Rankings
wgame_start = Start New Game
wgame_menu = Main Menu
wgame_exit = Exit Pixel Dungeon
wgame_return = Return to Game
3 changes: 2 additions & 1 deletion core/src/com/watabou/pixeldungeon/actors/blobs/ToxicGas.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
public class ToxicGas extends Blob implements Hero.Doom {

private static final String TXT_DESC = "blob_toxic_gas_desc";
private static final String TXT_DEATH = "blob_toxic_gas_death";

@Override
protected void evolve() {
Expand Down Expand Up @@ -92,6 +93,6 @@ public void onDeath() {
Badges.validateDeathFromGas();

Dungeon.fail( tr(ResultDescriptions.GAS, Dungeon.depth) );
GLog.n( "You died from a toxic gas.." );
GLog.n(tr(TXT_DEATH));
}
}
3 changes: 2 additions & 1 deletion core/src/com/watabou/pixeldungeon/actors/hero/Hero.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ public class Hero extends Char {
private static final String TXT_BUFF_WEAKNESS = "hero_buff_weakness";
private static final String TXT_BUFF_BLINDNESS = "hero_buff_blindness";
private static final String TXT_BUFF_FURY = "hero_buff_fury";
private static final String TXT_BUFF_FURY_STATUS = "hero_buff_fury_status";
private static final String TXT_BUFF_CHARM = "hero_buff_charm";
private static final String TXT_BUFF_CRIPPLE = "hero_buff_cripple";
private static final String TXT_BUFF_BLEEDING = "hero_buff_bleeding";
Expand Down Expand Up @@ -1058,7 +1059,7 @@ public void add( Buff buff ) {
GLog.w(tr(TXT_BUFF_BLINDNESS));
} else if (buff instanceof Fury) {
GLog.w(tr(TXT_BUFF_FURY));
sprite.showStatus( CharSprite.POSITIVE, "furious" );
sprite.showStatus( CharSprite.POSITIVE, tr(TXT_BUFF_FURY_STATUS));
} else if (buff instanceof Charm) {
GLog.w(tr(TXT_BUFF_CHARM));
} else if (buff instanceof Cripple) {
Expand Down
65 changes: 16 additions & 49 deletions core/src/com/watabou/pixeldungeon/actors/hero/HeroClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,49 +35,22 @@
import com.watabou.pixeldungeon.items.weapon.missiles.Boomerang;
import com.watabou.utils.Bundle;

import static com.watabou.noosa.NoosaI18N.tr;

public enum HeroClass {

WARRIOR( "warrior" ), MAGE( "mage" ), ROGUE( "rogue" ), HUNTRESS( "huntress" );

private String title;
WARRIOR( "warrior", "war", 5 ), MAGE( "mage", "mag", 5), ROGUE( "rogue", "rog", 6), HUNTRESS( "huntress", "hun", 5);

private HeroClass( String title ) {
private final String title;
private final String i18nPrefix;
private final int numI18nStrings;

private HeroClass(String title, String i18nPrefix, int numI18nStrings) {
this.title = title;
this.i18nPrefix = i18nPrefix;
this.numI18nStrings = numI18nStrings;
}

public static final String[] WAR_PERKS = {
"Warriors start with 11 points of Strength.",
"Warriors start with a unique short sword. This sword can be later \"reforged\" to upgrade another melee weapon.",
"Warriors are less proficient with missile weapons.",
"Any piece of food restores some health when eaten.",
"Potions of Strength are identified from the beginning.",
};

public static final String[] MAG_PERKS = {
"Mages start with a unique Wand of Magic Missile. This wand can be later \"disenchanted\" to upgrade another wand.",
"Mages recharge their wands faster.",
"When eaten, any piece of food restores 1 charge for all wands in the inventory.",
"Mages can use wands as a melee weapon.",
"Scrolls of Identify are identified from the beginning."
};

public static final String[] ROG_PERKS = {
"Rogues start with a Ring of Shadows+1.",
"Rogues identify a type of a ring on equipping it.",
"Rogues are proficient with light armor, dodging better while wearing one.",
"Rogues are proficient in detecting hidden doors and traps.",
"Rogues can go without food longer.",
"Scrolls of Magic Mapping are identified from the beginning."
};

public static final String[] HUN_PERKS = {
"Huntresses start with 15 points of Health.",
"Huntresses start with a unique upgradeable boomerang.",
"Huntresses are proficient with missile weapons and get damage bonus for excessive strength when using them.",
"Huntresses gain more health from dewdrops.",
"Huntresses sense neighbouring monsters even if they are hidden behind obstacles."
};

public void initHero( Hero hero ) {

hero.heroClass = this;
Expand Down Expand Up @@ -193,19 +166,13 @@ public String spritesheet() {
}

public String[] perks() {

switch (this) {
case WARRIOR:
return WAR_PERKS;
case MAGE:
return MAG_PERKS;
case ROGUE:
return ROG_PERKS;
case HUNTRESS:
return HUN_PERKS;
final String[] result = new String[numI18nStrings];

for (int j = 0; j < numI18nStrings; j++) {
result[j] = tr("perk_" + i18nPrefix + "_" + j);
}
return null;

return result;
}

private static final String BUNDLE_KEY_CLASS = "class";
Expand Down
26 changes: 14 additions & 12 deletions core/src/com/watabou/pixeldungeon/windows/WndGame.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,16 @@
import com.watabou.pixeldungeon.ui.RedButton;
import com.watabou.pixeldungeon.ui.Window;

import static com.watabou.noosa.NoosaI18N.tr;

public class WndGame extends Window {

private static final String TXT_SETTINGS = "Settings";
private static final String TXT_RANKINGS = "Rankings";
private static final String TXT_START = "Start New Game";
private static final String TXT_MENU = "Main Menu";
private static final String TXT_EXIT = "Exit Pixel Dungeon";
private static final String TXT_RETURN = "Return to Game";
private static final String TXT_SETTINGS = "wgame_settings";
private static final String TXT_RANKINGS = "wgame_rankings";
private static final String TXT_START = "wgame_start";
private static final String TXT_MENU = "wgame_menu";
private static final String TXT_EXIT = "wgame_exit";
private static final String TXT_RETURN = "wgame_return";

private static final int WIDTH = 120;
private static final int BTN_HEIGHT = 20;
Expand All @@ -48,7 +50,7 @@ public WndGame() {

super();

addButton( new RedButton( TXT_SETTINGS ) {
addButton( new RedButton( tr(TXT_SETTINGS) ) {
@Override
protected void onClick() {
hide();
Expand All @@ -60,7 +62,7 @@ protected void onClick() {
if (!Dungeon.hero.isAlive()) {

RedButton btnStart;
addButton( btnStart = new RedButton( TXT_START ) {
addButton( btnStart = new RedButton( tr(TXT_START) ) {
@Override
protected void onClick() {
Dungeon.hero = null;
Expand All @@ -71,7 +73,7 @@ protected void onClick() {
} );
btnStart.icon( Icons.get( Dungeon.hero.heroClass ) );

addButton( new RedButton( TXT_RANKINGS ) {
addButton( new RedButton( tr(TXT_RANKINGS) ) {
@Override
protected void onClick() {
InterlevelScene.mode = InterlevelScene.Mode.DESCEND;
Expand All @@ -81,7 +83,7 @@ protected void onClick() {
}

// Main menu
addButton( new RedButton( TXT_MENU ) {
addButton( new RedButton( tr(TXT_MENU) ) {
@Override
protected void onClick() {
try {
Expand All @@ -94,15 +96,15 @@ protected void onClick() {
} );

// Exit
addButton( new RedButton( TXT_EXIT ) {
addButton( new RedButton( tr(TXT_EXIT) ) {
@Override
protected void onClick() {
Game.instance.finish();
}
} );

// Cancel
addButton( new RedButton( TXT_RETURN ) {
addButton( new RedButton( tr(TXT_RETURN) ) {
@Override
protected void onClick() {
hide();
Expand Down

0 comments on commit a1d98f1

Please sign in to comment.