From c41417951f3bc13db17a807601a493b4cf6d2c80 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Wed, 25 Jul 2018 02:15:47 -0400 Subject: [PATCH] v0.7.0: implemented scroll of mystical energy --- .../actors/buffs/ArtifactRecharge.java | 73 +++++++++++++++++++ .../items/artifacts/Artifact.java | 4 + .../items/artifacts/CapeOfThorns.java | 13 +++- .../items/artifacts/ChaliceOfBlood.java | 7 +- .../items/artifacts/CloakOfShadows.java | 9 ++- .../items/artifacts/DriedRose.java | 9 ++- .../items/artifacts/EtherealChains.java | 10 ++- .../items/artifacts/HornOfPlenty.java | 9 ++- .../items/artifacts/LloydsBeacon.java | 7 ++ .../items/artifacts/MasterThievesArmband.java | 8 ++ .../items/artifacts/SandalsOfNature.java | 5 ++ .../items/artifacts/TalismanOfForesight.java | 7 ++ .../items/artifacts/TimekeepersHourglass.java | 7 ++ .../items/artifacts/UnstableSpellbook.java | 7 ++ .../items/scrolls/exotic/ExoticScroll.java | 10 +-- .../exotic/ScrollOfMysticalEnergy.java | 4 +- .../messages/actors/actors.properties | 3 + .../messages/items/items.properties | 2 +- 18 files changed, 181 insertions(+), 13 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/ArtifactRecharge.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/ArtifactRecharge.java index a8a4e5ab6..74145142a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/ArtifactRecharge.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/ArtifactRecharge.java @@ -21,5 +21,78 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.buffs; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Belongings; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; +import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.Artifact; +import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; +import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; +import com.watabou.noosa.Image; +import com.watabou.utils.Bundle; + +//TODO this may be very powerful, consider balancing public class ArtifactRecharge extends Buff { + + { + type = buffType.POSITIVE; + } + + private int left = 30; + + @Override + public boolean act() { + + if (target instanceof Hero){ + Belongings b = ((Hero) target).belongings; + + if (b.misc1 instanceof Artifact){ + ((Artifact)b.misc1).charge((Hero)target); + } + if (b.misc2 instanceof Artifact){ + ((Artifact)b.misc2).charge((Hero)target); + } + } + + left--; + if (left <= 0){ + detach(); + } else { + spend(TICK); + } + + return true; + } + + @Override + public int icon() { + return BuffIndicator.RECHARGING; + } + + @Override + public void tintIcon(Image icon) { + icon.hardlight(0, 1f, 0); + } + + @Override + public String toString() { + return Messages.get(this, "name"); + } + + @Override + public String desc() { + return Messages.get(this, "desc", dispTurns(left+1)); + } + + private static final String LEFT = "left"; + + @Override + public void storeInBundle(Bundle bundle) { + super.storeInBundle(bundle); + bundle.put( LEFT, left ); + } + + @Override + public void restoreFromBundle(Bundle bundle) { + super.restoreFromBundle(bundle); + left = bundle.getInt(LEFT); + } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/Artifact.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/Artifact.java index 72cd1e4fe..88d513588 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/Artifact.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/Artifact.java @@ -207,6 +207,10 @@ public class Artifact extends KindofMisc { } protected ArtifactBuff activeBuff() {return null; } + + public void charge(Hero target){ + //do nothing by default; + } public class ArtifactBuff extends Buff { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CapeOfThorns.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CapeOfThorns.java index 9f040267d..9f41c8238 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CapeOfThorns.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CapeOfThorns.java @@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.artifacts; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; @@ -47,7 +48,17 @@ public class CapeOfThorns extends Artifact { protected ArtifactBuff passiveBuff() { return new Thorns(); } - + + @Override + public void charge(Hero target) { + if (cooldown == 0) { + charge += 4; + } + if (charge >= chargeCap){ + target.buff(Thorns.class).proc(0, null, null); + } + } + @Override public String desc() { String desc = Messages.get(this, "desc"); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/ChaliceOfBlood.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/ChaliceOfBlood.java index 6fe7a537c..3aebdfe13 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/ChaliceOfBlood.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/ChaliceOfBlood.java @@ -135,7 +135,12 @@ public class ChaliceOfBlood extends Artifact { protected ArtifactBuff passiveBuff() { return new chaliceRegen(); } - + + @Override + public void charge(Hero target) { + target.HP = Math.min( target.HT, target.HP + 1 + Dungeon.depth/5); + } + @Override public String desc() { String desc = super.desc(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CloakOfShadows.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CloakOfShadows.java index d6a52684d..03bde5034 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CloakOfShadows.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CloakOfShadows.java @@ -133,7 +133,14 @@ public class CloakOfShadows extends Artifact { protected ArtifactBuff activeBuff( ) { return new cloakStealth(); } - + + @Override + public void charge(Hero target) { + if (charge < chargeCap) { + partialCharge += 0.25f; + } + } + @Override public Item upgrade() { chargeCap = Math.min(chargeCap + 1, 10); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java index 7517ea338..0e795ed1c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java @@ -193,7 +193,14 @@ public class DriedRose extends Artifact { protected ArtifactBuff passiveBuff() { return new roseRecharge(); } - + + @Override + public void charge(Hero target) { + if (ghost == null && charge < chargeCap){ + partialCharge += 0.25f; + } + } + @Override public Item upgrade() { if (level() >= 9) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/EtherealChains.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/EtherealChains.java index 4eef38a5c..5353dd64f 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/EtherealChains.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/EtherealChains.java @@ -230,7 +230,15 @@ public class EtherealChains extends Artifact { protected ArtifactBuff passiveBuff() { return new chainsRecharge(); } - + + @Override + public void charge(Hero target) { + int chargeTarget = 5+(level()*2); + if (charge < chargeTarget*2){ + partialCharge += 0.5f; + } + } + @Override public String desc() { String desc = super.desc(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/HornOfPlenty.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/HornOfPlenty.java index affbc5b74..cee2fd40d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/HornOfPlenty.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/HornOfPlenty.java @@ -143,7 +143,14 @@ public class HornOfPlenty extends Artifact { protected ArtifactBuff passiveBuff() { return new hornRecharge(); } - + + @Override + public void charge(Hero target) { + if (charge < chargeCap){ + partialCharge += 0.25f; + } + } + @Override public String desc() { String desc = super.desc(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/LloydsBeacon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/LloydsBeacon.java index 7e0ba4ed3..455be3076 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/LloydsBeacon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/LloydsBeacon.java @@ -261,6 +261,13 @@ public class LloydsBeacon extends Artifact { protected ArtifactBuff passiveBuff() { return new beaconRecharge(); } + + @Override + public void charge(Hero target) { + if (charge < chargeCap){ + partialCharge += 0.25f; + } + } @Override public Item upgrade() { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/MasterThievesArmband.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/MasterThievesArmband.java index 9f1f1828a..b06bd2e1b 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/MasterThievesArmband.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/MasterThievesArmband.java @@ -22,6 +22,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.artifacts; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.watabou.utils.Random; @@ -42,6 +43,13 @@ public class MasterThievesArmband extends Artifact { protected ArtifactBuff passiveBuff() { return new Thievery(); } + + @Override + public void charge(Hero target) { + if (charge < chargeCap){ + charge += 10; + } + } @Override public String desc() { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/SandalsOfNature.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/SandalsOfNature.java index cfb26f6ac..1fa473ede 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/SandalsOfNature.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/SandalsOfNature.java @@ -99,6 +99,11 @@ public class SandalsOfNature extends Artifact { protected ArtifactBuff passiveBuff() { return new Naturalism(); } + + @Override + public void charge(Hero target) { + target.buff(Naturalism.class).charge(); + } @Override public String desc() { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TalismanOfForesight.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TalismanOfForesight.java index b48414387..b3a537366 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TalismanOfForesight.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TalismanOfForesight.java @@ -102,6 +102,13 @@ public class TalismanOfForesight extends Artifact { protected ArtifactBuff passiveBuff() { return new Foresight(); } + + @Override + public void charge(Hero target) { + if (charge < chargeCap){ + partialCharge += 4f; + } + } @Override public String desc() { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TimekeepersHourglass.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TimekeepersHourglass.java index c4a7e58c2..d3e1327ab 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TimekeepersHourglass.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TimekeepersHourglass.java @@ -136,6 +136,13 @@ public class TimekeepersHourglass extends Artifact { protected ArtifactBuff passiveBuff() { return new hourglassRecharge(); } + + @Override + public void charge(Hero target) { + if (charge < chargeCap){ + partialCharge += 0.25f; + } + } @Override public Item upgrade() { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/UnstableSpellbook.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/UnstableSpellbook.java index 8406a145b..35380fd04 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/UnstableSpellbook.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/UnstableSpellbook.java @@ -170,6 +170,13 @@ public class UnstableSpellbook extends Artifact { protected ArtifactBuff passiveBuff() { return new bookRecharge(); } + + @Override + public void charge(Hero target) { + if (charge < chargeCap){ + partialCharge += 0.1f; + } + } @Override public Item upgrade() { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ExoticScroll.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ExoticScroll.java index 8f5b80817..e974e7640 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ExoticScroll.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ExoticScroll.java @@ -69,9 +69,6 @@ public abstract class ExoticScroll extends Scroll { regToExo.put(ScrollOfTerror.class, ScrollOfPetrification.class); exoToReg.put(ScrollOfPetrification.class, ScrollOfTerror.class); - regToExo.put(ScrollOfTransmutation.class, ScrollOfDistortion.class); - exoToReg.put(ScrollOfDistortion.class, ScrollOfTransmutation.class); - regToExo.put(ScrollOfRecharging.class, ScrollOfMysticalEnergy.class); exoToReg.put(ScrollOfMysticalEnergy.class, ScrollOfRecharging.class); @@ -86,8 +83,11 @@ public abstract class ExoticScroll extends Scroll { //TODO - regToExo.put(ScrollOfMirrorImage.class, ScrollOfPetrification.class); - exoToReg.put(ScrollOfPetrification.class, ScrollOfMirrorImage.class); + regToExo.put(ScrollOfMirrorImage.class, ScrollOfDivination.class); + exoToReg.put(ScrollOfDivination.class, ScrollOfMirrorImage.class); + + regToExo.put(ScrollOfTransmutation.class, ScrollOfDivination.class); + exoToReg.put(ScrollOfDivination.class, ScrollOfTransmutation.class); } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ScrollOfMysticalEnergy.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ScrollOfMysticalEnergy.java index 3b61c3539..656c518e6 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ScrollOfMysticalEnergy.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ScrollOfMysticalEnergy.java @@ -22,6 +22,8 @@ package com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic; import com.shatteredpixel.shatteredpixeldungeon.Assets; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.ArtifactRecharge; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility; import com.shatteredpixel.shatteredpixeldungeon.effects.SpellSprite; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging; @@ -37,7 +39,7 @@ public class ScrollOfMysticalEnergy extends ExoticScroll { public void doRead() { //append buff - ScrollOfRecharging.charge(curUser); + Buff.affect(curUser, ArtifactRecharge.class); Sample.INSTANCE.play( Assets.SND_READ ); Invisibility.dispel(); diff --git a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/actors/actors.properties b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/actors/actors.properties index 65a312480..1f6e0944f 100644 --- a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/actors/actors.properties +++ b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/actors/actors.properties @@ -48,6 +48,9 @@ actors.buffs.adrenalinesurge.desc=A surge of great might, but sadly not permanen actors.buffs.amok.name=Amok actors.buffs.amok.desc=Amok causes a state of great rage and confusion in its target.\n\nWhen a creature is amoked, they will attack whatever is near them, whether they be friend or foe.\n\nTurns of amok remaining: %s. +actors.buffs.artifactrecharge.name=Artifact Recharging +actors.buffs.artifactrecharge.desc=Energy is coursing through you, increasing the rate your equipped artiacts charge.\n\nEach artifact is affected a little differently, but they will all be less limited by their charge meter.\n\nTurns remaining: %s. + actors.buffs.barkskin.name=Barkskin actors.buffs.barkskin.desc=Your skin is hardened, it feels rough and solid like bark.\n\nThe hardened skin increases your effective armor, allowing you to better defend against physical attack.\n\nYour armor is currently increased by: %d.\nTurns until barkskin weakens: %s. diff --git a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties index 56aa654cb..e8b4e135a 100644 --- a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties +++ b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties @@ -812,7 +812,7 @@ items.scrolls.exotic.scrollofforesight.name=scroll of foresight items.scrolls.exotic.scrollofforesight.desc=When this scroll is read, detail of nearby terrain will be constantly fed to the reader's mind in crystal clarity. For the duration of this effect, searching will not be necessary, as the reader will automatically detect everything within their search radius. items.scrolls.exotic.scrollofmysticalenergy.name=scroll of mystical energy -items.scrolls.exotic.scrollofmysticalenergy.desc= +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.scrollofpassage.name=scroll of passage items.scrolls.exotic.scrollofpassage.desc=The spell on this parchment instantly transports the reader to the nearest region entrance above them. Very handy for quickly getting to a shop.