From 75f20247c2bfc38db7cac1f94aa4d279abdfdbec Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Thu, 28 Feb 2019 15:32:19 -0500 Subject: [PATCH] v0.7.2: plant balance adjustments: - increased total poison damage from sorrowmoss - increased duration of swiftthistle effect by 1 and allowed movement - buffed warden earthroot effect --- .../actors/hero/Hero.java | 4 + .../actors/mobs/Mob.java | 4 +- .../items/artifacts/LloydsBeacon.java | 3 + .../items/artifacts/TimekeepersHourglass.java | 2 +- .../items/scrolls/exotic/ScrollOfPassage.java | 3 + .../items/spells/BeaconOfReturning.java | 3 + .../items/wands/CursedWand.java | 4 + .../shatteredpixeldungeon/levels/Level.java | 30 ++++-- .../levels/features/Chasm.java | 3 + .../plants/Earthroot.java | 2 +- .../plants/Fadeleaf.java | 2 + .../plants/Sorrowmoss.java | 2 +- .../plants/Swiftthistle.java | 96 ++++++++++++++----- .../messages/plants/plants.properties | 2 +- 14 files changed, 121 insertions(+), 39 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java index e2c28f741..df6a84b27 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java @@ -835,6 +835,8 @@ public class Hero extends Char { Buff buff = buff(TimekeepersHourglass.timeFreeze.class); if (buff != null) buff.detach(); + buff = Dungeon.hero.buff(Swiftthistle.TimeBubble.class); + if (buff != null) buff.detach(); InterlevelScene.mode = InterlevelScene.Mode.DESCEND; Game.switchScene( InterlevelScene.class ); @@ -873,6 +875,8 @@ public class Hero extends Char { Buff buff = buff(TimekeepersHourglass.timeFreeze.class); if (buff != null) buff.detach(); + buff = Dungeon.hero.buff(Swiftthistle.TimeBubble.class); + if (buff != null) buff.detach(); InterlevelScene.mode = InterlevelScene.Mode.ASCEND; Game.switchScene( InterlevelScene.class ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java index 06fdce930..90a1381d8 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java @@ -53,6 +53,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfAggression; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon; import com.shatteredpixel.shatteredpixeldungeon.levels.features.Chasm; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; +import com.shatteredpixel.shatteredpixeldungeon.plants.Swiftthistle; import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.watabou.utils.Bundle; @@ -451,7 +452,8 @@ public abstract class Mob extends Char { @Override public void updateSpriteState() { super.updateSpriteState(); - if (Dungeon.hero.buff(TimekeepersHourglass.timeFreeze.class) != null) + if (Dungeon.hero.buff(TimekeepersHourglass.timeFreeze.class) != null + || Dungeon.hero.buff(Swiftthistle.TimeBubble.class) != null) sprite.add( CharSprite.State.PARALYSED ); } 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 d05d3b4d7..4452a45cd 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 @@ -35,6 +35,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation; import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; +import com.shatteredpixel.shatteredpixeldungeon.plants.Swiftthistle; import com.shatteredpixel.shatteredpixeldungeon.scenes.CellSelector; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.InterlevelScene; @@ -178,6 +179,8 @@ public class LloydsBeacon extends Artifact { Buff buff = Dungeon.hero.buff(TimekeepersHourglass.timeFreeze.class); if (buff != null) buff.detach(); + buff = Dungeon.hero.buff(Swiftthistle.TimeBubble.class); + if (buff != null) buff.detach(); InterlevelScene.mode = InterlevelScene.Mode.RETURN; InterlevelScene.returnDepth = returnDepth; 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 dc63f2980..0aeca743a 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 @@ -335,7 +335,7 @@ public class TimekeepersHourglass extends Artifact { @Override public void detach(){ for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])) - mob.sprite.remove(CharSprite.State.PARALYSED); + if (mob.paralysed <= 0) mob.sprite.remove(CharSprite.State.PARALYSED); GameScene.freezeEmitters = false; updateQuickslot(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ScrollOfPassage.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ScrollOfPassage.java index 68ccafa85..bfe2228aa 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ScrollOfPassage.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ScrollOfPassage.java @@ -26,6 +26,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; +import com.shatteredpixel.shatteredpixeldungeon.plants.Swiftthistle; import com.shatteredpixel.shatteredpixeldungeon.scenes.InterlevelScene; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.watabou.noosa.Game; @@ -50,6 +51,8 @@ public class ScrollOfPassage extends ExoticScroll { Buff buff = Dungeon.hero.buff(TimekeepersHourglass.timeFreeze.class); if (buff != null) buff.detach(); + buff = Dungeon.hero.buff(Swiftthistle.TimeBubble.class); + if (buff != null) buff.detach(); InterlevelScene.mode = InterlevelScene.Mode.RETURN; InterlevelScene.returnDepth = Math.max(1, (Dungeon.depth - 1 - (Dungeon.depth-2)%5)); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/BeaconOfReturning.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/BeaconOfReturning.java index 7e39b57e2..86e1ba845 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/BeaconOfReturning.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/BeaconOfReturning.java @@ -32,6 +32,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourg import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ScrollOfPassage; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; +import com.shatteredpixel.shatteredpixeldungeon.plants.Swiftthistle; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.InterlevelScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; @@ -129,6 +130,8 @@ public class BeaconOfReturning extends Spell { Buff buff = Dungeon.hero.buff(TimekeepersHourglass.timeFreeze.class); if (buff != null) buff.detach(); + buff = Dungeon.hero.buff(Swiftthistle.TimeBubble.class); + if (buff != null) buff.detach(); InterlevelScene.mode = InterlevelScene.Mode.RETURN; InterlevelScene.returnDepth = returnDepth; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/CursedWand.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/CursedWand.java index e0bd952e3..c2b75828d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/CursedWand.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/CursedWand.java @@ -60,6 +60,7 @@ import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; import com.shatteredpixel.shatteredpixeldungeon.messages.Languages; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.plants.Plant; +import com.shatteredpixel.shatteredpixeldungeon.plants.Swiftthistle; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.InterlevelScene; import com.shatteredpixel.shatteredpixeldungeon.ui.TargetHealthIndicator; @@ -325,6 +326,9 @@ public class CursedWand { Buff buff = Dungeon.hero.buff(TimekeepersHourglass.timeFreeze.class); if (buff != null) buff.detach(); + + buff = Dungeon.hero.buff(Swiftthistle.TimeBubble.class); + if (buff != null) buff.detach(); InterlevelScene.mode = InterlevelScene.Mode.RETURN; InterlevelScene.returnDepth = depth; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java index 09341257f..ea2fa23cc 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java @@ -64,6 +64,7 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.traps.Trap; import com.shatteredpixel.shatteredpixeldungeon.mechanics.ShadowCaster; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.plants.Plant; +import com.shatteredpixel.shatteredpixeldungeon.plants.Swiftthistle; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; import com.shatteredpixel.shatteredpixeldungeon.tiles.CustomTiledVisual; @@ -815,7 +816,26 @@ public abstract class Level implements Bundlable { TimekeepersHourglass.timeFreeze timeFreeze = Dungeon.hero.buff(TimekeepersHourglass.timeFreeze.class); - if (timeFreeze == null) { + Swiftthistle.TimeBubble bubble = + Dungeon.hero.buff(Swiftthistle.TimeBubble.class); + + if (bubble != null){ + + Sample.INSTANCE.play(Assets.SND_TRAP); + + discover(cell); + + bubble.setDelayedPress(cell); + + } else if (timeFreeze != null){ + + Sample.INSTANCE.play(Assets.SND_TRAP); + + discover(cell); + + timeFreeze.setDelayedPress(cell); + + } else { if (ch == Dungeon.hero) { Dungeon.hero.interrupt(); @@ -823,14 +843,6 @@ public abstract class Level implements Bundlable { trap.trigger(); - } else { - - Sample.INSTANCE.play(Assets.SND_TRAP); - - discover(cell); - - timeFreeze.setDelayedPress(cell); - } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/Chasm.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/Chasm.java index 4a0b42557..282d63076 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/Chasm.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/Chasm.java @@ -35,6 +35,7 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.RegularLevel; import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room; import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.WeakFloorRoom; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; +import com.shatteredpixel.shatteredpixeldungeon.plants.Swiftthistle; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.InterlevelScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.MobSprite; @@ -74,6 +75,8 @@ public class Chasm { Buff buff = Dungeon.hero.buff(TimekeepersHourglass.timeFreeze.class); if (buff != null) buff.detach(); + buff = Dungeon.hero.buff(Swiftthistle.TimeBubble.class); + if (buff != null) buff.detach(); if (Dungeon.hero.isAlive()) { Dungeon.hero.interrupt(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Earthroot.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Earthroot.java index cebb7b880..81aa6db85 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Earthroot.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Earthroot.java @@ -47,7 +47,7 @@ public class Earthroot extends Plant { if (ch == Dungeon.hero) { if (Dungeon.hero.subClass == HeroSubClass.WARDEN){ - Buff.affect(ch, Barkskin.class).set((Dungeon.depth + 5)/2, 5); + Buff.affect(ch, Barkskin.class).set(Dungeon.hero.lvl + 5, 5); } else { Buff.affect(ch, Armor.class).level(ch.HT); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Fadeleaf.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Fadeleaf.java index 7768342e3..313026856 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Fadeleaf.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Fadeleaf.java @@ -60,6 +60,8 @@ public class Fadeleaf extends Plant { Buff buff = Dungeon.hero.buff(TimekeepersHourglass.timeFreeze.class); if (buff != null) buff.detach(); + buff = Dungeon.hero.buff(Swiftthistle.TimeBubble.class); + if (buff != null) buff.detach(); InterlevelScene.mode = InterlevelScene.Mode.RETURN; InterlevelScene.returnDepth = Math.max(1, (Dungeon.depth - 1)); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Sorrowmoss.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Sorrowmoss.java index fea03a774..d14b30899 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Sorrowmoss.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Sorrowmoss.java @@ -45,7 +45,7 @@ public class Sorrowmoss extends Plant { } if (ch != null) { - Buff.affect( ch, Poison.class ).set( 4 + Dungeon.depth / 2 ); + Buff.affect( ch, Poison.class ).set( 5 + Math.round(2*Dungeon.depth / 3f) ); } if (Dungeon.level.heroFOV[pos]) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Swiftthistle.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Swiftthistle.java index f5f5ff9f7..acfc2cee2 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Swiftthistle.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Swiftthistle.java @@ -27,12 +27,17 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FlavourBuff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Haste; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass; +import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; +import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; +import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; import com.watabou.noosa.Image; import com.watabou.utils.Bundle; +import java.util.ArrayList; + public class Swiftthistle extends Plant { { @@ -44,7 +49,7 @@ public class Swiftthistle extends Plant { if (ch == Dungeon.hero) { Buff.affect(ch, TimeBubble.class).reset(); if (Dungeon.hero.subClass == HeroSubClass.WARDEN){ - Buff.affect(ch, Haste.class, 5f); + Buff.affect(ch, Haste.class, 1f); } } } @@ -57,16 +62,18 @@ public class Swiftthistle extends Plant { } } + //FIXME lots of copypasta from time freeze here + public static class TimeBubble extends Buff { - private float left; - private int pos; - { type = buffType.POSITIVE; announced = true; } + private float left; + ArrayList presses = new ArrayList(); + @Override public int icon() { return BuffIndicator.SLOW; @@ -74,25 +81,11 @@ public class Swiftthistle extends Plant { @Override public void tintIcon(Image icon) { - if (left < 4) FlavourBuff.greyIcon(icon, 4f, left); + FlavourBuff.greyIcon(icon, 5f, left); } public void reset(){ - pos = target.pos; - left = 6f; - } - - public void processTime( float time ){ - if (target.pos != pos){ - left = 0f; - } - - left -= time; - BuffIndicator.refreshHero(); - - if (left <= 0){ - detach(); - } + left = 7f; } @Override @@ -105,21 +98,74 @@ public class Swiftthistle extends Plant { return Messages.get(this, "desc", dispTurns(left)); } - private static final String POS = "pos"; + public void processTime(float time){ + left -= time; + + BuffIndicator.refreshHero(); + + if (left <= 0){ + detach(); + } + + } + + public void setDelayedPress(int cell){ + if (!presses.contains(cell)) + presses.add(cell); + } + + private void triggerPresses(){ + for (int cell : presses) + Dungeon.level.press(cell, null, true); + + presses = new ArrayList<>(); + } + + @Override + public boolean attachTo(Char target) { + if (Dungeon.level != null) + for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])) + mob.sprite.add(CharSprite.State.PARALYSED); + GameScene.freezeEmitters = true; + return super.attachTo(target); + } + + @Override + public void detach(){ + for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])) + if (mob.paralysed <= 0) mob.sprite.remove(CharSprite.State.PARALYSED); + GameScene.freezeEmitters = false; + + super.detach(); + triggerPresses(); + target.next(); + } + + private static final String PRESSES = "presses"; private static final String LEFT = "left"; @Override public void storeInBundle(Bundle bundle) { super.storeInBundle(bundle); - bundle.put( POS, pos ); - bundle.put( LEFT, left ); + + int[] values = new int[presses.size()]; + for (int i = 0; i < values.length; i ++) + values[i] = presses.get(i); + bundle.put( PRESSES , values ); + + bundle.put( LEFT, left); } @Override public void restoreFromBundle(Bundle bundle) { super.restoreFromBundle(bundle); - pos = bundle.getInt( POS ); - left = bundle.getInt( LEFT ); + + int[] values = bundle.getIntArray( PRESSES ); + for (int value : values) + presses.add(value); + + left = bundle.getFloat(LEFT); } + } } diff --git a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/plants/plants.properties b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/plants/plants.properties index 2933062ee..b4118c50f 100644 --- a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/plants/plants.properties +++ b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/plants/plants.properties @@ -60,4 +60,4 @@ plants.swiftthistle.name=Swiftthistle plants.swiftthistle.desc=When trampled, swiftthistle will briefly accelerate the flow of time around it, allowing the trampler to perform several actions instantly. plants.swiftthistle$seed.name=seed of swiftthistle plants.swiftthistle$timebubble.name=Time Bubble -plants.swiftthistle$timebubble.desc=You are in a small bubble of accelerated time, allowing you to perform actions instantly. Attacking, moving, or using magic will break this effect however.\n\nTurns remaining: %s. +plants.swiftthistle$timebubble.desc=You are in a small bubble of accelerated time, allowing you to perform actions instantly. Attacking or using magic will break this effect however.\n\nTurns remaining: %s.