cleaned up formatting:

- removed trailing whitespace
- changed all leading whitespace to tabs
- removed IDE created author comments
This commit is contained in:
Evan Debenham
2015-06-12 16:22:26 -04:00
parent baa83b7e43
commit cebdff0221
335 changed files with 8555 additions and 8714 deletions
@@ -41,13 +41,13 @@ public class IconTitle extends Component {
public IconTitle() {
super();
}
}
public IconTitle( Item item ) {
ItemSprite icon = new ItemSprite();
icon( icon );
label( Utils.capitalize( item.toString() ) );
icon.view( item );
public IconTitle( Item item ) {
ItemSprite icon = new ItemSprite();
icon( icon );
label( Utils.capitalize( item.toString() ) );
icon.view( item );
}
public IconTitle( Image icon, String label ) {
@@ -54,7 +54,7 @@ public class WndBadge extends Window {
line.y = PixelScene.align( pos );
add( line );
pos += line.height();
pos += line.height();
}
resize( (int)w, (int)(pos + MARGIN) );
@@ -65,7 +65,7 @@ public class WndBag extends WndTabbed {
ENCHANTABLE,
WAND,
SEED,
FOOD,
FOOD,
POTION,
SCROLL,
EQUIPMENT
@@ -123,8 +123,8 @@ public class WndBag extends WndTabbed {
Belongings stuff = Dungeon.hero.belongings;
Bag[] bags = {
stuff.backpack,
stuff.getItem( SeedPouch.class ),
stuff.backpack,
stuff.getItem( SeedPouch.class ),
stuff.getItem( ScrollHolder.class ),
stuff.getItem( PotionBandolier.class ),
stuff.getItem( WandHolster.class )};
@@ -142,7 +142,7 @@ public class WndBag extends WndTabbed {
public static WndBag lastBag( Listener listener, Mode mode, String title ) {
if (mode == lastMode && lastBag != null &&
if (mode == lastMode && lastBag != null &&
Dungeon.hero.belongings.backpack.contains( lastBag )) {
return new WndBag( lastBag, listener, mode, title );
@@ -287,7 +287,7 @@ public class WndBag extends WndTabbed {
}
}
private static class Placeholder extends Item {
private static class Placeholder extends Item {
{
name = null;
}
@@ -328,7 +328,7 @@ public class WndBag extends WndTabbed {
}
@Override
protected void createChildren() {
protected void createChildren() {
bg = new ColorBlock( SLOT_SIZE, SLOT_SIZE, NORMAL );
add( bg );
@@ -361,9 +361,9 @@ public class WndBag extends WndTabbed {
if (item.name() == null) {
enable( false );
} else {
enable(
enable(
mode == Mode.FOR_SALE && (item.price() > 0) && (!item.isEquipped( Dungeon.hero ) || !item.cursed) ||
mode == Mode.UPGRADEABLE && item.isUpgradable() ||
mode == Mode.UPGRADEABLE && item.isUpgradable() ||
mode == Mode.UNIDENTIFED && !item.isIdentified() ||
mode == Mode.QUICKSLOT && (item.defaultAction != null) ||
mode == Mode.WEAPON && (item instanceof MeleeWeapon || item instanceof Boomerang) ||
@@ -371,7 +371,7 @@ public class WndBag extends WndTabbed {
mode == Mode.ENCHANTABLE && (item instanceof MeleeWeapon || item instanceof Boomerang || item instanceof Armor) ||
mode == Mode.WAND && (item instanceof Wand) ||
mode == Mode.SEED && (item instanceof Seed) ||
mode == Mode.FOOD && (item instanceof Food) ||
mode == Mode.FOOD && (item instanceof Food) ||
mode == Mode.POTION && (item instanceof Potion) ||
mode == Mode.SCROLL && (item instanceof Scroll) ||
mode == Mode.EQUIPMENT && (item instanceof EquipableItem) ||
@@ -159,7 +159,7 @@ public class WndBlacksmith extends Window {
protected void onClick() {};
@Override
protected void layout() {
protected void layout() {
super.layout();
bg.x = x;
@@ -28,64 +28,64 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
public class WndChallenges extends Window {
private static final int WIDTH = 108;
private static final int WIDTH = 108;
private static final int TTL_HEIGHT = 12;
private static final int BTN_HEIGHT = 18;
private static final int GAP = 1;
private static final String TITLE = "Challenges";
private static final String TITLE = "Challenges";
private boolean editable;
private ArrayList<CheckBox> boxes;
private boolean editable;
private ArrayList<CheckBox> boxes;
public WndChallenges( int checked, boolean editable ) {
public WndChallenges( int checked, boolean editable ) {
super();
super();
this.editable = editable;
this.editable = editable;
BitmapText title = PixelScene.createText( TITLE, 9 );
title.hardlight( TITLE_COLOR );
title.measure();
title.x = PixelScene.align( camera, (WIDTH - title.width()) / 2 );
title.y = PixelScene.align( camera, (TTL_HEIGHT - title.height()) / 2 );
add( title );
BitmapText title = PixelScene.createText( TITLE, 9 );
title.hardlight( TITLE_COLOR );
title.measure();
title.x = PixelScene.align( camera, (WIDTH - title.width()) / 2 );
title.y = PixelScene.align( camera, (TTL_HEIGHT - title.height()) / 2 );
add( title );
boxes = new ArrayList<CheckBox>();
boxes = new ArrayList<CheckBox>();
float pos = TTL_HEIGHT;
for (int i=0; i < Challenges.NAMES.length; i++) {
float pos = TTL_HEIGHT;
for (int i=0; i < Challenges.NAMES.length; i++) {
CheckBox cb = new CheckBox( Challenges.NAMES[i] );
cb.checked( (checked & Challenges.MASKS[i]) != 0 );
cb.active = editable;
CheckBox cb = new CheckBox( Challenges.NAMES[i] );
cb.checked( (checked & Challenges.MASKS[i]) != 0 );
cb.active = editable;
if (i > 0) {
pos += GAP;
}
cb.setRect( 0, pos, WIDTH, BTN_HEIGHT );
pos = cb.bottom();
if (i > 0) {
pos += GAP;
}
cb.setRect( 0, pos, WIDTH, BTN_HEIGHT );
pos = cb.bottom();
add( cb );
boxes.add( cb );
}
add( cb );
boxes.add( cb );
}
resize( WIDTH, (int)pos );
}
resize( WIDTH, (int)pos );
}
@Override
public void onBackPressed() {
@Override
public void onBackPressed() {
if (editable) {
int value = 0;
for (int i=0; i < boxes.size(); i++) {
if (boxes.get( i ).checked()) {
value |= Challenges.MASKS[i];
}
}
ShatteredPixelDungeon.challenges( value );
}
if (editable) {
int value = 0;
for (int i=0; i < boxes.size(); i++) {
if (boxes.get( i ).checked()) {
value |= Challenges.MASKS[i];
}
}
ShatteredPixelDungeon.challenges( value );
}
super.onBackPressed();
}
super.onBackPressed();
}
}
@@ -28,173 +28,173 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
public class WndClass extends WndTabbed {
private static final String TXT_MASTERY = "Mastery";
private static final String TXT_MASTERY = "Mastery";
private static final int WIDTH = 110;
private static final int WIDTH = 110;
private static final int TAB_WIDTH = 50;
private static final int TAB_WIDTH = 50;
private HeroClass cl;
private HeroClass cl;
private PerksTab tabPerks;
private MasteryTab tabMastery;
private PerksTab tabPerks;
private MasteryTab tabMastery;
public WndClass( HeroClass cl ) {
public WndClass( HeroClass cl ) {
super();
super();
this.cl = cl;
this.cl = cl;
tabPerks = new PerksTab();
add( tabPerks );
tabPerks = new PerksTab();
add( tabPerks );
Tab tab = new RankingTab( Utils.capitalize( cl.title() ), tabPerks );
tab.setSize( TAB_WIDTH, tabHeight() );
add( tab );
Tab tab = new RankingTab( Utils.capitalize( cl.title() ), tabPerks );
tab.setSize( TAB_WIDTH, tabHeight() );
add( tab );
if (Badges.isUnlocked( cl.masteryBadge() )) {
tabMastery = new MasteryTab();
add( tabMastery );
if (Badges.isUnlocked( cl.masteryBadge() )) {
tabMastery = new MasteryTab();
add( tabMastery );
tab = new RankingTab( TXT_MASTERY, tabMastery );
add( tab );
tab = new RankingTab( TXT_MASTERY, tabMastery );
add( tab );
resize(
(int)Math.max( tabPerks.width, tabMastery.width ),
(int)Math.max( tabPerks.height, tabMastery.height ) );
} else {
resize( (int)tabPerks.width, (int)tabPerks.height );
}
resize(
(int)Math.max( tabPerks.width, tabMastery.width ),
(int)Math.max( tabPerks.height, tabMastery.height ) );
} else {
resize( (int)tabPerks.width, (int)tabPerks.height );
}
layoutTabs();
layoutTabs();
select( 0 );
}
select( 0 );
}
private class RankingTab extends LabeledTab {
private class RankingTab extends LabeledTab {
private Group page;
private Group page;
public RankingTab( String label, Group page ) {
super( label );
this.page = page;
}
public RankingTab( String label, Group page ) {
super( label );
this.page = page;
}
@Override
protected void select( boolean value ) {
super.select( value );
if (page != null) {
page.visible = page.active = selected;
}
}
}
@Override
protected void select( boolean value ) {
super.select( value );
if (page != null) {
page.visible = page.active = selected;
}
}
}
private class PerksTab extends Group {
private class PerksTab extends Group {
private static final int MARGIN = 4;
private static final int GAP = 4;
private static final int MARGIN = 4;
private static final int GAP = 4;
private static final String DOT = "\u007F";
private static final String DOT = "\u007F";
public float height;
public float width;
public float height;
public float width;
public PerksTab() {
super();
public PerksTab() {
super();
float dotWidth = 0;
float dotWidth = 0;
String[] items = cl.perks();
float pos = MARGIN;
String[] items = cl.perks();
float pos = MARGIN;
for (int i=0; i < items.length; i++) {
for (int i=0; i < items.length; i++) {
if (i > 0) {
pos += GAP;
}
if (i > 0) {
pos += GAP;
}
BitmapText dot = PixelScene.createText( DOT, 6 );
dot.x = MARGIN;
dot.y = pos;
if (dotWidth == 0) {
dot.measure();
dotWidth = dot.width();
}
add( dot );
BitmapText dot = PixelScene.createText( DOT, 6 );
dot.x = MARGIN;
dot.y = pos;
if (dotWidth == 0) {
dot.measure();
dotWidth = dot.width();
}
add( dot );
BitmapTextMultiline item = PixelScene.createMultiline( items[i], 6 );
item.x = dot.x + dotWidth;
item.y = pos;
item.maxWidth = (int)(WIDTH - MARGIN * 2 - dotWidth);
item.measure();
add( item );
BitmapTextMultiline item = PixelScene.createMultiline( items[i], 6 );
item.x = dot.x + dotWidth;
item.y = pos;
item.maxWidth = (int)(WIDTH - MARGIN * 2 - dotWidth);
item.measure();
add( item );
pos += item.height();
float w = item.width();
if (w > width) {
width = w;
}
}
pos += item.height();
float w = item.width();
if (w > width) {
width = w;
}
}
width += MARGIN + dotWidth;
height = pos + MARGIN;
}
}
width += MARGIN + dotWidth;
height = pos + MARGIN;
}
}
private class MasteryTab extends Group {
private class MasteryTab extends Group {
private static final int MARGIN = 4;
private static final int MARGIN = 4;
private BitmapTextMultiline normal;
private BitmapTextMultiline highlighted;
private BitmapTextMultiline normal;
private BitmapTextMultiline highlighted;
public float height;
public float width;
public float height;
public float width;
public MasteryTab() {
super();
public MasteryTab() {
super();
String text = null;
switch (cl) {
case WARRIOR:
text = HeroSubClass.GLADIATOR.desc() + "\n\n" + HeroSubClass.BERSERKER.desc();
break;
case MAGE:
text = HeroSubClass.BATTLEMAGE.desc() + "\n\n" + HeroSubClass.WARLOCK.desc();
break;
case ROGUE:
text = HeroSubClass.FREERUNNER.desc() + "\n\n" + HeroSubClass.ASSASSIN.desc();
break;
case HUNTRESS:
text = HeroSubClass.SNIPER.desc() + "\n\n" + HeroSubClass.WARDEN.desc();
break;
}
String text = null;
switch (cl) {
case WARRIOR:
text = HeroSubClass.GLADIATOR.desc() + "\n\n" + HeroSubClass.BERSERKER.desc();
break;
case MAGE:
text = HeroSubClass.BATTLEMAGE.desc() + "\n\n" + HeroSubClass.WARLOCK.desc();
break;
case ROGUE:
text = HeroSubClass.FREERUNNER.desc() + "\n\n" + HeroSubClass.ASSASSIN.desc();
break;
case HUNTRESS:
text = HeroSubClass.SNIPER.desc() + "\n\n" + HeroSubClass.WARDEN.desc();
break;
}
Highlighter hl = new Highlighter( text );
Highlighter hl = new Highlighter( text );
normal = PixelScene.createMultiline( hl.text, 6 );
normal.maxWidth = WIDTH - MARGIN * 2;
normal.measure();
normal.x = MARGIN;
normal.y = MARGIN;
add( normal );
normal = PixelScene.createMultiline( hl.text, 6 );
normal.maxWidth = WIDTH - MARGIN * 2;
normal.measure();
normal.x = MARGIN;
normal.y = MARGIN;
add( normal );
if (hl.isHighlighted()) {
normal.mask = hl.inverted();
if (hl.isHighlighted()) {
normal.mask = hl.inverted();
highlighted = PixelScene.createMultiline( hl.text, 6 );
highlighted.maxWidth = normal.maxWidth;
highlighted.measure();
highlighted.x = normal.x;
highlighted.y = normal.y;
add( highlighted );
highlighted = PixelScene.createMultiline( hl.text, 6 );
highlighted.maxWidth = normal.maxWidth;
highlighted.measure();
highlighted.x = normal.x;
highlighted.y = normal.y;
add( highlighted );
highlighted.mask = hl.mask;
highlighted.hardlight( TITLE_COLOR );
}
highlighted.mask = hl.mask;
highlighted.hardlight( TITLE_COLOR );
}
height = normal.y + normal.height() + MARGIN;
width = normal.x + normal.width() + MARGIN;
}
}
height = normal.y + normal.height() + MARGIN;
width = normal.x + normal.width() + MARGIN;
}
}
}
@@ -33,7 +33,7 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
public class WndGame extends Window {
private static final String TXT_SETTINGS = "Settings";
private static final String TXT_CHALLEGES = "Challenges";
private static final String TXT_CHALLEGES = "Challenges";
private static final String TXT_RANKINGS = "Rankings";
private static final String TXT_START = "Start New Game";
private static final String TXT_MENU = "Main Menu";
@@ -58,26 +58,26 @@ public class WndGame extends Window {
}
} );
// Challenges window
if (Dungeon.challenges > 0) {
addButton( new RedButton( TXT_CHALLEGES ) {
@Override
protected void onClick() {
hide();
GameScene.show( new WndChallenges( Dungeon.challenges, false ) );
}
} );
}
// Challenges window
if (Dungeon.challenges > 0) {
addButton( new RedButton( TXT_CHALLEGES ) {
@Override
protected void onClick() {
hide();
GameScene.show( new WndChallenges( Dungeon.challenges, false ) );
}
} );
}
// Restart
if (!Dungeon.hero.isAlive()) {
// Restart
if (!Dungeon.hero.isAlive()) {
RedButton btnStart;
addButton( btnStart = new RedButton( TXT_START ) {
@Override
protected void onClick() {
Dungeon.hero = null;
ShatteredPixelDungeon.challenges( Dungeon.challenges );
ShatteredPixelDungeon.challenges( Dungeon.challenges );
InterlevelScene.mode = InterlevelScene.Mode.DESCEND;
InterlevelScene.noStory = true;
Game.switchScene( InterlevelScene.class );
@@ -106,11 +106,11 @@ public class WndHero extends WndTabbed {
Hero hero = Dungeon.hero;
IconTitle title = new IconTitle();
title.icon( HeroSprite.avatar(hero.heroClass, hero.tier()) );
title.label(Utils.format( TXT_TITLE, hero.lvl, hero.className() ).toUpperCase( Locale.ENGLISH ), 9);
title.color(Window.SHPX_COLOR);
title.setRect( 0, 0, WIDTH, 0 );
IconTitle title = new IconTitle();
title.icon( HeroSprite.avatar(hero.heroClass, hero.tier()) );
title.label(Utils.format( TXT_TITLE, hero.lvl, hero.className() ).toUpperCase( Locale.ENGLISH ), 9);
title.color(Window.SHPX_COLOR);
title.setRect( 0, 0, WIDTH, 0 );
add(title);
RedButton btnCatalogus = new RedButton( TXT_CATALOGUS ) {
@@ -32,7 +32,7 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
public class WndImp extends Window {
private static final String TXT_MESSAGE =
private static final String TXT_MESSAGE =
"Oh yes! You are my hero!\n" +
"Regarding your reward, I don't have cash with me right now, but I have something better for you. " +
"This is my family heirloom ring: my granddad took it off a dead paladin's finger.";
@@ -11,9 +11,6 @@ import com.watabou.noosa.BitmapTextMultiline;
import com.watabou.noosa.Image;
import com.watabou.noosa.TextureFilm;
/**
* Created by debenhame on 06/04/2015.
*/
public class WndInfoBuff extends Window {
private static final float GAP = 2;
@@ -37,16 +37,16 @@ public class WndInfoItem extends Window {
private static final String TTL_CRYSTAL_CHEST = "Crystal chest";
private static final String TTL_TOMB = "Tomb";
private static final String TTL_SKELETON = "Skeletal remains";
private static final String TTL_REMAINS = "Heroes remains";
private static final String TTL_REMAINS = "Heroes remains";
private static final String TXT_WONT_KNOW = "You won't know what's inside until you open it!";
private static final String TXT_NEED_KEY = TXT_WONT_KNOW + " But to open it you need a golden key.";
private static final String TXT_INSIDE = "You can see %s inside, but to open the chest you need a golden key.";
private static final String TXT_OWNER =
private static final String TXT_OWNER =
"This ancient tomb may contain something useful, " +
"but its owner will most certainly object to checking.";
private static final String TXT_SKELETON =
"This is all that's left of some unfortunate adventurer. " +
"Maybe it's worth checking for any valuables.";
private static final String TXT_SKELETON =
"This is all that's left of some unfortunate adventurer. " +
"Maybe it's worth checking for any valuables.";
private static final String TXT_REMAINS =
"This is all that's left from one of your predecessors. " +
"Maybe it's worth checking for any valuables.";
@@ -65,9 +65,9 @@ public class WndInfoItem extends Window {
int color = TITLE_COLOR;
if (item.levelKnown && item.level > 0) {
color = ItemSlot.UPGRADED;
color = ItemSlot.UPGRADED;
} else if (item.levelKnown && item.level < 0) {
color = ItemSlot.DEGRADED;
color = ItemSlot.DEGRADED;
}
fillFields( item.image(), item.glowing(), color, item.toString(), item.info() );
@@ -83,21 +83,21 @@ public class WndInfoItem extends Window {
title = TTL_TOMB;
info = TXT_OWNER;
} else if (heap.type == Type.SKELETON) {
title = TTL_SKELETON;
info = TXT_SKELETON;
} else if (heap.type == Type.REMAINS) {
title = TTL_REMAINS;
info = TXT_REMAINS;
title = TTL_SKELETON;
info = TXT_SKELETON;
} else if (heap.type == Type.REMAINS) {
title = TTL_REMAINS;
info = TXT_REMAINS;
} else if (heap.type == Type.CRYSTAL_CHEST) {
title = TTL_CRYSTAL_CHEST;
if (heap.peek() instanceof Artifact)
info = Utils.format( TXT_INSIDE, "an artifact" );
else if (heap.peek() instanceof Wand)
info = Utils.format( TXT_INSIDE, "a wand" );
else if (heap.peek() instanceof Ring)
info = Utils.format( TXT_INSIDE, "a ring" );
if (heap.peek() instanceof Artifact)
info = Utils.format( TXT_INSIDE, "an artifact" );
else if (heap.peek() instanceof Wand)
info = Utils.format( TXT_INSIDE, "a wand" );
else if (heap.peek() instanceof Ring)
info = Utils.format( TXT_INSIDE, "a ring" );
else
info = Utils.format( TXT_INSIDE, Utils.indefinite( heap.peek().name() ) );
info = Utils.format( TXT_INSIDE, Utils.indefinite( heap.peek().name() ) );
} else {
title = TTL_LOCKED_CHEST;
info = TXT_NEED_KEY;
@@ -114,9 +114,9 @@ public class WndInfoItem extends Window {
int color = TITLE_COLOR;
if (item.levelKnown && item.level > 0) {
color = ItemSlot.UPGRADED;
color = ItemSlot.UPGRADED;
} else if (item.levelKnown && item.level < 0) {
color = ItemSlot.DEGRADED;
color = ItemSlot.DEGRADED;
}
fillFields( item.image(), item.glowing(), color, item.toString(), item.info() );
@@ -38,7 +38,7 @@ public class WndInfoMob extends WndTitledMessage {
StringBuilder builder = new StringBuilder( mob.description() );
builder.append( "\n\n" + mob.state.status() + "." );
builder.append( "\n\n" + mob.state.status() + "." );
return builder.toString();
}
@@ -56,7 +56,7 @@ public class WndInfoMob extends WndTitledMessage {
name = PixelScene.createText( Utils.capitalize( mob.name ), 9 );
name.hardlight( TITLE_COLOR );
name.measure();
name.measure();
add( name );
image = mob.sprite();
@@ -83,7 +83,7 @@ public class WndInfoMob extends WndTitledMessage {
health.setRect(image.width + GAP, image.height - health.height(), w, health.height());
buffs.setPos(
buffs.setPos(
name.x + name.width() + GAP-1,
name.y + name.baseLine() - BuffIndicator.SIZE-2 );
@@ -36,7 +36,7 @@ public class WndItem extends Window {
private static final int WIDTH = 120;
public WndItem( final WndBag owner, final Item item ) {
public WndItem( final WndBag owner, final Item item ) {
super();
@@ -48,7 +48,7 @@ public class WndItem extends Window {
titlebar.color( ItemSlot.UPGRADED );
} else if (item.levelKnown && item.level < 0) {
titlebar.color( ItemSlot.DEGRADED );
}
}
BitmapTextMultiline info = PixelScene.createMultiline( item.info(), 6 );
info.maxWidth = WIDTH;
@@ -38,8 +38,8 @@ public class WndMessage extends Window {
info.x = info.y = MARGIN;
add( info );
resize(
(int)info.width() + MARGIN * 2,
resize(
(int)info.width() + MARGIN * 2,
(int)info.height() + MARGIN * 2 );
}
}
@@ -22,7 +22,7 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
public class WndQuest extends WndTitledMessage {
public WndQuest( NPC questgiver, String text ) {
super( questgiver.sprite(), Utils.capitalize( questgiver.name ), text );
}
public WndQuest( NPC questgiver, String text ) {
super( questgiver.sprite(), Utils.capitalize( questgiver.name ), text );
}
}
@@ -79,7 +79,7 @@ public class WndRanking extends WndTabbed {
};
thread.start();
busy = Icons.BUSY.get();
busy = Icons.BUSY.get();
busy.origin.set( busy.width / 2, busy.height / 2 );
busy.angularSpeed = 720;
busy.x = (WIDTH - busy.width) / 2;
@@ -105,9 +105,9 @@ public class WndRanking extends WndTabbed {
private void createControls() {
String[] labels =
String[] labels =
{TXT_STATS, TXT_ITEMS, TXT_BADGES};
Group[] pages =
Group[] pages =
{new StatsTab(), new ItemsTab(), new BadgesTab()};
for (int i=0; i < pages.length; i++) {
@@ -145,9 +145,9 @@ public class WndRanking extends WndTabbed {
private static final int GAP = 4;
private static final String TXT_TITLE = "Level %d %s";
private static final String TXT_TITLE = "Level %d %s";
private static final String TXT_CHALLENGES = "Challenges";
private static final String TXT_CHALLENGES = "Challenges";
private static final String TXT_HEALTH = "Health";
private static final String TXT_STR = "Strength";
@@ -170,26 +170,26 @@ public class WndRanking extends WndTabbed {
IconTitle title = new IconTitle();
title.icon( HeroSprite.avatar( Dungeon.hero.heroClass, Dungeon.hero.tier() ) );
title.label( Utils.format( TXT_TITLE, Dungeon.hero.lvl, heroClass ).toUpperCase( Locale.ENGLISH ) );
title.color(Window.SHPX_COLOR);
title.color(Window.SHPX_COLOR);
title.setRect( 0, 0, WIDTH, 0 );
add( title );
float pos = title.bottom();
if (Dungeon.challenges > 0) {
RedButton btnCatalogus = new RedButton( TXT_CHALLENGES ) {
@Override
protected void onClick() {
Game.scene().add( new WndChallenges( Dungeon.challenges, false ) );
}
};
btnCatalogus.setRect( 0, pos + GAP, btnCatalogus.reqWidth() + 2, btnCatalogus.reqHeight() + 2 );
add( btnCatalogus );
if (Dungeon.challenges > 0) {
RedButton btnCatalogus = new RedButton( TXT_CHALLENGES ) {
@Override
protected void onClick() {
Game.scene().add( new WndChallenges( Dungeon.challenges, false ) );
}
};
btnCatalogus.setRect( 0, pos + GAP, btnCatalogus.reqWidth() + 2, btnCatalogus.reqHeight() + 2 );
add( btnCatalogus );
pos = btnCatalogus.bottom();
}
pos = btnCatalogus.bottom();
}
pos += GAP + GAP;
pos += GAP + GAP;
pos = statSlot( this, TXT_STR, Integer.toString( Dungeon.hero.STR ), pos );
pos = statSlot( this, TXT_HEALTH, Integer.toString( Dungeon.hero.HT ), pos );
@@ -317,7 +317,7 @@ public class WndRanking extends WndTabbed {
}
@Override
protected void createChildren() {
protected void createChildren() {
bg = new ColorBlock( HEIGHT, HEIGHT, 0xFF4A4D44 );
add( bg );
@@ -33,20 +33,20 @@ import com.watabou.noosa.BitmapTextMultiline;
public class WndSadGhost extends Window {
private static final String TXT_RAT =
private static final String TXT_RAT =
"Thank you, that horrid rat is slain and I can finally rest..." +
"I wonder what twisted magic created such a foul creature...\n\n";
private static final String TXT_GNOLL =
"Thank you, that scheming gnoll is slain and I can finally rest..." +
"I wonder what twisted magic made it so smart...\n\n";
private static final String TXT_CRAB =
"Thank you, that giant crab is slain and I can finally rest..." +
"I wonder what twisted magic allowed it to live so long...\n\n";
private static final String TXT_GIVEITEM=
"Please take one of these items, they are useless to me now... " +
"Maybe they will help you in your journey...\n\n" +
"Also... There is an item lost in this dungeon that is very dear to me..." +
"If you ever... find my... rose......";
"I wonder what twisted magic created such a foul creature...\n\n";
private static final String TXT_GNOLL =
"Thank you, that scheming gnoll is slain and I can finally rest..." +
"I wonder what twisted magic made it so smart...\n\n";
private static final String TXT_CRAB =
"Thank you, that giant crab is slain and I can finally rest..." +
"I wonder what twisted magic allowed it to live so long...\n\n";
private static final String TXT_GIVEITEM=
"Please take one of these items, they are useless to me now... " +
"Maybe they will help you in your journey...\n\n" +
"Also... There is an item lost in this dungeon that is very dear to me..." +
"If you ever... find my... rose......";
private static final String TXT_WEAPON = "Ghost's weapon";
private static final String TXT_ARMOR = "Ghost's armor";
@@ -59,25 +59,25 @@ public class WndSadGhost extends Window {
super();
IconTitle titlebar = new IconTitle();
BitmapTextMultiline message;
switch (type){
case 1:default:
titlebar.icon( new FetidRatSprite() );
titlebar.label( "DEFEATED FETID RAT" );
message = PixelScene.createMultiline( TXT_RAT+TXT_GIVEITEM, 6 );
break;
case 2:
titlebar.icon( new GnollTricksterSprite() );
titlebar.label( "DEFEATED GNOLL TRICKSTER" );
message = PixelScene.createMultiline( TXT_GNOLL+TXT_GIVEITEM, 6 );
break;
case 3:
titlebar.icon( new GreatCrabSprite());
titlebar.label( "DEFEATED GREAT CRAB" );
message = PixelScene.createMultiline( TXT_CRAB+TXT_GIVEITEM, 6 );
break;
BitmapTextMultiline message;
switch (type){
case 1:default:
titlebar.icon( new FetidRatSprite() );
titlebar.label( "DEFEATED FETID RAT" );
message = PixelScene.createMultiline( TXT_RAT+TXT_GIVEITEM, 6 );
break;
case 2:
titlebar.icon( new GnollTricksterSprite() );
titlebar.label( "DEFEATED GNOLL TRICKSTER" );
message = PixelScene.createMultiline( TXT_GNOLL+TXT_GIVEITEM, 6 );
break;
case 3:
titlebar.icon( new GreatCrabSprite());
titlebar.label( "DEFEATED GREAT CRAB" );
message = PixelScene.createMultiline( TXT_CRAB+TXT_GIVEITEM, 6 );
break;
}
}
titlebar.setRect( 0, 0, WIDTH, 0 );
@@ -97,20 +97,20 @@ public class WndSadGhost extends Window {
btnWeapon.setRect( 0, message.y + message.height() + GAP, WIDTH, BTN_HEIGHT );
add( btnWeapon );
if (!Dungeon.isChallenged( Challenges.NO_ARMOR )) {
RedButton btnArmor = new RedButton(TXT_ARMOR) {
@Override
protected void onClick() {
selectReward(ghost, Ghost.Quest.armor);
}
};
btnArmor.setRect(0, btnWeapon.bottom() + GAP, WIDTH, BTN_HEIGHT);
add(btnArmor);
if (!Dungeon.isChallenged( Challenges.NO_ARMOR )) {
RedButton btnArmor = new RedButton(TXT_ARMOR) {
@Override
protected void onClick() {
selectReward(ghost, Ghost.Quest.armor);
}
};
btnArmor.setRect(0, btnWeapon.bottom() + GAP, WIDTH, BTN_HEIGHT);
add(btnArmor);
resize(WIDTH, (int) btnArmor.bottom());
} else {
resize(WIDTH, (int) btnWeapon.bottom());
}
resize(WIDTH, (int) btnArmor.bottom());
} else {
resize(WIDTH, (int) btnWeapon.bottom());
}
}
private void selectReward( Ghost ghost, Item reward ) {
@@ -34,7 +34,7 @@ public class WndSettings extends Window {
private static final String TXT_ZOOM_DEFAULT = "Default Zoom";
private static final String TXT_SCALE_UP = "Scale up UI";
private static final String TXT_IMMERSIVE = "Immersive mode";
private static final String TXT_IMMERSIVE = "Immersive mode";
private static final String TXT_MUSIC = "Music";
@@ -57,7 +57,7 @@ public class WndSettings extends Window {
public WndSettings( boolean inGame ) {
super();
CheckBox btnImmersive = null;
CheckBox btnImmersive = null;
if (inGame) {
int w = BTN_HEIGHT;
@@ -101,19 +101,19 @@ public class WndSettings extends Window {
btnScaleUp.checked( ShatteredPixelDungeon.scaleUp() );
add( btnScaleUp );
btnImmersive = new CheckBox( TXT_IMMERSIVE ) {
@Override
protected void onClick() {
super.onClick();
ShatteredPixelDungeon.immerse( checked() );
}
};
btnImmersive.setRect( 0, btnScaleUp.bottom() + GAP, WIDTH, BTN_HEIGHT );
btnImmersive.checked( ShatteredPixelDungeon.immersed() );
btnImmersive.enable( android.os.Build.VERSION.SDK_INT >= 19 );
add( btnImmersive );
btnImmersive = new CheckBox( TXT_IMMERSIVE ) {
@Override
protected void onClick() {
super.onClick();
ShatteredPixelDungeon.immerse( checked() );
}
};
btnImmersive.setRect( 0, btnScaleUp.bottom() + GAP, WIDTH, BTN_HEIGHT );
btnImmersive.checked( ShatteredPixelDungeon.immersed() );
btnImmersive.enable( android.os.Build.VERSION.SDK_INT >= 19 );
add( btnImmersive );
}
}
CheckBox btnMusic = new CheckBox( TXT_MUSIC ) {
@Override
@@ -122,7 +122,7 @@ public class WndSettings extends Window {
ShatteredPixelDungeon.music(checked());
}
};
btnMusic.setRect( 0, (btnImmersive != null ? btnImmersive.bottom() : BTN_HEIGHT) + GAP, WIDTH, BTN_HEIGHT );
btnMusic.setRect( 0, (btnImmersive != null ? btnImmersive.bottom() : BTN_HEIGHT) + GAP, WIDTH, BTN_HEIGHT );
btnMusic.checked( ShatteredPixelDungeon.music() );
add( btnMusic );
@@ -31,8 +31,8 @@ import com.watabou.utils.SparseArray;
public class WndStory extends Window {
private static final int WIDTH_P = 120;
private static final int WIDTH_L = 144;
private static final int MARGIN = 6;
private static final int WIDTH_L = 144;
private static final int MARGIN = 6;
private static final float bgR = 0.77f;
private static final float bgG = 0.73f;
@@ -47,25 +47,25 @@ public class WndStory extends Window {
private static final SparseArray<String> CHAPTERS = new SparseArray<String>();
static {
CHAPTERS.put( ID_SEWERS,
CHAPTERS.put( ID_SEWERS,
"The Dungeon lies right beneath the City, its upper levels actually constitute the City's sewer system.\n\n " +
"As dark energy has crept up from below the usually harmless sewer creatures have become more and more " +
"dangerous. The city sends guard patrols down here to try and maintain safety for those above, but " +
"they are slowly failing.\n\n This place is dangerous, but at least the evil magic at work here is weak." );
"As dark energy has crept up from below the usually harmless sewer creatures have become more and more " +
"dangerous. The city sends guard patrols down here to try and maintain safety for those above, but " +
"they are slowly failing.\n\n This place is dangerous, but at least the evil magic at work here is weak." );
CHAPTERS.put( ID_PRISON,
CHAPTERS.put( ID_PRISON,
"Many years ago an underground prison was built here for the most dangerous criminals. At the time it seemed " +
"like a very clever idea, because this place indeed was very hard to escape. But soon dark miasma started to permeate " +
"from below, driving prisoners and guards insane. In the end the prison was abandoned, though some convicts " +
"were left locked up here." );
CHAPTERS.put( ID_CAVES,
CHAPTERS.put( ID_CAVES,
"The caves, which stretch down under the abandoned prison, are sparcely populated. They lie too deep to be exploited " +
"by the City and they are too poor in minerals to interest the dwarves. In the past there was a trade outpost " +
"somewhere here on the route between these two states, but it has perished since the decline of Dwarven Metropolis. " +
"Only omnipresent gnolls and subterranean animals dwell here now." );
CHAPTERS.put( ID_METROPOLIS,
CHAPTERS.put( ID_METROPOLIS,
"Dwarven Metropolis was once the greatest of dwarven city-states. In its heyday the mechanized army of dwarves " +
"has successfully repelled the invasion of the old god and his demon army. But it is said, that the returning warriors " +
"have brought seeds of corruption with them, and that victory was the beginning of the end for the underground kingdom." );
@@ -86,8 +86,8 @@ public class WndStory extends Window {
tf = PixelScene.createMultiline( text, 7 );
tf.maxWidth = ShatteredPixelDungeon.landscape() ?
WIDTH_L - MARGIN * 2:
WIDTH_P - MARGIN *2;
WIDTH_L - MARGIN * 2:
WIDTH_P - MARGIN *2;
tf.measure();
tf.ra = bgR;
tf.ga = bgG;
@@ -40,7 +40,7 @@ public class WndTabbed extends Window {
protected Tab add( Tab tab ) {
tab.setPos( tabs.size() == 0 ?
tab.setPos( tabs.size() == 0 ?
-chrome.marginLeft() + 1 :
tabs.get( tabs.size() - 1 ).right(), height );
tab.select( false );
@@ -75,7 +75,7 @@ public class WndTabbed extends Window {
this.width = w;
this.height = h;
chrome.size(
chrome.size(
width + chrome.marginHor(),
height + chrome.marginVer() );
@@ -102,7 +102,7 @@ public class WndTabbed extends Window {
}
public void layoutTabs(){
//subract two as there's extra horizontal space for those nobs on the top.
//subract two as there's extra horizontal space for those nobs on the top.
int fullWidth = width+chrome.marginHor()-2;
int numTabs = tabs.size();
@@ -172,8 +172,8 @@ public class WndTabbed extends Window {
remove( bg );
}
bg = Chrome.get( selected ?
Chrome.Type.TAB_SELECTED :
bg = Chrome.get( selected ?
Chrome.Type.TAB_SELECTED :
Chrome.Type.TAB_UNSELECTED );
addToBack( bg );
@@ -181,7 +181,7 @@ public class WndTabbed extends Window {
}
@Override
protected void onClick() {
protected void onClick() {
Sample.INSTANCE.play( Assets.SND_CLICK, 0.7f, 0.7f, 1.2f );
WndTabbed.this.onClick( this );
}
@@ -223,6 +223,6 @@ public class WndTabbed extends Window {
super.select( value );
btLabel.am = selected ? 1.0f : 0.6f;
}
}
}
}
@@ -43,7 +43,7 @@ public class WndTradeItem extends Window {
private static final String TXT_SALE = "FOR SALE: %s - %dg";
private static final String TXT_BUY = "Buy for %dg";
private static final String TXT_STEAL = "Steal with %d%% chance";
private static final String TXT_STEAL = "Steal with %d%% chance";
private static final String TXT_SELL = "Sell for %dg";
private static final String TXT_SELL_1 = "Sell 1 for %dg";
private static final String TXT_SELL_ALL = "Sell all for %dg";
@@ -51,7 +51,7 @@ public class WndTradeItem extends Window {
private static final String TXT_SOLD = "You've sold your %s for %dg";
private static final String TXT_BOUGHT = "You've bought %s for %dg";
private static final String TXT_STOLE = "You've stolen the %s";
private static final String TXT_STOLE = "You've stolen the %s";
private WndBag owner;
@@ -59,7 +59,7 @@ public class WndTradeItem extends Window {
super();
this.owner = owner;
this.owner = owner;
float pos = createDescription( item, false );
@@ -138,46 +138,46 @@ public class WndTradeItem extends Window {
btnBuy.enable( price <= Dungeon.gold );
add( btnBuy );
RedButton btnCancel = new RedButton( TXT_CANCEL ) {
@Override
protected void onClick() {
hide();
}
};
RedButton btnCancel = new RedButton( TXT_CANCEL ) {
@Override
protected void onClick() {
hide();
}
};
final MasterThievesArmband.Thievery thievery = Dungeon.hero.buff(MasterThievesArmband.Thievery.class);
if (thievery != null) {
final float chance = thievery.stealChance(price);
RedButton btnSteal = new RedButton(Utils.format(TXT_STEAL, Math.min(100, (int)(chance*100)))) {
@Override
protected void onClick() {
if(thievery.steal(price)){
Hero hero = Dungeon.hero;
Item item = heap.pickUp();
GLog.i( TXT_STOLE, item.name());
hide();
final MasterThievesArmband.Thievery thievery = Dungeon.hero.buff(MasterThievesArmband.Thievery.class);
if (thievery != null) {
final float chance = thievery.stealChance(price);
RedButton btnSteal = new RedButton(Utils.format(TXT_STEAL, Math.min(100, (int)(chance*100)))) {
@Override
protected void onClick() {
if(thievery.steal(price)){
Hero hero = Dungeon.hero;
Item item = heap.pickUp();
GLog.i( TXT_STOLE, item.name());
hide();
if (!item.doPickUp( hero )) {
Dungeon.level.drop( item, heap.pos ).sprite.drop();
}
} else {
for (Mob mob : Dungeon.level.mobs){
if (mob instanceof Shopkeeper) {
mob.yell(((Shopkeeper) mob).TXT_THIEF);
((Shopkeeper) mob).flee();
break;
}
}
hide();
}
}
};
btnSteal.setRect(0, btnBuy.bottom() + GAP, WIDTH, BTN_HEIGHT);
add(btnSteal);
if (!item.doPickUp( hero )) {
Dungeon.level.drop( item, heap.pos ).sprite.drop();
}
} else {
for (Mob mob : Dungeon.level.mobs){
if (mob instanceof Shopkeeper) {
mob.yell(((Shopkeeper) mob).TXT_THIEF);
((Shopkeeper) mob).flee();
break;
}
}
hide();
}
}
};
btnSteal.setRect(0, btnBuy.bottom() + GAP, WIDTH, BTN_HEIGHT);
add(btnSteal);
btnCancel.setRect( 0, btnSteal.bottom() + GAP, WIDTH, BTN_HEIGHT );
} else
btnCancel.setRect( 0, btnBuy.bottom() + GAP, WIDTH, BTN_HEIGHT );
btnCancel.setRect( 0, btnSteal.bottom() + GAP, WIDTH, BTN_HEIGHT );
} else
btnCancel.setRect( 0, btnBuy.bottom() + GAP, WIDTH, BTN_HEIGHT );
add( btnCancel );
@@ -206,17 +206,17 @@ public class WndTradeItem extends Window {
// Title
IconTitle titlebar = new IconTitle();
titlebar.icon( new ItemSprite( item ) );
titlebar.label( forSale ?
Utils.format( TXT_SALE, item.toString(), price( item ) ) :
titlebar.label( forSale ?
Utils.format( TXT_SALE, item.toString(), price( item ) ) :
Utils.capitalize( item.toString() ) );
titlebar.setRect( 0, 0, WIDTH, 0 );
add( titlebar );
// Upgraded / degraded
if (item.levelKnown && item.level > 0) {
titlebar.color( ItemSlot.UPGRADED );
titlebar.color( ItemSlot.UPGRADED );
} else if (item.levelKnown && item.level < 0) {
titlebar.color( ItemSlot.DEGRADED );
titlebar.color( ItemSlot.DEGRADED );
}
// Description
@@ -32,7 +32,7 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
public class WndWandmaker extends Window {
private static final String TXT_MESSAGE =
private static final String TXT_MESSAGE =
"Oh, I see you have succeeded! I do hope it hasn't troubled you too much. " +
"As I promised, you can choose one of my high quality wands.";