v0.3.1: rings and artifacts can now be switched around more easily with two full misc slots
This commit is contained in:
parent
e033cfb4d9
commit
98eb2052bf
|
@ -21,6 +21,7 @@
|
|||
package com.shatteredpixel.shatteredpixeldungeon.items.artifacts;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
|
@ -28,6 +29,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.items.KindofMisc;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions;
|
||||
import com.watabou.utils.Bundle;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
|
@ -42,6 +44,10 @@ public class Artifact extends KindofMisc {
|
|||
private static final String TXT_TO_STRING_LVL = "%s%+d";
|
||||
private static final String TXT_TO_STRING_LVL_CHARGE = "%s%+d (%d/%d)";
|
||||
|
||||
private static final String TXT_UNEQUIP_TITLE = "Unequip one item";
|
||||
private static final String TXT_UNEQUIP_MESSAGE =
|
||||
"You can only wear two misc items at a time.";
|
||||
|
||||
protected Buff passiveBuff;
|
||||
protected Buff activeBuff;
|
||||
|
||||
|
@ -76,19 +82,42 @@ public class Artifact extends KindofMisc {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean doEquip( Hero hero ) {
|
||||
public boolean doEquip( final Hero hero ) {
|
||||
|
||||
if (hero.belongings.misc1 != null && hero.belongings.misc2 != null) {
|
||||
|
||||
GLog.w("you can only wear 2 misc items at a time");
|
||||
return false;
|
||||
|
||||
} else if ((hero.belongings.misc1 != null && hero.belongings.misc1.getClass() == this.getClass())
|
||||
if ((hero.belongings.misc1 != null && hero.belongings.misc1.getClass() == this.getClass())
|
||||
|| (hero.belongings.misc2 != null && hero.belongings.misc2.getClass() == this.getClass())){
|
||||
|
||||
GLog.w("you cannot wear two of the same artifact");
|
||||
return false;
|
||||
|
||||
} else if (hero.belongings.misc1 != null && hero.belongings.misc2 != null) {
|
||||
|
||||
final KindofMisc m1 = hero.belongings.misc1;
|
||||
final KindofMisc m2 = hero.belongings.misc2;
|
||||
final Artifact art = this;
|
||||
|
||||
ShatteredPixelDungeon.scene().add(
|
||||
new WndOptions(TXT_UNEQUIP_TITLE, TXT_UNEQUIP_MESSAGE,
|
||||
Utils.capitalize(m1.toString()),
|
||||
Utils.capitalize(m2.toString())) {
|
||||
|
||||
@Override
|
||||
protected void onSelect(int index) {
|
||||
|
||||
KindofMisc equipped = (index == 0 ? m1 : m2);
|
||||
if (equipped.doUnequip(hero, true, false)) {
|
||||
int slot = Dungeon.quickslot.getSlot( art );
|
||||
doEquip(hero);
|
||||
if (slot != -1) {
|
||||
Dungeon.quickslot.setSlot( slot, art );
|
||||
updateQuickslot();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
|
||||
} else {
|
||||
|
||||
if (hero.belongings.misc1 == null) {
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.util.ArrayList;
|
|||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.KindofMisc;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
|
@ -33,6 +34,8 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.items.ItemStatusHandler;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions;
|
||||
import com.watabou.utils.Bundle;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
|
@ -45,6 +48,10 @@ public class Ring extends KindofMisc {
|
|||
private static final String TXT_IDENTIFY =
|
||||
"you are now familiar enough with your %s to identify it. It is %s.";
|
||||
|
||||
private static final String TXT_UNEQUIP_TITLE = "Unequip one item";
|
||||
private static final String TXT_UNEQUIP_MESSAGE =
|
||||
"You can only wear two misc items at a time.";
|
||||
|
||||
protected Buff buff;
|
||||
|
||||
private static final Class<?>[] rings = {
|
||||
|
@ -114,11 +121,28 @@ public class Ring extends KindofMisc {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean doEquip( Hero hero ) {
|
||||
public boolean doEquip( final Hero hero ) {
|
||||
|
||||
if (hero.belongings.misc1 != null && hero.belongings.misc2 != null) {
|
||||
|
||||
GLog.w( "you can only wear 2 misc items at a time" );
|
||||
final KindofMisc m1 = hero.belongings.misc1;
|
||||
final KindofMisc m2 = hero.belongings.misc2;
|
||||
|
||||
ShatteredPixelDungeon.scene().add(
|
||||
new WndOptions(TXT_UNEQUIP_TITLE, TXT_UNEQUIP_MESSAGE,
|
||||
Utils.capitalize(m1.toString()),
|
||||
Utils.capitalize(m2.toString())) {
|
||||
|
||||
@Override
|
||||
protected void onSelect(int index) {
|
||||
|
||||
KindofMisc equipped = (index == 0 ? m1 : m2);
|
||||
if (equipped.doUnequip(hero, true, false)) {
|
||||
doEquip(hero);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue
Block a user