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 new file mode 100644 index 000000000..7ce53bf37 --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/SmokeScreen.java @@ -0,0 +1,72 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2018 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.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 ); + //TODO finalize VFX + emitter.pour( Speck.factory( Speck.SMOKE ), 0.1f ); + } + + @Override + public void clear(int cell) { + super.clear(cell); + //TODO + } + + @Override + public void fullyClear() { + super.fullyClear(); + //TODO + } + + @Override + public String tileDesc() { + return Messages.get(this, "desc"); + } + +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/StormCloud.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/StormCloud.java new file mode 100644 index 000000000..eca3b28f7 --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/StormCloud.java @@ -0,0 +1,72 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2018 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.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; +import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; + +public class StormCloud extends Blob { + + @Override + protected void evolve() { + super.evolve(); + + int cell; + + for (int i = area.left; i < area.right; i++){ + for (int j = area.top; j < area.bottom; j++){ + cell = i + j*Dungeon.level.width(); + if (off[cell] > 0) { + int terr = Dungeon.level.map[cell]; + if (terr == Terrain.EMPTY || terr == Terrain.GRASS || + terr == Terrain.EMBERS || terr == Terrain.EMPTY_SP || + terr == Terrain.HIGH_GRASS || terr == Terrain.EMPTY_DECO) { + Level.set(cell, Terrain.WATER); + GameScene.updateMap(cell); + } else if (terr == Terrain.SECRET_TRAP || terr == Terrain.TRAP || terr == Terrain.INACTIVE_TRAP) { + Level.set(cell, Terrain.WATER); + Dungeon.level.traps.remove(cell); + GameScene.updateMap(cell); + } + } + } + } + } + + @Override + public void use( BlobEmitter emitter ) { + super.use( emitter ); + //TODO finalize VFX + emitter.pour( Speck.factory( Speck.CONFUSION ), 0.4f ); + } + + @Override + public String tileDesc() { + return Messages.get(this, "desc"); + } + +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Barkskin.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Barkskin.java index 443d66092..f6408c4cd 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Barkskin.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Barkskin.java @@ -23,16 +23,18 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.buffs; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; +import com.watabou.utils.Bundle; public class Barkskin extends Buff { private int level = 0; + private int interval = 1; @Override public boolean act() { if (target.isAlive()) { - spend( TICK ); + spend( interval ); if (--level <= 0) { detach(); } @@ -50,9 +52,12 @@ public class Barkskin extends Buff { return level; } - public void level( int value ) { - if (level < value) { + public void set( int value, int time ) { + //decide whether to override, preferring high value + low interval + if (Math.sqrt(interval)*level < Math.sqrt(time)*value) { level = value; + interval = time; + spend(cooldown() - time); } } @@ -67,7 +72,25 @@ public class Barkskin extends Buff { } @Override + //TODO public String desc() { return Messages.get(this, "desc", level); } + + private static final String LEVEL = "level"; + private static final String INTERVAL = "interval"; + + @Override + public void storeInBundle( Bundle bundle ) { + super.storeInBundle( bundle ); + bundle.put( INTERVAL, interval ); + bundle.put( LEVEL, level ); + } + + @Override + public void restoreFromBundle( Bundle bundle ) { + super.restoreFromBundle( bundle ); + interval = bundle.getInt( INTERVAL ); + level = bundle.getInt( LEVEL ); + } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/Speck.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/Speck.java index 6ccdaae72..4b1c7f80c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/Speck.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/Speck.java @@ -66,6 +66,7 @@ public class Speck extends Image { public static final int CONFUSION = 113; public static final int RED_LIGHT = 114; public static final int CALM = 115; + public static final int SMOKE = 116; private static final int SIZE = 7; @@ -113,6 +114,7 @@ public class Speck extends Image { case STENCH: case CONFUSION: case DUST: + case SMOKE: frame( film.get( STEAM ) ); break; case CALM: @@ -313,6 +315,13 @@ public class Speck extends Image { angle = Random.Float( 360 ); lifespan = Random.Float( 1f, 3f ); break; + + case SMOKE: + hardlight( 0x000000 ); + angularSpeed = 30; + angle = Random.Float( 360 ); + lifespan = Random.Float( 1f, 1.5f ); + break; case DUST: hardlight( 0xFFFF66 ); @@ -432,6 +441,7 @@ public class Speck extends Image { case CORROSION: hardlight( ColorMath.interpolate( 0xAAAAAA, 0xFF8800 , p )); case STENCH: + case SMOKE: am = (float)Math.sqrt( (p < 0.5f ? p : 1 - p) ); scale.set( 1 + p ); break; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/food/FrozenCarpaccio.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/food/FrozenCarpaccio.java index 4503e5919..d8cfa51ad 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/food/FrozenCarpaccio.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/food/FrozenCarpaccio.java @@ -68,7 +68,7 @@ public class FrozenCarpaccio extends Food { break; case 1: GLog.i( Messages.get(FrozenCarpaccio.class, "hard") ); - Buff.affect( hero, Barkskin.class ).level( hero.HT / 4 ); + Buff.affect( hero, Barkskin.class ).set( hero.HT / 4, 1 ); break; case 2: GLog.i( Messages.get(FrozenCarpaccio.class, "refresh") ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java index 37935f664..10a4c9a0c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java @@ -42,7 +42,9 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Recipe; import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag; import com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic.ExoticPotion; import com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic.PotionOfCorrosiveGas; +import com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic.PotionOfShroudingFog; import com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic.PotionOfSnapFreeze; +import com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic.PotionOfStormClouds; import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; @@ -127,6 +129,8 @@ public class Potion extends Item { //exotic mustThrowPots.add(PotionOfCorrosiveGas.class); mustThrowPots.add(PotionOfSnapFreeze.class); + mustThrowPots.add(PotionOfShroudingFog.class); + mustThrowPots.add(PotionOfStormClouds.class); } private static final HashSet> canThrowPots = new HashSet<>(); 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 4977e5003..64246ef5a 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 @@ -26,10 +26,16 @@ import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.Recipe; import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion; +import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfExperience; import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfFrost; import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHaste; import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing; +import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfInvisibility; +import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfLevitation; import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfLiquidFlame; +import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfMindVision; +import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfParalyticGas; +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; @@ -63,6 +69,24 @@ public class ExoticPotion extends Potion { regToExo.put(PotionOfLiquidFlame.class, PotionOfDragonsBreath.class); exoToReg.put(PotionOfDragonsBreath.class, PotionOfLiquidFlame.class); + + regToExo.put(PotionOfInvisibility.class, PotionOfShroudingFog.class); + exoToReg.put(PotionOfShroudingFog.class, PotionOfInvisibility.class); + + regToExo.put(PotionOfMindVision.class, PotionOfMagicalSight.class); + exoToReg.put(PotionOfMagicalSight.class, PotionOfMindVision.class); + + regToExo.put(PotionOfLevitation.class, PotionOfStormClouds.class); + exoToReg.put(PotionOfStormClouds.class, PotionOfLevitation.class); + + regToExo.put(PotionOfExperience.class, PotionOfHolyFuror.class); + exoToReg.put(PotionOfHolyFuror.class, PotionOfExperience.class); + + regToExo.put(PotionOfPurity.class, PotionOfCleansing.class); + exoToReg.put(PotionOfCleansing.class, PotionOfPurity.class); + + regToExo.put(PotionOfParalyticGas.class, PotionOfEarthenArmor.class); + exoToReg.put(PotionOfEarthenArmor.class, PotionOfParalyticGas.class); } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfCleansing.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfCleansing.java new file mode 100644 index 000000000..24e4ac102 --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfCleansing.java @@ -0,0 +1,35 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2018 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.hero.Hero; + +public class PotionOfCleansing extends ExoticPotion { + + @Override + public void apply( Hero hero ) { + setKnown(); + //TODO detach all debuffs, and satifsy hunger + //perhaps heal a little too? + } + +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfEarthenArmor.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfEarthenArmor.java new file mode 100644 index 000000000..448f45566 --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfEarthenArmor.java @@ -0,0 +1,37 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2018 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.Barkskin; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; + +public class PotionOfEarthenArmor extends ExoticPotion { + + @Override + public void apply( Hero hero ) { + setKnown(); + + Buff.affect(hero, Barkskin.class).set( 2 + hero.lvl/3, 50 ); + } + +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfHolyFuror.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfHolyFuror.java new file mode 100644 index 000000000..fee5c6082 --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfHolyFuror.java @@ -0,0 +1,36 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2018 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.Bless; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; + +public class PotionOfHolyFuror extends ExoticPotion { + + @Override + public void apply( Hero hero ) { + setKnown(); + Buff.prolong(hero, Bless.class, 100f); + } + +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfMagicalSight.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfMagicalSight.java new file mode 100644 index 000000000..55de5ebd9 --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfMagicalSight.java @@ -0,0 +1,43 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2018 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.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FlavourBuff; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; + +public class PotionOfMagicalSight extends ExoticPotion { + + @Override + public void apply(Hero hero) { + setKnown(); + Buff.affect(hero, MagicalSight.class, 30f); + Dungeon.observe(); + + } + + public static class MagicalSight extends FlavourBuff { + + } + +} 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 new file mode 100644 index 000000000..b95227dd5 --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfShroudingFog.java @@ -0,0 +1,46 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2018 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.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob; +import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.SmokeScreen; +import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; +import com.watabou.noosa.audio.Sample; + +public class PotionOfShroudingFog extends ExoticPotion { + + @Override + public void shatter( int cell ) { + + if (Dungeon.level.heroFOV[cell]) { + setKnown(); + + splash( cell ); + Sample.INSTANCE.play( Assets.SND_SHATTER ); + } + + GameScene.add( Blob.seed( cell, 1000, 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 new file mode 100644 index 000000000..1a894b5fc --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfStormClouds.java @@ -0,0 +1,45 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2018 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.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob; +import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.StormCloud; +import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; +import com.watabou.noosa.audio.Sample; + +public class PotionOfStormClouds extends ExoticPotion { + + @Override + public void shatter(int cell) { + + if (Dungeon.level.heroFOV[cell]) { + setKnown(); + + splash( cell ); + Sample.INSTANCE.play( Assets.SND_SHATTER ); + } + + GameScene.add( Blob.seed( cell, 1000, 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 caa74799b..4bf111ec6 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java @@ -29,6 +29,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Statistics; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob; +import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.SmokeScreen; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.WellWater; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Awareness; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Blindness; @@ -50,6 +51,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass; import com.shatteredpixel.shatteredpixeldungeon.items.food.SmallRation; import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength; +import com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic.PotionOfMagicalSight; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade; import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfEnchantment; import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfIntuition; @@ -578,6 +580,13 @@ public abstract class Level implements Bundlable { 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; + } + } + int lastRow = length() - width(); for (int i=0; i < width(); i++) { passable[i] = avoid[i] = false; @@ -636,6 +645,11 @@ public abstract class Level implements Bundlable { level.avoid[cell] = (flags & Terrain.AVOID) != 0; 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; + } } public Heap drop( Item item, int cell ) { @@ -847,8 +861,12 @@ public abstract class Level implements Bundlable { for (Buff b : c.buffs( MindVision.class )) { sense = Math.max( ((MindVision)b).distance, sense ); } + if (c.buff(PotionOfMagicalSight.MagicalSight.class) != null){ + sense = 8; + } } + //TODO rounding if ((sighted && sense > 1) || !sighted) { int ax = Math.max( 0, cx - sense ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/HighGrass.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/HighGrass.java index 78715f1ca..6e0ad8b2e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/HighGrass.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/HighGrass.java @@ -89,7 +89,7 @@ public class HighGrass { // Barkskin if (hero.subClass == HeroSubClass.WARDEN) { - Buff.affect(ch, Barkskin.class).level(ch.HT / 3); + Buff.affect(ch, Barkskin.class).set(ch.HT / 3, 1); leaves += 4; } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Plant.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Plant.java index 9ddb1c58b..2c0e6bdb0 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Plant.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Plant.java @@ -61,7 +61,7 @@ public abstract class Plant implements Bundlable { if (ch instanceof Hero){ ((Hero) ch).interrupt(); if (((Hero)ch).subClass == HeroSubClass.WARDEN) { - Buff.affect(ch, Barkskin.class).level(ch.HT / 3); + Buff.affect(ch, Barkskin.class).set(ch.HT / 3, 1); } }