cleaned up formatting:
- removed trailing whitespace - changed all leading whitespace to tabs - removed IDE created author comments
This commit is contained in:
@@ -36,163 +36,163 @@ import java.util.ArrayList;
|
||||
|
||||
public class Weightstone extends Item {
|
||||
|
||||
private static final String TXT_SELECT_WEAPON = "Select a weapon to balance";
|
||||
private static final String TXT_LIGHT = "you balanced your %s to make it lighter";
|
||||
private static final String TXT_HEAVY = "you balanced your %s to make it heavier";
|
||||
private static final String TXT_SELECT_WEAPON = "Select a weapon to balance";
|
||||
private static final String TXT_LIGHT = "you balanced your %s to make it lighter";
|
||||
private static final String TXT_HEAVY = "you balanced your %s to make it heavier";
|
||||
|
||||
private static final float TIME_TO_APPLY = 2;
|
||||
private static final float TIME_TO_APPLY = 2;
|
||||
|
||||
private static final String AC_APPLY = "APPLY";
|
||||
private static final String AC_APPLY = "APPLY";
|
||||
|
||||
{
|
||||
name = "weightstone";
|
||||
image = ItemSpriteSheet.WEIGHT;
|
||||
{
|
||||
name = "weightstone";
|
||||
image = ItemSpriteSheet.WEIGHT;
|
||||
|
||||
stackable = true;
|
||||
stackable = true;
|
||||
|
||||
bones = true;
|
||||
}
|
||||
bones = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> actions( Hero hero ) {
|
||||
ArrayList<String> actions = super.actions( hero );
|
||||
actions.add( AC_APPLY );
|
||||
return actions;
|
||||
}
|
||||
@Override
|
||||
public ArrayList<String> actions( Hero hero ) {
|
||||
ArrayList<String> actions = super.actions( hero );
|
||||
actions.add( AC_APPLY );
|
||||
return actions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute( Hero hero, String action ) {
|
||||
if (action == AC_APPLY) {
|
||||
@Override
|
||||
public void execute( Hero hero, String action ) {
|
||||
if (action == AC_APPLY) {
|
||||
|
||||
curUser = hero;
|
||||
GameScene.selectItem( itemSelector, WndBag.Mode.WEAPON, TXT_SELECT_WEAPON );
|
||||
curUser = hero;
|
||||
GameScene.selectItem( itemSelector, WndBag.Mode.WEAPON, TXT_SELECT_WEAPON );
|
||||
|
||||
} else {
|
||||
} else {
|
||||
|
||||
super.execute( hero, action );
|
||||
super.execute( hero, action );
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUpgradable() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isUpgradable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isIdentified() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isIdentified() {
|
||||
return true;
|
||||
}
|
||||
|
||||
private void apply( Weapon weapon, boolean forSpeed ) {
|
||||
private void apply( Weapon weapon, boolean forSpeed ) {
|
||||
|
||||
detach( curUser.belongings.backpack );
|
||||
detach( curUser.belongings.backpack );
|
||||
|
||||
if (forSpeed) {
|
||||
weapon.imbue = Weapon.Imbue.LIGHT;
|
||||
GLog.p( TXT_LIGHT, weapon.name() );
|
||||
} else {
|
||||
weapon.imbue = Weapon.Imbue.HEAVY;
|
||||
GLog.p( TXT_HEAVY, weapon.name() );
|
||||
}
|
||||
if (forSpeed) {
|
||||
weapon.imbue = Weapon.Imbue.LIGHT;
|
||||
GLog.p( TXT_LIGHT, weapon.name() );
|
||||
} else {
|
||||
weapon.imbue = Weapon.Imbue.HEAVY;
|
||||
GLog.p( TXT_HEAVY, weapon.name() );
|
||||
}
|
||||
|
||||
curUser.sprite.operate( curUser.pos );
|
||||
Sample.INSTANCE.play( Assets.SND_MISS );
|
||||
curUser.sprite.operate( curUser.pos );
|
||||
Sample.INSTANCE.play( Assets.SND_MISS );
|
||||
|
||||
curUser.spend( TIME_TO_APPLY );
|
||||
curUser.busy();
|
||||
}
|
||||
curUser.spend( TIME_TO_APPLY );
|
||||
curUser.busy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int price() {
|
||||
return 40 * quantity;
|
||||
}
|
||||
@Override
|
||||
public int price() {
|
||||
return 40 * quantity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String info() {
|
||||
return
|
||||
"Using a weightstone, you can balance your melee weapon to make it lighter or heavier, " +
|
||||
"increasing either speed or damage at the expense of the other.";
|
||||
}
|
||||
@Override
|
||||
public String info() {
|
||||
return
|
||||
"Using a weightstone, you can balance your melee weapon to make it lighter or heavier, " +
|
||||
"increasing either speed or damage at the expense of the other.";
|
||||
}
|
||||
|
||||
private final WndBag.Listener itemSelector = new WndBag.Listener() {
|
||||
@Override
|
||||
public void onSelect( Item item ) {
|
||||
if (item != null) {
|
||||
GameScene.show( new WndBalance( (Weapon)item ) );
|
||||
}
|
||||
}
|
||||
};
|
||||
private final WndBag.Listener itemSelector = new WndBag.Listener() {
|
||||
@Override
|
||||
public void onSelect( Item item ) {
|
||||
if (item != null) {
|
||||
GameScene.show( new WndBalance( (Weapon)item ) );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public class WndBalance extends Window {
|
||||
public class WndBalance extends Window {
|
||||
|
||||
private static final String TXT_CHOICE = "How would you like to balance your %s?";
|
||||
private static final String TXT_CHOICE = "How would you like to balance your %s?";
|
||||
|
||||
private static final String TXT_LIGHT = "Lighter";
|
||||
private static final String TXT_HEAVY = "Heavier";
|
||||
private static final String TXT_CANCEL = "Never mind";
|
||||
private static final String TXT_LIGHT = "Lighter";
|
||||
private static final String TXT_HEAVY = "Heavier";
|
||||
private static final String TXT_CANCEL = "Never mind";
|
||||
|
||||
private static final int WIDTH = 120;
|
||||
private static final int MARGIN = 2;
|
||||
private static final int BUTTON_WIDTH = WIDTH - MARGIN * 2;
|
||||
private static final int BUTTON_HEIGHT = 20;
|
||||
private static final int WIDTH = 120;
|
||||
private static final int MARGIN = 2;
|
||||
private static final int BUTTON_WIDTH = WIDTH - MARGIN * 2;
|
||||
private static final int BUTTON_HEIGHT = 20;
|
||||
|
||||
public WndBalance( final Weapon weapon ) {
|
||||
super();
|
||||
public WndBalance( final Weapon weapon ) {
|
||||
super();
|
||||
|
||||
IconTitle titlebar = new IconTitle( weapon );
|
||||
titlebar.setRect( 0, 0, WIDTH, 0 );
|
||||
add( titlebar );
|
||||
IconTitle titlebar = new IconTitle( weapon );
|
||||
titlebar.setRect( 0, 0, WIDTH, 0 );
|
||||
add( titlebar );
|
||||
|
||||
BitmapTextMultiline tfMesage = PixelScene.createMultiline( Utils.format( TXT_CHOICE, weapon.name() ), 8 );
|
||||
tfMesage.maxWidth = WIDTH - MARGIN * 2;
|
||||
tfMesage.measure();
|
||||
tfMesage.x = MARGIN;
|
||||
tfMesage.y = titlebar.bottom() + MARGIN;
|
||||
add( tfMesage );
|
||||
BitmapTextMultiline tfMesage = PixelScene.createMultiline( Utils.format( TXT_CHOICE, weapon.name() ), 8 );
|
||||
tfMesage.maxWidth = WIDTH - MARGIN * 2;
|
||||
tfMesage.measure();
|
||||
tfMesage.x = MARGIN;
|
||||
tfMesage.y = titlebar.bottom() + MARGIN;
|
||||
add( tfMesage );
|
||||
|
||||
float pos = tfMesage.y + tfMesage.height();
|
||||
float pos = tfMesage.y + tfMesage.height();
|
||||
|
||||
if (weapon.imbue != Weapon.Imbue.LIGHT) {
|
||||
RedButton btnSpeed = new RedButton( TXT_LIGHT ) {
|
||||
@Override
|
||||
protected void onClick() {
|
||||
hide();
|
||||
Weightstone.this.apply( weapon, true );
|
||||
}
|
||||
};
|
||||
btnSpeed.setRect( MARGIN, pos + MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT );
|
||||
add( btnSpeed );
|
||||
if (weapon.imbue != Weapon.Imbue.LIGHT) {
|
||||
RedButton btnSpeed = new RedButton( TXT_LIGHT ) {
|
||||
@Override
|
||||
protected void onClick() {
|
||||
hide();
|
||||
Weightstone.this.apply( weapon, true );
|
||||
}
|
||||
};
|
||||
btnSpeed.setRect( MARGIN, pos + MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT );
|
||||
add( btnSpeed );
|
||||
|
||||
pos = btnSpeed.bottom();
|
||||
}
|
||||
pos = btnSpeed.bottom();
|
||||
}
|
||||
|
||||
if (weapon.imbue != Weapon.Imbue.HEAVY) {
|
||||
RedButton btnAccuracy = new RedButton( TXT_HEAVY ) {
|
||||
@Override
|
||||
protected void onClick() {
|
||||
hide();
|
||||
Weightstone.this.apply( weapon, false );
|
||||
}
|
||||
};
|
||||
btnAccuracy.setRect( MARGIN, pos + MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT );
|
||||
add( btnAccuracy );
|
||||
if (weapon.imbue != Weapon.Imbue.HEAVY) {
|
||||
RedButton btnAccuracy = new RedButton( TXT_HEAVY ) {
|
||||
@Override
|
||||
protected void onClick() {
|
||||
hide();
|
||||
Weightstone.this.apply( weapon, false );
|
||||
}
|
||||
};
|
||||
btnAccuracy.setRect( MARGIN, pos + MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT );
|
||||
add( btnAccuracy );
|
||||
|
||||
pos = btnAccuracy.bottom();
|
||||
}
|
||||
pos = btnAccuracy.bottom();
|
||||
}
|
||||
|
||||
RedButton btnCancel = new RedButton( TXT_CANCEL ) {
|
||||
@Override
|
||||
protected void onClick() {
|
||||
hide();
|
||||
}
|
||||
};
|
||||
btnCancel.setRect( MARGIN, pos + MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT );
|
||||
add( btnCancel );
|
||||
RedButton btnCancel = new RedButton( TXT_CANCEL ) {
|
||||
@Override
|
||||
protected void onClick() {
|
||||
hide();
|
||||
}
|
||||
};
|
||||
btnCancel.setRect( MARGIN, pos + MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT );
|
||||
add( btnCancel );
|
||||
|
||||
resize( WIDTH, (int)btnCancel.bottom() + MARGIN );
|
||||
}
|
||||
resize( WIDTH, (int)btnCancel.bottom() + MARGIN );
|
||||
}
|
||||
|
||||
protected void onSelect( int index ) {};
|
||||
}
|
||||
protected void onSelect( int index ) {};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user