v2.5.0: added more info tracking to catalogs, and code improvements
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -98,7 +98,7 @@ public abstract class Recipe {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean testIngredients(ArrayList<Item> ingredients) {
|
||||
public boolean testIngredients(ArrayList<Item> ingredients) {
|
||||
|
||||
int[] needed = inQuantity.clone();
|
||||
|
||||
@@ -121,12 +121,12 @@ public abstract class Recipe {
|
||||
return true;
|
||||
}
|
||||
|
||||
public final int cost(ArrayList<Item> ingredients){
|
||||
public int cost(ArrayList<Item> ingredients){
|
||||
return cost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Item brew(ArrayList<Item> ingredients) {
|
||||
public Item brew(ArrayList<Item> 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<Item> ingredients){
|
||||
public Item sampleOutput(ArrayList<Item> ingredients){
|
||||
try {
|
||||
Item result = Reflection.newInstance(output);
|
||||
result.quantity(outQuantity);
|
||||
|
||||
@@ -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"));
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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") );
|
||||
}
|
||||
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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"));
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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") );
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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") );
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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<Item> ingredients) {
|
||||
Catalog.countUse(GooBlob.class);
|
||||
return super.brew(ingredients);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<Item> ingredients) {
|
||||
Catalog.countUse(GooBlob.class);
|
||||
return super.brew(ingredients);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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<Item> ingredients) {
|
||||
Catalog.countUse(GooBlob.class);
|
||||
return super.brew(ingredients);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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 ) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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<Item> ingredients) {
|
||||
Catalog.countUse(MetalShard.class);
|
||||
return super.brew(ingredients);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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++;
|
||||
}
|
||||
|
||||
|
||||
@@ -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<Item> ingredients) {
|
||||
Catalog.countUse(MetalShard.class);
|
||||
return super.brew(ingredients);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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<Item> ingredients) {
|
||||
Catalog.countUse(MetalShard.class);
|
||||
return super.brew(ingredients);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -252,7 +252,7 @@ public class WandOfWarding extends Wand {
|
||||
break;
|
||||
}
|
||||
|
||||
if (tier >= 4){
|
||||
if (Actor.chars().contains(this) && tier >= 3){
|
||||
Bestiary.setSeen(WardSentry.class);
|
||||
}
|
||||
|
||||
|
||||
@@ -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){
|
||||
|
||||
@@ -170,18 +170,21 @@ public enum Bestiary {
|
||||
TRAP,
|
||||
PLANT;
|
||||
|
||||
//tracks whether an entity has been encountered
|
||||
private final LinkedHashMap<Class<?>, Boolean> seen = new LinkedHashMap<>();
|
||||
//tracks enemy kills, trap activations, plant tramples, or just sets to 1 for seen on allies
|
||||
private LinkedHashMap<Class<?>, Integer> encounterCount = new LinkedHashMap<>();
|
||||
private final LinkedHashMap<Class<?>, 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<Class<?>> 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<?>, 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<Class<?>> classes = new ArrayList<>();
|
||||
ArrayList<Integer> kills = new ArrayList<>();
|
||||
ArrayList<Boolean> seen = new ArrayList<>();
|
||||
ArrayList<Integer> 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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<Class<?>, Boolean> seen = new LinkedHashMap<>();
|
||||
|
||||
//tracks whether an item has been collected while identified
|
||||
private final LinkedHashMap<Class<?>, Boolean> seen = new LinkedHashMap<>();
|
||||
//tracks upgrades spent for equipment, uses for consumables
|
||||
private final LinkedHashMap<Class<?>, Integer> useCount = new LinkedHashMap<>();
|
||||
|
||||
public Collection<Class<?>> 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<Class> seen = new ArrayList<>();
|
||||
|
||||
ArrayList<Class<?>> classes = new ArrayList<>();
|
||||
ArrayList<Boolean> seen = new ArrayList<>();
|
||||
ArrayList<Integer> 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<Class> 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]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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){
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user