From 415341bf57f7f25e4cf7e1df3e0cd5b00a576eaa Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Fri, 17 Sep 2021 21:56:17 -0400 Subject: [PATCH] v1.1.0: implemented simple buffs to exotic potions: - corrosive gas damage and AOE up - shrouding fog AOE up, and now only vision-blocks enemies - magical sight AOE up to 12 from 8 - storm clouds AOE size up to 3x3 from 1x1 --- .../assets/messages/actors/actors.properties | 2 +- .../assets/messages/items/items.properties | 8 ++--- .../shatteredpixeldungeon/Dungeon.java | 6 ++++ .../actors/blobs/SmokeScreen.java | 33 +---------------- .../actors/buffs/MagicalSight.java | 2 +- .../potions/exotic/PotionOfCorrosiveGas.java | 14 ++++++-- .../potions/exotic/PotionOfShroudingFog.java | 14 ++++++-- .../potions/exotic/PotionOfStormClouds.java | 12 ++++++- .../shatteredpixeldungeon/levels/Level.java | 36 ++++++++++--------- 9 files changed, 68 insertions(+), 59 deletions(-) diff --git a/core/src/main/assets/messages/actors/actors.properties b/core/src/main/assets/messages/actors/actors.properties index 446454e80..e6bd3c9eb 100644 --- a/core/src/main/assets/messages/actors/actors.properties +++ b/core/src/main/assets/messages/actors/actors.properties @@ -218,7 +218,7 @@ actors.buffs.lostinventory.name=Lost Inventory actors.buffs.lostinventory.desc=Your inventory has been lost somewhere in the dungeon! You won't be able to pick up or use most items until you retrieve it. actors.buffs.magicalsight.name=Magical Sight -actors.buffs.magicalsight.desc=Somehow you are able to see with your mind, rather than your eyes.\n\nAll terrain or effects which reduce or block vision are broken while magical sight is active.\n\nTurns of magical sight remaining: %s. +actors.buffs.magicalsight.desc=Somehow you are able to see with your mind, rather than your eyes.\n\nAll terrain or effects which reduce or block vision are broken while magical sight is active, and your vision range is increased by 50%.\n\nTurns of magical sight remaining: %s. actors.buffs.magicalsleep.name=Magical Sleep actors.buffs.magicalsleep.toohealthy=You are too healthy, and resist the urge to sleep. diff --git a/core/src/main/assets/messages/items/items.properties b/core/src/main/assets/messages/items/items.properties index cc9d04b38..c8d35e6c7 100644 --- a/core/src/main/assets/messages/items/items.properties +++ b/core/src/main/assets/messages/items/items.properties @@ -723,7 +723,7 @@ items.potions.exotic.potionofcleansing.name=potion of cleansing items.potions.exotic.potionofcleansing.desc=This powerful reagent will completely neutralize all harmful effects on the drinker when quaffed. It can be thrown at a target to cleanse them as well. items.potions.exotic.potionofcorrosivegas.name=potion of corrosive gas -items.potions.exotic.potionofcorrosivegas.desc=Uncorking or shattering this pressurized glass will cause its contents to explode into a deadly cloud of corrosive rust-colored gas. The gas is less concentrated however, and will not last for very long. +items.potions.exotic.potionofcorrosivegas.desc=Uncorking or shattering this pressurized glass will cause its contents to explode into a deadly cloud of corrosive rust-colored gas. The gas spreads more quickly than toxic gas and is more deadly, but also won't last as long. items.potions.exotic.potionofdragonsbreath.name=potion of dragon's breath items.potions.exotic.potionofdragonsbreath.prompt=Choose a location to burn @@ -736,13 +736,13 @@ 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.potionofmagicalsight.name=potion of magical sight -items.potions.exotic.potionofmagicalsight.desc=After drinking this, your senses will be briefly heightened to incredible levels, allowing you to see through walls! +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.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. items.potions.exotic.potionofshroudingfog.name=potion of shrouding fog -items.potions.exotic.potionofshroudingfog.desc=When exposed to air, the liquid in this flask will produce a thick smoky fog which completely blocks vision. +items.potions.exotic.potionofshroudingfog.desc=When exposed to air, the liquid in this flask will produce a thick smoky fog which quickly spreads and blocks the vision of your enemies. items.potions.exotic.potionofsnapfreeze.name=potion of snap freeze items.potions.exotic.potionofsnapfreeze.desc=The chemical contained in this potion will rapidly react with the air, instantly freezing and rooting all within its effect. @@ -751,7 +751,7 @@ items.potions.exotic.potionofstamina.name=potion of stamina items.potions.exotic.potionofstamina.desc=Drinking this oddly sweet liquid will imbue you with a long-lasting boost of energy, allowing you to run at a quickened pace for an extended period of time. items.potions.exotic.potionofstormclouds.name=potion of storm clouds -items.potions.exotic.potionofstormclouds.desc=Throwing this potion will create a cloud of concentrated vapor, which will condense and pour down onto the environment. Most terrain will be converted to water, and traps will be overwhelmed and break. +items.potions.exotic.potionofstormclouds.desc=Throwing this potion will create a quickly-spreading cloud of concentrated vapor, which will condense and pour down onto the environment. Most terrain will be converted to water, and traps will be overwhelmed and break. diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java index 3c90dd916..5eeb6a99f 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java @@ -26,6 +26,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Amok; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Awareness; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Light; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicalSight; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MindVision; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.RevealedArea; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; @@ -692,6 +693,11 @@ public class Dungeon { public static void observe(){ int dist = 8; dist *= 1f + 0.25f*Dungeon.hero.pointsInTalent(Talent.FARSIGHT); + + if (Dungeon.hero.buff(MagicalSight.class) != null){ + dist = Math.max( dist, MagicalSight.DISTANCE ); + } + observe( dist+1 ); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/SmokeScreen.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/SmokeScreen.java index f1d08cd4a..505e3def8 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/SmokeScreen.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/SmokeScreen.java @@ -21,49 +21,18 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.blobs; -import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.effects.BlobEmitter; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; -import com.shatteredpixel.shatteredpixeldungeon.levels.Level; -import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; public class SmokeScreen extends Blob { - @Override - protected void evolve() { - super.evolve(); - - int cell; - - Level l = Dungeon.level; - for (int i = area.left; i < area.right; i++){ - for (int j = area.top; j < area.bottom; j++){ - cell = i + j*l.width(); - l.losBlocking[cell] = off[cell] > 0 || (Terrain.flags[l.map[cell]] & Terrain.LOS_BLOCKING) != 0; - } - } - } - @Override public void use( BlobEmitter emitter ) { super.use( emitter ); emitter.pour( Speck.factory( Speck.SMOKE ), 0.1f ); } - - @Override - public void clear(int cell) { - super.clear(cell); - Level l = Dungeon.level; - l.losBlocking[cell] = cur[cell] > 0 || (Terrain.flags[l.map[cell]] & Terrain.LOS_BLOCKING) != 0; - } - - @Override - public void fullyClear() { - super.fullyClear(); - Dungeon.level.buildFlagMaps(); - } - + @Override public String tileDesc() { return Messages.get(this, "desc"); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/MagicalSight.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/MagicalSight.java index 1ed2eff49..88629cf2b 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/MagicalSight.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/MagicalSight.java @@ -31,7 +31,7 @@ public class MagicalSight extends FlavourBuff { public static final float DURATION = 50f; - public int distance = 8; + public static final int DISTANCE = 12; { type = buffType.POSITIVE; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfCorrosiveGas.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfCorrosiveGas.java index 801f306b6..05c0d05df 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfCorrosiveGas.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfCorrosiveGas.java @@ -28,6 +28,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.CorrosiveGas; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.watabou.noosa.audio.Sample; +import com.watabou.utils.PathFinder; public class PotionOfCorrosiveGas extends ExoticPotion { @@ -45,7 +46,16 @@ public class PotionOfCorrosiveGas extends ExoticPotion { Sample.INSTANCE.play( Assets.Sounds.SHATTER ); Sample.INSTANCE.play( Assets.Sounds.GAS ); } - - GameScene.add( Blob.seed( cell, 200, CorrosiveGas.class ).setStrength( 1 + Dungeon.depth/5)); + + int centerVolume = 25; + for (int i : PathFinder.NEIGHBOURS8){ + if (!Dungeon.level.solid[cell+i]){ + GameScene.add( Blob.seed( cell+i, 25, CorrosiveGas.class ).setStrength( 2 + Dungeon.depth/5)); + } else { + centerVolume += 25; + } + } + + GameScene.add( Blob.seed( cell, centerVolume, CorrosiveGas.class ).setStrength( 2 + Dungeon.depth/5)); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfShroudingFog.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfShroudingFog.java index b8c51b585..53b5c71f7 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfShroudingFog.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfShroudingFog.java @@ -28,6 +28,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.SmokeScreen; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.watabou.noosa.audio.Sample; +import com.watabou.utils.PathFinder; public class PotionOfShroudingFog extends ExoticPotion { @@ -45,8 +46,17 @@ public class PotionOfShroudingFog extends ExoticPotion { Sample.INSTANCE.play( Assets.Sounds.SHATTER ); Sample.INSTANCE.play( Assets.Sounds.GAS ); } - - GameScene.add( Blob.seed( cell, 1000, SmokeScreen.class ) ); + + int centerVolume = 120; + for (int i : PathFinder.NEIGHBOURS8){ + if (!Dungeon.level.solid[cell+i]){ + GameScene.add( Blob.seed( cell+i, 120, SmokeScreen.class ) ); + } else { + centerVolume += 120; + } + } + + GameScene.add( Blob.seed( cell, centerVolume, SmokeScreen.class ) ); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfStormClouds.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfStormClouds.java index 3dc423a25..c22cfc039 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfStormClouds.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfStormClouds.java @@ -28,6 +28,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.StormCloud; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.watabou.noosa.audio.Sample; +import com.watabou.utils.PathFinder; public class PotionOfStormClouds extends ExoticPotion { @@ -45,7 +46,16 @@ public class PotionOfStormClouds extends ExoticPotion { Sample.INSTANCE.play( Assets.Sounds.SHATTER ); Sample.INSTANCE.play( Assets.Sounds.GAS ); } + + int centerVolume = 120; + for (int i : PathFinder.NEIGHBOURS8){ + if (!Dungeon.level.solid[cell+i]){ + GameScene.add( Blob.seed( cell+i, 120, StormCloud.class ) ); + } else { + centerVolume += 120; + } + } - GameScene.add( Blob.seed( cell, 1000, StormCloud.class ) ); + GameScene.add( Blob.seed( cell, centerVolume, StormCloud.class ) ); } } 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 24f143f73..c2cfd616c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java @@ -46,7 +46,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.huntress.SpiritHawk; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Bestiary; -import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mimic; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.YogFist; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Sheep; @@ -639,13 +638,6 @@ public abstract class Level implements Bundlable { water[i] = (flags & Terrain.LIQUID) != 0; pit[i] = (flags & Terrain.PIT) != 0; } - - SmokeScreen s = (SmokeScreen)blobs.get(SmokeScreen.class); - if (s != null && s.volume > 0){ - for (int i=0; i < length(); i++) { - losBlocking[i] = losBlocking[i] || s.cur[i] > 0; - } - } Web w = (Web) blobs.get(Web.class); if (w != null && w.volume > 0){ @@ -744,11 +736,6 @@ public abstract class Level implements Bundlable { level.pit[cell] = (flags & Terrain.PIT) != 0; level.water[cell] = terrain == Terrain.WATER; - SmokeScreen s = (SmokeScreen)level.blobs.get(SmokeScreen.class); - if (s != null && s.volume > 0){ - level.losBlocking[cell] = level.losBlocking[cell] || s.cur[cell] > 0; - } - for (int i : PathFinder.NEIGHBOURS9){ i = cell + i; if (level.solid[i]){ @@ -1051,6 +1038,8 @@ public abstract class Level implements Bundlable { private static boolean[] heroMindFov; + private static boolean[] modifiableBlocking; + public void updateFieldOfView( Char c, boolean[] fieldOfView ) { int cx = c.pos % width(); @@ -1060,15 +1049,31 @@ public abstract class Level implements Bundlable { && c.buff( TimekeepersHourglass.timeStasis.class ) == null && c.isAlive(); if (sighted) { boolean[] blocking; + + if (modifiableBlocking == null || modifiableBlocking.length != Dungeon.level.losBlocking.length){ + modifiableBlocking = new boolean[Dungeon.level.losBlocking.length]; + } if ((c instanceof Hero && ((Hero) c).subClass == HeroSubClass.WARDEN) || c instanceof YogFist.SoiledFist) { - blocking = Dungeon.level.losBlocking.clone(); + System.arraycopy(Dungeon.level.losBlocking, 0, modifiableBlocking, 0, modifiableBlocking.length); + blocking = modifiableBlocking; for (int i = 0; i < blocking.length; i++){ if (blocking[i] && (Dungeon.level.map[i] == Terrain.HIGH_GRASS || Dungeon.level.map[i] == Terrain.FURROWED_GRASS)){ blocking[i] = false; } } + } else if (c.alignment == Char.Alignment.ENEMY + && Dungeon.level.blobs.containsKey(SmokeScreen.class) + && Dungeon.level.blobs.get(SmokeScreen.class).volume > 0) { + System.arraycopy(Dungeon.level.losBlocking, 0, modifiableBlocking, 0, modifiableBlocking.length); + blocking = modifiableBlocking; + Blob s = Dungeon.level.blobs.get(SmokeScreen.class); + for (int i = 0; i < blocking.length; i++){ + if (!blocking[i] && s.cur[i] > 0){ + blocking[i] = true; + } + } } else { blocking = Dungeon.level.losBlocking; } @@ -1090,8 +1095,7 @@ public abstract class Level implements Bundlable { sense = Math.max( ((MindVision)b).distance, sense ); } if (c.buff(MagicalSight.class) != null){ - sense = 8; - sense *= 1f + 0.25f*((Hero) c).pointsInTalent(Talent.FARSIGHT); + sense = Math.max( MagicalSight.DISTANCE, sense ); } }