v1.1.0: scroll of metamorphosis now prevents talents that can't be used

This commit is contained in:
Evan Debenham 2021-11-29 13:56:07 -05:00
parent 816d5fcd0e
commit 94d20a1e25
2 changed files with 23 additions and 10 deletions

View File

@ -1016,7 +1016,7 @@ items.scrolls.exotic.scrollofmetamorphosis.name=scroll of metamorphosis
items.scrolls.exotic.scrollofmetamorphosis.choose_desc=Choose a talent to metamorphose. items.scrolls.exotic.scrollofmetamorphosis.choose_desc=Choose a talent to metamorphose.
items.scrolls.exotic.scrollofmetamorphosis.replace_desc=Choose a new talent to replace your metamorphosed talent with. items.scrolls.exotic.scrollofmetamorphosis.replace_desc=Choose a new talent to replace your metamorphosed talent with.
items.scrolls.exotic.scrollofmetamorphosis.metamorphose_talent=metamorphose talent items.scrolls.exotic.scrollofmetamorphosis.metamorphose_talent=metamorphose talent
items.scrolls.exotic.scrollofmetamorphosis.desc=This scroll contains powerful transmutation magic, which will apply to the caster instead of to an item. The magic of this scroll will let you select one talent, and replace it with an equivalent talent from a different hero class!\n\nThis effect can only apply to class talents, not talents gained from subclasses or armor abilities. Be careful, not all talents work for all heroes. items.scrolls.exotic.scrollofmetamorphosis.desc=This scroll contains powerful transmutation magic, which will apply to the caster instead of to an item. The magic of this scroll will let you select one talent, and replace it with one of three talents of the same tier from different hero classes!\n\nThis effect can only apply to class talents, not talents gained from subclasses or armor abilities. Talents that you cannot use will not be given as options.
items.scrolls.exotic.scrollofmysticalenergy.name=scroll of mystical energy items.scrolls.exotic.scrollofmysticalenergy.name=scroll of mystical energy
items.scrolls.exotic.scrollofmysticalenergy.desc=The raw magical power bound up in this parchment will, when released, charge a user's equipped artifacts over time. items.scrolls.exotic.scrollofmysticalenergy.desc=The raw magical power bound up in this parchment will, when released, charge a user's equipped artifacts over time.

View File

@ -23,18 +23,11 @@ package com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic;
import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Sheep;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Flare;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.effects.Transmuting; import com.shatteredpixel.shatteredpixeldungeon.effects.Transmuting;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.InventoryScroll; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.InventoryScroll;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
@ -43,7 +36,6 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock; import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock;
import com.shatteredpixel.shatteredpixeldungeon.ui.TalentButton; import com.shatteredpixel.shatteredpixeldungeon.ui.TalentButton;
import com.shatteredpixel.shatteredpixeldungeon.ui.TalentsPane; import com.shatteredpixel.shatteredpixeldungeon.ui.TalentsPane;
import com.shatteredpixel.shatteredpixeldungeon.ui.TargetHealthIndicator;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window; import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
import com.shatteredpixel.shatteredpixeldungeon.windows.IconTitle; import com.shatteredpixel.shatteredpixeldungeon.windows.IconTitle;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions; import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions;
@ -55,7 +47,6 @@ import java.util.HashMap;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Set; import java.util.Set;
//TODO currently lots of talents that do nothing
public class ScrollOfMetamorphosis extends ExoticScroll { public class ScrollOfMetamorphosis extends ExoticScroll {
{ {
@ -158,6 +149,24 @@ public class ScrollOfMetamorphosis extends ExoticScroll {
public static class WndMetamorphReplace extends Window { public static class WndMetamorphReplace extends Window {
//talents that can only be used by one hero class
//TODO could some of these be made more generic?
private static HashMap<Talent, HeroClass> restrictedTalents = new HashMap<>();
static {
restrictedTalents.put(Talent.IRON_WILL, HeroClass.WARRIOR);
restrictedTalents.put(Talent.RESTORED_WILLPOWER, HeroClass.WARRIOR);
restrictedTalents.put(Talent.RUNIC_TRANSFERENCE, HeroClass.WARRIOR);
restrictedTalents.put(Talent.BACKUP_BARRIER, HeroClass.MAGE);
restrictedTalents.put(Talent.ENERGIZING_UPGRADE, HeroClass.MAGE);
restrictedTalents.put(Talent.WAND_PRESERVATION, HeroClass.MAGE);
restrictedTalents.put(Talent.PROTECTIVE_SHADOWS, HeroClass.ROGUE);
restrictedTalents.put(Talent.MYSTICAL_UPGRADE, HeroClass.ROGUE);
restrictedTalents.put(Talent.SEER_SHOT, HeroClass.HUNTRESS);
}
public static WndMetamorphReplace INSTANCE; public static WndMetamorphReplace INSTANCE;
public Talent replacing; public Talent replacing;
@ -204,6 +213,10 @@ public class ScrollOfMetamorphosis extends ExoticScroll {
if (curTalentsAtTier.contains(talent)){ if (curTalentsAtTier.contains(talent)){
clsTalentsAtTier.remove(talent); clsTalentsAtTier.remove(talent);
} }
if (restrictedTalents.containsKey(talent)
&& restrictedTalents.get(talent) != curUser.heroClass){
clsTalentsAtTier.remove(talent);
}
} }
} }
if (!replacingIsInSet && !clsTalentsAtTier.isEmpty()) { if (!replacingIsInSet && !clsTalentsAtTier.isEmpty()) {