diff --git a/core/src/main/assets/messages/items/items.properties b/core/src/main/assets/messages/items/items.properties index 7abd31659..dd3751daf 100644 --- a/core/src/main/assets/messages/items/items.properties +++ b/core/src/main/assets/messages/items/items.properties @@ -719,9 +719,9 @@ items.potions.exotic.exoticpotion.bistre=exotic bistre potion items.potions.exotic.exoticpotion.indigo=exotic indigo potion items.potions.exotic.exoticpotion.silver=exotic silver potion items.potions.exotic.exoticpotion.unknown_desc=This round flask contains a grainy colorful liquid. It seems to be foreign to this land, who knows what it might do when drunk or thrown? - -items.potions.exotic.potionofadrenalinesurge.name=potion of adrenaline surge -items.potions.exotic.potionofadrenalinesurge.desc=This powerful liquid will give you a greater boost of strength that withers after an extended period of time. +items.potions.exotic.exoticpotion.warning=Do you really want to cancel this potion usage? It will be consumed anyway. +items.potions.exotic.exoticpotion.yes=Yes, I'm positive +items.potions.exotic.exoticpotion.no=No, I changed my mind items.potions.exotic.potionofcleansing.name=potion of cleansing items.potions.exotic.potionofcleansing.desc=This powerful reagent will render the drinker immune to all harmful effects for a few turns when quaffed. It can be thrown at a target to cleanse them as well. @@ -747,6 +747,9 @@ items.potions.exotic.potionofdivineinspiration.desc=The power of holy energy red 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! +items.potions.exotic.potionofmastery.name=potion of mastery +items.potions.exotic.potionofmastery.desc=Rather than granting raw strength, this potion will instead attune the muscles of the user to a particular item. This will make that item easier to use, as if the drinker had practised with it and built muscle memory.\n\nThe chosen weapon or armor will require 2 less strength to use. This potion can only be used once on each item. + items.potions.exotic.potionofshielding.name=potion of shielding items.potions.exotic.potionofshielding.desc=Rather than heal, this potion will instead project a durable shield around the user's body, blocking a considerable amount of damage. diff --git a/core/src/main/assets/sprites/item_icons.png b/core/src/main/assets/sprites/item_icons.png index 2f0bfa437..c5f2bae29 100644 Binary files a/core/src/main/assets/sprites/item_icons.png and b/core/src/main/assets/sprites/item_icons.png differ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java index 304d39c67..2ba7cee7c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java @@ -58,6 +58,9 @@ public class ShatteredPixelDungeon extends Game { com.watabou.utils.Bundle.addAlias( com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic.PotionOfDivineInspiration.class, "com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic.PotionOfHolyFuror" ); + com.watabou.utils.Bundle.addAlias( + com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic.PotionOfMastery.class, + "com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic.PotionOfAdrenalineSurge" ); //v1.0.0 com.watabou.utils.Bundle.addAlias( diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/AdrenalineSurge.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/AdrenalineSurge.java index 4c2ba90b5..eec9e5b96 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/AdrenalineSurge.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/AdrenalineSurge.java @@ -27,7 +27,7 @@ import com.watabou.utils.Bundle; public class AdrenalineSurge extends Buff { - public static float DURATION = 800f; + public static float DURATION = 200f; { type = buffType.POSITIVE; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java index e3c8a63cc..74c223785 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java @@ -103,6 +103,7 @@ public class Armor extends EquipableItem { public Glyph glyph; public boolean curseInfusionBonus = false; + public boolean masteryPotionBonus = false; private BrokenSeal seal; @@ -120,6 +121,7 @@ public class Armor extends EquipableItem { private static final String AVAILABLE_USES = "available_uses"; private static final String GLYPH = "glyph"; private static final String CURSE_INFUSION_BONUS = "curse_infusion_bonus"; + private static final String MASTERY_POTION_BONUS = "mastery_potion_bonus"; private static final String SEAL = "seal"; private static final String AUGMENT = "augment"; @@ -130,6 +132,7 @@ public class Armor extends EquipableItem { bundle.put( AVAILABLE_USES, availableUsesToID ); bundle.put( GLYPH, glyph ); bundle.put( CURSE_INFUSION_BONUS, curseInfusionBonus ); + bundle.put( MASTERY_POTION_BONUS, masteryPotionBonus ); bundle.put( SEAL, seal); bundle.put( AUGMENT, augment); } @@ -141,6 +144,7 @@ public class Armor extends EquipableItem { availableUsesToID = bundle.getInt( AVAILABLE_USES ); inscribe((Glyph) bundle.get(GLYPH)); curseInfusionBonus = bundle.getBoolean( CURSE_INFUSION_BONUS ); + masteryPotionBonus = bundle.getBoolean( MASTERY_POTION_BONUS ); seal = (BrokenSeal)bundle.get(SEAL); augment = bundle.getEnum(AUGMENT, Augment.class); @@ -533,7 +537,11 @@ public class Armor extends EquipableItem { } public int STRReq(){ - return STRReq(level()); + int req = STRReq(level()); + if (masteryPotionBonus){ + req -= 2; + } + return req; } public int STRReq(int lvl){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/ClassArmor.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/ClassArmor.java index 361b67dfe..1292870de 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/ClassArmor.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/ClassArmor.java @@ -110,6 +110,7 @@ abstract public class ClassArmor extends Armor { classArmor.inscribe( armor.glyph ); classArmor.cursed = armor.cursed; classArmor.curseInfusionBonus = armor.curseInfusionBonus; + classArmor.masteryPotionBonus = armor.masteryPotionBonus; classArmor.identify(); classArmor.charge = 50; 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 0667abd4a..2202d268f 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 @@ -37,7 +37,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfParalyticG import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfPurity; import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength; import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfToxicGas; -import com.shatteredpixel.shatteredpixeldungeon.plants.Plant; import com.watabou.utils.Reflection; import java.util.ArrayList; @@ -58,8 +57,8 @@ public class ExoticPotion extends Potion { regToExo.put(PotionOfToxicGas.class, PotionOfCorrosiveGas.class); exoToReg.put(PotionOfCorrosiveGas.class, PotionOfToxicGas.class); - regToExo.put(PotionOfStrength.class, PotionOfAdrenalineSurge.class); - exoToReg.put(PotionOfAdrenalineSurge.class, PotionOfStrength.class); + regToExo.put(PotionOfStrength.class, PotionOfMastery.class); + exoToReg.put(PotionOfMastery.class, PotionOfStrength.class); regToExo.put(PotionOfFrost.class, PotionOfSnapFreeze.class); exoToReg.put(PotionOfSnapFreeze.class, PotionOfFrost.class); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfAdrenalineSurge.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfAdrenalineSurge.java deleted file mode 100644 index 437d11a18..000000000 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfAdrenalineSurge.java +++ /dev/null @@ -1,43 +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.AdrenalineSurge; -import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; -import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; -import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; - -public class PotionOfAdrenalineSurge extends ExoticPotion { - - { - icon = ItemSpriteSheet.Icons.POTION_ARENSURGE; - - unique = true; - } - - @Override - public void apply(Hero hero) { - identify(); - Buff.affect(hero, AdrenalineSurge.class).reset(2, 800f); - } - -} 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 a1743f25e..ea5aa69ff 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 @@ -39,7 +39,9 @@ import com.shatteredpixel.shatteredpixeldungeon.mechanics.ConeAOE; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.CellSelector; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; +import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions; import com.watabou.noosa.audio.Sample; import com.watabou.utils.Callback; import com.watabou.utils.PathFinder; @@ -62,12 +64,38 @@ public class PotionOfDragonsBreath extends ExoticPotion { } private CellSelector.Listener targeter = new CellSelector.Listener() { + + private boolean showingWindow = false; + @Override public void onSelect(final Integer cell) { + if (showingWindow){ + return; + } + if (cell == null && !isKnown()){ - identify(); - detach(curUser.belongings.backpack); + showingWindow = true; + GameScene.show( new WndOptions(new ItemSprite(PotionOfDragonsBreath.this), + Messages.titleCase(name()), + Messages.get(ExoticPotion.class, "warning"), + Messages.get(ExoticPotion.class, "yes"), + Messages.get(ExoticPotion.class, "no") ) { + @Override + protected void onSelect( int index ) { + showingWindow = false; + switch (index) { + case 0: + curUser.spendAndNext(1f); + detach(curUser.belongings.backpack); + break; + case 1: + GameScene.selectCell( targeter ); + break; + } + } + public void onBackPressed() {} + } ); } else if (cell != null) { identify(); curUser.busy(); 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 new file mode 100644 index 000000000..234dc71ee --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfMastery.java @@ -0,0 +1,114 @@ +/* + * 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.actors.hero.Hero; +import com.shatteredpixel.shatteredpixeldungeon.items.Item; +import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; +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.scenes.GameScene; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; +import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; +import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag; +import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions; +import com.watabou.noosa.audio.Sample; + +public class PotionOfMastery extends ExoticPotion { + + { + icon = ItemSpriteSheet.Icons.POTION_MASTERY; + + unique = true; + } + + @Override + //need to override drink so that time isn't spent right away + protected void drink(final Hero hero) { + curUser = hero; + curItem = this; + + GameScene.selectItem(itemSelector); + } + + protected WndBag.ItemSelector itemSelector = new WndBag.ItemSelector() { + + @Override + public String textPrompt() { + return "Master an Item"; + } + + @Override + public boolean itemSelectable(Item item) { + return + (item instanceof MeleeWeapon && !((MeleeWeapon) item).masteryPotionBonus) + || (item instanceof Armor && !((Armor) item).masteryPotionBonus); + } + + @Override + public void onSelect(Item item) { + + if (item == null && !isKnown()){ + GameScene.show( new WndOptions(new ItemSprite(PotionOfMastery.this), + Messages.titleCase(name()), + Messages.get(ExoticPotion.class, "warning"), + Messages.get(ExoticPotion.class, "yes"), + Messages.get(ExoticPotion.class, "no") ) { + @Override + protected void onSelect( int index ) { + switch (index) { + case 0: + curUser.spendAndNext(1f); + detach(curUser.belongings.backpack); + break; + case 1: + GameScene.selectItem(itemSelector); + break; + } + } + public void onBackPressed() {} + } ); + } else if (item != null) { + + if (item instanceof Weapon) { + ((Weapon) item).masteryPotionBonus = true; + GLog.p( "Your weapon becomes easier to wield!" ); + } else if (item instanceof Armor) { + ((Armor) item).masteryPotionBonus = true; + GLog.p( "Your weapon becomes easier to wear!" ); + } + updateQuickslot(); + + identify(); + Sample.INSTANCE.play( Assets.Sounds.DRINK ); + curUser.sprite.operate(curUser.pos); + curItem.detach(curUser.belongings.backpack); + + } + + } + }; + +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfTransmutation.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfTransmutation.java index 99ef154b9..a7666d6eb 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfTransmutation.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfTransmutation.java @@ -180,6 +180,7 @@ public class ScrollOfTransmutation extends InventoryScroll { n.enchantment = w.enchantment; n.curseInfusionBonus = w.curseInfusionBonus; + n.masteryPotionBonus = w.masteryPotionBonus; n.levelKnown = w.levelKnown; n.cursedKnown = w.cursedKnown; n.cursed = w.cursed; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java index 3cf2c3450..c3304c38d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java @@ -99,6 +99,7 @@ abstract public class Weapon extends KindOfWeapon { public Enchantment enchantment; public boolean curseInfusionBonus = false; + public boolean masteryPotionBonus = false; @Override public int proc( Char attacker, Char defender, int damage ) { @@ -133,6 +134,7 @@ abstract public class Weapon extends KindOfWeapon { private static final String AVAILABLE_USES = "available_uses"; private static final String ENCHANTMENT = "enchantment"; private static final String CURSE_INFUSION_BONUS = "curse_infusion_bonus"; + private static final String MASTERY_POTION_BONUS = "mastery_potion_bonus"; private static final String AUGMENT = "augment"; @Override @@ -142,6 +144,7 @@ abstract public class Weapon extends KindOfWeapon { bundle.put( AVAILABLE_USES, availableUsesToID ); bundle.put( ENCHANTMENT, enchantment ); bundle.put( CURSE_INFUSION_BONUS, curseInfusionBonus ); + bundle.put( MASTERY_POTION_BONUS, masteryPotionBonus ); bundle.put( AUGMENT, augment ); } @@ -152,6 +155,7 @@ abstract public class Weapon extends KindOfWeapon { availableUsesToID = bundle.getFloat( AVAILABLE_USES ); enchantment = (Enchantment)bundle.get( ENCHANTMENT ); curseInfusionBonus = bundle.getBoolean( CURSE_INFUSION_BONUS ); + masteryPotionBonus = bundle.getBoolean( MASTERY_POTION_BONUS ); augment = bundle.getEnum(AUGMENT, Augment.class); } @@ -207,7 +211,11 @@ abstract public class Weapon extends KindOfWeapon { } public int STRReq(){ - return STRReq(level()); + int req = STRReq(level()); + if (masteryPotionBonus){ + req -= 2; + } + return req; } public abstract int STRReq(int lvl); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Rotberry.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Rotberry.java index 1543b520b..1184f9d0d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Rotberry.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Rotberry.java @@ -41,7 +41,7 @@ public class Rotberry extends Plant { @Override public void activate( Char ch ) { if (ch instanceof Hero && ((Hero) ch).subClass == HeroSubClass.WARDEN){ - Buff.affect(ch, AdrenalineSurge.class).reset(1, 200f); + Buff.affect(ch, AdrenalineSurge.class).reset(1, AdrenalineSurge.DURATION); } Dungeon.level.drop( new Seed(), pos ).sprite.drop(); 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 177b340ce..2ae8bb040 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java @@ -834,7 +834,7 @@ public class ItemSpriteSheet { } private static final int EXOTIC_POTIONS = xy(1, 7); //16 slots - public static final int POTION_ARENSURGE= EXOTIC_POTIONS+0; + public static final int POTION_MASTERY = EXOTIC_POTIONS+0; public static final int POTION_SHIELDING= EXOTIC_POTIONS+1; public static final int POTION_MAGISIGHT= EXOTIC_POTIONS+2; public static final int POTION_SNAPFREEZ= EXOTIC_POTIONS+3; @@ -847,7 +847,7 @@ public class ItemSpriteSheet { public static final int POTION_CLEANSE = EXOTIC_POTIONS+10; public static final int POTION_DIVINE = EXOTIC_POTIONS+11; static { - assignIconRect( POTION_ARENSURGE, 7, 7 ); + assignIconRect( POTION_MASTERY, 7, 7 ); assignIconRect( POTION_SHIELDING, 6, 6 ); assignIconRect( POTION_MAGISIGHT, 7, 5 ); assignIconRect( POTION_SNAPFREEZ, 7, 7 );