diff --git a/core/src/main/assets/items.png b/core/src/main/assets/items.png index 1c6ace094..ed22377bb 100644 Binary files a/core/src/main/assets/items.png and b/core/src/main/assets/items.png differ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java index 10ef5cc37..2295cd3db 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java @@ -73,6 +73,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.EtherealChains; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.HornOfPlenty; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TalismanOfForesight; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass; +import com.shatteredpixel.shatteredpixeldungeon.items.keys.CrystalKey; import com.shatteredpixel.shatteredpixeldungeon.items.keys.GoldenKey; import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey; import com.shatteredpixel.shatteredpixeldungeon.items.keys.Key; @@ -726,8 +727,8 @@ public class Hero extends Char { Heap heap = Dungeon.level.heaps.get( dst ); if (heap != null && (heap.type != Type.HEAP && heap.type != Type.FOR_SALE)) { - if ((heap.type == Type.LOCKED_CHEST || heap.type == Type.CRYSTAL_CHEST) - && Notes.keyCount(new GoldenKey(Dungeon.depth)) < 1) { + if ((heap.type == Type.LOCKED_CHEST && Notes.keyCount(new GoldenKey(Dungeon.depth)) < 1) + || (heap.type == Type.CRYSTAL_CHEST && Notes.keyCount(new CrystalKey(Dungeon.depth)) < 1)){ GLog.w( Messages.get(this, "locked_chest") ); ready(); @@ -1476,8 +1477,10 @@ public class Hero extends Char { 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 || heap.type == Type.CRYSTAL_CHEST){ + } 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)); } StatusPane.needsKeyUpdate = true; heap.open( this ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/keys/CrystalKey.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/keys/CrystalKey.java new file mode 100644 index 000000000..80e94cf4f --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/keys/CrystalKey.java @@ -0,0 +1,41 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2017 Evan Debenham + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see + */ + +package com.shatteredpixel.shatteredpixeldungeon.items.keys; + +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; + +public class CrystalKey extends Key { + + { + image = ItemSpriteSheet.CRYSTAL_KEY; + } + + public CrystalKey() { + this( 0 ); + } + + public CrystalKey( int depth ) { + super(); + this.depth = depth; + } + +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java index 25a785d97..d811f2cc5 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java @@ -30,7 +30,9 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; import com.shatteredpixel.shatteredpixeldungeon.items.Generator; import com.shatteredpixel.shatteredpixeldungeon.items.Heap; import com.shatteredpixel.shatteredpixeldungeon.items.Item; +import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.Artifact; import com.shatteredpixel.shatteredpixeldungeon.items.journal.GuidePage; +import com.shatteredpixel.shatteredpixeldungeon.items.keys.GoldenKey; import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll; import com.shatteredpixel.shatteredpixeldungeon.journal.Document; @@ -318,7 +320,16 @@ public abstract class RegularLevel extends Level { map[cell] = Terrain.GRASS; losBlocking[cell] = false; } - drop( Generator.random(), cell ).type = type; + + Item toDrop = Generator.random(); + if ((toDrop instanceof Artifact && Random.Int(2) > 0) || + (toDrop.isUpgradable() && Random.Int(2 + toDrop.level()) > 0)){ + drop( toDrop, cell ).type = Heap.Type.LOCKED_CHEST; + addItemToSpawn(new GoldenKey(Dungeon.depth)); + } else { + drop( toDrop, cell ).type = type; + } + } for (Item item : itemsToSpawn) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/VaultRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/VaultRoom.java index 1e7ba207e..d2892f106 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/VaultRoom.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/VaultRoom.java @@ -25,7 +25,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.items.Generator; import com.shatteredpixel.shatteredpixeldungeon.items.Heap; import com.shatteredpixel.shatteredpixeldungeon.items.Item; -import com.shatteredpixel.shatteredpixeldungeon.items.keys.GoldenKey; +import com.shatteredpixel.shatteredpixeldungeon.items.keys.CrystalKey; import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey; import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; @@ -50,29 +50,14 @@ public class VaultRoom extends SpecialRoom { Random.shuffle(prizeClasses); - switch (Random.Int( 3 )) { - - case 0: - level.drop( prize( level ), c ).type = Heap.Type.LOCKED_CHEST; - level.addItemToSpawn( new GoldenKey( Dungeon.depth ) ); - break; - - case 1: - Item i1, i2; - do { - i1 = prize( level ); - i2 = prize( level ); - } while (i1.getClass() == i2.getClass()); - level.drop( i1, c ).type = Heap.Type.CRYSTAL_CHEST; - level.drop( i2, c + PathFinder.NEIGHBOURS8[Random.Int( 8 )]).type = Heap.Type.CRYSTAL_CHEST; - level.addItemToSpawn( new GoldenKey( Dungeon.depth ) ); - break; - - case 2: - level.drop( prize( level ), c ); - Painter.set( level, c, Terrain.PEDESTAL ); - break; - } + Item i1, i2; + do { + i1 = prize( level ); + i2 = prize( level ); + } while (i1.getClass() == i2.getClass()); + level.drop( i1, c ).type = Heap.Type.CRYSTAL_CHEST; + level.drop( i2, c + PathFinder.NEIGHBOURS8[Random.Int( 8 )]).type = Heap.Type.CRYSTAL_CHEST; + level.addItemToSpawn( new CrystalKey( Dungeon.depth ) ); entrance().set( Door.Type.LOCKED ); level.addItemToSpawn( new IronKey( Dungeon.depth ) ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java index da2e4a366..092dd1bd8 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java @@ -106,10 +106,11 @@ public class ItemSpriteSheet { public static final int SHATTPOT = SINGLE_USE+8; public static final int IRON_KEY = SINGLE_USE+9; public static final int GOLDEN_KEY = SINGLE_USE+10; - public static final int SKELETON_KEY = SINGLE_USE+11; - public static final int MASTERY = SINGLE_USE+12; - public static final int KIT = SINGLE_USE+13; - public static final int AMULET = SINGLE_USE+14; + public static final int CRYSTAL_KEY = SINGLE_USE+11; + public static final int SKELETON_KEY = SINGLE_USE+13; + public static final int MASTERY = SINGLE_USE+14; + public static final int KIT = SINGLE_USE+15; + public static final int AMULET = SINGLE_USE+16; static{ assignItemRect(ANKH, 10, 16); assignItemRect(STYLUS, 12, 13); @@ -122,6 +123,7 @@ public class ItemSpriteSheet { assignItemRect(SHATTPOT, 14, 12); assignItemRect(IRON_KEY, 8, 14); assignItemRect(GOLDEN_KEY, 8, 14); + assignItemRect(CRYSTAL_KEY, 8, 14); assignItemRect(SKELETON_KEY, 8, 14); assignItemRect(MASTERY, 13, 16); assignItemRect(KIT, 16, 15); diff --git a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties index d8f2ab5c3..b18851e0f 100644 --- a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties +++ b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties @@ -401,7 +401,10 @@ items.journal.guidepage.desc=A torn page from an adventuring guidebook.\n\nMost ###keys items.keys.goldenkey.name=golden key -items.keys.goldenkey.desc=The notches on this golden key are tiny and intricate. Maybe it can open some chest lock? +items.keys.goldenkey.desc=The notches on this golden key are tiny and intricate. Perhaps it will open a locked chest? + +items.keys.crystalkey.name=Crystal key +items.keys.crystalkey.desc=The cut surfaces of this crystalline key shimmer in the darkness. Perhaps it will open a crystal chest? items.keys.ironkey.name=iron key items.keys.ironkey.desc=The notches on this ancient iron key are well worn; its leather lanyard is battered by age. What door might it open? @@ -1017,9 +1020,9 @@ items.gold.desc=A pile of gold coins. Collect gold coins to spend them later in items.heap.chest=Chest items.heap.chest_desc=You won't know what's inside until you open it! items.heap.locked_chest=Locked chest -items.heap.locked_chest_desc=You won't know what's inside until you open it! But to open it you need a golden key. +items.heap.locked_chest_desc=You won't know what's inside until you open it! But to open it you need a golden key. items.heap.crystal_chest=Crystal chest -items.heap.crystal_chest_desc=You can see %s inside, but to open the chest you need a golden key. +items.heap.crystal_chest_desc=You can see _%s_ inside, but to open the chest you need a crystal key. items.heap.artifact=an artifact items.heap.wand=a wand items.heap.ring=a ring