diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java index 4f0b91ac8..10e03a852 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java @@ -80,7 +80,6 @@ public class ShatteredPixelDungeon extends Game { "com.shatteredpixel.shatteredpixeldungeon.items.food.OverpricedRation" ); //v0.6.2 - //rooms com.watabou.utils.Bundle.addAlias( com.shatteredpixel.shatteredpixeldungeon.levels.rooms.secret.RatKingRoom.class, "com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.RatKingRoom" ); @@ -91,7 +90,6 @@ public class ShatteredPixelDungeon extends Game { com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.GardenRoom.class, "com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.FoliageRoom" ); - //traps com.watabou.utils.Bundle.addAlias( com.shatteredpixel.shatteredpixeldungeon.levels.traps.WornDartTrap.class, "com.shatteredpixel.shatteredpixeldungeon.levels.traps.WornTrap" ); @@ -111,6 +109,10 @@ public class ShatteredPixelDungeon extends Game { com.shatteredpixel.shatteredpixeldungeon.levels.traps.BurningTrap.class, "com.shatteredpixel.shatteredpixeldungeon.levels.traps.FireTrap" ); + com.watabou.utils.Bundle.addAlias( + com.shatteredpixel.shatteredpixeldungeon.actors.buffs.BlobImmunity.class, + "com.shatteredpixel.shatteredpixeldungeon.actors.buffs.GasesImmunity" ); + com.watabou.utils.Bundle.exceptionReporter = new com.watabou.utils.Bundle.BundleExceptionCallback() { @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Electricity.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Electricity.java index d7d0e9eac..9c4e1fa52 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Electricity.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Electricity.java @@ -63,7 +63,7 @@ public class Electricity extends Blob { cell = i + j*Dungeon.level.width(); if (cur[cell] > 0) { Char ch = Actor.findChar( cell ); - if (ch != null) { + if (ch != null && !ch.immunities().contains(this.getClass())) { Buff.prolong( ch, Paralysis.class, 1f); if (cur[cell] % 2 == 1) { ch.damage(Math.round(Random.Float(2 + Dungeon.depth / 5f)), this); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Fire.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Fire.java index 06a4dd04e..33c4ca84b 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Fire.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Fire.java @@ -98,7 +98,7 @@ public class Fire extends Blob { private void burn( int pos ) { Char ch = Actor.findChar( pos ); - if (ch != null) { + if (ch != null && !ch.immunities().contains(this.getClass())) { Buff.affect( ch, Burning.class ).reignite( ch ); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Freezing.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Freezing.java index 853d297b3..ab5a83b06 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Freezing.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Freezing.java @@ -56,7 +56,7 @@ public class Freezing extends Blob { } Char ch = Actor.findChar( cell ); - if (ch != null) { + if (ch != null && !ch.immunities().contains(this.getClass())) { if (ch.buff(Frost.class) != null){ Buff.affect(ch, Frost.class, 2f); } else { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Regrowth.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Regrowth.java index 0df79d904..f5dddeec3 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Regrowth.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Regrowth.java @@ -59,7 +59,9 @@ public class Regrowth extends Blob { } Char ch = Actor.findChar( cell ); - if (ch != null && off[cell] > 1) { + if (ch != null + && !ch.immunities().contains(this.getClass()) + && off[cell] > 1) { Buff.prolong( ch, Roots.class, TICK ); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Web.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Web.java index ed7784b8f..3037da2f1 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Web.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Web.java @@ -47,7 +47,7 @@ public class Web extends Blob { volume += off[cell]; Char ch = Actor.findChar( cell ); - if (ch != null) { + if (ch != null && !ch.immunities().contains(this.getClass())) { Buff.prolong( ch, Roots.class, TICK ); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/GasesImmunity.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/BlobImmunity.java similarity index 77% rename from core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/GasesImmunity.java rename to core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/BlobImmunity.java index 074c75e20..cf2c851c0 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/GasesImmunity.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/BlobImmunity.java @@ -22,15 +22,20 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.buffs; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ConfusionGas; +import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Electricity; +import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire; +import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Freezing; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ParalyticGas; +import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Regrowth; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.StenchGas; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ToxicGas; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.VenomGas; +import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Web; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; import com.watabou.noosa.Image; -public class GasesImmunity extends FlavourBuff { +public class BlobImmunity extends FlavourBuff { public static final float DURATION = 20f; @@ -55,6 +60,11 @@ public class GasesImmunity extends FlavourBuff { immunities.add( ConfusionGas.class ); immunities.add( StenchGas.class ); immunities.add( VenomGas.class ); + immunities.add( Fire.class ); + immunities.add( Freezing.class ); + immunities.add( Electricity.class ); + immunities.add( Regrowth.class ); + immunities.add( Web.class ); } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfFrost.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfFrost.java index 629d5a167..87e326ad6 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfFrost.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfFrost.java @@ -23,15 +23,13 @@ package com.shatteredpixel.shatteredpixeldungeon.items.potions; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; -import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire; +import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Freezing; -import com.shatteredpixel.shatteredpixeldungeon.utils.BArray; +import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.watabou.noosa.audio.Sample; import com.watabou.utils.PathFinder; public class PotionOfFrost extends Potion { - - private static final int DISTANCE = 2; { initials = 1; @@ -40,23 +38,21 @@ public class PotionOfFrost extends Potion { @Override public void shatter( int cell ) { - PathFinder.buildDistanceMap( cell, BArray.not( Dungeon.level.losBlocking, null ), DISTANCE ); - - Fire fire = (Fire)Dungeon.level.blobs.get( Fire.class ); - - boolean visible = false; - for (int i=0; i < Dungeon.level.length(); i++) { - if (PathFinder.distance[i] < Integer.MAX_VALUE) { - visible = Freezing.affect( i, fire ) || visible; - } - } - - if (visible) { + if (Dungeon.level.heroFOV[cell]) { + setKnown(); + splash( cell ); Sample.INSTANCE.play( Assets.SND_SHATTER ); - - setKnown(); } + + for (int offset : PathFinder.NEIGHBOURS9){ + if (!Dungeon.level.solid[cell+offset]) { + + GameScene.add(Blob.seed(cell + offset, 10, Freezing.class)); + + } + } + } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfLiquidFlame.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfLiquidFlame.java index 808d4c8cc..62784ffdb 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfLiquidFlame.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfLiquidFlame.java @@ -23,11 +23,8 @@ package com.shatteredpixel.shatteredpixeldungeon.items.potions; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; -import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire; -import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter; -import com.shatteredpixel.shatteredpixeldungeon.effects.particles.FlameParticle; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.watabou.noosa.audio.Sample; import com.watabou.utils.PathFinder; @@ -49,16 +46,10 @@ public class PotionOfLiquidFlame extends Potion { } for (int offset : PathFinder.NEIGHBOURS9){ - if (Dungeon.level.flamable[cell+offset] - || Actor.findChar(cell+offset) != null - || Dungeon.level.heaps.get(cell+offset) != null) { + if (!Dungeon.level.solid[cell+offset]) { GameScene.add(Blob.seed(cell + offset, 2, Fire.class)); - } else { - - CellEmitter.get(cell+offset).burst(FlameParticle.FACTORY, 2); - } } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfPurity.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfPurity.java index c0e71e35d..21182b76d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfPurity.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfPurity.java @@ -24,13 +24,8 @@ package com.shatteredpixel.shatteredpixeldungeon.items.potions; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob; -import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ConfusionGas; -import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ParalyticGas; -import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.StenchGas; -import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ToxicGas; -import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.VenomGas; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.BlobImmunity; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; -import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.GasesImmunity; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; @@ -40,86 +35,71 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.watabou.noosa.audio.Sample; import com.watabou.utils.PathFinder; +import java.util.ArrayList; + public class PotionOfPurity extends Potion { - private static final int DISTANCE = 5; + private static final int DISTANCE = 3; + + private static ArrayList affectedBlobs; { initials = 9; + + affectedBlobs = new ArrayList<>(new BlobImmunity().immunities()); } @Override public void shatter( int cell ) { - PathFinder.buildDistanceMap( cell, BArray.not( Dungeon.level.losBlocking, null ), DISTANCE ); + PathFinder.buildDistanceMap( cell, BArray.not( Dungeon.level.solid, null ), DISTANCE ); - boolean procd = false; - - Blob[] blobs = { - Dungeon.level.blobs.get( ToxicGas.class ), - Dungeon.level.blobs.get( ParalyticGas.class ), - Dungeon.level.blobs.get( ConfusionGas.class ), - Dungeon.level.blobs.get( StenchGas.class ), - Dungeon.level.blobs.get( VenomGas.class ) - }; - - for (int j=0; j < blobs.length; j++) { - - Blob blob = blobs[j]; - if (blob == null || blob.volume == 0) { - continue; + ArrayList blobs = new ArrayList<>(); + for (Class c : affectedBlobs){ + Blob b = Dungeon.level.blobs.get(c); + if (b != null && b.volume > 0){ + blobs.add(b); } - - for (int i=0; i < Dungeon.level.length(); i++) { - if (PathFinder.distance[i] < Integer.MAX_VALUE) { + } + + for (int i=0; i < Dungeon.level.length(); i++) { + if (PathFinder.distance[i] < Integer.MAX_VALUE) { + + for (Blob blob : blobs) { int value = blob.cur[i]; if (value > 0) { + blob.clear(i); blob.cur[i] = 0; blob.volume -= value; - procd = true; - - if (Dungeon.level.heroFOV[i]) { - CellEmitter.get( i ).burst( Speck.factory( Speck.DISCOVER ), 1 ); - } + } - + } + + if (Dungeon.level.heroFOV[i]) { + CellEmitter.get( i ).burst( Speck.factory( Speck.DISCOVER ), 2 ); + } + } } - boolean heroAffected = PathFinder.distance[Dungeon.hero.pos] < Integer.MAX_VALUE; - if (procd) { - - if (Dungeon.level.heroFOV[cell]) { - splash( cell ); - Sample.INSTANCE.play( Assets.SND_SHATTER ); - } - + if (Dungeon.level.heroFOV[cell]) { + splash(cell); + Sample.INSTANCE.play(Assets.SND_SHATTER); + setKnown(); - - if (heroAffected) { - GLog.p( Messages.get(this, "freshness") ); - } - - } else { - - super.shatter( cell ); - - if (heroAffected) { - GLog.i( Messages.get(this, "freshness") ); - setKnown(); - } - + GLog.i(Messages.get(this, "freshness")); } + } @Override public void apply( Hero hero ) { - GLog.w( Messages.get(this, "no_smell") ); - Buff.prolong( hero, GasesImmunity.class, GasesImmunity.DURATION ); + GLog.w( Messages.get(this, "protected") ); + Buff.prolong( hero, BlobImmunity.class, BlobImmunity.DURATION ); setKnown(); } 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 736125fd0..1163a39f8 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 @@ -121,8 +121,8 @@ actors.buffs.fury.name=Furious actors.buffs.fury.heromsg=You become furious! actors.buffs.fury.desc=You are angry, enemies won't like you when you're angry.\n\nA great rage burns within you, increasing the damage you deal with physical attacks by 50%%.\n\nThis rage will last as long as you are injured below 50%% health. -actors.buffs.gasesimmunity.name=Immune to gases -actors.buffs.gasesimmunity.desc=Some strange force is filtering out the air around you, it's not causing you any harm, but it blocks out everything but air so effectively you can't even smell anything!\n\nYou are immune to the effects of all gasses while this buff lasts.\n\nTurns of gas immunity remaining: %s. +actors.buffs.blobimmunity.name=Purification Barrier +actors.buffs.blobimmunity.desc=Some strange force is encasing you in a thin protective barrier, blocking out all harmful airborne effects.\n\nYou are immune to all area-bound effects while this barrier lasts.\n\nTurns of immunity remaining: %s. actors.buffs.healing.value=%+dHP 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 3e84f69cd..d8f2ab5c3 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 @@ -438,7 +438,7 @@ items.potions.potionofexperience.name=potion of experience items.potions.potionofexperience.desc=The storied experiences of multitudes of battles reduced to liquid form, this draught will instantly raise your experience level. items.potions.potionoffrost.name=potion of frost -items.potions.potionoffrost.desc=Upon exposure to open air this chemical will evaporate into a freezing cloud, causing any creature that contacts it to be frozen in place unable to act and move. The freezing effect is much stronger if the environment is wet. +items.potions.potionoffrost.desc=The chemical contained in this potion will evaporate into a freezing cloud upon exposure to open air. items.potions.potionofhealing.name=potion of healing items.potions.potionofhealing.heal=Your wounds begin to close. @@ -470,8 +470,8 @@ items.potions.potionofparalyticgas.desc=Upon exposure to open air, the liquid in items.potions.potionofpurity.name=potion of purification items.potions.potionofpurity.freshness=You feel uncommon freshness in the air. -items.potions.potionofpurity.no_smell=You've stopped sensing any smells! -items.potions.potionofpurity.desc=This reagent will quickly neutralize all harmful gases in the area of effect. Drinking it will give you a temporary immunity to such gases. +items.potions.potionofpurity.protected=A protective film envelops you! +items.potions.potionofpurity.desc=This magical reagent will quickly neutralize all harmful effects in a large area. Drinking it will give you temporary immunity to such effects. items.potions.potionofstrength.name=potion of strength items.potions.potionofstrength.msg_1=+1 str