v0.9.0: implemented an ID speed related talent for each hero

This commit is contained in:
Evan Debenham 2020-09-15 17:42:31 -04:00
parent a7c6744c30
commit 8aeeacb10e
9 changed files with 112 additions and 31 deletions

View File

@ -298,32 +298,32 @@ actors.buffs.wellfed.desc=You feel quite satisfied and full.\n\nWhile well fed,
###hero ###hero
actors.hero.talent.hearty_meal.title=hearty meal actors.hero.talent.hearty_meal.title=hearty meal
actors.hero.talent.hearty_meal.desc=_+1:_ Eating at below 50% health heals the Warrior for _4 HP_.\n\n_+2:_ Eating at below 50% health heals the Warrior for _6 HP_. actors.hero.talent.hearty_meal.desc=_+1:_ Eating at below 50% health heals the Warrior for _4 HP_.\n\n_+2:_ Eating at below 50% health heals the Warrior for _6 HP_.
actors.hero.talent.test_warrior_2.title=armsmaster's intuition actors.hero.talent.armsmasters_intuition.title=armsmaster's intuition
actors.hero.talent.test_warrior_2.desc=_+1:_ The Warrior identifies weapons and armor _2x faster_.\n\n_+2:_ The Warrior identifies weapons and armor _when he equips them_. actors.hero.talent.armsmasters_intuition.desc=_+1:_ The Warrior identifies weapons and armor _2x faster_.\n\n_+2:_ The Warrior identifies weapons and armor _when he equips them_.
actors.hero.talent.test_warrior_3.title=test talent actors.hero.talent.test_warrior_3.title=test talent
actors.hero.talent.test_warrior_3.desc=_+1:_ Whenever he identifies a potion, the warrior heals for _3 HP_.\n\n_+2:_ Whenever he identifies a potion, the warrior heals for _5 HP_. actors.hero.talent.test_warrior_3.desc=_+1:_ Whenever he identifies a potion, the warrior heals for _3 HP_.\n\n_+2:_ Whenever he identifies a potion, the warrior heals for _5 HP_.
actors.hero.talent.test_warrior_4.title=iron will actors.hero.talent.test_warrior_4.title=iron will
actors.hero.talent.test_warrior_4.desc=_+1:_ The max shield provided by the warrior's seal is _increased by 1_.\n\n_+2:_ The max shield provided by the warrior's seal is _increased by 2_. actors.hero.talent.test_warrior_4.desc=_+1:_ The max shield provided by the warrior's seal is _increased by 1_.\n\n_+2:_ The max shield provided by the warrior's seal is _increased by 2_.
actors.hero.talent.energizing_meal.title=energizing meal actors.hero.talent.energizing_meal.title=energizing meal
actors.hero.talent.energizing_meal.desc=_+1:_ Eating at below 50% health grants the Mage _4 turns of wand recharging_.\n\n_+2:_ Eating at below 50% health grants the Mage _6 turns of wand recharging_. actors.hero.talent.energizing_meal.desc=_+1:_ Eating at below 50% health grants the Mage _4 turns of wand recharging_.\n\n_+2:_ Eating at below 50% health grants the Mage _6 turns of wand recharging_.
actors.hero.talent.test_mage_2.title=scholar's intuition actors.hero.talent.scholars_intuition.title=scholar's intuition
actors.hero.talent.test_mage_2.desc=_+1:_ The Mage identifies wands _2x faster_.\n\n_+2:_ The Mage identifies wands _when he uses them_. actors.hero.talent.scholars_intuition.desc=_+1:_ The Mage identifies wands _2x faster_.\n\n_+2:_ The Mage identifies wands _when he uses them_.
actors.hero.talent.test_mage_3.title=test talent actors.hero.talent.test_mage_3.title=test talent
actors.hero.talent.test_mage_3.desc=TODO actors.hero.talent.test_mage_3.desc=TODO
actors.hero.talent.test_mage_4.title=test talent actors.hero.talent.test_mage_4.title=test talent
actors.hero.talent.test_mage_4.desc=TODO actors.hero.talent.test_mage_4.desc=TODO
actors.hero.talent.rationed_meal.title=rationed meal actors.hero.talent.rationed_meal.title=rationed meal
actors.hero.talent.rationed_meal.desc=_+1:_ Eating at below 50% health gives the Rogue _20% more satiety_.\n\n_+2:_ Eating at below 50% health gives the Rogue _30% more satiety_. actors.hero.talent.rationed_meal.desc=_+1:_ Eating at below 50% health gives the Rogue _20% more satiety_.\n\n_+2:_ Eating at below 50% health gives the Rogue _30% more satiety_.
actors.hero.talent.test_rogue_2.title=thief's intuition actors.hero.talent.thiefs_intuition.title=thief's intuition
actors.hero.talent.test_rogue_2.desc=_+1:_ The Rogue identifies the type of a ring _when he equips it_.\n\n_+2:_ The Rogue identifies the type of a ring _when he examines it_. actors.hero.talent.thiefs_intuition.desc=_+1:_ The Rogue identifies rings _2x faster_, and identifies the type of a ring _when he equips it_.\n\n_+2:_ The Rogue identifies rings _when he equips them_, and identifies the type of a ring _when he picks it up_.
actors.hero.talent.test_rogue_3.title=test talent actors.hero.talent.test_rogue_3.title=test talent
actors.hero.talent.test_rogue_3.desc=TODO actors.hero.talent.test_rogue_3.desc=TODO
actors.hero.talent.test_rogue_4.title=test talent actors.hero.talent.test_rogue_4.title=test talent
actors.hero.talent.test_rogue_4.desc=TODO actors.hero.talent.test_rogue_4.desc=TODO
actors.hero.talent.invigorating_meal.title=invigorating meal actors.hero.talent.invigorating_meal.title=invigorating meal
actors.hero.talent.invigorating_meal.desc=_+1:_ Eating at below 50% health takes 1 turn and grants the Huntress _2 turns of haste_.\n\n_+2:_ Eating at below 50% health takes 1 turn and grants the Huntress _3 turns of haste_. actors.hero.talent.invigorating_meal.desc=_+1:_ Eating at below 50% health takes 1 turn and grants the Huntress _2 turns of haste_.\n\n_+2:_ Eating at below 50% health takes 1 turn and grants the Huntress _3 turns of haste_.
actors.hero.talent.test_huntress_2.title=survivalist's intuition actors.hero.talent.survivalists_intuition.title=survivalist's intuition
actors.hero.talent.test_huntress_2.desc=_+1:_ The Huntress identifies all equipment _1.5x faster_.\n\n_+2:_ The Huntress identifies all equipment _2x faster_. actors.hero.talent.survivalists_intuition.desc=_+1:_ The Huntress identifies all equipment _1.5x faster_.\n\n_+2:_ The Huntress identifies all equipment _2x faster_.
actors.hero.talent.test_huntress_3.title=test talent actors.hero.talent.test_huntress_3.title=test talent
actors.hero.talent.test_huntress_3.desc=TODO actors.hero.talent.test_huntress_3.desc=TODO
actors.hero.talent.test_huntress_4.title=test talent actors.hero.talent.test_huntress_4.title=test talent

