diff --git a/core/src/main/assets/messages/actors/actors.properties b/core/src/main/assets/messages/actors/actors.properties index 26f412430..024803bb4 100644 --- a/core/src/main/assets/messages/actors/actors.properties +++ b/core/src/main/assets/messages/actors/actors.properties @@ -633,7 +633,7 @@ actors.hero.talent.iron_will.meta_desc=_If this talent is gained by a different actors.hero.talent.iron_stomach.title=iron stomach actors.hero.talent.iron_stomach.desc=_+1:_ Eating food takes the Warrior 1 turn and grants him _75% damage resistance_ while eating.\n\n_+2:_ Eating food takes the Warrior 1 turn and grants him _100% damage resistance_ while eating. actors.hero.talent.liquid_willpower.title=liquid willpower -actors.hero.talent.liquid_willpower.desc=_+1:_ The Warrior instantly regains _50% of the shielding_ from his broken seal when drinking or throwing a potion.\n\n_+2:_ The Warrior instantly regains _75% of the shielding_ from his broken seal when drinking or throwing a potion.\n\nThe shield regeneration effect is doubled when using potions of strength, experience, mastery, or divine inspiration. +actors.hero.talent.liquid_willpower.desc=_+1:_ The Warrior instantly regains _50% of the shielding_ from his broken seal when drinking or throwing a potion, brew, or elixir.\n\n_+2:_ The Warrior instantly regains _75% of the shielding_ from his broken seal when drinking or throwing a potion, brew, or elixir.\n\nThe shield regeneration effect is doubled when using potions of strength, experience, or alchemy items that must be crafted using those potions.\n\nFor alchemy items with higher output quantities (e.g. aqua brew), this talent has a chance to trigger based on how many of that item is produced. actors.hero.talent.liquid_willpower.meta_desc=_If this talent is gained by a different hero_ it will instead grant shielding equal to 5% max hp at +1, or 7.5% max hp at +2. actors.hero.talent.runic_transference.title=runic transference actors.hero.talent.runic_transference.desc=_+1:_ The Warrior's broken seal can transfer _regular glyphs_ in the same way it transfers an upgrade.\n\n_+2:_ The Warrior's broken seal can transfer _regular, powerful, and curse glyphs_ in the same way it transfers an upgrade. @@ -697,7 +697,7 @@ actors.hero.talent.backup_barrier.meta_desc=_If this talent is gained by a diffe actors.hero.talent.energizing_meal.title=energizing meal actors.hero.talent.energizing_meal.desc=_+1:_ Eating food takes the Mage 1 turn and grants him _5 turns of wand recharging_.\n\n_+2:_ Eating food takes the Mage 1 turn and grants him _8 turns of wand recharging_. actors.hero.talent.inscribed_power.title=inscribed power -actors.hero.talent.inscribed_power.desc=_+1:_ When the Mage reads a scroll, his _next 2 wand zaps_ get +2 levels.\n\n_+2:_ When the Mage reads a scroll, his _next 3 wand zaps_ get +2 levels.\n\nThe number of enhanced wand zaps is doubled when reading a scroll of upgrade, transmutation, enchantment, or metamorphosis. +actors.hero.talent.inscribed_power.desc=_+1:_ When the Mage reads a scroll or uses a spell item, his _next 2 wand zaps_ get +2 levels.\n\n_+2:_ When the Mage reads a scroll or uses a spell item, his _next 3 wand zaps_ get +2 levels.\n\nThe number of enhanced wand zaps is doubled when reading a scroll of upgrade, transmutation, enchantment, or metamorphosis.\n\nFor alchemy items with higher output quantities (e.g. most spells), this talent has a chance to trigger based on how many of that item is produced. actors.hero.talent.wand_preservation.title=wand preservation actors.hero.talent.wand_preservation.desc=_+1:_ When the Mage imbues a new wand into his staff, the old wand has a _67% chance_ of being returned at +0, otherwise it will be returned as 1 arcane resin.\n\n_+2:_ When the Mage imbues a new wand into his staff, the old wand has a _100% chance_ of being returned at +0.\n\nThis talent can preserve wands a maximum of five times, afterward it will always grant 1 arcane resin. actors.hero.talent.wand_preservation.meta_desc=_If this talent is gained by a different hero_ it will instead increase the amount of arcane resin gained when putting a wand into an alchemy pot by 1 at +1, or by 2 at +2. @@ -759,7 +759,7 @@ actors.hero.talent.protective_shadows.desc=_+1:_ The Rogue gains one shielding _ actors.hero.talent.mystical_meal.title=mystical meal actors.hero.talent.mystical_meal.desc=_+1:_ Eating food takes the Rogue 1 turn (supply rations are eaten instantly) and grants him _3 turns of artifact recharging_.\n\n_+2:_ Eating food takes the Rogue 1 turn (supply rations are eaten instantly) and grants him _5 turns of artifact recharging_.\n\nThis talent cannot be used to let the horn of plenty recharge itself. actors.hero.talent.inscribed_stealth.title=inscribed stealth -actors.hero.talent.inscribed_stealth.desc=_+1:_ The Rogue gains _3 turns_ of invisibility after reading a scroll.\n\n_+2:_ The Rogue gains _5 turns_ of invisibility after reading a scroll.\n\nThe invisibility duration is doubled when reading a scroll of upgrade, transmutation, enchantment, or metamorphosis. +actors.hero.talent.inscribed_stealth.desc=_+1:_ The Rogue gains _3 turns_ of invisibility after reading a scroll or using a spell item.\n\n_+2:_ The Rogue gains _5 turns_ of invisibility after reading a scroll or using a spell item\n\nThe invisibility duration is doubled when use a scroll of upgrade, scroll of transmutation, or alchemy items that must be crafted using those scrolls.\n\nFor alchemy items with higher output quantities (e.g. most spells), this talent has a chance to trigger based on how many of that item is produced. actors.hero.talent.wide_search.title=wide search actors.hero.talent.wide_search.desc=_+1:_ The Rogue’s search radius is increased from a 5x5 square to a _7x7 circle_.\n\n_+2:_ The Rogue’s search radius is increased from a 5x5 square to a _7x7 square_. actors.hero.talent.wide_search.meta_desc=_If this talent is gained by a different hero_ it will instead increase their search radius from a 3x3 square to a 5x5 circle at +1, or a 5x5 square at +2. @@ -822,7 +822,7 @@ actors.hero.talent.natures_aid.desc=_+1:_ The Huntress gains 0-2 armor of barksk actors.hero.talent.invigorating_meal.title=invigorating meal actors.hero.talent.invigorating_meal.desc=_+1:_ Eating food takes the Huntress 1 turn (berries are eaten instantly) and grants her _1 turn of haste_.\n\n_+2:_ Eating food takes the Huntress 1 turn (berries are eaten instantly) and grants her _2 turns of haste_. actors.hero.talent.liquid_nature.title=liquid nature -actors.hero.talent.liquid_nature.desc=_+1:_ When the Huntress drinks or throws a potion, _up to 4 grass tiles_ sprout in the surrounding area, and adjacent enemies are rooted for _1 turn_.\n\n_+2:_ When the Huntress drinks or throws a potion, _up to 6 grass tiles_ sprout in the surrounding area, and adjacent enemies are rooted for _2 turns_.\n\nThe amount of grass and root duration are doubled when using potions of strength, experience, mastery, or divine inspiration. +actors.hero.talent.liquid_nature.desc=_+1:_ When the Huntress drinks or throws a potion, brew, or elixir, _up to 4 grass tiles_ sprout in the surrounding area, and adjacent enemies are rooted for _1 turn_.\n\n_+2:_ When the Huntress drinks or throws a potion, brew, or elixir, _up to 6 grass tiles_ sprout in the surrounding area, and adjacent enemies are rooted for _2 turns_.\n\nThe amount of grass and root duration are doubled when using potions of strength, experience, or alchemy items that must be crafted using those potions.\n\nFor alchemy items with higher output quantities (e.g. aqua brew), this talent has a chance to trigger based on how many of that item is produced. actors.hero.talent.rejuvenating_steps.title=rejuvenating steps actors.hero.talent.rejuvenating_steps.desc=_+1:_ When the Huntress steps on short grass or embers, they spring up into tall grass which the Huntress immediately furrows. This has a _10 turn cooldown_.\n\n_+2:_ When the Huntress steps on short grass or embers, they spring up into tall grass which the Huntress immediately furrows. This has a _5 turn cooldown_.\n\nThis talent will produce furrowed grass if passive regeneration effects are disabled or the hero has not gained exp in a long time. actors.hero.talent.heightened_senses.title=heightened senses @@ -886,7 +886,7 @@ actors.hero.talent.focused_meal.title=focused meal actors.hero.talent.focused_meal.desc=_+1:_ Eating food takes the Duelist 1 turn and grants her _1 charge_ on her primary weapon.\n\n_+2:_ Eating food takes the Duelist 1 turn and grants her _1.5 charge_ on her primary weapon. actors.hero.talent.focused_meal.meta_desc=_If this talent is gained by a different hero_ it will instead grant bonus damage to their next attack equal to their level/3 at +1, or level/2 at +2. actors.hero.talent.liquid_agility.title=liquid agility -actors.hero.talent.liquid_agility.desc=_+1:_ The Duelist has _4x evasion_ while drinking or throwing a potion.\n\n_+2:_ The Duelist has _infinite evasion_ while drinking or throwing a potion.\n\nThis evasion bonus lasts for 1 additional turn when using potions of strength, experience, mastery, or divine inspiration. +actors.hero.talent.liquid_agility.desc=_+1:_ The Duelist has _4x evasion_ while drinking or throwing a potion, brew, or elixir.\n\n_+2:_ The Duelist has _infinite evasion_ while drinking or throwing a potion, brew, or elixir.\n\nThis evasion bonus lasts for 1 additional turn when using potions of strength, experience, or alchemy items that must be crafted using those potions.\n\nFor alchemy items with higher output quantities (e.g. aqua brew), this talent has a chance to trigger based on how many of that item is produced. actors.hero.talent.weapon_recharging.title=weapon recharging actors.hero.talent.weapon_recharging.desc=_+1:_ The Duelist gains one primary weapon charge every _10 turns_ when under the effect of wand or artifact recharging buffs.\n\n_+2:_ The Duelist gains one primary weapon charge every _6 turns_ when under the effect of wand or artifact recharging buffs. actors.hero.talent.weapon_recharging.meta_desc=_If this talent is gained by a different hero_ it will instead cause them to deal +5% melee damage while recharging at +1, or +7.5% melee damage while recharging at +2. diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java index 070259c05..2f9fee2f3 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java @@ -136,6 +136,8 @@ public class Potion extends Item { //affects how strongly on-potion talents trigger from this potion protected float talentFactor = 1; + //the chance (0-1) of whether on-potion talents trigger from this potion + protected float talentChance = 1; { stackable = true; @@ -285,7 +287,7 @@ public class Potion extends Item { hero.sprite.operate( hero.pos ); - if (!anonymous){ + if (!anonymous && Random.Float() < talentChance){ Talent.onPotionUsed(curUser, curUser.pos, talentFactor); } } @@ -301,7 +303,7 @@ public class Potion extends Item { Dungeon.level.pressCell( cell ); shatter( cell ); - if (!anonymous){ + if (!anonymous && Random.Float() < talentChance){ Talent.onPotionUsed(curUser, cell, talentFactor); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/brews/AquaBrew.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/brews/AquaBrew.java index 4794dd0e0..b27544243 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/brews/AquaBrew.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/brews/AquaBrew.java @@ -30,6 +30,8 @@ public class AquaBrew extends Brew { { image = ItemSpriteSheet.BREW_AQUA; + + talentChance = 1/(float)Recipe.OUT_QUANTITY; } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/elixirs/ElixirOfFeatherFall.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/elixirs/ElixirOfFeatherFall.java index f11f65c86..60bcb1b5e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/elixirs/ElixirOfFeatherFall.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/elixirs/ElixirOfFeatherFall.java @@ -36,6 +36,8 @@ public class ElixirOfFeatherFall extends Elixir { { image = ItemSpriteSheet.ELIXIR_FEATHER; + + talentChance = 1/(float)Recipe.OUT_QUANTITY; } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/elixirs/ElixirOfMight.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/elixirs/ElixirOfMight.java index 2d3a0cb5d..397e9bfac 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/elixirs/ElixirOfMight.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/elixirs/ElixirOfMight.java @@ -41,6 +41,8 @@ public class ElixirOfMight extends Elixir { image = ItemSpriteSheet.ELIXIR_MIGHT; unique = true; + + talentFactor = 2f; } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfDivineInspiration.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfDivineInspiration.java index 0dd626cdf..349726279 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfDivineInspiration.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfDivineInspiration.java @@ -38,6 +38,7 @@ import com.shatteredpixel.shatteredpixeldungeon.windows.WndHero; import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions; import com.watabou.noosa.audio.Sample; import com.watabou.utils.Bundle; +import com.watabou.utils.Random; public class PotionOfDivineInspiration extends ExoticPotion { @@ -133,7 +134,7 @@ 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){ + if (!anonymous && Random.Float() < talentChance){ Talent.onPotionUsed(curUser, curUser.pos, talentFactor); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfDragonsBreath.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfDragonsBreath.java index 6760b0861..2c2360a98 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfDragonsBreath.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfDragonsBreath.java @@ -47,6 +47,7 @@ import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions; import com.watabou.noosa.audio.Sample; import com.watabou.utils.Callback; import com.watabou.utils.PathFinder; +import com.watabou.utils.Random; import java.util.ArrayList; @@ -198,7 +199,7 @@ public class PotionOfDragonsBreath extends ExoticPotion { curUser.spendAndNext(1f); - if (!anonymous){ + if (!anonymous && Random.Float() < talentChance){ Talent.onPotionUsed(curUser, curUser.pos, talentFactor); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfMastery.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfMastery.java index f0caee820..492e46991 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfMastery.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfMastery.java @@ -36,6 +36,7 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag; import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions; import com.watabou.noosa.audio.Sample; +import com.watabou.utils.Random; public class PotionOfMastery extends ExoticPotion { @@ -120,7 +121,7 @@ public class PotionOfMastery extends ExoticPotion { } identifiedByUse = false; - if (!anonymous){ + if (!anonymous && Random.Float() < talentChance){ Talent.onPotionUsed(curUser, curUser.pos, talentFactor); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/Scroll.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/Scroll.java index 0c5c17105..17cb74da6 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/Scroll.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/Scroll.java @@ -53,6 +53,7 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.HeroSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.watabou.utils.Bundle; +import com.watabou.utils.Random; import com.watabou.utils.Reflection; import java.util.ArrayList; @@ -89,6 +90,8 @@ public abstract class Scroll extends Item { //affects how strongly on-scroll talents trigger from this scroll protected float talentFactor = 1; + //the chance (0-1) of whether on-scroll talents trigger from this potion + protected float talentChance = 1; { stackable = true; @@ -186,7 +189,7 @@ public abstract class Scroll extends Item { curUser.busy(); ((HeroSprite)curUser.sprite).read(); - if (!anonymous) { + if (!anonymous && Random.Float() < talentChance) { Talent.onScrollUsed(curUser, curUser.pos, talentFactor); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/Alchemize.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/Alchemize.java index 8771a2ec0..e2f570b04 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/Alchemize.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/Alchemize.java @@ -24,6 +24,7 @@ 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.actors.hero.Talent; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Shopkeeper; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.stones.Runestone; @@ -38,6 +39,7 @@ import com.shatteredpixel.shatteredpixeldungeon.windows.WndEnergizeItem; import com.shatteredpixel.shatteredpixeldungeon.windows.WndInfoItem; import com.shatteredpixel.shatteredpixeldungeon.windows.WndTradeItem; import com.watabou.noosa.audio.Sample; +import com.watabou.utils.Random; import java.util.ArrayList; @@ -45,6 +47,8 @@ public class Alchemize extends Spell { { image = ItemSpriteSheet.ALCHEMIZE; + + talentChance = 1/(float)Recipe.OUT_QUANTITY; } private static WndBag parentWnd; @@ -254,6 +258,9 @@ public class Alchemize extends Spell { } GameScene.selectItem(itemSelector); } + if (curItem instanceof Alchemize && Random.Float() < ((Alchemize)curItem).talentChance){ + Talent.onScrollUsed(curUser, curUser.pos, ((Alchemize) curItem).talentFactor); + } } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/BeaconOfReturning.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/BeaconOfReturning.java index fa2696ae5..a4205e8e6 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/BeaconOfReturning.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/BeaconOfReturning.java @@ -27,6 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; 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.Pushing; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ScrollOfPassage; @@ -50,6 +51,8 @@ public class BeaconOfReturning extends Spell { { image = ItemSpriteSheet.RETURN_BEACON; + + talentChance = 1/(float)Recipe.OUT_QUANTITY; } public int returnDepth = -1; @@ -170,6 +173,9 @@ public class BeaconOfReturning extends Spell { Game.switchScene( InterlevelScene.class ); } detach(hero.belongings.backpack); + if (Random.Float() < talentChance){ + Talent.onScrollUsed(curUser, curUser.pos, talentFactor); + } } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/CurseInfusion.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/CurseInfusion.java index 4852df4d7..d8b047068 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/CurseInfusion.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/CurseInfusion.java @@ -44,6 +44,8 @@ public class CurseInfusion extends InventorySpell { { image = ItemSpriteSheet.CURSE_INFUSE; + + talentChance = 1/(float)Recipe.OUT_QUANTITY; } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/InventorySpell.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/InventorySpell.java index f4bdb5f10..0caa8152a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/InventorySpell.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/InventorySpell.java @@ -24,12 +24,14 @@ package com.shatteredpixel.shatteredpixeldungeon.items.spells; import com.shatteredpixel.shatteredpixeldungeon.Assets; 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.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag; import com.watabou.noosa.audio.Sample; +import com.watabou.utils.Random; public abstract class InventorySpell extends Spell { @@ -87,6 +89,10 @@ public abstract class InventorySpell extends Spell { Sample.INSTANCE.play( Assets.Sounds.READ ); Invisibility.dispel(); + + if (Random.Float() < ((Spell)curItem).talentChance){ + Talent.onScrollUsed(curUser, curUser.pos, ((Spell)curItem).talentFactor); + } } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/MagicalInfusion.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/MagicalInfusion.java index 05a6652dc..f8f073d6d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/MagicalInfusion.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/MagicalInfusion.java @@ -39,6 +39,8 @@ public class MagicalInfusion extends InventorySpell { image = ItemSpriteSheet.MAGIC_INFUSE; unique = true; + + talentFactor = 2; } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/PhaseShift.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/PhaseShift.java index 6b2f46ee5..e7520af82 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/PhaseShift.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/PhaseShift.java @@ -40,6 +40,8 @@ public class PhaseShift extends TargetedSpell { image = ItemSpriteSheet.PHASE_SHIFT; usesTargeting = true; + + talentChance = 1/(float)Recipe.OUT_QUANTITY; } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/ReclaimTrap.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/ReclaimTrap.java index 83544c51a..540cae765 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/ReclaimTrap.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/ReclaimTrap.java @@ -43,6 +43,8 @@ public class ReclaimTrap extends TargetedSpell { { image = ItemSpriteSheet.RECLAIM_TRAP; + + talentChance = 1/(float)Recipe.OUT_QUANTITY; } private Class storedTrap = null; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/Recycle.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/Recycle.java index 097734701..9d5f3e2dc 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/Recycle.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/Recycle.java @@ -46,6 +46,9 @@ public class Recycle extends InventorySpell { { image = ItemSpriteSheet.RECYCLE; + + talentFactor = 2; + talentChance = 1/(float)Recipe.OUT_QUANTITY; } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/Spell.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/Spell.java index f8444ba68..a02b3048a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/Spell.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/Spell.java @@ -33,6 +33,11 @@ import java.util.ArrayList; public abstract class Spell extends Item { public static final String AC_CAST = "CAST"; + + //affects how strongly on-scroll talents trigger from this scroll + protected float talentFactor = 1; + //the chance (0-1) of whether on-scroll talents trigger from this potion + protected float talentChance = 1; { stackable = true; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/SummonElemental.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/SummonElemental.java index 030d8e4dd..b3c5166b4 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/SummonElemental.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/SummonElemental.java @@ -29,6 +29,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AllyBuff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; 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.actors.hero.abilities.huntress.SpiritHawk; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Elemental; import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile; @@ -63,6 +64,8 @@ public class SummonElemental extends Spell { { image = ItemSpriteSheet.SUMMON_ELE; + + talentChance = 1/(float)Recipe.OUT_QUANTITY; } private Class summonClass = Elemental.AllyNewBornElemental.class; @@ -117,6 +120,9 @@ public class SummonElemental extends Spell { curUser.spendAndNext(Actor.TICK); detach(Dungeon.hero.belongings.backpack); + if (Random.Float() < talentChance){ + Talent.onScrollUsed(curUser, curUser.pos, talentFactor); + } } else { GLog.w(Messages.get(SpiritHawk.class, "no_space")); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/TargetedSpell.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/TargetedSpell.java index f4de00fe6..e8d1e0fe1 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/TargetedSpell.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/TargetedSpell.java @@ -25,6 +25,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; 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.mechanics.Ballistica; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; @@ -33,6 +34,7 @@ import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.ui.QuickSlotButton; import com.watabou.noosa.audio.Sample; import com.watabou.utils.Callback; +import com.watabou.utils.Random; public abstract class TargetedSpell extends Spell { @@ -90,6 +92,9 @@ public abstract class TargetedSpell extends Spell { Invisibility.dispel(); curSpell.updateQuickslot(); curUser.spendAndNext( 1f ); + if (Random.Float() < curSpell.talentChance){ + Talent.onScrollUsed(curUser, curUser.pos, curSpell.talentFactor); + } } }); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/TelekineticGrab.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/TelekineticGrab.java index 81d4b539e..2e1f7fbd7 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/TelekineticGrab.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/TelekineticGrab.java @@ -43,6 +43,8 @@ public class TelekineticGrab extends TargetedSpell { { image = ItemSpriteSheet.TELE_GRAB; + + talentChance = 1/(float)Recipe.OUT_QUANTITY; } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/UnstableSpell.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/UnstableSpell.java index b8e74aef6..7cccd340f 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/UnstableSpell.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/UnstableSpell.java @@ -22,6 +22,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.spells; 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.scrolls.Scroll; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfIdentify; @@ -109,6 +110,10 @@ public class UnstableSpell extends Spell { s.anonymize(); curItem = s; s.doRead(); + + if (Random.Float() < talentChance){ + Talent.onScrollUsed(curUser, curUser.pos, talentFactor); + } } //lower values, as it's cheaper to make diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/WildEnergy.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/WildEnergy.java index 1f4b70283..f121e2489 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/WildEnergy.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/WildEnergy.java @@ -39,7 +39,10 @@ public class WildEnergy extends TargetedSpell { { image = ItemSpriteSheet.WILD_ENERGY; + usesTargeting = true; + + talentChance = 1/(float)Recipe.OUT_QUANTITY; } //we rely on cursedWand to do fx instead