From f28c15b84242c7e34a42eb3608a550f177694bfd Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Tue, 9 Nov 2021 15:17:12 -0500 Subject: [PATCH] v1.1.0: reworked potion of holy furor into potion of divine inspiration --- .../assets/messages/items/items.properties | 7 +- core/src/main/assets/sprites/item_icons.png | Bin 1569 -> 1593 bytes .../ShatteredPixelDungeon.java | 3 + .../actors/hero/Hero.java | 22 ++- .../items/potions/exotic/ExoticPotion.java | 4 +- .../exotic/PotionOfDivineInspiration.java | 171 ++++++++++++++++++ .../potions/exotic/PotionOfHolyFuror.java | 41 ----- .../scenes/GameScene.java | 4 + .../sprites/ItemSpriteSheet.java | 6 +- .../shatteredpixeldungeon/ui/StatusPane.java | 12 +- .../shatteredpixeldungeon/ui/TalentsPane.java | 17 +- 11 files changed, 228 insertions(+), 59 deletions(-) create mode 100644 core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfDivineInspiration.java delete mode 100644 core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfHolyFuror.java diff --git a/core/src/main/assets/messages/items/items.properties b/core/src/main/assets/messages/items/items.properties index 3a1f640b2..7f1efefbc 100644 --- a/core/src/main/assets/messages/items/items.properties +++ b/core/src/main/assets/messages/items/items.properties @@ -734,8 +734,11 @@ items.potions.exotic.potionofdragonsbreath.desc=This flask contains an unusual c items.potions.exotic.potionofearthenarmor.name=potion of earthen armor items.potions.exotic.potionofearthenarmor.desc=Rather than paralyze, this liquid has a hardening effect on the skin which will turn it into temporary natural armor. -items.potions.exotic.potionofholyfuror.name=potion of holy furor -items.potions.exotic.potionofholyfuror.desc=The power of holy energy reduced to liquid form, this draught will bless you for an extended period of time. +items.potions.exotic.potionofdivineinspiration.name=potion of divine inspiration +items.potions.exotic.potionofdivineinspiration.no_more_points=You can't gain any more bonus talent points. +items.potions.exotic.potionofdivineinspiration.select_tier=Select a talent tier to gain two bonus points in. You must have unlocked the tier to be able to spend the points. +items.potions.exotic.potionofdivineinspiration.bonus=+2 Talent Points! +items.potions.exotic.potionofdivineinspiration.desc=The power of holy energy reduced to liquid form, this draught will imbue the drinker with divine power, granting them two bonus talent points in a tier of their choosing.\n\nThis potion can only be used once for each talent tier. items.potions.exotic.potionofmagicalsight.name=potion of magical sight items.potions.exotic.potionofmagicalsight.desc=After drinking this, your senses will be briefly heightened to incredible levels, increasing your vision range and allowing you to see through walls! diff --git a/core/src/main/assets/sprites/item_icons.png b/core/src/main/assets/sprites/item_icons.png index a1a06b59f9361af3de5319a2be1bcb76a831d2cd..2f0bfa437f0f1291539fb1034f2926270457ceb8 100644 GIT binary patch delta 1311 zcmV+)1>pLj47m)DBLV>hktKE*0002AfBwuVZK2Z7rT`p=KmPy#0C*_>k+Vw!|Nj7y z{umtq004^E*#G|k|Noi)|7QQHGfh1%1kMaD00011lQ01)2S8^3|NsAhlVJfGe;og2 z|7QPYfd6S}RR3mXUlX;`000DyNklxa_5Xh_x4L02 zJrrHFCZ#_gbMl>257+Np=jy#e?^uyr7%g4peLi2Z&Kkh3ps^p|o_=@JL_)?vW^JF=-wzD5R6Z>>OGH&k=j^+XNIr zz0nJBb^{2liIVhdJI~&Oe}F7#gBbvr-$Nw8+AC(D-Y5jl=d(<(^$bXb0o*C6fn0K&qILgYU&mt`2bckZ-z0E>Fo5)91{wnxV;?wj$X>XuOAZEad zAPivoK{EpsD^c7Bf6rf^?E=7F0fKl6tb%w7enlcyr{FwW{Y&WR=;#=N_>mdANO~g; zf-w9&snnn=)~OoKjPFldo_!uD`DY?J&)f1?hV2~&Xh8m^$z=|lp$lNj`jOXDI8^1d$*kQ2~|BR6RF`yUAggMk)= zKiVJuAF+Cg(QyhkP0@%9VuD0x+ zujj6y|EEu%^1eSOz-+(Y&+yyyF#U%4@pv?cCAeo<=Fa1MK6`j?LT}u@i(UEkDwPT` zhybbY&#!@;fItuc5Cmc^z9WFsD!Z>TF6;ASedZnh5&_Tfe<~gz_5C1S1A*Wh2>T^d;4518=BLV>b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qOg6!rWO0J-l^*FZ`@L=XWW5{R|<9043w= Talent.tierLevelThresholds[tier+1]){ - return Talent.tierLevelThresholds[tier+1] - Talent.tierLevelThresholds[tier] - talentPointsSpent(tier); + return Talent.tierLevelThresholds[tier+1] - Talent.tierLevelThresholds[tier] - talentPointsSpent(tier) + bonusTalentPoints(tier); } else { - return 1 + lvl - Talent.tierLevelThresholds[tier] - talentPointsSpent(tier); + return 1 + lvl - Talent.tierLevelThresholds[tier] - talentPointsSpent(tier) + bonusTalentPoints(tier); + } + } + + public int bonusTalentPoints(int tier){ + if (lvl < (Talent.tierLevelThresholds[tier]-1) + || (tier == 3 && subClass == HeroSubClass.NONE) + || (tier == 4 && armorAbility == null)) { + return 0; + } else if (buff(PotionOfDivineInspiration.DivineInspirationTracker.class) != null + && buff(PotionOfDivineInspiration.DivineInspirationTracker.class).isBoosted(tier)) { + return 2; + } else { + return 0; } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/ExoticPotion.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/ExoticPotion.java index 17c849c4e..584b5f62c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/ExoticPotion.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/ExoticPotion.java @@ -79,8 +79,8 @@ public class ExoticPotion extends Potion { regToExo.put(PotionOfLevitation.class, PotionOfStormClouds.class); exoToReg.put(PotionOfStormClouds.class, PotionOfLevitation.class); - regToExo.put(PotionOfExperience.class, PotionOfHolyFuror.class); - exoToReg.put(PotionOfHolyFuror.class, PotionOfExperience.class); + regToExo.put(PotionOfExperience.class, PotionOfDivineInspiration.class); + exoToReg.put(PotionOfDivineInspiration.class, PotionOfExperience.class); regToExo.put(PotionOfPurity.class, PotionOfCleansing.class); exoToReg.put(PotionOfCleansing.class, PotionOfPurity.class); 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 new file mode 100644 index 000000000..74b9a99ce --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfDivineInspiration.java @@ -0,0 +1,171 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2021 Evan Debenham + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see + */ + +package com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic; + +import com.shatteredpixel.shatteredpixeldungeon.Assets; +import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; +import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; +import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; +import com.shatteredpixel.shatteredpixeldungeon.ui.StatusPane; +import com.shatteredpixel.shatteredpixeldungeon.ui.TalentsPane; +import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; +import com.shatteredpixel.shatteredpixeldungeon.windows.WndHero; +import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions; +import com.watabou.noosa.audio.Sample; +import com.watabou.utils.Bundle; + +public class PotionOfDivineInspiration extends ExoticPotion { + + { + icon = ItemSpriteSheet.Icons.POTION_DIVINE; + } + + @Override + //need to override drink so that time isn't spent right away + protected void drink(final Hero hero) { + curUser = hero; + curItem = this; + + boolean[] enabled = new boolean[5]; + enabled[1] = enabled[2] = enabled[3] = enabled[4] = true; + + DivineInspirationTracker tracker = hero.buff(DivineInspirationTracker.class); + + if (tracker != null){ + boolean allBoosted = true; + for (int i = 1; i <= 4; i++){ + if (tracker.isBoosted(i)){ + enabled[i] = false; + } else { + allBoosted = false; + } + } + + if (allBoosted){ + GLog.w(Messages.get(this, "no_more_bonus")); + return; + } + } + + if (!isIdentified()) { + curItem.detach(curUser.belongings.backpack); + } + + GameScene.show(new WndOptions( + new ItemSprite(this), + Messages.titleCase(trueName()), + Messages.get(PotionOfDivineInspiration.class, "select_tier"), + Messages.titleCase(Messages.get(TalentsPane.class, "tier", 1)), + Messages.titleCase(Messages.get(TalentsPane.class, "tier", 2)), + Messages.titleCase(Messages.get(TalentsPane.class, "tier", 3)), + Messages.titleCase(Messages.get(TalentsPane.class, "tier", 4)) + ){ + @Override + protected boolean enabled(int index) { + return enabled[index+1]; + } + + @Override + protected void onSelect(int index) { + super.onSelect(index); + + if (index != -1){ + Buff.affect(curUser, DivineInspirationTracker.class).setBoosted(index+1); + + if (isIdentified()) { + curItem.detach(curUser.belongings.backpack); + } + + identify(); + curUser.busy(); + curUser.sprite.operate(curUser.pos); + + curUser.spendAndNext(1f); + + boolean unspentTalents = false; + for (int i = 1; i <= Dungeon.hero.talents.size(); i++){ + if (Dungeon.hero.talentPointsAvailable(i) > 0){ + unspentTalents = true; + break; + } + } + if (unspentTalents){ + StatusPane.talentBlink = 10f; + WndHero.lastIdx = 1; + } + + GameScene.showlevelUpStars(); + + Sample.INSTANCE.play( Assets.Sounds.DRINK ); + Sample.INSTANCE.playDelayed(Assets.Sounds.LEVELUP, 0.3f, 0.7f, 1.2f); + Sample.INSTANCE.playDelayed(Assets.Sounds.LEVELUP, 0.6f, 0.7f, 1.2f); + GLog.p(Messages.get(PotionOfDivineInspiration.class, "bonus")); + + } + } + + @Override + public void onBackPressed() { + //do nothing, prevents accidentally closing + } + }); + + } + + public static class DivineInspirationTracker extends Buff { + + { + type = buffType.POSITIVE; + revivePersists = true; + } + + private boolean[] boostedTiers = new boolean[5]; + + private static final String BOOSTED_TIERS = "boosted_tiers"; + + @Override + public void storeInBundle(Bundle bundle) { + super.storeInBundle(bundle); + bundle.put(BOOSTED_TIERS, boostedTiers); + } + + @Override + public void restoreFromBundle(Bundle bundle) { + super.restoreFromBundle(bundle); + boostedTiers = bundle.getBooleanArray(BOOSTED_TIERS); + } + + public void setBoosted( int tier ){ + boostedTiers[tier] = true; + } + + public boolean isBoosted( int tier ){ + return boostedTiers[tier]; + } + + } + +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfHolyFuror.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfHolyFuror.java deleted file mode 100644 index 81ab01a00..000000000 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfHolyFuror.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Pixel Dungeon - * Copyright (C) 2012-2015 Oleg Dolya - * - * Shattered Pixel Dungeon - * Copyright (C) 2014-2021 Evan Debenham - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see - */ - -package com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic; - -import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Bless; -import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; -import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; -import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; - -public class PotionOfHolyFuror extends ExoticPotion { - - { - icon = ItemSpriteSheet.Icons.POTION_HOLYFUROR; - } - - @Override - public void apply( Hero hero ) { - identify(); - Buff.prolong(hero, Bless.class, Bless.DURATION*4f); - } - -} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java index 4b4a6fad1..f44ad1e64 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java @@ -963,6 +963,10 @@ public class GameScene extends PixelScene { public static void flashForDocument( String page ){ if (scene != null) scene.pane.flashForPage( page ); } + + public static void showlevelUpStars(){ + if (scene != null) scene.pane.showStarParticles(); + } public static void updateKeyDisplay(){ if (scene != null) scene.pane.updateKeys(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java index b2064ecdd..49ebab521 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java @@ -792,7 +792,7 @@ public class ItemSpriteSheet { assignIconRect( SCROLL_CHALLENGE, 7, 7 ); assignIconRect( SCROLL_PSIBLAST, 5, 6 ); assignIconRect( SCROLL_DREAD, 5, 7 ); - assignIconRect( SCROLL_POLYMORPH, 7, 6 ); + assignIconRect( SCROLL_POLYMORPH, 7, 7 ); } //16 free slots @@ -837,7 +837,7 @@ public class ItemSpriteSheet { public static final int POTION_STRMCLOUD= EXOTIC_POTIONS+8; public static final int POTION_EARTHARMR= EXOTIC_POTIONS+9; public static final int POTION_CLEANSE = EXOTIC_POTIONS+10; - public static final int POTION_HOLYFUROR= EXOTIC_POTIONS+11; + public static final int POTION_DIVINE = EXOTIC_POTIONS+11; static { assignIconRect( POTION_ARENSURGE, 7, 7 ); assignIconRect( POTION_SHIELDING, 6, 6 ); @@ -850,7 +850,7 @@ public class ItemSpriteSheet { assignIconRect( POTION_STRMCLOUD, 7, 7 ); assignIconRect( POTION_EARTHARMR, 6, 6 ); assignIconRect( POTION_CLEANSE, 7, 7 ); - assignIconRect( POTION_HOLYFUROR, 5, 7 ); + assignIconRect( POTION_DIVINE, 7, 7 ); } //16 free slots diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/StatusPane.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/StatusPane.java index 53b07abe9..0f247f3b1 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/StatusPane.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/StatusPane.java @@ -241,10 +241,7 @@ public class StatusPane extends Component { if (Dungeon.hero.lvl != lastLvl) { if (lastLvl != -1) { - Emitter emitter = (Emitter)recycle( Emitter.class ); - emitter.revive(); - emitter.pos( 27, 27 ); - emitter.burst( Speck.factory( Speck.STAR ), 12 ); + showStarParticles(); } lastLvl = Dungeon.hero.lvl; @@ -262,6 +259,13 @@ public class StatusPane extends Component { } } + public void showStarParticles(){ + Emitter emitter = (Emitter)recycle( Emitter.class ); + emitter.revive(); + emitter.pos( 27, 27 ); + emitter.burst( Speck.factory( Speck.STAR ), 12 ); + } + public void pickup( Item item, int cell) { pickedUp.reset( item, cell, 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 abed88d74..ff5adcc14 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/TalentsPane.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/TalentsPane.java @@ -193,7 +193,7 @@ public class TalentsPane extends ScrollPane { stars.clear(); } - int totStars = Talent.tierLevelThresholds[tier+1] - Talent.tierLevelThresholds[tier]; + int totStars = Talent.tierLevelThresholds[tier+1] - Talent.tierLevelThresholds[tier] + Dungeon.hero.bonusTalentPoints(tier); int openStars = Dungeon.hero.talentPointsAvailable(tier); int usedStars = Dungeon.hero.talentPointsSpent(tier); for (int i = 0; i < totStars; i++){ @@ -212,16 +212,27 @@ public class TalentsPane extends ScrollPane { protected void layout() { super.layout(); + int regStars = Talent.tierLevelThresholds[tier+1] - Talent.tierLevelThresholds[tier]; + float titleWidth = title.width(); - titleWidth += 2 + stars.size()*6; + titleWidth += 2 + Math.min(stars.size(), regStars)*6; title.setPos(x + (width - titleWidth)/2f, y); float left = title.right() + 2; + + float starTop = title.top(); + if (regStars < stars.size()) starTop -= 2; + for (Image star : stars){ star.x = left; - star.y = title.top(); + star.y = starTop; PixelScene.align(star); left += 6; + regStars--; + if (regStars == 0){ + starTop += 6; + left = title.right() + 2; + } } float gap = (width - buttons.size()*TalentButton.WIDTH)/(buttons.size()+1);