View File

@ -306,6 +306,7 @@ public class Hero extends Char {
if (f == talent) tier.put(talent, tier.get(talent)+1); if (f == talent) tier.put(talent, tier.get(talent)+1);
} }
} }
Talent.onTalentUpgraded(this, talent);
} }
//TODO account for tiers //TODO account for tiers

View File

@ -21,12 +21,19 @@
package com.shatteredpixel.shatteredpixeldungeon.actors.hero; package com.shatteredpixel.shatteredpixeldungeon.actors.hero;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Haste; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Haste;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Recharging; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Recharging;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.watabou.utils.Bundle; import com.watabou.utils.Bundle;
@ -37,22 +44,22 @@ import java.util.LinkedHashMap;
public enum Talent { public enum Talent {
HEARTY_MEAL(0), HEARTY_MEAL(0),
TEST_WARRIOR_2(1), ARMSMASTERS_INTUITION(1),
TEST_WARRIOR_3(2), TEST_WARRIOR_3(2),
TEST_WARRIOR_4(3), TEST_WARRIOR_4(3),
ENERGIZING_MEAL(16), ENERGIZING_MEAL(16),
TEST_MAGE_2(17), SCHOLARS_INTUITION(17),
TEST_MAGE_3(18), TEST_MAGE_3(18),
TEST_MAGE_4(19), TEST_MAGE_4(19),
RATIONED_MEAL(32), RATIONED_MEAL(32),
TEST_ROGUE_2(33), THIEFS_INTUITION(33),
TEST_ROGUE_3(34), TEST_ROGUE_3(34),
TEST_ROGUE_4(35), TEST_ROGUE_4(35),
INVIGORATING_MEAL(48), INVIGORATING_MEAL(48),
TEST_HUNTRESS_2(49), SURVIVALISTS_INTUITION(49),
TEST_HUNTRESS_3(50), TEST_HUNTRESS_3(50),
TEST_HUNTRESS_4(51); TEST_HUNTRESS_4(51);
@ -78,6 +85,26 @@ public enum Talent {
return Messages.get(this, name() + ".desc"); return Messages.get(this, name() + ".desc");
} }
public static void onTalentUpgraded( Hero hero, Talent talent){
if (talent == ARMSMASTERS_INTUITION && hero.pointsInTalent(ARMSMASTERS_INTUITION) == 2){
if (hero.belongings.weapon != null) hero.belongings.weapon.identify();
if (hero.belongings.armor != null) hero.belongings.armor.identify();
}
if (talent == THIEFS_INTUITION && hero.pointsInTalent(THIEFS_INTUITION) == 2){
if (hero.belongings.ring instanceof Ring) hero.belongings.ring.identify();
if (hero.belongings.misc instanceof Ring) hero.belongings.misc.identify();
for (Item item : Dungeon.hero.belongings){
if (item instanceof Ring){
((Ring) item).setKnown();
}
}
}
if (talent == THIEFS_INTUITION && hero.pointsInTalent(THIEFS_INTUITION) == 1){
if (hero.belongings.ring instanceof Ring) hero.belongings.ring.setKnown();
if (hero.belongings.misc instanceof Ring) ((Ring) hero.belongings.misc).setKnown();
}
}
public static void onFoodEaten( Hero hero, float foodVal ){ public static void onFoodEaten( Hero hero, float foodVal ){
if (hero.hasTalent(HEARTY_MEAL) && hero.HP <= hero.HT/2){ if (hero.hasTalent(HEARTY_MEAL) && hero.HP <= hero.HT/2){
//4/6 HP healed //4/6 HP healed
@ -104,6 +131,42 @@ public enum Talent {
} }
} }
public static float itemIDSpeedFactor( Hero hero, Item item ){
// 1.5x/2x speed with huntress talent
float factor = 1f + hero.pointsInTalent(SURVIVALISTS_INTUITION)/2f;
//otherwise 2x/3x speed (also ID instantly though)
if (item instanceof MeleeWeapon || item instanceof Armor){
factor *= 1f + hero.pointsInTalent(ARMSMASTERS_INTUITION);
}
if (item instanceof Wand){
factor *= 1f + hero.pointsInTalent(SCHOLARS_INTUITION);
}
if (item instanceof Ring){
factor *= 1f + hero.pointsInTalent(THIEFS_INTUITION);
}
return factor;
}
public static void onItemEquipped( Hero hero, Item item ){
if (hero.hasTalent(ARMSMASTERS_INTUITION) && (item instanceof Weapon || item instanceof Armor)){
item.identify();
}
if (hero.hasTalent(THIEFS_INTUITION) && item instanceof Ring){
if (hero.pointsInTalent(THIEFS_INTUITION) == 2){
item.identify();
} else {
((Ring) item).setKnown();
}
}
}
public static void onItemCollected( Hero hero, Item item ){
if (hero.pointsInTalent(THIEFS_INTUITION) == 2){
if (item instanceof Ring) ((Ring) item).setKnown();
}
}
private static final int TALENT_TIERS = 1; private static final int TALENT_TIERS = 1;
public static void initClassTalents( Hero hero ){ public static void initClassTalents( Hero hero ){
@ -116,16 +179,16 @@ public enum Talent {
//tier 1 //tier 1
switch (hero.heroClass){ switch (hero.heroClass){
case WARRIOR: default: case WARRIOR: default:
Collections.addAll(tierTalents, HEARTY_MEAL, TEST_WARRIOR_2, TEST_WARRIOR_3, TEST_WARRIOR_4); Collections.addAll(tierTalents, HEARTY_MEAL, ARMSMASTERS_INTUITION, TEST_WARRIOR_3, TEST_WARRIOR_4);
break; break;
case MAGE: case MAGE:
Collections.addAll(tierTalents, ENERGIZING_MEAL, TEST_MAGE_2, TEST_MAGE_3, TEST_MAGE_4); Collections.addAll(tierTalents, ENERGIZING_MEAL, SCHOLARS_INTUITION, TEST_MAGE_3, TEST_MAGE_4);
break; break;
case ROGUE: case ROGUE:
Collections.addAll(tierTalents, RATIONED_MEAL, TEST_ROGUE_2, TEST_ROGUE_3, TEST_ROGUE_4); Collections.addAll(tierTalents, RATIONED_MEAL, THIEFS_INTUITION, TEST_ROGUE_3, TEST_ROGUE_4);
break; break;
case HUNTRESS: case HUNTRESS:
Collections.addAll(tierTalents, INVIGORATING_MEAL, TEST_HUNTRESS_2, TEST_HUNTRESS_3, TEST_HUNTRESS_4); Collections.addAll(tierTalents, INVIGORATING_MEAL, SURVIVALISTS_INTUITION, TEST_HUNTRESS_3, TEST_HUNTRESS_4);
break; break;
} }
for (Talent talent : tierTalents){ for (Talent talent : tierTalents){

View File

@ -26,6 +26,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicImmune; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicImmune;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShadowParticle; import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShadowParticle;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
@ -59,6 +60,9 @@ public abstract class EquipableItem extends Item {
//This is a special case as the item is being removed from inventory, but is staying with the hero. //This is a special case as the item is being removed from inventory, but is staying with the hero.
int slot = Dungeon.quickslot.getSlot( this ); int slot = Dungeon.quickslot.getSlot( this );
doEquip(hero); doEquip(hero);
if (isEquipped(hero)){
Talent.onItemEquipped(hero, this);
}
if (slot != -1) { if (slot != -1) {
Dungeon.quickslot.setSlot( slot, this ); Dungeon.quickslot.setSlot( slot, this );
updateQuickslot(); updateQuickslot();

View File

@ -28,6 +28,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Degrade; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Degrade;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag; import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag;
import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog;
@ -105,6 +106,7 @@ public class Item implements Bundlable {
GameScene.pickUp( this, hero.pos ); GameScene.pickUp( this, hero.pos );
Sample.INSTANCE.play( Assets.Sounds.ITEM ); Sample.INSTANCE.play( Assets.Sounds.ITEM );
Talent.onItemCollected( hero, this );
hero.spendAndNext( TIME_TO_PICK_UP ); hero.spendAndNext( TIME_TO_PICK_UP );
return true; return true;

View File

@ -29,6 +29,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicImmune; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicImmune;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Momentum; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Momentum;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.items.BrokenSeal; import com.shatteredpixel.shatteredpixeldungeon.items.BrokenSeal;
import com.shatteredpixel.shatteredpixeldungeon.items.EquipableItem; import com.shatteredpixel.shatteredpixeldungeon.items.EquipableItem;
@ -106,7 +107,7 @@ public class Armor extends EquipableItem {
public int tier; public int tier;
private static final int USES_TO_ID = 10; private static final int USES_TO_ID = 10;
private int usesLeftToID = USES_TO_ID; private float usesLeftToID = USES_TO_ID;
private float availableUsesToID = USES_TO_ID/2f; private float availableUsesToID = USES_TO_ID/2f;
public Armor( int tier ) { public Armor( int tier ) {
@ -386,9 +387,10 @@ public class Armor extends EquipableItem {
damage = glyph.proc( this, attacker, defender, damage ); damage = glyph.proc( this, attacker, defender, damage );
} }
if (!levelKnown && defender == Dungeon.hero && availableUsesToID >= 1) { if (!levelKnown && defender == Dungeon.hero) {
availableUsesToID--; float uses = Math.min( availableUsesToID, Talent.itemIDSpeedFactor(Dungeon.hero, this) );
usesLeftToID--; availableUsesToID -= uses;
usesLeftToID -= uses;
if (usesLeftToID <= 0) { if (usesLeftToID <= 0) {
identify(); identify();
GLog.p( Messages.get(Armor.class, "identify") ); GLog.p( Messages.get(Armor.class, "identify") );
@ -401,6 +403,7 @@ public class Armor extends EquipableItem {
@Override @Override
public void onHeroGainExp(float levelPercent, Hero hero) { public void onHeroGainExp(float levelPercent, Hero hero) {
levelPercent *= Talent.itemIDSpeedFactor(hero, this);
if (!levelKnown && isEquipped(hero) && availableUsesToID <= USES_TO_ID/2f) { if (!levelKnown && isEquipped(hero) && availableUsesToID <= USES_TO_ID/2f) {
//gains enough uses to ID over 0.5 levels //gains enough uses to ID over 0.5 levels
availableUsesToID = Math.min(USES_TO_ID/2f, availableUsesToID + levelPercent * USES_TO_ID); availableUsesToID = Math.min(USES_TO_ID/2f, availableUsesToID + levelPercent * USES_TO_ID);

View File

@ -26,6 +26,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; 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.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.ItemStatusHandler; import com.shatteredpixel.shatteredpixeldungeon.items.ItemStatusHandler;
import com.shatteredpixel.shatteredpixeldungeon.items.KindofMisc; import com.shatteredpixel.shatteredpixeldungeon.items.KindofMisc;
@ -288,6 +289,7 @@ public class Ring extends KindofMisc {
public void onHeroGainExp( float levelPercent, Hero hero ){ public void onHeroGainExp( float levelPercent, Hero hero ){
if (isIdentified() || !isEquipped(hero)) return; if (isIdentified() || !isEquipped(hero)) return;
levelPercent *= Talent.itemIDSpeedFactor(hero, this);
//becomes IDed after 1 level //becomes IDed after 1 level
levelsToID -= levelPercent; levelsToID -= levelPercent;
if (levelsToID <= 0){ if (levelsToID <= 0){

View File

@ -35,6 +35,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.SoulMark;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile; import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile;
import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag; import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag;
@ -72,7 +73,7 @@ public abstract class Wand extends Item {
public boolean curseInfusionBonus = false; public boolean curseInfusionBonus = false;
private static final int USES_TO_ID = 10; private static final int USES_TO_ID = 10;
private int usesLeftToID = USES_TO_ID; private float usesLeftToID = USES_TO_ID;
private float availableUsesToID = USES_TO_ID/2f; private float availableUsesToID = USES_TO_ID/2f;
protected int collisionProperties = Ballistica.MAGIC_BOLT; protected int collisionProperties = Ballistica.MAGIC_BOLT;
@ -202,6 +203,7 @@ public abstract class Wand extends Item {
} }
public void onHeroGainExp( float levelPercent, Hero hero ){ public void onHeroGainExp( float levelPercent, Hero hero ){
levelPercent *= Talent.itemIDSpeedFactor(hero, this);
if (!isIdentified() && availableUsesToID <= USES_TO_ID/2f) { if (!isIdentified() && availableUsesToID <= USES_TO_ID/2f) {
//gains enough uses to ID over 1 level //gains enough uses to ID over 1 level
availableUsesToID = Math.min(USES_TO_ID/2f, availableUsesToID + levelPercent * USES_TO_ID/2f); availableUsesToID = Math.min(USES_TO_ID/2f, availableUsesToID + levelPercent * USES_TO_ID/2f);
@ -319,10 +321,11 @@ public abstract class Wand extends Item {
} }
protected void wandUsed() { protected void wandUsed() {
if (!isIdentified() && availableUsesToID >= 1) { if (!isIdentified()) {
availableUsesToID--; float uses = Math.min( availableUsesToID, Talent.itemIDSpeedFactor(Dungeon.hero, this) );
usesLeftToID--; availableUsesToID -= uses;
if (usesLeftToID <= 0) { usesLeftToID -= uses;
if (usesLeftToID <= 0 || Dungeon.hero.pointsInTalent(Talent.SCHOLARS_INTUITION) == 2) {
identify(); identify();
GLog.p( Messages.get(Wand.class, "identify") ); GLog.p( Messages.get(Wand.class, "identify") );
Badges.validateItemLevelAquired( this ); Badges.validateItemLevelAquired( this );

View File

@ -26,6 +26,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicImmune; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicImmune;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; 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.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon; import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfFuror; import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfFuror;
@ -92,7 +93,7 @@ abstract public class Weapon extends KindOfWeapon {
public Augment augment = Augment.NONE; public Augment augment = Augment.NONE;
private static final int USES_TO_ID = 20; private static final int USES_TO_ID = 20;
private int usesLeftToID = USES_TO_ID; private float usesLeftToID = USES_TO_ID;
private float availableUsesToID = USES_TO_ID/2f; private float availableUsesToID = USES_TO_ID/2f;
public Enchantment enchantment; public Enchantment enchantment;
@ -105,9 +106,10 @@ abstract public class Weapon extends KindOfWeapon {
damage = enchantment.proc( this, attacker, defender, damage ); damage = enchantment.proc( this, attacker, defender, damage );
} }
if (!levelKnown && attacker == Dungeon.hero && availableUsesToID >= 1) { if (!levelKnown && attacker == Dungeon.hero) {
availableUsesToID--; float uses = Math.min( availableUsesToID, Talent.itemIDSpeedFactor(Dungeon.hero, this) );
usesLeftToID--; availableUsesToID -= uses;
usesLeftToID -= uses;
if (usesLeftToID <= 0) { if (usesLeftToID <= 0) {
identify(); identify();
GLog.p( Messages.get(Weapon.class, "identify") ); GLog.p( Messages.get(Weapon.class, "identify") );
@ -119,6 +121,7 @@ abstract public class Weapon extends KindOfWeapon {
} }
public void onHeroGainExp( float levelPercent, Hero hero ){ public void onHeroGainExp( float levelPercent, Hero hero ){
levelPercent *= Talent.itemIDSpeedFactor(hero, this);
if (!levelKnown && isEquipped(hero) && availableUsesToID <= USES_TO_ID/2f) { if (!levelKnown && isEquipped(hero) && availableUsesToID <= USES_TO_ID/2f) {
//gains enough uses to ID over 0.5 levels //gains enough uses to ID over 0.5 levels
availableUsesToID = Math.min(USES_TO_ID/2f, availableUsesToID + levelPercent * USES_TO_ID); availableUsesToID = Math.min(USES_TO_ID/2f, availableUsesToID + levelPercent * USES_TO_ID);
@ -144,8 +147,8 @@ abstract public class Weapon extends KindOfWeapon {
@Override @Override
public void restoreFromBundle( Bundle bundle ) { public void restoreFromBundle( Bundle bundle ) {
super.restoreFromBundle( bundle ); super.restoreFromBundle( bundle );
usesLeftToID = bundle.getInt( USES_LEFT_TO_ID ); usesLeftToID = bundle.getFloat( USES_LEFT_TO_ID );
availableUsesToID = bundle.getInt( AVAILABLE_USES ); availableUsesToID = bundle.getFloat( AVAILABLE_USES );
enchantment = (Enchantment)bundle.get( ENCHANTMENT ); enchantment = (Enchantment)bundle.get( ENCHANTMENT );
curseInfusionBonus = bundle.getBoolean( CURSE_INFUSION_BONUS ); curseInfusionBonus = bundle.getBoolean( CURSE_INFUSION_BONUS );