v0.9.4: initial implementation of unblessed ankh changes, missing polish

This commit is contained in:
Evan Debenham 2021-07-25 20:41:50 -04:00
parent 1ee6a0f993
commit 12fa719716
22 changed files with 215 additions and 146 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -236,6 +236,9 @@ actors.buffs.momentum.momentum_desc=As he moves, the Freerunner builds momentum,
actors.buffs.momentum.running_desc=As he moves, the Freerunner builds momentum, which he can spend to start freerunning.\n\nWhile freerunning, the Freerunner moves at double speed and gains bonus evasion based on his level.\n\nTurns remaining: %d.
actors.buffs.momentum.resting_desc=As he moves, the Freerunner builds momentum, which he can spend to start freerunning.\n\nThe Freerunner needs time to regain his stamina before building momentum again.\n\nTurns remaining: %d.
actors.buffs.noinventory.name=Lost Inventory
actors.buffs.noinventory.desc=TODO
actors.buffs.ooze.name=Caustic ooze
actors.buffs.ooze.heromsg=Caustic ooze eats your flesh. Wash it away!
actors.buffs.ooze.ondeath=You melt away...

View File

@ -1713,6 +1713,9 @@ items.liquidmetal.already_fixed=That thrown weapon is already in perfect conditi
items.liquidmetal.apply=You use %d liquid metal to repair your thrown weapon.
items.liquidmetal.desc=When poured over a thrown weapon, this magical liquid will fill into the cracks and tears from use, restoring the thrown weapon to perfect condition!\n\nA tier 1 weapon requires 10 liquid metal to be fully repaired, a tier 5 weapon requires 30. Each upgrade also doubles the amount of metal needed.\n\nLiquid metal cannot be used to repair the tips on tipped darts.
items.lostbackpack.name=lost backpack
items.lostbackpack.desc=TODO
items.merchantsbeacon.name=merchant's beacon
items.merchantsbeacon.ac_use=USE
items.merchantsbeacon.desc=This odd piece of dwarven technology allows you to communicate from great distances.\n\nAfter being activated, this beacon will let you sell items to Pixel Mart from anywhere in the dungeon.\n\nHowever, the magic within the beacon will only last for one session, so use it wisely.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -68,6 +68,7 @@ import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.ui.QuickSlotButton;
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
import com.shatteredpixel.shatteredpixeldungeon.utils.DungeonSeed;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndResurrect;
import com.watabou.noosa.Game;
import com.watabou.utils.Bundlable;
import com.watabou.utils.Bundle;
@ -525,7 +526,7 @@ public class Dungeon {
}
public static void saveAll() throws IOException {
if (hero != null && hero.isAlive()) {
if (hero != null && (hero.isAlive() || WndResurrect.instance != null)) {
Actor.fixTime();
saveGame( GamesInProgress.curSlot );

View File

@ -0,0 +1,27 @@
package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
public class LostInventory extends Buff {
{
type = buffType.NEGATIVE;
}
@Override
public int icon() {
return BuffIndicator.NOINV;
}
@Override
public String toString() {
return Messages.get(this, "name");
}
@Override
public String desc() {
return Messages.get(this, "desc");
}
}

View File

@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.hero;
import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.GamesInProgress;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LostInventory;
import com.shatteredpixel.shatteredpixeldungeon.items.EquipableItem;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon;
@ -31,7 +32,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClassArmor;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.Artifact;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag;
import com.shatteredpixel.shatteredpixeldungeon.items.keys.Key;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRemoveCurse;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand;
@ -47,6 +47,7 @@ public class Belongings implements Iterable<Item> {
public Bag backpack;
//FIXME these need accessor methods so they can work in conjunction with the lost inventory debuff =I
public KindOfWeapon weapon = null;
public Armor armor = null;
public Artifact artifact = null;
@ -152,10 +153,27 @@ public class Belongings implements Iterable<Item> {
info.armorTier = 0;
}
}
//ignores lost inventory debuff
public ArrayList<Bag> getBags(){
ArrayList<Bag> result = new ArrayList<>();
result.add(backpack);
for (Item i : this){
if (i instanceof Bag){
result.add((Bag)i);
}
}
return result;
}
@SuppressWarnings("unchecked")
public<T extends Item> T getItem( Class<T> itemClass ) {
if (owner != null && owner.buff(LostInventory.class) != null) return null;
for (Item item : this) {
if (itemClass.isInstance( item )) {
return (T)item;
@ -168,6 +186,8 @@ public class Belongings implements Iterable<Item> {
public<T extends Item> ArrayList<T> getAllItems( Class<T> itemClass ) {
ArrayList<T> result = new ArrayList<>();
if (owner != null && owner.buff(LostInventory.class) != null) return result;
for (Item item : this) {
if (itemClass.isInstance( item )) {
result.add((T) item);
@ -178,6 +198,8 @@ public class Belongings implements Iterable<Item> {
}
public boolean contains( Item contains ){
if (owner != null && owner.buff(LostInventory.class) != null) return false;
for (Item item : this) {
if (contains == item ) {
@ -189,6 +211,8 @@ public class Belongings implements Iterable<Item> {
}
public Item getSimilar( Item similar ){
if (owner != null && owner.buff(LostInventory.class) != null) return null;
for (Item item : this) {
if (similar != item && similar.isSimilar(item)) {
@ -201,6 +225,8 @@ public class Belongings implements Iterable<Item> {
public ArrayList<Item> getAllSimilar( Item similar ){
ArrayList<Item> result = new ArrayList<>();
if (owner != null && owner.buff(LostInventory.class) != null) return result;
for (Item item : this) {
if (item != similar && similar.isSimilar(item)) {
@ -253,49 +279,6 @@ public class Belongings implements Iterable<Item> {
return Random.element( backpack.items );
}
public void resurrect( int depth ) {
for (Item item : backpack.items.toArray( new Item[0])) {
if (item instanceof Key) {
if (((Key)item).depth == depth) {
item.detachAll( backpack );
}
} else if (item.unique) {
item.detachAll(backpack);
//you keep the bag itself, not its contents.
if (item instanceof Bag){
((Bag)item).resurrect();
}
item.collect();
} else if (!item.isEquipped( owner )) {
item.detachAll( backpack );
}
}
if (weapon != null) {
weapon.cursed = false;
weapon.activate( owner );
}
if (armor != null) {
armor.cursed = false;
armor.activate( owner );
}
if (artifact != null) {
artifact.cursed = false;
artifact.activate( owner );
}
if (misc != null) {
misc.cursed = false;
misc.activate( owner );
}
if (ring != null) {
ring.cursed = false;
ring.activate( owner );
}
}
public int charge( float charge ) {
int count = 0;

View File

@ -47,6 +47,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Fury;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.HoldFast;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LostInventory;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MindVision;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Momentum;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis;
@ -378,6 +379,9 @@ public class Hero extends Char {
}
public void live() {
for (Buff b : buffs()){
b.detach();
}
Buff.affect( this, Regeneration.class );
Buff.affect( this, Hunger.class );
}
@ -1596,7 +1600,7 @@ public class Hero extends Char {
}
@Override
public void die( Object cause ) {
public void die( Object cause ) {
curAction = null;
@ -1611,49 +1615,43 @@ public class Hero extends Char {
}
}
if (ankh != null && ankh.isBlessed()) {
this.HP = HT/4;
PotionOfHealing.cure(this);
Buff.prolong(this, AnkhInvulnerability.class, AnkhInvulnerability.DURATION);
if (ankh != null) {
ankh.detach(belongings.backpack);
SpellSprite.show(this, SpellSprite.ANKH);
GameScene.flash(0x80FFFF40);
Sample.INSTANCE.play( Assets.Sounds.TELEPORT );
GLog.w( Messages.get(this, "revive") );
Statistics.ankhsUsed++;
for (Char ch : Actor.chars()){
if (ch instanceof DriedRose.GhostHero){
((DriedRose.GhostHero) ch).sayAnhk();
return;
}
}
if (ankh.isBlessed()) {
this.HP = HT / 4;
PotionOfHealing.cure(this);
Buff.prolong(this, AnkhInvulnerability.class, AnkhInvulnerability.DURATION);
SpellSprite.show(this, SpellSprite.ANKH);
GameScene.flash(0x80FFFF40);
Sample.INSTANCE.play(Assets.Sounds.TELEPORT);
GLog.w(Messages.get(this, "revive"));
Statistics.ankhsUsed++;
for (Char ch : Actor.chars()) {
if (ch instanceof DriedRose.GhostHero) {
((DriedRose.GhostHero) ch).sayAnhk();
return;
}
}
} else {
Game.runOnRenderThread(new Callback() {
@Override
public void call() {
GameScene.show( new WndResurrect() );
}
});
}
return;
}
Actor.fixTime();
super.die( cause );
if (ankh == null) {
reallyDie( cause );
} else {
Dungeon.deleteGame( GamesInProgress.curSlot, false );
final Ankh finalAnkh = ankh;
Game.runOnRenderThread(new Callback() {
@Override
public void call() {
GameScene.show( new WndResurrect( finalAnkh, cause ) );
}
});
}
reallyDie( cause );
}
public static void reallyDie( Object cause ) {
@ -1983,15 +1981,13 @@ public class Hero extends Char {
return smthFound;
}
public void resurrect( int resetLevel ) {
public void resurrect() {
HP = HT;
Dungeon.gold = 0;
exp = 0;
belongings.resurrect( resetLevel );
live();
Buff.affect(this, LostInventory.class);
Buff.affect(this, Invisibility.class, 3f);
//lost inventory is dropped in interlevelscene
}
@Override

View File

@ -231,8 +231,9 @@ public class Generator {
return i;
}
}
return item instanceof Bag ? Integer.MAX_VALUE : Integer.MAX_VALUE - 1;
//items without a category-defined order are sorted based on the spritesheet
return Short.MAX_VALUE+item.image();
}
static {

View File

@ -181,8 +181,17 @@ public class Item implements Bundlable {
return true;
}
if (!container.canHold(this)){
GLog.n( Messages.get(Item.class, "pack_full", container.name()) );
return false;
}
ArrayList<Item> items = container.items;
if (items.contains( this )) {
return true;
}
for (Item item:items) {
if (item instanceof Bag && ((Bag)item).canHold( this )) {
if (collect( (Bag)item )){
@ -190,15 +199,6 @@ public class Item implements Bundlable {
}
}
}
if (!container.canHold(this)){
GLog.n( Messages.get(Item.class, "pack_full", container.name()) );
return false;
}
if (items.contains( this )) {
return true;
}
if (stackable) {
for (Item item:items) {

View File

@ -0,0 +1,28 @@
package com.shatteredpixel.shatteredpixeldungeon.items;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LostInventory;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.noosa.audio.Sample;
public class LostBackpack extends Item {
{
image = ItemSpriteSheet.BACKPACK;
unique = true;
}
@Override
public boolean doPickUp(Hero hero) {
if (hero.buff(LostInventory.class) != null){
hero.buff(LostInventory.class).detach();
}
Item.updateQuickslot();
Sample.INSTANCE.play( Assets.Sounds.DEWDROP );
hero.spendAndNext(TIME_TO_PICK_UP);
return true;
}
}

View File

@ -24,6 +24,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.bags;
import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LostInventory;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
@ -140,12 +141,18 @@ public class Bag extends Item implements Iterable<Item> {
bundle.put( ITEMS, items );
}
//temp variable so that bags can load contents even with lost inventory debuff
private boolean loading;
@Override
public void restoreFromBundle( Bundle bundle ) {
super.restoreFromBundle( bundle );
loading = true;
for (Bundlable item : bundle.getCollection( ITEMS )) {
if (item != null) ((Item)item).collect( this );
}
loading = false;
}
public boolean contains( Item item ) {
@ -160,6 +167,10 @@ public class Bag extends Item implements Iterable<Item> {
}
public boolean canHold( Item item ){
if (!loading && owner != null && owner.buff(LostInventory.class) != null){
return false;
}
if (items.contains(item) || item instanceof Bag || items.size() < capacity()){
return true;
} else if (item.stackable) {

View File

@ -97,6 +97,7 @@ import com.shatteredpixel.shatteredpixeldungeon.windows.WndInfoPlant;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndInfoTrap;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndMessage;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndResurrect;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndStory;
import com.watabou.glwrap.Blending;
import com.watabou.noosa.Camera;
@ -360,8 +361,9 @@ public class GameScene extends PixelScene {
switch (InterlevelScene.mode) {
case RESURRECT:
ScrollOfTeleportation.appear( Dungeon.hero, Dungeon.level.entrance );
new Flare( 8, 32 ).color( 0xFFFF66, true ).show( hero, 2f ) ;
ScrollOfTeleportation.appear( Dungeon.hero, Dungeon.hero.pos );
SpellSprite.show(Dungeon.hero, SpellSprite.ANKH);
new Flare( 5, 16 ).color( 0xFFFF00, true ).show( hero, 6f ) ;
break;
case RETURN:
ScrollOfTeleportation.appear( Dungeon.hero, Dungeon.hero.pos );
@ -528,6 +530,11 @@ public class GameScene extends PixelScene {
fadeIn();
//assume the hero died with an ankh
if (!Dungeon.hero.isAlive()){
add(new WndResurrect());
}
}
public void destroy() {

View File

@ -30,6 +30,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Statistics;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.items.LostBackpack;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.features.Chasm;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.SpecialRoom;
@ -40,6 +41,7 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.Icons;
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock;
import com.shatteredpixel.shatteredpixeldungeon.ui.StyledButton;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndError;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndStory;
import com.watabou.gltextures.TextureCache;
@ -439,19 +441,32 @@ public class InterlevelScene extends PixelScene {
}
}
private void resurrect() throws IOException {
private void resurrect() {
Mob.holdAllies( Dungeon.level );
Level level;
if (Dungeon.level.locked) {
Dungeon.hero.resurrect( Dungeon.depth );
Dungeon.hero.resurrect();
Dungeon.depth--;
Level level = Dungeon.newLevel();
Dungeon.switchLevel( level, level.entrance );
level = Dungeon.newLevel();
Dungeon.hero.pos = level.randomRespawnCell(Dungeon.hero);
level.drop(new LostBackpack(), level.randomRespawnCell(null));
} else {
Dungeon.hero.resurrect( -1 );
Dungeon.resetLevel();
Dungeon.hero.resurrect();
level = Dungeon.level;
BArray.setFalse(level.visited);
BArray.setFalse(level.mapped);
int invPos = Dungeon.hero.pos;
int tries = 0;
do {
Dungeon.hero.pos = level.randomRespawnCell(Dungeon.hero);
tries++;
} while (level.trueDistance(invPos, Dungeon.hero.pos) <= 30 - (tries/10));
level.drop(new LostBackpack(), invPos);
}
Dungeon.switchLevel( level, Dungeon.hero.pos );
}
private void reset() throws IOException {

View File

@ -673,13 +673,15 @@ public class ItemSpriteSheet {
private static final int BAGS = xy(1, 31); //16 slots
public static final int WATERSKIN = BAGS+0;
public static final int POUCH = BAGS+1;
public static final int HOLDER = BAGS+2;
public static final int BANDOLIER = BAGS+3;
public static final int HOLSTER = BAGS+4;
public static final int VIAL = BAGS+5;
public static final int BACKPACK = BAGS+1;
public static final int POUCH = BAGS+2;
public static final int HOLDER = BAGS+3;
public static final int BANDOLIER = BAGS+4;
public static final int HOLSTER = BAGS+5;
public static final int VIAL = BAGS+6;
static{
assignItemRect(WATERSKIN, 16, 14);
assignItemRect(BACKPACK, 16, 16);
assignItemRect(POUCH, 14, 15);
assignItemRect(HOLDER, 16, 16);
assignItemRect(BANDOLIER, 15, 16);

View File

@ -99,6 +99,7 @@ public class BuffIndicator extends Component {
public static final int UPGRADE = 50;
public static final int MOMENTUM = 51;
public static final int ANKH = 52;
public static final int NOINV = 53;
public static final int SIZE = 7;

View File

@ -25,6 +25,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.SPDAction;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LostInventory;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
@ -215,7 +216,7 @@ public class QuickSlotButton extends Button {
}
private void enableSlot() {
slot.enable(Dungeon.quickslot.isNonePlaceholder( slotNum ));
slot.enable(Dungeon.quickslot.isNonePlaceholder( slotNum ) && Dungeon.hero.buff(LostInventory.class) == null);
}
public static void useTargeting(int idx){

View File

@ -24,6 +24,7 @@ package com.shatteredpixel.shatteredpixeldungeon.windows;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.SPDAction;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LostInventory;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Belongings;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.EquipableItem;
@ -129,15 +130,7 @@ public class WndBag extends WndTabbed {
resize( windowWidth, windowHeight );
Belongings stuff = Dungeon.hero.belongings;
Bag[] bags = {
stuff.backpack,
stuff.getItem( VelvetPouch.class ),
stuff.getItem( ScrollHolder.class ),
stuff.getItem( PotionBandolier.class ),
stuff.getItem( MagicalHolster.class )};
for (Bag b : bags) {
for (Bag b : Dungeon.hero.belongings.getBags()) {
if (b != null) {
BagTab tab = new BagTab( b );
add( tab );
@ -393,8 +386,10 @@ public class WndBag extends WndTabbed {
if (item.name() == null) {
enable( false );
} else if (selector != null) {
enable(selector.itemSelectable(item));
} else if (selector != null && !selector.itemSelectable(item)) {
enable(false);
} else if (Dungeon.hero.buff(LostInventory.class) != null){
enable(false);
}
} else {
bg.color( NORMAL );

View File

@ -3,7 +3,7 @@ package com.shatteredpixel.shatteredpixeldungeon.windows;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Chrome;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.QuickSlot;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LostInventory;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
import com.shatteredpixel.shatteredpixeldungeon.items.EquipableItem;
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
@ -198,6 +198,10 @@ public class WndQuickBag extends Window {
}
}
if (Dungeon.hero.buff(LostInventory.class) != null){
enable(false); //TODO enable when hero has selected this item to keep
}
} else {
bg.color(NORMAL);
}
@ -215,7 +219,7 @@ public class WndQuickBag extends Window {
@Override
protected void onClick() {
if (Dungeon.hero == null || !Dungeon.hero.isAlive()){
if (Dungeon.hero == null || !Dungeon.hero.isAlive() || !Dungeon.hero.belongings.contains(item)){
Game.scene().addToFront(new WndUseItem(WndQuickBag.this, item));
return;
}

View File

@ -21,10 +21,12 @@
package com.shatteredpixel.shatteredpixeldungeon.windows;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.Rankings;
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.Ankh;
import com.shatteredpixel.shatteredpixeldungeon.items.LostBackpack;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.InterlevelScene;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
@ -41,14 +43,14 @@ public class WndResurrect extends Window {
private static final float GAP = 2;
public static WndResurrect instance;
public static Object causeOfDeath;
public WndResurrect( final Ankh ankh, Object causeOfDeath ) {
public WndResurrect() {
super();
instance = this;
WndResurrect.causeOfDeath = causeOfDeath;
Ankh ankh = new Ankh();
IconTitle titlebar = new IconTitle();
titlebar.icon( new ItemSprite( ankh.image(), null ) );
@ -56,7 +58,7 @@ public class WndResurrect extends Window {
titlebar.setRect( 0, 0, WIDTH, 0 );
add( titlebar );
RenderedTextBlock message = PixelScene.renderTextBlock( Messages.get(this, "message"), 6 );
RenderedTextBlock message = PixelScene.renderTextBlock( "TODO, need to add item selection here. Atm we just revive and all equipped items work", 6 );
message.maxWidth(WIDTH);
message.setPos(0, titlebar.bottom() + GAP);
add( message );
@ -74,20 +76,8 @@ public class WndResurrect extends Window {
};
btnYes.setRect( 0, message.top() + message.height() + GAP, WIDTH, BTN_HEIGHT );
add( btnYes );
RedButton btnNo = new RedButton( Messages.get(this, "no") ) {
@Override
protected void onClick() {
hide();
Hero.reallyDie( WndResurrect.causeOfDeath );
Rankings.INSTANCE.submit( false, WndResurrect.causeOfDeath.getClass() );
}
};
btnNo.setRect( 0, btnYes.bottom() + GAP, WIDTH, BTN_HEIGHT );
add( btnNo );
resize( WIDTH, (int)btnNo.bottom() );
resize( WIDTH, (int)btnYes.bottom() );
}
@Override

View File

@ -38,9 +38,10 @@ public class WndUseItem extends WndInfoItem {
super(item);
float y = height + GAP;
float y = height;
if (Dungeon.hero.isAlive()) {
if (Dungeon.hero.isAlive() && Dungeon.hero.belongings.contains(item)) {
y += GAP;
ArrayList<RedButton> buttons = new ArrayList<>();
for (final String action : item.actions( Dungeon.hero )) {