diff --git a/core/src/main/assets/interfaces/icons.png b/core/src/main/assets/interfaces/icons.png index 5d1b01f87..1674bbe59 100644 Binary files a/core/src/main/assets/interfaces/icons.png and b/core/src/main/assets/interfaces/icons.png differ diff --git a/core/src/main/assets/messages/ui/ui.properties b/core/src/main/assets/messages/ui/ui.properties index 011a81811..80667fea4 100644 --- a/core/src/main/assets/messages/ui/ui.properties +++ b/core/src/main/assets/messages/ui/ui.properties @@ -26,6 +26,11 @@ ui.talentspane.tier=tier %d ui.talentspane.unlock_tier2=Reach level 6 to unlock more talents. ui.talentspane.unlock_tier3=Reach level 12 and use the item from the second boss to unlock more talents. ui.talentspane.unlock_tier4=Reach level 20 and use the item from the fourth boss to unlock more talents. +ui.talentspane.random_title=Random Talents +ui.talentspane.random_sure=Are you sure you want to spend these talent points randomly? +ui.talentspane.random_yes=Yes, spend them all. +ui.talentspane.random_one=Just spend one randomly. +ui.talentspane.random_no=I'll decide later. ui.toolbar.quickslot_prompt=Select a Quickslot ui.toolbar.quickslot_select=Select Quickslot diff --git a/core/src/main/assets/messages/windows/windows.properties b/core/src/main/assets/messages/windows/windows.properties index d5f4c1704..e5a5c4b10 100644 --- a/core/src/main/assets/messages/windows/windows.properties +++ b/core/src/main/assets/messages/windows/windows.properties @@ -30,12 +30,16 @@ windows.wndchooseability.cancel=I'll decide later windows.wndchooseability.are_you_sure=Are you sure you want to choose this ability? windows.wndchooseability.yes=Yes, I've made my choice. windows.wndchooseability.no=No, I'll decide later. +windows.wndchooseability.random_title=Random Armor Ability +windows.wndchooseability.random_sure=Are you sure you want to choose your armor ability randomly? windows.wndchoosesubclass.message=As the mask fits over your face, your eyesight fades and visions of new power flood into your mind. How will you direct the mask's power? windows.wndchoosesubclass.cancel=I'll decide later windows.wndchoosesubclass.are_you_sure=Are you sure you want to choose this subclass? windows.wndchoosesubclass.yes=Yes, I've made my choice. windows.wndchoosesubclass.no=No, I'll decide later. +windows.wndchoosesubclass.random_title=Random Subclass +windows.wndchoosesubclass.random_sure=Are you sure you want to choose a subclass randomly? windows.wndclass.mastery=Mastery diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Icons.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Icons.java index 8907230fb..8d5b098d2 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Icons.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Icons.java @@ -226,7 +226,7 @@ public enum Icons { icon.frame( icon.texture.uvRectBySize( 240, 16, 13, 10 ) ); break; case SHUFFLE: - icon.frame(icon.texture.uvRectBySize( 240, 32, 16, 15 ) ); + icon.frame(icon.texture.uvRectBySize( 240, 32, 15, 12 ) ); break; case TARGET: diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/TalentsPane.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/TalentsPane.java index 123b831a7..d3938c7ed 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/TalentsPane.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/TalentsPane.java @@ -28,10 +28,13 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.Ratmogrify; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; +import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; +import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions; import com.watabou.noosa.ColorBlock; import com.watabou.noosa.Image; import com.watabou.noosa.ui.Component; +import com.watabou.utils.Random; import java.util.ArrayList; import java.util.LinkedHashMap; @@ -162,6 +165,7 @@ public class TalentsPane extends ScrollPane { ArrayList buttons; ArrayList stars = new ArrayList<>(); + IconButton random; public TalentTierPane(LinkedHashMap talents, int tier, TalentButton.Mode mode){ super(); @@ -172,7 +176,44 @@ public class TalentsPane extends ScrollPane { title.hardlight(Window.TITLE_COLOR); add(title); - if (mode == TalentButton.Mode.UPGRADE) setupStars(); + if (mode == TalentButton.Mode.UPGRADE) { + setupStars(); + if (Dungeon.hero.talentPointsAvailable(tier) > 0){ + + random = new IconButton(Icons.SHUFFLE.get()){ + @Override + protected void onClick() { + super.onClick(); + GameScene.show(new WndOptions( + Icons.SHUFFLE.get(), + Messages.get(TalentsPane.class, "random_title"), + Messages.get(TalentsPane.class, "random_sure"), + Messages.get(TalentsPane.class, "random_yes"), + Messages.get(TalentsPane.class, "random_one"), + Messages.get(TalentsPane.class, "random_no")) { + @Override + protected void onSelect(int index) { + super.onSelect(index); + if (index == 0 || index == 1){ + while (Dungeon.hero.talentPointsAvailable(tier) > 0){ + TalentButton button = Random.element(buttons); + if (Dungeon.hero.pointsInTalent(button.talent) < button.talent.maxPoints()){ + button.upgradeTalent(); + if (index == 1){ + break; + } + } + }; + setupStars(); + TalentTierPane.this.layout(); + } + } + }); + }; + }; + add(random); + } + } buttons = new ArrayList<>(); for (Talent talent : talents.keySet()){ @@ -213,6 +254,12 @@ public class TalentsPane extends ScrollPane { im.tint(0f, 0f, 0f, 0.9f); } } + + if (random != null && openStars == 0){ + random.killAndErase(); + random.destroy(); + random = null; + } } @Override @@ -242,6 +289,10 @@ public class TalentsPane extends ScrollPane { } } + if (random != null){ + random.setRect(width - 16, y-2, 16, 14); + } + float gap = (width - buttons.size()*TalentButton.WIDTH)/(buttons.size()+1); left = x + gap; for (TalentButton btn : buttons){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndChooseAbility.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndChooseAbility.java index 231afae82..27837bdee 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndChooseAbility.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndChooseAbility.java @@ -24,7 +24,6 @@ package com.shatteredpixel.shatteredpixeldungeon.windows; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.ArmorAbility; -import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.cleric.Trinity; import com.shatteredpixel.shatteredpixeldungeon.items.KingsCrown; import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; @@ -37,6 +36,7 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.Icons; import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock; import com.shatteredpixel.shatteredpixeldungeon.ui.Window; +import com.watabou.utils.Random; public class WndChooseAbility extends Window { @@ -54,6 +54,36 @@ public class WndChooseAbility extends Window { titlebar.setRect( 0, 0, WIDTH, 0 ); add( titlebar ); + IconButton random = new IconButton(Icons.SHUFFLE.get()){ + @Override + protected void onClick() { + super.onClick(); + GameScene.show(new WndOptions(Icons.SHUFFLE.get(), + Messages.get(WndChooseAbility.class, "random_title"), + Messages.get(WndChooseAbility.class, "random_sure"), + Messages.get(WndChooseAbility.class, "yes"), + Messages.get(WndChooseAbility.class, "no")){ + @Override + protected void onSelect(int index) { + super.onSelect(index); + if (index == 0){ + WndChooseAbility.this.hide(); + ArmorAbility abil = Random.oneOf(hero.heroClass.armorAbilities()); + crown.upgradeArmor(hero, armor, abil); + GameScene.show(new WndInfoArmorAbility(hero.heroClass, abil)); + } + } + }); + } + + @Override + protected String hoverText() { + return Messages.get(WndChooseAbility.class, "random_title"); + } + }; + random.setRect(WIDTH-16, 0, 16, 16); + if (crown != null) add(random); + RenderedTextBlock body = PixelScene.renderTextBlock( 6 ); if (crown != null) { body.text(Messages.get(this, "message"), WIDTH); @@ -66,18 +96,12 @@ public class WndChooseAbility extends Window { float pos = body.bottom() + 3*GAP; for (ArmorAbility ability : hero.heroClass.armorAbilities()) { - String warn; - if (Dungeon.initialVersion < 821 && ability instanceof Trinity){ - warn = "_WARNING, code to track which items you have found for use in trinity was added in BETA-2.2. This run was started before that, and so some items you have encountered may not be usable with Trinity. Any items you currently hold can be made selectable by dropping and picking them back up._\n\n"; - } else { - warn = ""; - } RedButton abilityButton = new RedButton(ability.shortDesc(), 6){ @Override protected void onClick() { GameScene.show(new WndOptions( new HeroIcon( ability ), Messages.titleCase(ability.name()), - warn + Messages.get(WndChooseAbility.this, "are_you_sure"), + Messages.get(WndChooseAbility.this, "are_you_sure"), Messages.get(WndChooseAbility.this, "yes"), Messages.get(WndChooseAbility.this, "no")){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndChooseSubclass.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndChooseSubclass.java index b94aa2422..4ae9179f1 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndChooseSubclass.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndChooseSubclass.java @@ -35,6 +35,7 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.Icons; import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock; import com.shatteredpixel.shatteredpixeldungeon.ui.Window; +import com.watabou.utils.Random; public class WndChooseSubclass extends Window { @@ -48,9 +49,39 @@ public class WndChooseSubclass extends Window { IconTitle titlebar = new IconTitle(); titlebar.icon( new ItemSprite( tome.image(), null ) ); titlebar.label( tome.name() ); - titlebar.setRect( 0, 0, WIDTH, 0 ); + titlebar.setRect( 0, 0, WIDTH-16, 0 ); add( titlebar ); + IconButton random = new IconButton(Icons.SHUFFLE.get()){ + @Override + protected void onClick() { + super.onClick(); + GameScene.show(new WndOptions(Icons.SHUFFLE.get(), + Messages.get(WndChooseSubclass.class, "random_title"), + Messages.get(WndChooseSubclass.class, "random_sure"), + Messages.get(WndChooseSubclass.class, "yes"), + Messages.get(WndChooseSubclass.class, "no")){ + @Override + protected void onSelect(int index) { + super.onSelect(index); + if (index == 0){ + WndChooseSubclass.this.hide(); + HeroSubClass cls = Random.oneOf(hero.heroClass.subClasses()); + tome.choose(cls); + GameScene.show(new WndInfoSubclass(hero.heroClass, cls)); + } + } + }); + } + + @Override + protected String hoverText() { + return Messages.get(WndChooseSubclass.class, "random_title"); + } + }; + random.setRect(WIDTH-16, 0, 16, 16); + add(random); + RenderedTextBlock message = PixelScene.renderTextBlock( 6 ); message.text( Messages.get(this, "message"), WIDTH ); message.setPos( titlebar.left(), titlebar.bottom() + GAP );