diff --git a/core/src/main/assets/items.png b/core/src/main/assets/items.png index f740fe2e9..1614f5cae 100644 Binary files a/core/src/main/assets/items.png and b/core/src/main/assets/items.png differ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java index ade385794..8e5e6b03f 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java @@ -109,7 +109,7 @@ public abstract class Char extends Actor { public int viewDistance = 8; - protected boolean[] fieldOfView = null; + public boolean[] fieldOfView = null; private HashSet buffs = new HashSet<>(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/Bomb.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/Bomb.java index 125388680..9d8073a57 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/Bomb.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/Bomb.java @@ -33,7 +33,14 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.particles.SmokeParticle; import com.shatteredpixel.shatteredpixeldungeon.items.Heap; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.Recipe; +import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfFrost; import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing; +import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfInvisibility; +import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfLiquidFlame; +import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMirrorImage; +import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRage; +import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging; +import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRemoveCurse; import com.shatteredpixel.shatteredpixeldungeon.items.stones.Runestone; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.plants.Plant; @@ -158,7 +165,7 @@ public class Bomb extends Item { } if (ch == Dungeon.hero && !ch.isAlive()) - Dungeon.fail( getClass() ); + Dungeon.fail( Bomb.class ); } } } @@ -249,6 +256,9 @@ public class Bomb extends Item { for (Heap heap : Dungeon.level.heaps.values()) { if (heap.items.contains(bomb)) { heap.items.remove(bomb); + if (heap.items.isEmpty()){ + heap.destroy(); + } bomb.explode(heap.pos); @@ -290,7 +300,14 @@ public class Bomb extends Item { private static final HashMap, Class> validIngredients = new HashMap<>(); static { - validIngredients.put(PotionOfHealing.class, HealingBomb.class); + validIngredients.put(PotionOfLiquidFlame.class, Firebomb.class); + validIngredients.put(PotionOfFrost.class, FrostBomb.class); + validIngredients.put(PotionOfHealing.class, HealingBomb.class); + validIngredients.put(PotionOfInvisibility.class, Flashbang.class); + validIngredients.put(ScrollOfRecharging.class, ShockBomb.class); + validIngredients.put(ScrollOfRemoveCurse.class, HolyBomb.class); + validIngredients.put(ScrollOfMirrorImage.class, WoollyBomb.class); + validIngredients.put(ScrollOfRage.class, Noisemaker.class); } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/Firebomb.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/Firebomb.java new file mode 100644 index 000000000..6aebfc64f --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/Firebomb.java @@ -0,0 +1,59 @@ +/* + * 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.bombs; + +import com.shatteredpixel.shatteredpixeldungeon.Assets; +import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +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.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; +import com.shatteredpixel.shatteredpixeldungeon.utils.BArray; +import com.watabou.noosa.audio.Sample; +import com.watabou.utils.PathFinder; + +public class Firebomb extends Bomb { + + { + //TODO visuals + image = ItemSpriteSheet.FIRE_BOMB; + } + + @Override + public void explode(int cell) { + super.explode(cell); + + PathFinder.buildDistanceMap( cell, BArray.not( Dungeon.level.solid, null ), 2 ); + for (int i = 0; i < PathFinder.distance.length; i++) { + if (PathFinder.distance[i] < Integer.MAX_VALUE) { + if (Dungeon.level.pit[i]) + GameScene.add(Blob.seed(i, 2, Fire.class)); + else + GameScene.add(Blob.seed(i, 10, Fire.class)); + CellEmitter.get(i).burst(FlameParticle.FACTORY, 5); + } + } + Sample.INSTANCE.play(Assets.SND_BURNING); + } +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/Flashbang.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/Flashbang.java new file mode 100644 index 000000000..7e89bb97a --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/Flashbang.java @@ -0,0 +1,74 @@ +/* + * 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.bombs; + +import com.shatteredpixel.shatteredpixeldungeon.Assets; +import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; +import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Blindness; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; +import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter; +import com.shatteredpixel.shatteredpixeldungeon.effects.particles.BlastParticle; +import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; +import com.watabou.noosa.audio.Sample; + +public class Flashbang extends Bomb { + + { + //TODO visuals + image = ItemSpriteSheet.FLASHBANG; + } + + @Override + public void explode(int cell) { + //We're blowing up, so no need for a fuse anymore. + this.fuse = null; + + Sample.INSTANCE.play( Assets.SND_BLAST ); + + if (Dungeon.level.heroFOV[cell]) { + CellEmitter.center( cell ).burst( BlastParticle.FACTORY, 30 ); + } + + //no regular explosion damage + + //FIXME currently has odd behaviour for the hero + //TODO final balancing for effect here, based on distance? perhaps also cripple/weaken? + for (Char ch : Actor.chars()){ + if (ch == Dungeon.hero){ + if (Dungeon.level.heroFOV[cell]){ + Buff.prolong(ch, Blindness.class, 5f); + GameScene.flash(0xFFFFFF); + } + } else if (ch.fieldOfView[cell]){ + Buff.prolong(ch, Blindness.class, 5f); + if (ch == Dungeon.hero){ + GameScene.flash(0xFFFFFF); + } + } + } + + + } +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/FrostBomb.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/FrostBomb.java new file mode 100644 index 000000000..ed6e7fd34 --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/FrostBomb.java @@ -0,0 +1,49 @@ +/* + * 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.bombs; + +import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob; +import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Freezing; +import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; +import com.shatteredpixel.shatteredpixeldungeon.utils.BArray; +import com.watabou.utils.PathFinder; + +public class FrostBomb extends Bomb { + + { + //TODO visuals + image = ItemSpriteSheet.FROST_BOMB; + } + + @Override + public void explode(int cell) { + super.explode(cell); + PathFinder.buildDistanceMap( cell, BArray.not( Dungeon.level.solid, null ), 2 ); + for (int i = 0; i < PathFinder.distance.length; i++) { + if (PathFinder.distance[i] < Integer.MAX_VALUE) { + GameScene.add(Blob.seed(i, 10, Freezing.class)); + } + } + } +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/HealingBomb.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/HealingBomb.java index 996730e29..5e561019f 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/HealingBomb.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/HealingBomb.java @@ -21,12 +21,49 @@ package com.shatteredpixel.shatteredpixeldungeon.items.bombs; +import com.shatteredpixel.shatteredpixeldungeon.Assets; +import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; +import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Healing; +import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter; +import com.shatteredpixel.shatteredpixeldungeon.effects.particles.BlastParticle; +import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; +import com.shatteredpixel.shatteredpixeldungeon.utils.BArray; +import com.watabou.noosa.audio.Sample; +import com.watabou.utils.PathFinder; public class HealingBomb extends Bomb { { + //TODO visuals image = ItemSpriteSheet.HEAL_BOMB; } + @Override + public void explode(int cell) { + //We're blowing up, so no need for a fuse anymore. + this.fuse = null; + + Sample.INSTANCE.play( Assets.SND_BLAST ); + + if (Dungeon.level.heroFOV[cell]) { + CellEmitter.center( cell ).burst( BlastParticle.FACTORY, 30 ); + } + + //no regular explosion damage + + PathFinder.buildDistanceMap( cell, BArray.not( Dungeon.level.solid, null ), 2 ); + for (int i = 0; i < PathFinder.distance.length; i++) { + if (PathFinder.distance[i] < Integer.MAX_VALUE) { + Char ch = Actor.findChar(i); + if (ch != null){ + Buff.affect( ch, Healing.class ).setHeal((int)(0.5f*ch.HT + 30), 0.333f, 0); + PotionOfHealing.cure( ch ); + } + } + } + } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/HolyBomb.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/HolyBomb.java new file mode 100644 index 000000000..61b492a95 --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/HolyBomb.java @@ -0,0 +1,68 @@ +/* + * 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.bombs; + +import com.shatteredpixel.shatteredpixeldungeon.Assets; +import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; +import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Blindness; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; +import com.shatteredpixel.shatteredpixeldungeon.effects.Flare; +import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShadowParticle; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; +import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap; +import com.shatteredpixel.shatteredpixeldungeon.utils.BArray; +import com.watabou.noosa.audio.Sample; +import com.watabou.utils.PathFinder; + +public class HolyBomb extends Bomb { + + { + //TODO visuals + image = ItemSpriteSheet.HOLY_BOMB; + } + + @Override + public void explode(int cell) { + super.explode(cell); + + if (Dungeon.level.heroFOV[cell]) { + new Flare(10, 64).show(Dungeon.hero.sprite.parent, DungeonTilemap.tileCenterToWorld(cell), 2f); + } + + PathFinder.buildDistanceMap( cell, BArray.not( Dungeon.level.solid, null ), 2 ); + for (int i = 0; i < PathFinder.distance.length; i++) { + if (PathFinder.distance[i] < Integer.MAX_VALUE) { + Char n = Actor.findChar(i); + if (n != null) { + Buff.prolong(n, Blindness.class, 1f); + if (n.properties().contains(Char.Property.UNDEAD) || n.properties().contains(Char.Property.DEMONIC)){ + //TODO decide on damage numbers and other effects here + n.sprite.emitter().start( ShadowParticle.UP, 0.05f, 10 ); + } + } + } + } + Sample.INSTANCE.play( Assets.SND_READ ); + } +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/Noisemaker.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/Noisemaker.java new file mode 100644 index 000000000..e1579982a --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/Noisemaker.java @@ -0,0 +1,111 @@ +/* + * 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.bombs; + +import com.shatteredpixel.shatteredpixeldungeon.Assets; +import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; +import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; +import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter; +import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; +import com.shatteredpixel.shatteredpixeldungeon.effects.particles.BlastParticle; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; +import com.watabou.noosa.audio.Sample; +import com.watabou.utils.Bundle; + +public class Noisemaker extends Bomb { + + { + //TODO visuals + image = ItemSpriteSheet.NOISEMAKER; + } + + @Override + public void explode(int cell) { + //We're blowing up, so no need for a fuse anymore. + this.fuse = null; + + Sample.INSTANCE.play( Assets.SND_BLAST ); + + if (Dungeon.level.heroFOV[cell]) { + CellEmitter.center( cell ).burst( BlastParticle.FACTORY, 30 ); + } + + //no regular explosion damage + + Buff.affect(Dungeon.hero, Noise.class).set(cell); + } + + public static class Noise extends Buff { + + int floor; + int cell; + + int left; + + public void set(int cell){ + floor = Dungeon.depth; + this.cell = cell; + left = 8; + } + + @Override + public boolean act() { + + if (Dungeon.depth == floor){ + //VFX + if (Dungeon.level.heroFOV[cell]) { + CellEmitter.center( cell ).start( Speck.factory( Speck.SCREAM ), 0.3f, 3 ); + Sample.INSTANCE.play( Assets.SND_ALERT ); + } else { + CellEmitter.center( cell ).start( Speck.factory( Speck.SCREAM ), 0.3f, 3 ); + Sample.INSTANCE.play( Assets.SND_ALERT, 0.5f ); + } + + for (Mob m : Dungeon.level.mobs){ + if (m.state != m.HUNTING) { + m.beckon(cell); + } + } + } + + if (left > 0) { + spend(TICK * 10f); + left--; + } else { + detach(); + } + + return true; + } + + @Override + public void storeInBundle(Bundle bundle) { + super.storeInBundle(bundle); + } + + @Override + public void restoreFromBundle(Bundle bundle) { + super.restoreFromBundle(bundle); + } + } +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/ShockBomb.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/ShockBomb.java new file mode 100644 index 000000000..ba5a2fe50 --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/ShockBomb.java @@ -0,0 +1,53 @@ +/* + * 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.bombs; + +import com.shatteredpixel.shatteredpixeldungeon.Assets; +import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob; +import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Electricity; +import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; +import com.shatteredpixel.shatteredpixeldungeon.utils.BArray; +import com.watabou.noosa.audio.Sample; +import com.watabou.utils.PathFinder; + +public class ShockBomb extends Bomb { + + { + //TODO visuals + image = ItemSpriteSheet.SHOCK_BOMB; + } + + @Override + public void explode(int cell) { + super.explode(cell); + + PathFinder.buildDistanceMap( cell, BArray.not( Dungeon.level.solid, null ), 2 ); + for (int i = 0; i < PathFinder.distance.length; i++) { + if (PathFinder.distance[i] < Integer.MAX_VALUE) { + GameScene.add(Blob.seed(i, 10, Electricity.class)); + } + } + Sample.INSTANCE.play(Assets.SND_BURNING); + } +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/WoollyBomb.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/WoollyBomb.java new file mode 100644 index 000000000..4d760e4c5 --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/WoollyBomb.java @@ -0,0 +1,78 @@ +/* + * 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.bombs; + +import com.shatteredpixel.shatteredpixeldungeon.Assets; +import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; +import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Sheep; +import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter; +import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; +import com.shatteredpixel.shatteredpixeldungeon.effects.particles.BlastParticle; +import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; +import com.shatteredpixel.shatteredpixeldungeon.utils.BArray; +import com.watabou.noosa.audio.Sample; +import com.watabou.utils.PathFinder; +import com.watabou.utils.Random; + +public class WoollyBomb extends Bomb { + + { + //TODO visuals + image = ItemSpriteSheet.WOOLY_BOMB; + } + + @Override + public void explode(int cell) { + //We're blowing up, so no need for a fuse anymore. + this.fuse = null; + + Sample.INSTANCE.play( Assets.SND_BLAST ); + + if (Dungeon.level.heroFOV[cell]) { + CellEmitter.center( cell ).burst( BlastParticle.FACTORY, 30 ); + } + + //no regular explosion damage + + PathFinder.buildDistanceMap( cell, BArray.not( Dungeon.level.solid, null ), 2 ); + for (int i = 0; i < PathFinder.distance.length; i++) { + if (PathFinder.distance[i] < Integer.MAX_VALUE) { + if (Dungeon.level.insideMap(i) + && Actor.findChar(i) == null + && !(Dungeon.level.pit[i])) { + Sheep sheep = new Sheep(); + sheep.lifespan = Random.NormalIntRange( 8, 16 ); + sheep.pos = i; + Dungeon.level.press(sheep.pos, sheep); + GameScene.add(sheep); + CellEmitter.get(i).burst(Speck.factory(Speck.WOOL), 4); + } + } + } + + Sample.INSTANCE.play(Assets.SND_PUFF); + + + } +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java index 48e4f44c6..2d9254bd4 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java @@ -132,12 +132,26 @@ public class ItemSpriteSheet { private static final int BOMBS = xy(1, 5); //16 slots public static final int BOMB = BOMBS+0; public static final int DBL_BOMB = BOMBS+1; - public static final int HEAL_BOMB = BOMBS+2; + public static final int FIRE_BOMB = BOMBS+2; + public static final int FROST_BOMB = BOMBS+3; + public static final int HEAL_BOMB = BOMBS+4; + public static final int FLASHBANG = BOMBS+5; + public static final int SHOCK_BOMB = BOMBS+6; + public static final int HOLY_BOMB = BOMBS+7; + public static final int WOOLY_BOMB = BOMBS+8; + public static final int NOISEMAKER = BOMBS+9; static{ assignItemRect(BOMB, 10, 13); assignItemRect(DBL_BOMB, 14, 13); + assignItemRect(FIRE_BOMB, 10, 13); + assignItemRect(FROST_BOMB, 10, 13); assignItemRect(HEAL_BOMB, 10, 13); + assignItemRect(FLASHBANG, 10, 13); + assignItemRect(SHOCK_BOMB, 10, 13); + assignItemRect(HOLY_BOMB, 10, 13); + assignItemRect(WOOLY_BOMB, 10, 13); + assignItemRect(NOISEMAKER, 10, 13); } 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 f62875ed2..16141b501 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 @@ -354,7 +354,29 @@ items.bombs.bomb.desc_burning=A fairly hefty black powder bomb. An explosion fro items.bombs.bomb$doublebomb.name=two bombs items.bombs.bomb$doublebomb.desc=A stack of two hefty black powder bombs, looks like you get one free! +items.bombs.firebomb.name=firebomb +items.bombs.firebomb.desc=TODO +items.bombs.flashbang.name=flashbang +items.bombs.flashbang.desc=TODO + +items.bombs.frostbomb.name=frost bomb +items.bombs.frostbomb.desc=TODO + +items.bombs.healingbomb.name=healing bomb +items.bombs.healingbomb.desc=TODO + +items.bombs.holybomb.name=holy bomb +items.bombs.holybomb.desc=TODO + +items.bombs.noisemaker.name=noisemaker +items.bombs.noisemaker.desc=TODO + +items.bombs.shockbomb.name=shock bomb +items.bombs.shockbomb.desc=TODO + +items.bombs.woollybomb.name=woolly bomb +items.bombs.woollybomb.desc=TODO ###food items.food.blandfruit.name=blandfruit