Search in sources :

Example 1 with SkeletonKey

use of com.shatteredpixel.shatteredpixeldungeon.items.keys.SkeletonKey in project shattered-pixel-dungeon-gdx by 00-Evan.

the class Yog method die.

@SuppressWarnings("unchecked")
@Override
public void die(Object cause) {
    for (Mob mob : (Iterable<Mob>) Dungeon.level.mobs.clone()) {
        if (mob instanceof BurningFist || mob instanceof RottingFist) {
            mob.die(cause);
        }
    }
    GameScene.bossSlain();
    Dungeon.level.drop(new SkeletonKey(Dungeon.depth), pos).sprite.drop();
    super.die(cause);
    yell(Messages.get(this, "defeated"));
}
Also used : SkeletonKey(com.shatteredpixel.shatteredpixeldungeon.items.keys.SkeletonKey)

Example 2 with SkeletonKey

use of com.shatteredpixel.shatteredpixeldungeon.items.keys.SkeletonKey in project shattered-pixel-dungeon-gdx by 00-Evan.

the class King method die.

@Override
public void die(Object cause) {
    GameScene.bossSlain();
    Dungeon.level.drop(new ArmorKit(), pos).sprite.drop();
    Dungeon.level.drop(new SkeletonKey(Dungeon.depth), pos).sprite.drop();
    super.die(cause);
    Badges.validateBossSlain();
    LloydsBeacon beacon = Dungeon.hero.belongings.getItem(LloydsBeacon.class);
    if (beacon != null) {
        beacon.upgrade();
    }
    yell(Messages.get(this, "defeated", Dungeon.hero.givenName()));
}
Also used : ArmorKit(com.shatteredpixel.shatteredpixeldungeon.items.ArmorKit) LloydsBeacon(com.shatteredpixel.shatteredpixeldungeon.items.artifacts.LloydsBeacon) SkeletonKey(com.shatteredpixel.shatteredpixeldungeon.items.keys.SkeletonKey)

Example 3 with SkeletonKey

use of com.shatteredpixel.shatteredpixeldungeon.items.keys.SkeletonKey in project shattered-pixel-dungeon-gdx by 00-Evan.

the class Belongings method restoreFromBundle.

public void restoreFromBundle(Bundle bundle) {
    // moving keys to Notes, for pre-0.6.1 saves
    if (bundle.contains("ironKeys")) {
        int[] ironKeys = bundle.getIntArray("ironKeys");
        for (int i = 0; i < ironKeys.length; i++) {
            if (ironKeys[i] > 0) {
                Notes.add((Key) new IronKey(i).quantity(ironKeys[i]));
            }
        }
    }
    if (bundle.contains("specialKeys")) {
        int[] specialKeys = bundle.getIntArray("specialKeys");
        for (int i = 0; i < specialKeys.length; i++) {
            if (specialKeys[i] > 0) {
                if (i % 5 == 0) {
                    Notes.add((Key) new SkeletonKey(i).quantity(specialKeys[i]));
                } else {
                    Notes.add((Key) new GoldenKey(i).quantity(specialKeys[i]));
                }
            }
        }
    }
    backpack.clear();
    backpack.restoreFromBundle(bundle);
    weapon = (KindOfWeapon) bundle.get(WEAPON);
    if (weapon != null) {
        weapon.activate(owner);
    }
    armor = (Armor) bundle.get(ARMOR);
    if (armor != null) {
        armor.activate(owner);
    }
    misc1 = (KindofMisc) bundle.get(MISC1);
    if (misc1 != null) {
        misc1.activate(owner);
    }
    misc2 = (KindofMisc) bundle.get(MISC2);
    if (misc2 != null) {
        misc2.activate(owner);
    }
}
Also used : GoldenKey(com.shatteredpixel.shatteredpixeldungeon.items.keys.GoldenKey) IronKey(com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey) SkeletonKey(com.shatteredpixel.shatteredpixeldungeon.items.keys.SkeletonKey)

Example 4 with SkeletonKey

use of com.shatteredpixel.shatteredpixeldungeon.items.keys.SkeletonKey in project shattered-pixel-dungeon-gdx by 00-Evan.

