v0.6.1: refactored keys, now stored in notes
This commit is contained in:
@@ -602,6 +602,8 @@ public class Dungeon {
|
||||
Badges.reset();
|
||||
}
|
||||
|
||||
Notes.restoreFromBundle( bundle );
|
||||
|
||||
hero = null;
|
||||
hero = (Hero)bundle.get( HERO );
|
||||
|
||||
@@ -609,10 +611,9 @@ public class Dungeon {
|
||||
depth = bundle.getInt( DEPTH );
|
||||
|
||||
Statistics.restoreFromBundle( bundle );
|
||||
Notes.restoreFromBundle( bundle );
|
||||
Generator.restoreFromBundle( bundle );
|
||||
|
||||
droppedItems = new SparseArray<ArrayList<Item>>();
|
||||
droppedItems = new SparseArray<>();
|
||||
for (int i=2; i <= Statistics.deepestFloor + 1; i++) {
|
||||
ArrayList<Item> dropped = new ArrayList<Item>();
|
||||
if (bundle.contains(Messages.format( DROPPED, i )))
|
||||
|
||||
+25
-22
@@ -27,10 +27,13 @@ import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.KindofMisc;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.keys.GoldenKey;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.keys.Key;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.keys.SkeletonKey;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRemoveCurse;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.journal.Notes;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.watabou.utils.Bundle;
|
||||
import com.watabou.utils.Random;
|
||||
@@ -49,9 +52,6 @@ public class Belongings implements Iterable<Item> {
|
||||
public Armor armor = null;
|
||||
public KindofMisc misc1 = null;
|
||||
public KindofMisc misc2 = null;
|
||||
|
||||
public int[] ironKeys = new int[26];
|
||||
public int[] specialKeys = new int[26]; //golden or boss keys
|
||||
|
||||
public Belongings( Hero owner ) {
|
||||
this.owner = owner;
|
||||
@@ -68,9 +68,6 @@ public class Belongings implements Iterable<Item> {
|
||||
private static final String MISC1 = "misc1";
|
||||
private static final String MISC2 = "misc2";
|
||||
|
||||
private static final String IRON_KEYS = "ironKeys";
|
||||
private static final String SPECIAL_KEYS = "specialKeys";
|
||||
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
|
||||
backpack.storeInBundle( bundle );
|
||||
@@ -79,29 +76,35 @@ public class Belongings implements Iterable<Item> {
|
||||
bundle.put( ARMOR, armor );
|
||||
bundle.put( MISC1, misc1);
|
||||
bundle.put( MISC2, misc2);
|
||||
|
||||
bundle.put( IRON_KEYS, ironKeys);
|
||||
bundle.put( SPECIAL_KEYS, specialKeys);
|
||||
}
|
||||
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
|
||||
if (bundle.contains(IRON_KEYS)) ironKeys = bundle.getIntArray( IRON_KEYS );
|
||||
if (bundle.contains(SPECIAL_KEYS)) specialKeys = bundle.getIntArray( SPECIAL_KEYS );
|
||||
//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 GoldenKey(i).quantity(specialKeys[i]));
|
||||
} else {
|
||||
Notes.add((Key) new SkeletonKey(i).quantity(specialKeys[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
backpack.clear();
|
||||
backpack.restoreFromBundle( bundle );
|
||||
|
||||
//removing keys, from pre-0.4.1 saves
|
||||
for (Item item : backpack.items.toArray(new Item[0])){
|
||||
if (item instanceof Key){
|
||||
item.detachAll(backpack);
|
||||
if (item instanceof IronKey)
|
||||
ironKeys[((Key) item).depth] += item.quantity();
|
||||
else
|
||||
specialKeys[((Key) item).depth] += item.quantity();
|
||||
}
|
||||
}
|
||||
|
||||
weapon = (KindOfWeapon) bundle.get(WEAPON);
|
||||
if (weapon != null) {
|
||||
|
||||
@@ -68,7 +68,10 @@ 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.GoldenKey;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.keys.Key;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.keys.SkeletonKey;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfMight;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength;
|
||||
@@ -86,6 +89,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Flail;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.journal.Notes;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.features.AlchemyPot;
|
||||
@@ -717,7 +721,7 @@ public class Hero extends Char {
|
||||
if (heap != null && (heap.type != Type.HEAP && heap.type != Type.FOR_SALE)) {
|
||||
|
||||
if ((heap.type == Type.LOCKED_CHEST || heap.type == Type.CRYSTAL_CHEST)
|
||||
&& belongings.specialKeys[Dungeon.depth] < 1) {
|
||||
&& Notes.keyCount(new GoldenKey(Dungeon.depth)) < 1) {
|
||||
|
||||
GLog.w( Messages.get(this, "locked_chest") );
|
||||
ready();
|
||||
@@ -764,12 +768,12 @@ public class Hero extends Char {
|
||||
int door = Dungeon.level.map[doorCell];
|
||||
|
||||
if (door == Terrain.LOCKED_DOOR
|
||||
&& belongings.ironKeys[Dungeon.depth] > 0) {
|
||||
&& Notes.keyCount(new IronKey(Dungeon.depth)) > 0) {
|
||||
|
||||
hasKey = true;
|
||||
|
||||
} else if (door == Terrain.LOCKED_EXIT
|
||||
&& belongings.specialKeys[Dungeon.depth] > 0) {
|
||||
&& Notes.keyCount(new GoldenKey(Dungeon.depth)) > 0) {
|
||||
|
||||
hasKey = true;
|
||||
|
||||
@@ -1459,10 +1463,10 @@ public class Hero extends Char {
|
||||
int door = Dungeon.level.map[doorCell];
|
||||
|
||||
if (door == Terrain.LOCKED_DOOR){
|
||||
belongings.ironKeys[Dungeon.depth]--;
|
||||
Notes.remove(new IronKey(Dungeon.depth));
|
||||
Level.set( doorCell, Terrain.DOOR );
|
||||
} else {
|
||||
belongings.specialKeys[Dungeon.depth]--;
|
||||
Notes.remove(new SkeletonKey(Dungeon.depth));
|
||||
Level.set( doorCell, Terrain.UNLOCKED_EXIT );
|
||||
}
|
||||
StatusPane.needsKeyUpdate = true;
|
||||
@@ -1476,7 +1480,7 @@ public class Hero extends Char {
|
||||
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){
|
||||
belongings.specialKeys[Dungeon.depth]--;
|
||||
Notes.remove(new GoldenKey(Dungeon.depth));
|
||||
}
|
||||
StatusPane.needsKeyUpdate = true;
|
||||
heap.open( this );
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
|
||||
package com.shatteredpixel.shatteredpixeldungeon.items.keys;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
|
||||
public class GoldenKey extends Key {
|
||||
@@ -31,12 +29,6 @@ public class GoldenKey extends Key {
|
||||
image = ItemSpriteSheet.GOLDEN_KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doPickUp(Hero hero) {
|
||||
Dungeon.hero.belongings.specialKeys[depth] += quantity();
|
||||
return super.doPickUp(hero);
|
||||
}
|
||||
|
||||
public GoldenKey() {
|
||||
this( 0 );
|
||||
}
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
|
||||
package com.shatteredpixel.shatteredpixeldungeon.items.keys;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
|
||||
public class IronKey extends Key {
|
||||
@@ -31,12 +29,6 @@ public class IronKey extends Key {
|
||||
image = ItemSpriteSheet.IRON_KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doPickUp(Hero hero) {
|
||||
Dungeon.hero.belongings.ironKeys[depth] += quantity();
|
||||
return super.doPickUp(hero);
|
||||
}
|
||||
|
||||
public IronKey() {
|
||||
this( 0 );
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.keys;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.journal.Notes;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.StatusPane;
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
@@ -48,6 +49,7 @@ public abstract class Key extends Item {
|
||||
@Override
|
||||
public boolean doPickUp(Hero hero) {
|
||||
GameScene.pickUpJournal(this);
|
||||
Notes.add(this);
|
||||
Sample.INSTANCE.play( Assets.SND_ITEM );
|
||||
hero.spendAndNext( TIME_TO_PICK_UP );
|
||||
StatusPane.needsKeyUpdate = true;
|
||||
|
||||
-15
@@ -21,16 +21,12 @@
|
||||
|
||||
package com.shatteredpixel.shatteredpixeldungeon.items.keys;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
|
||||
public class SkeletonKey extends Key {
|
||||
|
||||
{
|
||||
image = ItemSpriteSheet.SKELETON_KEY;
|
||||
stackable = false;
|
||||
}
|
||||
|
||||
public SkeletonKey() {
|
||||
@@ -42,15 +38,4 @@ public class SkeletonKey extends Key {
|
||||
this.depth = depth;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doPickUp(Hero hero) {
|
||||
Dungeon.hero.belongings.specialKeys[depth]++;
|
||||
return super.doPickUp(hero);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSimilar( Item item ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,14 +22,47 @@
|
||||
package com.shatteredpixel.shatteredpixeldungeon.journal;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.keys.Key;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.watabou.utils.Bundlable;
|
||||
import com.watabou.utils.Bundle;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
||||
public class Notes {
|
||||
|
||||
public static abstract class Record implements Comparable<Record>, Bundlable {
|
||||
|
||||
protected int depth;
|
||||
|
||||
public int depth(){
|
||||
return depth;
|
||||
}
|
||||
|
||||
public abstract String desc();
|
||||
|
||||
@Override
|
||||
public abstract boolean equals(Object obj);
|
||||
|
||||
@Override
|
||||
public int compareTo( Record another ) {
|
||||
return another.depth() - depth();
|
||||
}
|
||||
|
||||
private static final String DEPTH = "depth";
|
||||
|
||||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
depth = bundle.getInt( DEPTH );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
bundle.put( DEPTH, depth );
|
||||
}
|
||||
}
|
||||
|
||||
public enum Landmark {
|
||||
WELL_OF_HEALTH,
|
||||
WELL_OF_AWARENESS,
|
||||
@@ -42,94 +75,178 @@ public class Notes {
|
||||
WANDMAKER,
|
||||
TROLL,
|
||||
IMP;
|
||||
|
||||
|
||||
public String desc() {
|
||||
return Messages.get(this, name());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static class Record implements Comparable<Record>, Bundlable {
|
||||
public static class LandmarkRecord extends Record {
|
||||
|
||||
//compatibility with pre-0.6.1 saves
|
||||
private static final String FEATURE = "feature";
|
||||
protected Landmark landmark;
|
||||
|
||||
private static final String LANDMARK = "landmark";
|
||||
public LandmarkRecord() {}
|
||||
|
||||
private static final String DEPTH = "depth";
|
||||
|
||||
public Landmark landmark;
|
||||
|
||||
public int depth;
|
||||
|
||||
public Record() {
|
||||
}
|
||||
|
||||
public Record(Landmark landmark, int depth ) {
|
||||
public LandmarkRecord(Landmark landmark, int depth ) {
|
||||
this.landmark = landmark;
|
||||
this.depth = depth;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int compareTo( Record another ) {
|
||||
return another.depth - depth;
|
||||
public String desc() {
|
||||
return landmark.desc();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
if (bundle.contains(FEATURE)) {
|
||||
landmark = Landmark.valueOf(bundle.getString(FEATURE));
|
||||
} else {
|
||||
landmark = Landmark.valueOf(bundle.getString(LANDMARK));
|
||||
}
|
||||
depth = bundle.getInt( DEPTH );
|
||||
public boolean equals(Object obj) {
|
||||
return (obj instanceof LandmarkRecord)
|
||||
&& landmark == ((LandmarkRecord) obj).landmark
|
||||
&& depth() == ((LandmarkRecord) obj).depth();
|
||||
}
|
||||
|
||||
|
||||
private static final String LANDMARK = "landmark";
|
||||
|
||||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
public void restoreFromBundle(Bundle bundle) {
|
||||
super.restoreFromBundle(bundle);
|
||||
landmark = Landmark.valueOf(bundle.getString(LANDMARK));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void storeInBundle(Bundle bundle) {
|
||||
super.storeInBundle(bundle);
|
||||
bundle.put( LANDMARK, landmark.toString() );
|
||||
bundle.put( DEPTH, depth );
|
||||
}
|
||||
}
|
||||
|
||||
public static ArrayList<Record> records;
|
||||
public static class KeyRecord extends Record {
|
||||
|
||||
protected Key key;
|
||||
|
||||
public KeyRecord() {}
|
||||
|
||||
public KeyRecord( Key key ){
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int depth() {
|
||||
return key.depth;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return key.toString();
|
||||
}
|
||||
|
||||
public Class<? extends Key> type(){
|
||||
return key.getClass();
|
||||
}
|
||||
|
||||
public int quantity(){
|
||||
return key.quantity();
|
||||
}
|
||||
|
||||
public void quantity(int num){
|
||||
key.quantity(num);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return (obj instanceof KeyRecord)
|
||||
&& key.isSimilar(((KeyRecord) obj).key);
|
||||
}
|
||||
|
||||
private static final String KEY = "key";
|
||||
|
||||
@Override
|
||||
public void restoreFromBundle(Bundle bundle) {
|
||||
super.restoreFromBundle(bundle);
|
||||
key = (Key) bundle.get(KEY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void storeInBundle(Bundle bundle) {
|
||||
super.storeInBundle(bundle);
|
||||
bundle.put( KEY, key );
|
||||
}
|
||||
}
|
||||
|
||||
private static ArrayList<Record> records;
|
||||
|
||||
public static void reset() {
|
||||
records = new ArrayList<>();
|
||||
}
|
||||
|
||||
private static final String JOURNAL = "journal";
|
||||
private static final String RECORDS = "records";
|
||||
|
||||
public static void storeInBundle( Bundle bundle ) {
|
||||
bundle.put( JOURNAL, records );
|
||||
bundle.put( RECORDS, records );
|
||||
}
|
||||
|
||||
public static void restoreFromBundle( Bundle bundle ) {
|
||||
records = new ArrayList<>();
|
||||
for (Bundlable rec : bundle.getCollection( JOURNAL ) ) {
|
||||
for (Bundlable rec : bundle.getCollection( RECORDS ) ) {
|
||||
records.add( (Record) rec );
|
||||
}
|
||||
}
|
||||
|
||||
public static void add( Landmark landmark ) {
|
||||
int size = records.size();
|
||||
for (int i=0; i < size; i++) {
|
||||
Record rec = records.get( i );
|
||||
if (rec.landmark == landmark && rec.depth == Dungeon.depth) {
|
||||
return;
|
||||
}
|
||||
LandmarkRecord l = new LandmarkRecord( landmark, Dungeon.depth );
|
||||
if (!records.contains(l)) {
|
||||
records.add(new LandmarkRecord(landmark, Dungeon.depth));
|
||||
Collections.sort(records);
|
||||
}
|
||||
|
||||
records.add( new Record(landmark, Dungeon.depth ) );
|
||||
}
|
||||
|
||||
public static void remove( Landmark landmark ) {
|
||||
int size = records.size();
|
||||
for (int i=0; i < size; i++) {
|
||||
Record rec = records.get( i );
|
||||
if (rec.landmark == landmark && rec.depth == Dungeon.depth) {
|
||||
records.remove( i );
|
||||
return;
|
||||
records.remove( new LandmarkRecord(landmark, Dungeon.depth) );
|
||||
}
|
||||
|
||||
public static void add( Key key ){
|
||||
KeyRecord k = new KeyRecord(key);
|
||||
if (!records.contains(k)){
|
||||
records.add(k);
|
||||
Collections.sort(records);
|
||||
} else {
|
||||
k = (KeyRecord) records.get(records.indexOf(k));
|
||||
k.quantity(k.quantity() + key.quantity());
|
||||
}
|
||||
}
|
||||
|
||||
public static void remove( Key key ){
|
||||
KeyRecord k = new KeyRecord( key );
|
||||
if (records.contains(k)){
|
||||
k = (KeyRecord) records.get(records.indexOf(k));
|
||||
k.quantity(k.quantity() - key.quantity());
|
||||
if (k.quantity() <= 0){
|
||||
records.remove(k);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static int keyCount( Key key ){
|
||||
KeyRecord k = new KeyRecord( key );
|
||||
if (records.contains(k)){
|
||||
k = (KeyRecord) records.get(records.indexOf(k));
|
||||
return k.quantity();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static ArrayList<Record> getRecords(){
|
||||
return getRecords(Record.class);
|
||||
}
|
||||
|
||||
public static <T extends Record> ArrayList<T> getRecords( Class<T> recordType ){
|
||||
ArrayList<T> filtered = new ArrayList<>();
|
||||
for (Record rec : records){
|
||||
if (recordType.isInstance(rec)){
|
||||
filtered.add((T)rec);
|
||||
}
|
||||
}
|
||||
return filtered;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+6
-2
@@ -25,6 +25,10 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Belongings;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.LloydsBeacon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.keys.GoldenKey;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.keys.Key;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.journal.Notes;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.InterlevelScene;
|
||||
import com.watabou.noosa.Game;
|
||||
|
||||
@@ -39,8 +43,8 @@ public class DistortionTrap extends Trap{
|
||||
public void activate() {
|
||||
InterlevelScene.returnDepth = Dungeon.depth;
|
||||
Belongings belongings = Dungeon.hero.belongings;
|
||||
belongings.ironKeys[Dungeon.depth] = 0;
|
||||
belongings.specialKeys[Dungeon.depth] = 0;
|
||||
Notes.remove((Key) new IronKey(Dungeon.depth).quantity(99));
|
||||
Notes.remove((Key) new GoldenKey(Dungeon.depth).quantity(99));
|
||||
for (Item i : belongings){
|
||||
if (i instanceof LloydsBeacon && ((LloydsBeacon) i).returnDepth == Dungeon.depth)
|
||||
((LloydsBeacon) i).returnDepth = -1;
|
||||
|
||||
@@ -62,6 +62,7 @@ public class Messages {
|
||||
private static String[] prop_files = new String[]{
|
||||
"com.shatteredpixel.shatteredpixeldungeon.messages.actors.actors",
|
||||
"com.shatteredpixel.shatteredpixeldungeon.messages.items.items",
|
||||
"com.shatteredpixel.shatteredpixeldungeon.messages.journal.journal",
|
||||
"com.shatteredpixel.shatteredpixeldungeon.messages.levels.levels",
|
||||
"com.shatteredpixel.shatteredpixeldungeon.messages.plants.plants",
|
||||
"com.shatteredpixel.shatteredpixeldungeon.messages.scenes.scenes",
|
||||
|
||||
@@ -25,6 +25,8 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.journal.Notes;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.HeroSprite;
|
||||
@@ -272,30 +274,23 @@ public class StatusPane extends Component {
|
||||
|
||||
public void updateKeyDisplay() {
|
||||
needsKeyUpdate = false;
|
||||
|
||||
boolean foundKeys = false;
|
||||
|
||||
boolean blackKey = false;
|
||||
boolean specialKey = false;
|
||||
int ironKeys = 0;
|
||||
for (int i = 1; i <= Math.min(Dungeon.depth, 25); i++) {
|
||||
if (Dungeon.hero.belongings.ironKeys[i] > 0 || Dungeon.hero.belongings.specialKeys[i] > 0) {
|
||||
foundKeys = true;
|
||||
|
||||
if (i < Dungeon.depth){
|
||||
blackKey = true;
|
||||
|
||||
for (Notes.KeyRecord rec : Notes.getRecords(Notes.KeyRecord.class)){
|
||||
if (rec.depth() < Dungeon.depth){
|
||||
blackKey = true;
|
||||
} else if (rec.depth() == Dungeon.depth){
|
||||
if (rec.type().equals(IronKey.class)) {
|
||||
ironKeys += rec.quantity();
|
||||
} else {
|
||||
if (Dungeon.hero.belongings.specialKeys[i] > 0){
|
||||
specialKey = true;
|
||||
}
|
||||
ironKeys = Dungeon.hero.belongings.ironKeys[i];
|
||||
specialKey = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundKeys){
|
||||
icon.frame(31, 0, 11, 7);
|
||||
} else {
|
||||
if (blackKey || specialKey || ironKeys > 0){
|
||||
int left = 46, top = 0, width = 0, height = 7;
|
||||
if (blackKey){
|
||||
left = 43;
|
||||
@@ -308,6 +303,8 @@ public class StatusPane extends Component {
|
||||
width += ironKeys*3;
|
||||
width = Math.min( width, 9);
|
||||
icon.frame(left, top, width, height);
|
||||
} else {
|
||||
icon.frame(31, 0, 11, 7);
|
||||
}
|
||||
layout();
|
||||
|
||||
|
||||
+10
-38
@@ -24,9 +24,6 @@ package com.shatteredpixel.shatteredpixeldungeon.windows;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.keys.GoldenKey;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.keys.SkeletonKey;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
|
||||
@@ -199,47 +196,22 @@ public class WndJournal extends WndTabbed {
|
||||
private void updateList(){
|
||||
Component content = list.content();
|
||||
|
||||
Collections.sort( Notes.records );
|
||||
|
||||
float pos = 0;
|
||||
|
||||
//Keys
|
||||
for (int i = Dungeon.hero.belongings.ironKeys.length-1; i > 0; i--){
|
||||
if (Dungeon.hero.belongings.specialKeys[i] > 0){
|
||||
String text;
|
||||
if (i % 5 == 0)
|
||||
text = Messages.capitalize(Messages.get(SkeletonKey.class, "name"));
|
||||
else
|
||||
text = Messages.capitalize(Messages.get(GoldenKey.class, "name"));
|
||||
|
||||
if (Dungeon.hero.belongings.specialKeys[i] > 1){
|
||||
text += " x" + Dungeon.hero.belongings.specialKeys[i];
|
||||
}
|
||||
ListItem item = new ListItem( Icons.get(Icons.DEPTH), Messages.titleCase(text), i );
|
||||
item.setRect( 0, pos, width(), ITEM_HEIGHT );
|
||||
content.add( item );
|
||||
|
||||
pos += item.height();
|
||||
}
|
||||
if (Dungeon.hero.belongings.ironKeys[i] > 0){
|
||||
String text = Messages.titleCase(Messages.get(IronKey.class, "name"));
|
||||
|
||||
if (Dungeon.hero.belongings.ironKeys[i] > 1){
|
||||
text += " x" + Dungeon.hero.belongings.ironKeys[i];
|
||||
}
|
||||
|
||||
ListItem item = new ListItem( Icons.get(Icons.DEPTH), text, i );
|
||||
item.setRect( 0, pos, width(), ITEM_HEIGHT );
|
||||
content.add( item );
|
||||
|
||||
pos += item.height();
|
||||
}
|
||||
for(Notes.Record rec : Notes.getRecords(Notes.KeyRecord.class)){
|
||||
ListItem item = new ListItem( Icons.get(Icons.DEPTH),
|
||||
Messages.titleCase(rec.desc()), rec.depth() );
|
||||
item.setRect( 0, pos, width(), ITEM_HEIGHT );
|
||||
content.add( item );
|
||||
|
||||
pos += item.height();
|
||||
}
|
||||
|
||||
//Notes entries
|
||||
for (Notes.Record rec : Notes.records) {
|
||||
ListItem item = new ListItem( Icons.get(Icons.DEPTH), rec.landmark.desc(), rec.depth );
|
||||
//Landmarks
|
||||
for (Notes.Record rec : Notes.getRecords(Notes.LandmarkRecord.class)) {
|
||||
ListItem item = new ListItem( Icons.get(Icons.DEPTH),
|
||||
Messages.titleCase(rec.desc()), rec.depth() );
|
||||
item.setRect( 0, pos, width(), ITEM_HEIGHT );
|
||||
content.add( item );
|
||||
|
||||
|
||||
+10
-10
@@ -1,10 +1,10 @@
|
||||
notes$landmark.well_of_health=Well of Health
|
||||
notes$landmark.well_of_awareness=Well of Awareness
|
||||
notes$landmark.well_of_transmutation=Well of Transmutation
|
||||
notes$landmark.alchemy=Alchemy pot
|
||||
notes$landmark.garden=Garden
|
||||
notes$landmark.statue=Animated statue
|
||||
notes$landmark.ghost=Sad ghost
|
||||
notes$landmark.wandmaker=Old wandmaker
|
||||
notes$landmark.troll=Troll blacksmith
|
||||
notes$landmark.imp=Ambitious imp
|
||||
journal.notes$landmark.well_of_health=well of health
|
||||
journal.notes$landmark.well_of_awareness=well of awareness
|
||||
journal.notes$landmark.well_of_transmutation=well of transmutation
|
||||
journal.notes$landmark.alchemy=alchemy pot
|
||||
journal.notes$landmark.garden=garden
|
||||
journal.notes$landmark.statue=animated statue
|
||||
journal.notes$landmark.ghost=sad ghost
|
||||
journal.notes$landmark.wandmaker=old wandmaker
|
||||
journal.notes$landmark.troll=troll blacksmith
|
||||
journal.notes$landmark.imp=ambitious imp
|
||||
Reference in New Issue
Block a user