diff --git a/core/src/main/assets/messages/windows/windows.properties b/core/src/main/assets/messages/windows/windows.properties index e161ce815..4d85d464e 100644 --- a/core/src/main/assets/messages/windows/windows.properties +++ b/core/src/main/assets/messages/windows/windows.properties @@ -131,9 +131,13 @@ windows.wndjournal$catalogtab.not_seen_enemy=This enemy hasn't been defeated in windows.wndjournal$catalogtab.not_seen_ally=You haven't encountered this character in any of your runs yet. windows.wndjournal$catalogtab.not_seen_trap=You haven't triggered this trap in any of your runs yet. windows.wndjournal$catalogtab.not_seen_plant=You haven't trampled this plant in any of your runs yet. -windows.wndjournal$catalogtab.enemy_count=You have defeated this enemy _%d_ times. -windows.wndjournal$catalogtab.trap_count=You have triggered this trap _%d_ times. -windows.wndjournal$catalogtab.plant_count=You have trampled this plant _%d_ times. +windows.wndjournal$catalogtab.upgrade_count=You have upgraded this item a total of _%,d_ times. +windows.wndjournal$catalogtab.use_count=You have used this item a total of _%,d_ times. +windows.wndjournal$catalogtab.gold_count=You have spent a total of _%,d_ gold. +windows.wndjournal$catalogtab.energy_count=You have used a total of _%,d_ energy crystals. +windows.wndjournal$catalogtab.enemy_count=You have defeated this enemy a total of _%,d_ times. +windows.wndjournal$catalogtab.trap_count=You have triggered this trap a total of _%,d_ times. +windows.wndjournal$catalogtab.plant_count=You have trampled this plant a total of _%,d_ times. windows.wndjournal$catalogtab.not_seen_lore=You haven't found this lore text in any of your runs yet. windows.wndjournal$loretab.title=Documents diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/AllyBuff.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/AllyBuff.java index 4a0dacbe6..018490a84 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/AllyBuff.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/AllyBuff.java @@ -61,7 +61,8 @@ public abstract class AllyBuff extends Buff{ Statistics.enemiesSlain++; Badges.validateMonstersSlain(); Statistics.qualifiedForNoKilling = false; - Bestiary.trackEncounter(enemy.getClass()); + Bestiary.setSeen(enemy.getClass()); + Bestiary.countEncounter(enemy.getClass()); AscensionChallenge.processEnemyKill(enemy); 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 815cc89ec..f9cccea91 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 @@ -132,6 +132,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.RoundShield; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Sai; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Scimitar; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.journal.Document; import com.shatteredpixel.shatteredpixeldungeon.journal.Notes; import com.shatteredpixel.shatteredpixeldungeon.levels.Level; @@ -1941,6 +1942,7 @@ public class Hero extends Char { Sample.INSTANCE.play(Assets.Sounds.TELEPORT); GLog.w(Messages.get(this, "revive")); Statistics.ankhsUsed++; + Catalog.countUse(Ankh.class); ankh.detach(belongings.backpack); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java index de9819a42..c376fe113 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java @@ -782,7 +782,8 @@ public abstract class Mob extends Char { Statistics.enemiesSlain++; Badges.validateMonstersSlain(); Statistics.qualifiedForNoKilling = false; - Bestiary.trackEncounter(getClass()); + Bestiary.setSeen(getClass()); + Bestiary.countEncounter(getClass()); AscensionChallenge.processEnemyKill(this); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/ArcaneResin.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/ArcaneResin.java index c42da3dea..f7fe4fcbf 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/ArcaneResin.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/ArcaneResin.java @@ -31,6 +31,7 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag; import com.shatteredpixel.shatteredpixeldungeon.items.bags.MagicalHolster; import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; @@ -123,6 +124,7 @@ public class ArcaneResin extends Item { } else { + Catalog.countUses(ArcaneResin.class, resinToUse); if (resinToUse < quantity()){ quantity(quantity()-resinToUse); } else { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Dewdrop.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Dewdrop.java index fd97e50cc..a561c1193 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Dewdrop.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Dewdrop.java @@ -63,6 +63,8 @@ public class Dewdrop extends Item { if (!consumeDew(1, hero, terr == Terrain.ENTRANCE || terr == Terrain.ENTRANCE_SP || terr == Terrain.EXIT || terr == Terrain.UNLOCKED_EXIT)){ return false; + } else { + Catalog.countUse(getClass()); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Honeypot.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Honeypot.java index 076d1f02f..e37be274a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Honeypot.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Honeypot.java @@ -29,6 +29,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Bee; import com.shatteredpixel.shatteredpixeldungeon.effects.Pushing; import com.shatteredpixel.shatteredpixeldungeon.effects.Splash; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.watabou.noosa.audio.Sample; @@ -68,6 +69,7 @@ public class Honeypot extends Item { hero.sprite.zap( hero.pos ); detach( hero.belongings.backpack ); + Catalog.countUse(getClass()); Item item = shatter( hero, hero.pos ); if (!item.collect()){ @@ -87,6 +89,7 @@ public class Honeypot extends Item { if (Dungeon.level.pit[cell]) { super.onThrow( cell ); } else { + Catalog.countUse(getClass()); Dungeon.level.drop(shatter( null, cell ), cell); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/KingsCrown.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/KingsCrown.java index 664983428..c12081ee1 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/KingsCrown.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/KingsCrown.java @@ -30,6 +30,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.Ratmogrify import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClassArmor; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.HeroSprite; @@ -89,6 +90,7 @@ public class KingsCrown extends Item { public void upgradeArmor(Hero hero, Armor armor, ArmorAbility ability) { detach(hero.belongings.backpack); + Catalog.countUse( getClass() ); hero.sprite.emitter().burst( Speck.factory( Speck.CROWN), 12 ); hero.spend(Actor.TICK); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/LiquidMetal.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/LiquidMetal.java index ab3ebe2fa..25286a2cd 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/LiquidMetal.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/LiquidMetal.java @@ -31,6 +31,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.bags.MagicalHolster; import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.darts.Dart; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; @@ -146,11 +147,13 @@ public class LiquidMetal extends Item { GLog.w(Messages.get(LiquidMetal.class, "already_fixed")); return; } else if (maxToUse < quantity()) { + Catalog.countUses(LiquidMetal.class, maxToUse); m.repair(maxToUse*durabilityPerMetal); quantity(quantity()-maxToUse); GLog.i(Messages.get(LiquidMetal.class, "apply", maxToUse)); } else { + Catalog.countUses(LiquidMetal.class, quantity()); m.repair(quantity()*durabilityPerMetal); GLog.i(Messages.get(LiquidMetal.class, "apply", quantity())); detachAll(Dungeon.hero.belongings.backpack); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Recipe.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Recipe.java index 23429a103..2c9e278eb 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Recipe.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Recipe.java @@ -98,7 +98,7 @@ public abstract class Recipe { } @Override - public final boolean testIngredients(ArrayList ingredients) { + public boolean testIngredients(ArrayList ingredients) { int[] needed = inQuantity.clone(); @@ -121,12 +121,12 @@ public abstract class Recipe { return true; } - public final int cost(ArrayList ingredients){ + public int cost(ArrayList ingredients){ return cost; } @Override - public final Item brew(ArrayList ingredients) { + public Item brew(ArrayList ingredients) { if (!testIngredients(ingredients)) return null; int[] needed = inQuantity.clone(); @@ -150,7 +150,7 @@ public abstract class Recipe { } //ingredients are ignored, as output doesn't vary - public final Item sampleOutput(ArrayList ingredients){ + public Item sampleOutput(ArrayList ingredients){ try { Item result = Reflection.newInstance(output); result.quantity(outQuantity); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Stylus.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Stylus.java index 460c4bba8..d7615d931 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Stylus.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Stylus.java @@ -28,6 +28,7 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.Enchanting; import com.shatteredpixel.shatteredpixeldungeon.effects.particles.PurpleParticle; import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; @@ -94,6 +95,7 @@ public class Stylus extends Item { } detach(curUser.belongings.backpack); + Catalog.countUse(getClass()); GLog.w( Messages.get(this, "inscribed")); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/TengusMask.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/TengusMask.java index 30a7e15f0..c3cb07d04 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/TengusMask.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/TengusMask.java @@ -30,6 +30,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; @@ -93,6 +94,7 @@ public class TengusMask extends Item { public void choose( HeroSubClass way ) { detach( curUser.belongings.backpack ); + Catalog.countUse( getClass() ); curUser.spend( Actor.TICK ); curUser.busy(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Torch.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Torch.java index a0bea4f41..7b43dcb68 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Torch.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Torch.java @@ -26,6 +26,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Light; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.effects.particles.FlameParticle; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.watabou.noosa.audio.Sample; import com.watabou.noosa.particles.Emitter; @@ -66,6 +67,7 @@ public class Torch extends Item { hero.sprite.operate( hero.pos ); detach( hero.belongings.backpack ); + Catalog.countUse(getClass()); Buff.affect(hero, Light.class, Light.DURATION); Sample.INSTANCE.play(Assets.Sounds.BURNING); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Waterskin.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Waterskin.java index 697d58309..f341fda30 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Waterskin.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Waterskin.java @@ -25,6 +25,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Barrier; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; @@ -105,6 +106,7 @@ public class Waterskin extends Item { if (Dewdrop.consumeDew(dropsNeeded, hero, true)){ volume -= dropsNeeded; + Catalog.countUses(Dewdrop.class, dropsNeeded); hero.spend(TIME_TO_DRINK); hero.busy(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/AlchemistsToolkit.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/AlchemistsToolkit.java index 2e6b42309..ccc76e23a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/AlchemistsToolkit.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/AlchemistsToolkit.java @@ -27,6 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicImmune; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent; import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfEnergy; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.AlchemyScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; @@ -115,12 +116,14 @@ public class AlchemistsToolkit extends Artifact { Sample.INSTANCE.playDelayed(Assets.Sounds.PUFF, 0.5f); Dungeon.hero.sprite.operate(Dungeon.hero.pos); upgrade(); + Catalog.countUse(AlchemistsToolkit.class); } else if (index == 1){ Dungeon.energy -= 6*maxLevels; Sample.INSTANCE.play(Assets.Sounds.DRINK); Sample.INSTANCE.playDelayed(Assets.Sounds.PUFF, 0.5f); Dungeon.hero.sprite.operate(Dungeon.hero.pos); upgrade(maxLevels); + Catalog.countUses(AlchemistsToolkit.class, maxLevels); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CapeOfThorns.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CapeOfThorns.java index 0e848a5c2..f952a1db5 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CapeOfThorns.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CapeOfThorns.java @@ -24,6 +24,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.artifacts; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; @@ -111,6 +112,7 @@ public class CapeOfThorns extends Artifact { if (exp >= (level()+1)*5 && level() < levelCap){ exp -= (level()+1)*5; upgrade(); + Catalog.countUse(CapeOfThorns.class); GLog.p( Messages.get(this, "levelup") ); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/ChaliceOfBlood.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/ChaliceOfBlood.java index e22052bb2..d9ef9b56c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/ChaliceOfBlood.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/ChaliceOfBlood.java @@ -30,6 +30,7 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.FloatingText; import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShadowParticle; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfLivingEarth; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.plants.Earthroot; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; @@ -130,6 +131,7 @@ public class ChaliceOfBlood extends Artifact { GLog.n( Messages.get(this, "ondeath") ); } else { upgrade(); + Catalog.countUse(getClass()); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CloakOfShadows.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CloakOfShadows.java index 6529be00b..11c8d09a0 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CloakOfShadows.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CloakOfShadows.java @@ -35,6 +35,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag; import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfEnergy; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; @@ -341,6 +342,7 @@ public class CloakOfShadows extends Artifact { if (exp >= (level() + 1) * 50 && level() < levelCap) { upgrade(); + Catalog.countUse(CloakOfShadows.class); exp -= level() * 50; GLog.p(Messages.get(this, "levelup")); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java index 44b0ffea4..8d8751de4 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java @@ -503,6 +503,7 @@ public class DriedRose extends Artifact { } else { rose.upgrade(); + Catalog.countUse(rose.getClass()); if (rose.level() == rose.levelCap) { GLog.p( Messages.get(this, "maxlevel") ); } else diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/EtherealChains.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/EtherealChains.java index 0caaf34ca..535c28c94 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/EtherealChains.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/EtherealChains.java @@ -36,6 +36,7 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.Chains; import com.shatteredpixel.shatteredpixeldungeon.effects.Effects; import com.shatteredpixel.shatteredpixeldungeon.effects.Pushing; import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfEnergy; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.levels.MiningLevel; import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; @@ -346,6 +347,7 @@ public class EtherealChains extends Artifact { if (exp > 100+level()*100 && level() < levelCap){ exp -= 100+level()*100; GLog.p( Messages.get(this, "levelup") ); + Catalog.countUses(EtherealChains.class, 2); upgrade(); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/HornOfPlenty.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/HornOfPlenty.java index 87b538130..4c601f2ad 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/HornOfPlenty.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/HornOfPlenty.java @@ -41,6 +41,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.food.MeatPie; import com.shatteredpixel.shatteredpixeldungeon.items.food.Pasty; import com.shatteredpixel.shatteredpixeldungeon.items.food.PhantomMeat; import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfEnergy; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; @@ -226,6 +227,7 @@ public class HornOfPlenty extends Artifact { int upgrades = storedFoodEnergy / (int)Hunger.HUNGRY; upgrades = Math.min(upgrades, 10 - level()); upgrade(upgrades); + Catalog.countUse(HornOfPlenty.class); storedFoodEnergy -= upgrades * Hunger.HUNGRY; if (level() == 10){ storedFoodEnergy = 0; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/MasterThievesArmband.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/MasterThievesArmband.java index 76a1fdb1c..8e93ef2b4 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/MasterThievesArmband.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/MasterThievesArmband.java @@ -40,6 +40,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Shopkeeper; import com.shatteredpixel.shatteredpixeldungeon.effects.Surprise; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfEnergy; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.CellSelector; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; @@ -184,6 +185,7 @@ public class MasterThievesArmband extends Artifact { Talent.onArtifactUsed(Dungeon.hero); while (exp >= (10 + Math.round(3.33f * level())) && level() < levelCap) { exp -= 10 + Math.round(3.33f * level()); + Catalog.countUse(MasterThievesArmband.class); GLog.p(Messages.get(MasterThievesArmband.class, "level_up")); upgrade(); } @@ -302,6 +304,7 @@ public class MasterThievesArmband extends Artifact { Talent.onArtifactUsed(Dungeon.hero); while (exp >= (10 + Math.round(3.33f * level())) && level() < levelCap) { exp -= 10 + Math.round(3.33f * level()); + Catalog.countUse(MasterThievesArmband.class); GLog.p(Messages.get(MasterThievesArmband.class, "level_up")); upgrade(); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TalismanOfForesight.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TalismanOfForesight.java index 749944608..9833a9849 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TalismanOfForesight.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TalismanOfForesight.java @@ -36,6 +36,7 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.CheckedCell; import com.shatteredpixel.shatteredpixeldungeon.items.Heap; import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfEnergy; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicMapping; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; import com.shatteredpixel.shatteredpixeldungeon.mechanics.ConeAOE; @@ -209,6 +210,7 @@ public class TalismanOfForesight extends Artifact { if (exp >= 100 + 50*level() && level() < levelCap) { exp -= 100 + 50*level(); upgrade(); + Catalog.countUse(TalismanOfForesight.class); GLog.p( Messages.get(TalismanOfForesight.class, "levelup") ); } updateQuickslot(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TimekeepersHourglass.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TimekeepersHourglass.java index 5841225c5..c681a6386 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TimekeepersHourglass.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TimekeepersHourglass.java @@ -480,6 +480,7 @@ public class TimekeepersHourglass extends Artifact { TimekeepersHourglass hourglass = hero.belongings.getItem( TimekeepersHourglass.class ); if (hourglass != null && !hourglass.cursed) { hourglass.upgrade(); + Catalog.countUses(hourglass.getClass(), 2); Sample.INSTANCE.play( Assets.Sounds.DEWDROP ); if (hourglass.level() == hourglass.levelCap) GLog.p( Messages.get(this, "maxlevel") ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/UnstableSpellbook.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/UnstableSpellbook.java index 373be61eb..1d1a9f13c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/UnstableSpellbook.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/UnstableSpellbook.java @@ -41,6 +41,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicMappi import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRemoveCurse; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTransmutation; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ExoticScroll; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; @@ -352,6 +353,7 @@ public class UnstableSpellbook extends Artifact { item.detach(hero.belongings.backpack); upgrade(); + Catalog.countUse(UnstableSpellbook.class); GLog.i( Messages.get(UnstableSpellbook.class, "infuse_scroll") ); return; } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/Bomb.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/Bomb.java index b7d1da2da..c181d0692 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/Bomb.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/Bomb.java @@ -44,6 +44,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMirrorImag import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRage; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRemoveCurse; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.messages.Languages; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; @@ -306,6 +307,7 @@ public class Bomb extends Item { protected void trigger(Heap heap){ heap.remove(bomb); + Catalog.countUse(bomb.getClass()); bomb.explode(heap.pos); Actor.remove(this); } @@ -414,7 +416,13 @@ public class Bomb extends Item { result = Reflection.newInstance(validIngredients.get(i.getClass())); } } - + + if (result instanceof ArcaneBomb){ + Catalog.countUse(GooBlob.class); + } else if (result instanceof ShrapnelBomb){ + Catalog.countUse(MetalShard.class); + } + return result; } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/food/Blandfruit.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/food/Blandfruit.java index 76a430370..942ca3701 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/food/Blandfruit.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/food/Blandfruit.java @@ -39,6 +39,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfParalyticG import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfPurity; import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength; import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfToxicGas; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.plants.Plant.Seed; @@ -199,6 +200,7 @@ public class Blandfruit extends Food { potionAttrib instanceof PotionOfLevitation || potionAttrib instanceof PotionOfPurity) { + Catalog.countUse(getClass()); potionAttrib.shatter( cell ); Dungeon.level.drop(new Chunks(), cell).sprite.drop(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/food/Food.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/food/Food.java index 4755ec98b..68535be79 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/food/Food.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/food/Food.java @@ -34,6 +34,7 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.SpellSprite; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.Artifact; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.HornOfPlenty; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; @@ -73,6 +74,7 @@ public class Food extends Item { if (action.equals( AC_EAT )) { detach( hero.belongings.backpack ); + Catalog.countUse(getClass()); satisfy(hero); GLog.i( Messages.get(this, "eat_msg") ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java index 46665fe34..019da843e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java @@ -288,8 +288,11 @@ public class Potion extends Item { hero.sprite.operate( hero.pos ); - if (!anonymous && Random.Float() < talentChance){ - Talent.onPotionUsed(curUser, curUser.pos, talentFactor); + if (!anonymous) { + Catalog.countUse(getClass()); + if (Random.Float() < talentChance) { + Talent.onPotionUsed(curUser, curUser.pos, talentFactor); + } } } @@ -307,8 +310,11 @@ public class Potion extends Item { } shatter( cell ); - if (!anonymous && Random.Float() < talentChance){ - Talent.onPotionUsed(curUser, cell, talentFactor); + if (!anonymous) { + Catalog.countUse(getClass()); + if (Random.Float() < talentChance) { + Talent.onPotionUsed(curUser, curUser.pos, talentFactor); + } } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/brews/CausticBrew.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/brews/CausticBrew.java index 7ac3f60b6..703943a71 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/brews/CausticBrew.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/brews/CausticBrew.java @@ -28,13 +28,17 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Ooze; import com.shatteredpixel.shatteredpixeldungeon.effects.Splash; +import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfToxicGas; import com.shatteredpixel.shatteredpixeldungeon.items.quest.GooBlob; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.watabou.utils.BArray; import com.watabou.noosa.audio.Sample; import com.watabou.utils.PathFinder; +import java.util.ArrayList; + public class CausticBrew extends Brew { { @@ -73,6 +77,11 @@ public class CausticBrew extends Brew { output = CausticBrew.class; outQuantity = 1; } - + + @Override + public Item brew(ArrayList ingredients) { + Catalog.countUse(GooBlob.class); + return super.brew(ingredients); + } } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/elixirs/ElixirOfAquaticRejuvenation.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/elixirs/ElixirOfAquaticRejuvenation.java index 07af7fdb1..a1bcc85cb 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/elixirs/ElixirOfAquaticRejuvenation.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/elixirs/ElixirOfAquaticRejuvenation.java @@ -26,8 +26,10 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.effects.FloatingText; +import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing; import com.shatteredpixel.shatteredpixeldungeon.items.quest.GooBlob; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; @@ -37,6 +39,8 @@ import com.watabou.utils.Bundle; import com.watabou.utils.GameMath; import com.watabou.utils.Random; +import java.util.ArrayList; + public class ElixirOfAquaticRejuvenation extends Elixir { { @@ -152,7 +156,12 @@ public class ElixirOfAquaticRejuvenation extends Elixir { output = ElixirOfAquaticRejuvenation.class; outQuantity = 1; } - + + @Override + public Item brew(ArrayList ingredients) { + Catalog.countUse(GooBlob.class); + return super.brew(ingredients); + } } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/elixirs/ElixirOfArcaneArmor.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/elixirs/ElixirOfArcaneArmor.java index a55178419..5f07966f6 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/elixirs/ElixirOfArcaneArmor.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/elixirs/ElixirOfArcaneArmor.java @@ -24,10 +24,14 @@ package com.shatteredpixel.shatteredpixeldungeon.items.potions.elixirs; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.ArcaneArmor; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; +import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic.PotionOfEarthenArmor; import com.shatteredpixel.shatteredpixeldungeon.items.quest.GooBlob; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; +import java.util.ArrayList; + public class ElixirOfArcaneArmor extends Elixir { { @@ -50,6 +54,11 @@ public class ElixirOfArcaneArmor extends Elixir { output = ElixirOfArcaneArmor.class; outQuantity = 1; } - + + @Override + public Item brew(ArrayList ingredients) { + Catalog.countUse(GooBlob.class); + return super.brew(ingredients); + } } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfDivineInspiration.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfDivineInspiration.java index 349726279..2bb68e08c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfDivineInspiration.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfDivineInspiration.java @@ -27,6 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent; import com.shatteredpixel.shatteredpixeldungeon.effects.Flare; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; @@ -134,8 +135,11 @@ public class PotionOfDivineInspiration extends ExoticPotion { new Flare( 6, 32 ).color(0xFFFF00, true).show( curUser.sprite, 2f ); GLog.p(Messages.get(PotionOfDivineInspiration.class, "bonus")); - if (!anonymous && Random.Float() < talentChance){ - Talent.onPotionUsed(curUser, curUser.pos, talentFactor); + if (!anonymous) { + Catalog.countUse(PotionOfDivineInspiration.class); + if (Random.Float() < talentChance) { + Talent.onPotionUsed(curUser, curUser.pos, talentFactor); + } } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfDragonsBreath.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfDragonsBreath.java index 2c2360a98..9c8e6f31d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfDragonsBreath.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfDragonsBreath.java @@ -34,6 +34,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Cripple; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent; import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; @@ -199,8 +200,11 @@ public class PotionOfDragonsBreath extends ExoticPotion { curUser.spendAndNext(1f); - if (!anonymous && Random.Float() < talentChance){ - Talent.onPotionUsed(curUser, curUser.pos, talentFactor); + if (!anonymous) { + Catalog.countUse(PotionOfDragonsBreath.class); + if (Random.Float() < talentChance) { + Talent.onPotionUsed(curUser, curUser.pos, talentFactor); + } } } }); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfMastery.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfMastery.java index 492e46991..e062ea679 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfMastery.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfMastery.java @@ -28,6 +28,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; @@ -121,8 +122,11 @@ public class PotionOfMastery extends ExoticPotion { } identifiedByUse = false; - if (!anonymous && Random.Float() < talentChance){ - Talent.onPotionUsed(curUser, curUser.pos, talentFactor); + if (!anonymous) { + Catalog.countUse(PotionOfMastery.class); + if (Random.Float() < talentChance) { + Talent.onPotionUsed(curUser, curUser.pos, talentFactor); + } } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/remains/RemainsItem.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/remains/RemainsItem.java index 42e7abae9..55c4c251e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/remains/RemainsItem.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/remains/RemainsItem.java @@ -25,6 +25,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass; import com.shatteredpixel.shatteredpixeldungeon.items.Item; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import java.util.ArrayList; @@ -52,6 +53,7 @@ public abstract class RemainsItem extends Item { if (action.equals(AC_USE)){ hero.sprite.operate(hero.pos); + Catalog.countUse(getClass()); doEffect(hero); hero.spendAndNext(Actor.TICK); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/Scroll.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/Scroll.java index 17cb74da6..df512fc33 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/Scroll.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/Scroll.java @@ -189,8 +189,11 @@ public abstract class Scroll extends Item { curUser.busy(); ((HeroSprite)curUser.sprite).read(); - if (!anonymous && Random.Float() < talentChance) { - Talent.onScrollUsed(curUser, curUser.pos, talentFactor); + if (!anonymous) { + Catalog.countUse(getClass()); + if (Random.Float() < talentChance) { + Talent.onScrollUsed(curUser, curUser.pos, talentFactor); + } } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfUpgrade.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfUpgrade.java index 28a0a4322..50e5aeebb 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfUpgrade.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfUpgrade.java @@ -34,6 +34,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring; import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; @@ -119,6 +120,9 @@ public class ScrollOfUpgrade extends InventoryScroll { Badges.validateItemLevelAquired( item ); Statistics.upgradesUsed++; Badges.validateMageUnlock(); + + Catalog.countUse(item.getClass()); + Catalog.countUse(getClass()); } public static void upgrade( Hero hero ) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/Alchemize.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/Alchemize.java index e2f570b04..1a0c10b19 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/Alchemize.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/Alchemize.java @@ -28,6 +28,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Shopkeeper; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.stones.Runestone; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.plants.Plant; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; @@ -258,6 +259,7 @@ public class Alchemize extends Spell { } GameScene.selectItem(itemSelector); } + Catalog.countUse(getClass()); if (curItem instanceof Alchemize && Random.Float() < ((Alchemize)curItem).talentChance){ Talent.onScrollUsed(curUser, curUser.pos, ((Alchemize) curItem).talentFactor); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/BeaconOfReturning.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/BeaconOfReturning.java index a4205e8e6..f51abece0 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/BeaconOfReturning.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/BeaconOfReturning.java @@ -31,6 +31,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent; import com.shatteredpixel.shatteredpixeldungeon.effects.Pushing; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ScrollOfPassage; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; @@ -173,6 +174,7 @@ public class BeaconOfReturning extends Spell { Game.switchScene( InterlevelScene.class ); } detach(hero.belongings.backpack); + Catalog.countUse(getClass()); if (Random.Float() < talentChance){ Talent.onScrollUsed(curUser, curUser.pos, talentFactor); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/CurseInfusion.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/CurseInfusion.java index d8b047068..a786d9a0c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/CurseInfusion.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/CurseInfusion.java @@ -37,9 +37,12 @@ import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.watabou.noosa.audio.Sample; +import java.util.ArrayList; + public class CurseInfusion extends InventorySpell { { @@ -118,6 +121,11 @@ public class CurseInfusion extends InventorySpell { output = CurseInfusion.class; outQuantity = OUT_QUANTITY; } - + + @Override + public Item brew(ArrayList ingredients) { + Catalog.countUse(MetalShard.class); + return super.brew(ingredients); + } } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/InventorySpell.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/InventorySpell.java index 0caa8152a..6b45971b2 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/InventorySpell.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/InventorySpell.java @@ -27,6 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag; @@ -90,6 +91,7 @@ public abstract class InventorySpell extends Spell { Sample.INSTANCE.play( Assets.Sounds.READ ); Invisibility.dispel(); + Catalog.countUse(curItem.getClass()); if (Random.Float() < ((Spell)curItem).talentChance){ Talent.onScrollUsed(curUser, curUser.pos, ((Spell)curItem).talentFactor); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/MagicalInfusion.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/MagicalInfusion.java index f8f073d6d..93884b030 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/MagicalInfusion.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/MagicalInfusion.java @@ -29,6 +29,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade; import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; @@ -70,6 +71,9 @@ public class MagicalInfusion extends InventorySpell { GLog.p( Messages.get(this, "infuse") ); Badges.validateItemLevelAquired(item); + Catalog.countUse(item.getClass()); + Catalog.countUse(getClass()); + Statistics.upgradesUsed++; } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/ReclaimTrap.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/ReclaimTrap.java index 5f9d0e37d..a7e13fb88 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/ReclaimTrap.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/ReclaimTrap.java @@ -24,10 +24,12 @@ package com.shatteredpixel.shatteredpixeldungeon.items.spells; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; +import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.quest.MetalShard; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicMapping; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging; import com.shatteredpixel.shatteredpixeldungeon.journal.Bestiary; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.levels.traps.Trap; import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; @@ -82,7 +84,8 @@ public class ReclaimTrap extends TargetedSpell { storedTrap = null; t.pos = bolt.collisionPos; - Bestiary.trackEncounter(t.getClass()); + Bestiary.setSeen(t.getClass()); + Bestiary.countEncounter(t.getClass()); t.activate(); } @@ -154,7 +157,12 @@ public class ReclaimTrap extends TargetedSpell { output = ReclaimTrap.class; outQuantity = OUT_QUANTITY; } - + + @Override + public Item brew(ArrayList ingredients) { + Catalog.countUse(MetalShard.class); + return super.brew(ingredients); + } } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/SummonElemental.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/SummonElemental.java index b3c5166b4..9933817c9 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/SummonElemental.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/SummonElemental.java @@ -43,6 +43,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.quest.Embers; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTransmutation; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite; @@ -120,6 +121,7 @@ public class SummonElemental extends Spell { curUser.spendAndNext(Actor.TICK); detach(Dungeon.hero.belongings.backpack); + Catalog.countUse(getClass()); if (Random.Float() < talentChance){ Talent.onScrollUsed(curUser, curUser.pos, talentFactor); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/TargetedSpell.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/TargetedSpell.java index e8d1e0fe1..a3783649b 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/TargetedSpell.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/TargetedSpell.java @@ -27,6 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent; import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.CellSelector; @@ -92,6 +93,7 @@ public abstract class TargetedSpell extends Spell { Invisibility.dispel(); curSpell.updateQuickslot(); curUser.spendAndNext( 1f ); + Catalog.countUse(curSpell.getClass()); if (Random.Float() < curSpell.talentChance){ Talent.onScrollUsed(curUser, curUser.pos, curSpell.talentFactor); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/UnstableSpell.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/UnstableSpell.java index 7cccd340f..1da404daf 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/UnstableSpell.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/UnstableSpell.java @@ -38,6 +38,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTerror; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTransmutation; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ExoticScroll; import com.shatteredpixel.shatteredpixeldungeon.items.stones.Runestone; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.watabou.utils.Random; import com.watabou.utils.Reflection; @@ -111,6 +112,7 @@ public class UnstableSpell extends Spell { curItem = s; s.doRead(); + Catalog.countUse(getClass()); if (Random.Float() < talentChance){ Talent.onScrollUsed(curUser, curUser.pos, talentFactor); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/WildEnergy.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/WildEnergy.java index f121e2489..64b7b9ec6 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/WildEnergy.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/WildEnergy.java @@ -27,14 +27,18 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Recharging; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.effects.SpellSprite; +import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.quest.MetalShard; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging; import com.shatteredpixel.shatteredpixeldungeon.items.wands.CursedWand; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.watabou.noosa.audio.Sample; import com.watabou.utils.Callback; +import java.util.ArrayList; + public class WildEnergy extends TargetedSpell { { @@ -88,6 +92,11 @@ public class WildEnergy extends TargetedSpell { output = WildEnergy.class; outQuantity = OUT_QUANTITY; } - + + @Override + public Item brew(ArrayList ingredients) { + Catalog.countUse(MetalShard.class); + return super.brew(ingredients); + } } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/Runestone.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/Runestone.java index 14f985769..4dea93917 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/Runestone.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/Runestone.java @@ -25,6 +25,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility; import com.shatteredpixel.shatteredpixeldungeon.items.Item; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; public abstract class Runestone extends Item { @@ -41,6 +42,7 @@ public abstract class Runestone extends Item { (Dungeon.level.pit[cell] && Actor.findChar(cell) == null)){ super.onThrow( cell ); } else { + Catalog.countUse(getClass()); activate(cell); if (Actor.findChar(cell) == null) Dungeon.level.pressCell( cell ); Invisibility.dispel(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfAugmentation.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfAugmentation.java index 524f23cb3..0baa07af4 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfAugmentation.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfAugmentation.java @@ -27,6 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ScrollOfEnchantment; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; @@ -70,6 +71,7 @@ public class StoneOfAugmentation extends InventoryStone { useAnimation(); ScrollOfUpgrade.upgrade(curUser); curItem.detach( curUser.belongings.backpack ); + Catalog.countUse(getClass()); } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfEnchantment.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfEnchantment.java index bb3c0a325..08a89ef5b 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfEnchantment.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfEnchantment.java @@ -28,6 +28,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ScrollOfEnchantment; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; @@ -49,6 +50,7 @@ public class StoneOfEnchantment extends InventoryStone { @Override protected void onItemSelected(Item item) { curItem.detach( curUser.belongings.backpack ); + Catalog.countUse(getClass()); if (item instanceof Weapon) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfIntuition.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfIntuition.java index 5401568df..b4951b128 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfIntuition.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfIntuition.java @@ -30,6 +30,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic.ExoticPotio import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ExoticScroll; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; @@ -99,6 +100,7 @@ public class StoneOfIntuition extends InventoryStone { protected void onClick() { super.onClick(); useAnimation(); + Catalog.countUse(getClass()); if (item.getClass() == curGuess){ if (item instanceof Ring){ ((Ring) item).setKnown(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/trinkets/Trinket.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/trinkets/Trinket.java index a8d68e49a..f42cf6562 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/trinkets/Trinket.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/trinkets/Trinket.java @@ -24,6 +24,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.trinkets; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.Recipe; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import java.util.ArrayList; @@ -102,6 +103,9 @@ public abstract class Trinket extends Item { Item result = ingredients.get(0).duplicate(); ingredients.get(0).quantity(0); result.upgrade(); + + Catalog.countUse(result.getClass()); + return result; } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/trinkets/TrinketCatalyst.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/trinkets/TrinketCatalyst.java index d237f851b..3081a38db 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/trinkets/TrinketCatalyst.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/trinkets/TrinketCatalyst.java @@ -27,6 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.items.Generator; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.journal.Guidebook; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.journal.Document; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.AlchemyScene; @@ -197,6 +198,7 @@ public class TrinketCatalyst extends Item { if (cata != null) { cata.detach(Dungeon.hero.belongings.backpack); + Catalog.countUse(cata.getClass()); ((AlchemyScene)ShatteredPixelDungeon.scene()).craftItem(null, item); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfWarding.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfWarding.java index 33c83859f..e1c2b9dac 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfWarding.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfWarding.java @@ -252,7 +252,7 @@ public class WandOfWarding extends Wand { break; } - if (tier >= 4){ + if (Actor.chars().contains(this) && tier >= 3){ Bestiary.setSeen(WardSentry.class); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/TippedDart.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/TippedDart.java index e9b3982d1..7e27596ad 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/TippedDart.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/TippedDart.java @@ -32,6 +32,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Generator; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfRegrowth; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Crossbow; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.plants.Blindweed; import com.shatteredpixel.shatteredpixeldungeon.plants.Earthroot; @@ -120,6 +121,7 @@ public abstract class TippedDart extends Dart { if (durability <= 0){ //attempt to stick the dart to the enemy, just drop it if we can't. Dart d = new Dart(); + Catalog.countUse(getClass()); if (sticky && enemy != null && enemy.isAlive() && enemy.alignment != Char.Alignment.ALLY){ PinCushion p = Buff.affect(enemy, PinCushion.class); if (p.target == enemy){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/journal/Bestiary.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/journal/Bestiary.java index 008edb081..9f364675b 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/journal/Bestiary.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/journal/Bestiary.java @@ -170,18 +170,21 @@ public enum Bestiary { TRAP, PLANT; + //tracks whether an entity has been encountered + private final LinkedHashMap, Boolean> seen = new LinkedHashMap<>(); //tracks enemy kills, trap activations, plant tramples, or just sets to 1 for seen on allies - private LinkedHashMap, Integer> encounterCount = new LinkedHashMap<>(); + private final LinkedHashMap, Integer> encounterCount = new LinkedHashMap<>(); //should only be used when initializing private void addEntities(Class... classes ){ for (Class cls : classes){ + seen.put(cls, false); encounterCount.put(cls, 0); } } public Collection> entities(){ - return encounterCount.keySet(); + return seen.keySet(); } public String title(){ @@ -189,13 +192,13 @@ public enum Bestiary { } public int totalEntities(){ - return encounterCount.size(); + return seen.size(); } public int totalSeen(){ int seenTotal = 0; - for (int count : encounterCount.values()){ - if (count > 0) seenTotal++; + for (boolean entitySeen : seen.values()){ + if (entitySeen) seenTotal++; } return seenTotal; } @@ -250,19 +253,6 @@ public enum Bestiary { } - public static int encounterCount(Class cls) { - for (Bestiary cat : values()) { - if (cat.encounterCount.containsKey(cls)) { - return cat.encounterCount.get(cls); - } - } - return 0; - } - - public static boolean isSeen(Class cls){ - return encounterCount(cls) > 0; - } - //some mobs and traps have different internal classes in some cases, so need to convert here private static final HashMap, Class> classConversions = new HashMap<>(); static { @@ -283,73 +273,100 @@ public enum Bestiary { classConversions.put(YogDzewa.YogScorpio.class, Scorpio.class); } - public static void setSeen(Class mobClass){ - if (classConversions.containsKey(mobClass)){ - mobClass = classConversions.get(mobClass); + public static boolean isSeen(Class cls){ + for (Bestiary cat : values()) { + if (cat.seen.containsKey(cls)) { + return cat.seen.get(cls); + } + } + return false; + } + + public static void setSeen(Class cls){ + if (classConversions.containsKey(cls)){ + cls = classConversions.get(cls); } for (Bestiary cat : values()) { - if (cat.encounterCount.containsKey(mobClass)) { - if (cat.encounterCount.get(mobClass) == 0){ - cat.encounterCount.put(mobClass, 1); - Journal.saveNeeded = true; - } + if (cat.seen.containsKey(cls) && !cat.seen.get(cls)) { + cat.seen.put(cls, true); + Journal.saveNeeded = true; } } Badges.validateCatalogBadges(); } - public static void trackEncounter(Class mobClass){ - if (classConversions.containsKey(mobClass)){ - mobClass = classConversions.get(mobClass); + public static int encounterCount(Class cls) { + for (Bestiary cat : values()) { + if (cat.encounterCount.containsKey(cls)) { + return cat.encounterCount.get(cls); + } + } + return 0; + } + + public static void countEncounter(Class cls){ + if (classConversions.containsKey(cls)){ + cls = classConversions.get(cls); } for (Bestiary cat : values()) { - if (cat.encounterCount.containsKey(mobClass)) { - if (cat.encounterCount.get(mobClass) != Integer.MAX_VALUE){ - cat.encounterCount.put(mobClass, cat.encounterCount.get(mobClass)+1); - Journal.saveNeeded = true; - } + if (cat.encounterCount.containsKey(cls) && cat.encounterCount.get(cls) != Integer.MAX_VALUE){ + cat.encounterCount.put(cls, cat.encounterCount.get(cls)+1); + Journal.saveNeeded = true; } } Badges.validateCatalogBadges(); } - private static final String BESTIARY_CLASSES = "bestiary_classes"; + private static final String BESTIARY_CLASSES = "bestiary_classes"; + private static final String BESTIARY_SEEN = "bestiary_seen"; private static final String BESTIARY_ENCOUNTERS = "bestiary_encounters"; public static void store( Bundle bundle ){ ArrayList> classes = new ArrayList<>(); - ArrayList kills = new ArrayList<>(); + ArrayList seen = new ArrayList<>(); + ArrayList encounters = new ArrayList<>(); for (Bestiary cat : values()) { - for (Class mob : cat.entities()) { - if (cat.encounterCount.get(mob) > 0){ - classes.add(mob); - kills.add(cat.encounterCount.get(mob)); + for (Class entity : cat.entities()) { + if (cat.seen.get(entity) || cat.encounterCount.get(entity) > 0){ + classes.add(entity); + seen.add(cat.seen.get(entity)); + encounters.add(cat.encounterCount.get(entity)); } } } - int[] killsToStore = new int[kills.size()]; - for (int i = 0; i < killsToStore.length; i++){ - killsToStore[i] = kills.get(i); + Class[] storeCls = new Class[classes.size()]; + boolean[] storeSeen = new boolean[seen.size()]; + int[] storeEncounters = new int[encounters.size()]; + + for (int i = 0; i < storeCls.length; i++){ + storeCls[i] = classes.get(i); + storeSeen[i] = seen.get(i); + storeEncounters[i] = encounters.get(i); } - bundle.put( BESTIARY_CLASSES, classes.toArray(new Class[0]) ); - bundle.put( BESTIARY_ENCOUNTERS, killsToStore ); + bundle.put( BESTIARY_CLASSES, storeCls ); + bundle.put( BESTIARY_SEEN, storeSeen ); + bundle.put( BESTIARY_ENCOUNTERS, storeEncounters ); } public static void restore( Bundle bundle ){ - if (bundle.contains(BESTIARY_CLASSES) && bundle.contains(BESTIARY_ENCOUNTERS)){ + if (bundle.contains(BESTIARY_CLASSES) + && bundle.contains(BESTIARY_SEEN) + && bundle.contains(BESTIARY_ENCOUNTERS)){ Class[] classes = bundle.getClassArray(BESTIARY_CLASSES); - int[] kills = bundle.getIntArray(BESTIARY_ENCOUNTERS); + boolean[] seen = bundle.getBooleanArray(BESTIARY_SEEN); + int[] encounters = bundle.getIntArray(BESTIARY_ENCOUNTERS); for (int i = 0; i < classes.length; i++){ for (Bestiary cat : values()){ - if (cat.encounterCount.containsKey(classes[i])){ - cat.encounterCount.put(classes[i], kills[i]); + if (cat.seen.containsKey(classes[i])){ + cat.seen.put(classes[i], seen[i]); + cat.encounterCount.put(classes[i], encounters[i]); } } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/journal/Catalog.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/journal/Catalog.java index acb65d0c8..b37de1a8e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/journal/Catalog.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/journal/Catalog.java @@ -119,7 +119,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.LinkedHashMap; -import java.util.List; //For items, but includes a few item-like effects, such as enchantments public enum Catalog { @@ -149,8 +148,11 @@ public enum Catalog { BREWS_ELIXIRS, SPELLS, MISC_CONSUMABLES; - - private LinkedHashMap, Boolean> seen = new LinkedHashMap<>(); + + //tracks whether an item has been collected while identified + private final LinkedHashMap, Boolean> seen = new LinkedHashMap<>(); + //tracks upgrades spent for equipment, uses for consumables + private final LinkedHashMap, Integer> useCount = new LinkedHashMap<>(); public Collection> items(){ return seen.keySet(); @@ -160,6 +162,7 @@ public enum Catalog { private void addItems( Class... items){ for (Class item : items){ seen.put(item, false); + useCount.put(item, 0); } } @@ -179,7 +182,6 @@ public enum Catalog { return seenTotal; } - //TODO ordering of some items, and see if there may be better places to centralize some of these lists static { MELEE_WEAPONS.addItems(Generator.Category.WEP_T1.classes); @@ -301,10 +303,10 @@ public enum Catalog { consumableCatalogs.add(MISC_CONSUMABLES); } - public static boolean isSeen(Class itemClass){ + public static boolean isSeen(Class cls){ for (Catalog cat : values()) { - if (cat.seen.containsKey(itemClass)) { - return cat.seen.get(itemClass); + if (cat.seen.containsKey(cls)) { + return cat.seen.get(cls); } } return false; @@ -319,30 +321,75 @@ public enum Catalog { } Badges.validateCatalogBadges(); } - - private static final String CATALOG_ITEMS = "catalog_items"; + + public static int useCount(Class cls){ + for (Catalog cat : values()) { + if (cat.useCount.containsKey(cls)) { + return cat.useCount.get(cls); + } + } + return 0; + } + + public static void countUse(Class cls){ + countUses(cls, 1); + } + + public static void countUses(Class cls, int uses){ + for (Catalog cat : values()) { + if (cat.useCount.containsKey(cls) && cat.useCount.get(cls) != Integer.MAX_VALUE) { + cat.useCount.put(cls, cat.useCount.get(cls)+uses); + if (cat.useCount.get(cls) < -1_000_000_000){ //to catch cases of overflow + cat.useCount.put(cls, Integer.MAX_VALUE); + } + Journal.saveNeeded = true; + } + } + } + + private static final String CATALOG_CLASSES = "catalog_classes"; + private static final String CATALOG_SEEN = "catalog_seen"; + private static final String CATALOG_USES = "catalog_uses"; public static void store( Bundle bundle ){ - - Badges.loadGlobal(); - - ArrayList seen = new ArrayList<>(); + + ArrayList> classes = new ArrayList<>(); + ArrayList seen = new ArrayList<>(); + ArrayList uses = new ArrayList<>(); for (Catalog cat : values()) { for (Class item : cat.items()) { - if (cat.seen.get(item)) seen.add(item); + if (cat.seen.get(item) || cat.useCount.get(item) > 0){ + classes.add(item); + seen.add(cat.seen.get(item)); + uses.add(cat.useCount.get(item)); + } } } + + Class[] storeCls = new Class[classes.size()]; + boolean[] storeSeen = new boolean[seen.size()]; + int[] storeUses = new int[uses.size()]; + + for (int i = 0; i < storeCls.length; i++){ + storeCls[i] = classes.get(i); + storeSeen[i] = seen.get(i); + storeUses[i] = uses.get(i); + } - bundle.put( CATALOG_ITEMS, seen.toArray(new Class[0]) ); + bundle.put( CATALOG_CLASSES, storeCls ); + bundle.put( CATALOG_SEEN, storeSeen ); + bundle.put( CATALOG_USES, storeUses ); } + + //pre-v2.5 + private static final String CATALOG_ITEMS = "catalog_items"; public static void restore( Bundle bundle ){ - - Badges.loadGlobal(); //old logic for pre-v2.5 catalog-specific badges + Badges.loadGlobal(); for (Catalog cat : values()){ if (Badges.isUnlocked(catalogBadges.get(cat))){ for (Class item : cat.items()){ @@ -350,22 +397,33 @@ public enum Catalog { } } } - - //general save/load if (bundle.contains(CATALOG_ITEMS)) { - List seenClasses = new ArrayList<>(); - if (bundle.contains(CATALOG_ITEMS)) { - seenClasses = Arrays.asList(bundle.getClassArray(CATALOG_ITEMS)); - } - - for (Catalog cat : values()) { - for (Class item : cat.items()) { - if (seenClasses.contains(item)) { - cat.seen.put(item, true); + for (Class cls : Arrays.asList(bundle.getClassArray(CATALOG_ITEMS))){ + for (Catalog cat : values()) { + if (cat.seen.containsKey(cls)) { + cat.seen.put(cls, true); } } } } + //end of old logic + + if (bundle.contains(CATALOG_CLASSES)){ + Class[] classes = bundle.getClassArray(CATALOG_CLASSES); + boolean[] seen = bundle.getBooleanArray(CATALOG_SEEN); + int[] uses = bundle.getIntArray(CATALOG_USES); + + for (int i = 0; i < classes.length; i++){ + for (Catalog cat : values()) { + if (cat.seen.containsKey(classes[i])) { + cat.seen.put(classes[i], seen[i]); + cat.useCount.put(classes[i], uses[i]); + } + } + + } + } + } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/journal/Notes.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/journal/Notes.java index 23dd5bb94..43762a16f 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/journal/Notes.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/journal/Notes.java @@ -225,6 +225,7 @@ public class Notes { public static boolean remove( Key key ){ KeyRecord k = new KeyRecord( key ); if (records.contains(k)){ + Catalog.countUses(key.getClass(), key.quantity()); k = (KeyRecord) records.get(records.indexOf(k)); k.quantity(k.quantity() - key.quantity()); if (k.quantity() <= 0){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/DistortionTrap.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/DistortionTrap.java index 68175848b..b3188cbe7 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/DistortionTrap.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/DistortionTrap.java @@ -156,7 +156,8 @@ public class DistortionTrap extends Trap{ if ((t = Dungeon.level.traps.get(mob.pos)) != null && t.active){ if (t.disarmedByActivation) t.disarm(); t.reveal(); - Bestiary.trackEncounter(t.getClass()); + Bestiary.setSeen(t.getClass()); + Bestiary.countEncounter(t.getClass()); t.activate(); } ScrollOfTeleportation.appear(mob, mob.pos); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/FlockTrap.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/FlockTrap.java index 9b4b62626..be1c4bf7f 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/FlockTrap.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/FlockTrap.java @@ -67,7 +67,8 @@ public class FlockTrap extends Trap { if ((t = Dungeon.level.traps.get(i)) != null && t.active){ if (t.disarmedByActivation) t.disarm(); t.reveal(); - Bestiary.trackEncounter(t.getClass()); + Bestiary.setSeen(t.getClass()); + Bestiary.countEncounter(t.getClass()); t.activate(); } Dungeon.level.occupyCell(sheep); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/SummoningTrap.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/SummoningTrap.java index 9d6fd24b4..202addd99 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/SummoningTrap.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/SummoningTrap.java @@ -93,7 +93,8 @@ public class SummoningTrap extends Trap { if ((t = Dungeon.level.traps.get(mob.pos)) != null && t.active){ if (t.disarmedByActivation) t.disarm(); t.reveal(); - Bestiary.trackEncounter(t.getClass()); + Bestiary.setSeen(t.getClass()); + Bestiary.countEncounter(t.getClass()); t.activate(); } ScrollOfTeleportation.appear(mob, mob.pos); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/Trap.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/Trap.java index 882575524..667f224fc 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/Trap.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/Trap.java @@ -94,7 +94,8 @@ public abstract class Trap implements Bundlable { } if (disarmedByActivation) disarm(); Dungeon.level.discover(pos); - Bestiary.trackEncounter(getClass()); + Bestiary.setSeen(getClass()); + Bestiary.countEncounter(getClass()); activate(); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Plant.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Plant.java index 0bded424a..1f42aa32d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Plant.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Plant.java @@ -35,6 +35,7 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.particles.LeafParticle; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfRegrowth; import com.shatteredpixel.shatteredpixeldungeon.journal.Bestiary; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; @@ -71,7 +72,8 @@ public abstract class Plant implements Bundlable { wither(); activate( ch ); - Bestiary.trackEncounter(getClass()); + Bestiary.setSeen(getClass()); + Bestiary.countEncounter(getClass()); } public abstract void activate( Char ch ); @@ -153,6 +155,7 @@ public abstract class Plant implements Bundlable { || Dungeon.isChallenged(Challenges.NO_HERBALISM)) { super.onThrow( cell ); } else { + Catalog.countUse(getClass()); Dungeon.level.plant( this, cell ); if (Dungeon.hero.subClass == HeroSubClass.WARDEN) { for (int i : PathFinder.NEIGHBOURS8) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/AlchemyScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/AlchemyScene.java index e0002de03..d57b3e593 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/AlchemyScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/AlchemyScene.java @@ -31,12 +31,14 @@ import com.shatteredpixel.shatteredpixeldungeon.Statistics; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Belongings; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.effects.particles.SparkParticle; +import com.shatteredpixel.shatteredpixeldungeon.items.EnergyCrystal; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.LiquidMetal; import com.shatteredpixel.shatteredpixeldungeon.items.Recipe; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.AlchemistsToolkit; import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag; import com.shatteredpixel.shatteredpixeldungeon.items.trinkets.TrinketCatalyst; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.journal.Document; import com.shatteredpixel.shatteredpixeldungeon.journal.Journal; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; @@ -612,6 +614,7 @@ public class AlchemyScene extends PixelScene { if (toolkit != null){ cost = toolkit.consumeEnergy(cost); } + Catalog.countUses(EnergyCrystal.class, cost); Dungeon.energy -= cost; String energyText = Messages.get(AlchemyScene.class, "energy") + " " + Dungeon.energy; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndBlacksmith.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndBlacksmith.java index 3f3cf296b..d4a6ff50f 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndBlacksmith.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndBlacksmith.java @@ -37,6 +37,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.journal.Notes; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; @@ -442,6 +443,8 @@ public class WndBlacksmith extends Window { if (!Blacksmith.Quest.rewardsAvailable()){ Notes.remove( Notes.Landmark.TROLL ); } + + Catalog.countUse(item.getClass()); } } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndJournal.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndJournal.java index 1587252c0..9280bd2f4 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndJournal.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndJournal.java @@ -28,6 +28,8 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mimic; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Pylon; +import com.shatteredpixel.shatteredpixeldungeon.items.EnergyCrystal; +import com.shatteredpixel.shatteredpixeldungeon.items.Gold; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClassArmor; @@ -655,6 +657,18 @@ public class WndJournal extends WndTabbed { title = Messages.titleCase(item.trueName()); desc = item instanceof ClassArmor ? item.desc() : item.info(); + if (Catalog.useCount(itemClass) > 1) { + if (item.isUpgradable()) { + desc += "\n\n" + Messages.get(CatalogTab.class, "upgrade_count", Catalog.useCount(itemClass)); + } else if (item instanceof Gold) { + desc += "\n\n" + Messages.get(CatalogTab.class, "gold_count", Catalog.useCount(itemClass)); + } else if (item instanceof EnergyCrystal) { + desc += "\n\n" + Messages.get(CatalogTab.class, "energy_count", Catalog.useCount(itemClass)); + } else { + desc += "\n\n" + Messages.get(CatalogTab.class, "use_count", Catalog.useCount(itemClass)); + } + } + if (item.icon != -1) { secondIcon = new Image(Assets.Sprites.ITEM_ICONS); secondIcon.frame(ItemSpriteSheet.Icons.film.get(item.icon)); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndResurrect.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndResurrect.java index a87a8a3e1..b4358a2f9 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndResurrect.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndResurrect.java @@ -26,6 +26,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Statistics; import com.shatteredpixel.shatteredpixeldungeon.items.Ankh; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.InterlevelScene; @@ -125,6 +126,7 @@ public class WndResurrect extends Window { hide(); Statistics.ankhsUsed++; + Catalog.countUse(Ankh.class); ankh.detach(Dungeon.hero.belongings.backpack); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndTradeItem.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndTradeItem.java index b2f103376..1d992ca74 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndTradeItem.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndTradeItem.java @@ -32,6 +32,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Gold; import com.shatteredpixel.shatteredpixeldungeon.items.Heap; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.MasterThievesArmband; +import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; @@ -274,6 +275,7 @@ public class WndTradeItem extends WndInfoItem { int price = Shopkeeper.sellPrice( item ); Dungeon.gold -= price; + Catalog.countUses(Gold.class, price); if (!item.doPickUp( Dungeon.hero )) { Dungeon.level.drop( item, heap.pos ).sprite.drop();