the class Hero method actUnlock.

private boolean actUnlock(HeroAction.Unlock action) {
    int doorCell = action.dst;
    if (Dungeon.level.adjacent(pos, doorCell)) {
        boolean hasKey = false;
        int door = Dungeon.level.map[doorCell];
        if (door == Terrain.LOCKED_DOOR && Notes.keyCount(new IronKey(Dungeon.depth)) > 0) {
            hasKey = true;
        } else if (door == Terrain.LOCKED_EXIT && Notes.keyCount(new SkeletonKey(Dungeon.depth)) > 0) {
            hasKey = true;
        }
        if (hasKey) {
            spend(Key.TIME_TO_UNLOCK);
            sprite.operate(doorCell);
            Sample.INSTANCE.play(Assets.SND_UNLOCK);
        } else {
            GLog.w(Messages.get(this, "locked_door"));
            ready();
        }
        return false;
    } else if (getCloser(doorCell)) {
        return true;
    } else {
        ready();
        return false;
    }
}
Also used : IronKey(com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey) SkeletonKey(com.shatteredpixel.shatteredpixeldungeon.items.keys.SkeletonKey)

Example 5 with SkeletonKey

use of com.shatteredpixel.shatteredpixeldungeon.items.keys.SkeletonKey in project shattered-pixel-dungeon-gdx by 00-Evan.

the class Hero method onOperateComplete.

@Override
public void onOperateComplete() {
    if (curAction instanceof HeroAction.Unlock) {
        int doorCell = ((HeroAction.Unlock) curAction).dst;
        int door = Dungeon.level.map[doorCell];
        if (door == Terrain.LOCKED_DOOR) {
            Notes.remove(new IronKey(Dungeon.depth));
            Level.set(doorCell, Terrain.DOOR);
        } else {
            Notes.remove(new SkeletonKey(Dungeon.depth));
            Level.set(doorCell, Terrain.UNLOCKED_EXIT);
        }
        GameScene.updateKeyDisplay();
        Level.set(doorCell, door == Terrain.LOCKED_DOOR ? Terrain.DOOR : Terrain.UNLOCKED_EXIT);
        GameScene.updateMap(doorCell);
    } else if (curAction instanceof HeroAction.OpenChest) {
        Heap heap = Dungeon.level.heaps.get(((HeroAction.OpenChest) curAction).dst);
        if (heap.type == Type.SKELETON || heap.type == Type.REMAINS) {
            Sample.INSTANCE.play(Assets.SND_BONES);
        } else if (heap.type == Type.LOCKED_CHEST) {
            Notes.remove(new GoldenKey(Dungeon.depth));
        } else if (heap.type == Type.CRYSTAL_CHEST) {
            Notes.remove(new CrystalKey(Dungeon.depth));
        }
        GameScene.updateKeyDisplay();
        heap.open(this);
    }
    curAction = null;
    super.onOperateComplete();
}
Also used : CrystalKey(com.shatteredpixel.shatteredpixeldungeon.items.keys.CrystalKey) GoldenKey(com.shatteredpixel.shatteredpixeldungeon.items.keys.GoldenKey) IronKey(com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey) Heap(com.shatteredpixel.shatteredpixeldungeon.items.Heap) SkeletonKey(com.shatteredpixel.shatteredpixeldungeon.items.keys.SkeletonKey)

Aggregations

SkeletonKey (com.shatteredpixel.shatteredpixeldungeon.items.keys.SkeletonKey)7 IronKey (com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey)3 LloydsBeacon (com.shatteredpixel.shatteredpixeldungeon.items.artifacts.LloydsBeacon)2 GoldenKey (com.shatteredpixel.shatteredpixeldungeon.items.keys.GoldenKey)2 ArmorKit (com.shatteredpixel.shatteredpixeldungeon.items.ArmorKit)1 Heap (com.shatteredpixel.shatteredpixeldungeon.items.Heap)1 CrystalKey (com.shatteredpixel.shatteredpixeldungeon.items.keys.CrystalKey)1