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
@@ -26,84 +26,84 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShadowParticle
public abstract class EquipableItem extends Item {
private static final String TXT_UNEQUIP_CURSED = "You can't remove cursed %s!";
private static final String TXT_UNEQUIP_CURSED = "You can't remove cursed %s!";
public static final String AC_EQUIP = "EQUIP";
public static final String AC_UNEQUIP = "UNEQUIP";
public static final String AC_EQUIP = "EQUIP";
public static final String AC_UNEQUIP = "UNEQUIP";
{
bones = true;
}
{
bones = true;
}
@Override
public void execute( Hero hero, String action ) {
if (action.equals( AC_EQUIP )) {
//In addition to equipping itself, item reassigns itself to the quickslot
//This is a special case as the item is being removed from inventory, but is staying with the hero.
int slot = Dungeon.quickslot.getSlot( this );
doEquip(hero);
if (slot != -1) {
Dungeon.quickslot.setSlot( slot, this );
updateQuickslot();
}
} else if (action.equals( AC_UNEQUIP )) {
doUnequip( hero, true );
} else {
super.execute( hero, action );
}
}
@Override
public void execute( Hero hero, String action ) {
if (action.equals( AC_EQUIP )) {
//In addition to equipping itself, item reassigns itself to the quickslot
//This is a special case as the item is being removed from inventory, but is staying with the hero.
int slot = Dungeon.quickslot.getSlot( this );
doEquip(hero);
if (slot != -1) {
Dungeon.quickslot.setSlot( slot, this );
updateQuickslot();
}
} else if (action.equals( AC_UNEQUIP )) {
doUnequip( hero, true );
} else {
super.execute( hero, action );
}
}
@Override
public void doDrop( Hero hero ) {
if (!isEquipped( hero ) || doUnequip( hero, false, false )) {
super.doDrop( hero );
}
}
@Override
public void doDrop( Hero hero ) {
if (!isEquipped( hero ) || doUnequip( hero, false, false )) {
super.doDrop( hero );
}
}
@Override
public void cast( final Hero user, int dst ) {
@Override
public void cast( final Hero user, int dst ) {
if (isEquipped( user )) {
if (quantity == 1 && !this.doUnequip( user, false, false )) {
return;
}
}
if (isEquipped( user )) {
if (quantity == 1 && !this.doUnequip( user, false, false )) {
return;
}
}
super.cast( user, dst );
}
super.cast( user, dst );
}
public static void equipCursed( Hero hero ) {
hero.sprite.emitter().burst( ShadowParticle.CURSE, 6 );
Sample.INSTANCE.play( Assets.SND_CURSED );
}
public static void equipCursed( Hero hero ) {
hero.sprite.emitter().burst( ShadowParticle.CURSE, 6 );
Sample.INSTANCE.play( Assets.SND_CURSED );
}
protected float time2equip( Hero hero ) {
return 1;
}
protected float time2equip( Hero hero ) {
return 1;
}
public abstract boolean doEquip( Hero hero );
public abstract boolean doEquip( Hero hero );
public boolean doUnequip( Hero hero, boolean collect, boolean single ) {
public boolean doUnequip( Hero hero, boolean collect, boolean single ) {
if (cursed) {
GLog.w(TXT_UNEQUIP_CURSED, name());
return false;
}
if (cursed) {
GLog.w(TXT_UNEQUIP_CURSED, name());
return false;
}
if (single) {
hero.spendAndNext( time2equip( hero ) );
} else {
hero.spend( time2equip( hero ) );
}
if (single) {
hero.spendAndNext( time2equip( hero ) );
} else {
hero.spend( time2equip( hero ) );
}
if (collect && !collect( hero.belongings.backpack )) {
Dungeon.level.drop( this, hero.pos );
}
if (collect && !collect( hero.belongings.backpack )) {
Dungeon.level.drop( this, hero.pos );
}
return true;
}
return true;
}
final public boolean doUnequip( Hero hero, boolean collect ) {
return doUnequip( hero, collect, true );
}
final public boolean doUnequip( Hero hero, boolean collect ) {
return doUnequip( hero, collect, true );
}
}