From 20a6f91758e31e793f08cdd6951db70bf2be0c5f Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Tue, 30 Jun 2015 15:45:50 -0400 Subject: [PATCH] v0.3.1: new traps batch 1 (11 new traps, changes to 2 existing traps) --- .../shatteredpixeldungeon/items/Bomb.java | 3 +- .../levels/traps/BlazingTrap.java | 61 ++++++++++++ .../levels/traps/ChillingTrap.java | 69 +++++++++++++ .../levels/traps/ConfusionTrap.java | 48 +++++++++ .../levels/traps/ExplosiveTrap.java | 44 +++++++++ .../levels/traps/FlashingTrap.java | 74 ++++++++++++++ .../levels/traps/FlockTrap.java | 75 ++++++++++++++ .../levels/traps/GrippingTrap.java | 6 +- .../levels/traps/LightningTrap.java | 17 +++- .../levels/traps/OozeTrap.java | 52 ++++++++++ .../levels/traps/TeleportationTrap.java | 97 +++++++++++++++++++ .../levels/traps/TrapGenerator.java | 43 ++++++++ .../levels/traps/VenomTrap.java | 52 ++++++++++ .../levels/traps/WornTrap.java | 44 +++++++++ 14 files changed, 680 insertions(+), 5 deletions(-) create mode 100644 src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/BlazingTrap.java create mode 100644 src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/ChillingTrap.java create mode 100644 src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/ConfusionTrap.java create mode 100644 src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/ExplosiveTrap.java create mode 100644 src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/FlashingTrap.java create mode 100644 src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/FlockTrap.java create mode 100644 src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/OozeTrap.java create mode 100644 src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/TeleportationTrap.java create mode 100644 src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/TrapGenerator.java create mode 100644 src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/VenomTrap.java create mode 100644 src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/WornTrap.java diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/Bomb.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/Bomb.java index 733ae38d7..9f1ee4b01 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/Bomb.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/Bomb.java @@ -150,8 +150,7 @@ public class Bomb extends Item { } if (ch == Dungeon.hero && !ch.isAlive()) - //constant is used here in the rare instance a player is killed by a double bomb. - Dungeon.fail(Utils.format(ResultDescriptions.ITEM, "bomb")); + Dungeon.fail("Killed by an explosion"); } } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/BlazingTrap.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/BlazingTrap.java new file mode 100644 index 000000000..e4bc72efa --- /dev/null +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/BlazingTrap.java @@ -0,0 +1,61 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2015 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.levels.traps; + +import com.shatteredpixel.shatteredpixeldungeon.Assets; +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.levels.Level; +import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; +import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite; +import com.watabou.noosa.audio.Sample; + +//TODO: test fire in water/pits +public class BlazingTrap extends Trap { + + { + name = "Blazing trap"; + color = TrapSprite.ORANGE; + shape = TrapSprite.STARS; + } + + + @Override + public void activate() { + for (int i : Level.NEIGHBOURS9DIST2){ + if (!Level.solid[pos+i]) { + if (Level.pit[pos+i] || Level.water[pos+i]) + GameScene.add(Blob.seed(pos + i, 1, Fire.class)); + else + GameScene.add(Blob.seed(pos + i, 5, Fire.class)); + CellEmitter.get(pos + i).burst(FlameParticle.FACTORY, 5); + } + } + Sample.INSTANCE.play(Assets.SND_BURNING); + } + + @Override + public String desc() { + return "stepping on this trap will ignite a powerful chemical mixture, setting a wide area ablaze."; + } +} diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/ChillingTrap.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/ChillingTrap.java new file mode 100644 index 000000000..2d76305b6 --- /dev/null +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/ChillingTrap.java @@ -0,0 +1,69 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2015 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.levels.traps; + +import com.shatteredpixel.shatteredpixeldungeon.Assets; +import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.ResultDescriptions; +import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; +import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Chill; +import com.shatteredpixel.shatteredpixeldungeon.effects.Splash; +import com.shatteredpixel.shatteredpixeldungeon.items.Heap; +import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite; +import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; +import com.shatteredpixel.shatteredpixeldungeon.utils.Utils; +import com.watabou.noosa.audio.Sample; +import com.watabou.utils.Random; + +public class ChillingTrap extends Trap{ + + { + name = "Chilling trap"; + color = TrapSprite.WHITE; + shape = TrapSprite.DOTS; + } + + @Override + public void activate() { + Heap heap = Dungeon.level.heaps.get( pos ); + if (heap != null) heap.freeze(); + + Char ch = Actor.findChar( pos ); + if (ch != null){ + if (visible){ + Splash.at( sprite.center(), 0xFFB2D6FF, 5); + Sample.INSTANCE.play( Assets.SND_SHATTER ); + } + Chill.prolong(ch, Chill.class, 5f + Random.Int(Dungeon.depth)); + ch.damage(Random.NormalIntRange(1 , Dungeon.depth), this); + if (!ch.isAlive() && ch == Dungeon.hero){ + Dungeon.fail( Utils.format(ResultDescriptions.TRAP, name) ); + GLog.n("You succumb to the chilling trap..."); + } + } + } + + @Override + public String desc() { + return "when activated, chemicals in this trap will trigger a snap-frost at its location."; + } +} diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/ConfusionTrap.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/ConfusionTrap.java new file mode 100644 index 000000000..98f4902c3 --- /dev/null +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/ConfusionTrap.java @@ -0,0 +1,48 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2015 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.levels.traps; + +import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob; +import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ConfusionGas; +import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; +import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite; + +public class ConfusionTrap extends Trap { + + { + name = "Confusion gas trap"; + color = TrapSprite.TEAL; + shape = TrapSprite.GRILL; + } + + @Override + public void activate() { + + GameScene.add(Blob.seed(pos, 300 + 20 * Dungeon.depth, ConfusionGas.class)); + + } + + @Override + public String desc() { + return "Triggering this trap will set a cloud of confusion gas loose within the immediate area."; + } +} diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/ExplosiveTrap.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/ExplosiveTrap.java new file mode 100644 index 000000000..6662be827 --- /dev/null +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/ExplosiveTrap.java @@ -0,0 +1,44 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2015 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.levels.traps; + +import com.shatteredpixel.shatteredpixeldungeon.items.Bomb; +import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite; + +public class ExplosiveTrap extends Trap { + + { + name = "Explosive trap"; + color = TrapSprite.GREY; + shape = TrapSprite.WAVES; + } + + @Override + public void activate() { + new Bomb().explode(pos); + } + + @Override + public String desc() { + return "This trap contains some powdered explosive and a trigger mechanism. " + + "Activating it will cause an explosion in the immediate area."; + } +} diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/FlashingTrap.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/FlashingTrap.java new file mode 100644 index 000000000..55b89ab63 --- /dev/null +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/FlashingTrap.java @@ -0,0 +1,74 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2015 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.levels.traps; + +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.actors.buffs.Cripple; +import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; +import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter; +import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; +import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; +import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite; +import com.watabou.noosa.audio.Sample; +import com.watabou.utils.Random; + +public class FlashingTrap extends Trap { + + { + name = "Flashing trap"; + color = TrapSprite.YELLOW; + shape = TrapSprite.STARS; + } + + @Override + public void activate() { + Char ch = Actor.findChar(pos); + + if (ch != null) { + int len = Random.Int(5, 10)+Dungeon.depth; + Buff.prolong( ch, Blindness.class, len ); + Buff.prolong( ch, Cripple.class, len ); + if (ch instanceof Mob) { + if (((Mob)ch).state == ((Mob)ch).HUNTING) ((Mob)ch).state = ((Mob)ch).WANDERING; + ((Mob)ch).beckon( Dungeon.level.randomDestination() ); + } + if (ch == Dungeon.hero){ + Sample.INSTANCE.play( Assets.SND_BLAST ); + } + } + + if (Dungeon.visible[pos]) { + GameScene.flash(0xFFFFFF); + CellEmitter.get(pos).burst( Speck.factory(Speck.LIGHT), 4 ); + } + } + + @Override + public String desc() { + return "On activation, this trap with ignite a potent flashing powder stored within, " + + "temporarily blinding and crippling its victim."; + } +} diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/FlockTrap.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/FlockTrap.java new file mode 100644 index 000000000..7726a0c11 --- /dev/null +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/FlockTrap.java @@ -0,0 +1,75 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2015 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.levels.traps; + +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.levels.Level; +import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; +import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite; +import com.watabou.noosa.audio.Sample; +import com.watabou.utils.Random; + +public class FlockTrap extends Trap { + + { + name = "Flock trap"; + color = TrapSprite.WHITE; + shape = TrapSprite.WAVES; + } + + + @Override + public void activate() { + //use an actor as we want to put this on a slight delay so all chars get a chance to act this turn first. + Actor.add(new Actor() { + + { actPriority = 3; } + + protected boolean act() { + int cell; + for (int i : Level.NEIGHBOURS9DIST2) { + cell = pos + i; + if (Level.insideMap(cell) && Actor.findChar(cell) == null && !(Level.solid[cell] || Level.pit[cell])) { + Sheep sheep = new Sheep(); + sheep.lifespan = 2 + Random.Int(Dungeon.depth + 10); + sheep.pos = cell; + GameScene.add(sheep); + } + CellEmitter.get(cell).burst(Speck.factory(Speck.WOOL), 4); + } + Sample.INSTANCE.play(Assets.SND_PUFF); + Actor.remove(this); + return true; + } + }); + + } + + @Override + public String desc() { + return "Perhaps a joke from some amateur mage, triggering this trap will create a flock of magical sheep."; + } +} diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/GrippingTrap.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/GrippingTrap.java index 8bcb0fdb8..e22411a96 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/GrippingTrap.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/GrippingTrap.java @@ -26,6 +26,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Bleeding; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Cripple; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Roots; import com.shatteredpixel.shatteredpixeldungeon.effects.Wound; import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite; import com.watabou.utils.Random; @@ -44,9 +45,10 @@ public class GrippingTrap extends Trap { Char c = Actor.findChar( pos ); if (c != null) { - int damage = Math.max( 0, (Dungeon.depth + 3) - Random.IntRange( 0, c.dr() / 2 ) ); + int damage = Math.max( 0, (Dungeon.depth) - Random.IntRange( 0, c.dr() / 2 ) ); Buff.affect( c, Bleeding.class ).set( damage ); - Buff.prolong( c, Cripple.class, Cripple.DURATION ); + Buff.prolong( c, Cripple.class, 15f); + Buff.prolong( c, Roots.class, 5f); Wound.hit( c ); } else { Wound.hit( pos ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/LightningTrap.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/LightningTrap.java index d1329b1a8..831c3daf6 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/LightningTrap.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/LightningTrap.java @@ -21,6 +21,11 @@ package com.shatteredpixel.shatteredpixeldungeon.levels.traps; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; +import com.shatteredpixel.shatteredpixeldungeon.effects.SpellSprite; +import com.shatteredpixel.shatteredpixeldungeon.items.Heap; +import com.shatteredpixel.shatteredpixeldungeon.items.Item; +import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff; import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite; import com.watabou.noosa.Camera; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; @@ -68,6 +73,16 @@ public class LightningTrap extends Trap { ch.sprite.parent.add( new Lightning( arcs, null ) ); } + Heap heap = Dungeon.level.heaps.get(pos); + if (heap != null){ + //TODO: this should probably charge staffs too + Item item = heap.items.peek(); + if (item instanceof Wand){ + Wand wand = (Wand)item; + ((Wand)item).curCharges += (int)Math.ceil((wand.curCharges - wand.maxCharges)/2f); + } + } + CellEmitter.center( pos ).burst( SparkParticle.FACTORY, Random.IntRange( 3, 4 ) ); } @@ -79,6 +94,6 @@ public class LightningTrap extends Trap { @Override public String desc() { return "A mechanism with a large amount of energy stored into it. " + - "Triggering the trap will discharge that energy into whever is nearby."; + "Triggering the trap will discharge that energy into whatever activates it."; } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/OozeTrap.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/OozeTrap.java new file mode 100644 index 000000000..d596af5b1 --- /dev/null +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/OozeTrap.java @@ -0,0 +1,52 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2015 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.levels.traps; + +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.Ooze; +import com.shatteredpixel.shatteredpixeldungeon.effects.Splash; +import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite; + +public class OozeTrap extends Trap { + + { + name = "Ooze trap"; + color = TrapSprite.GREEN; + shape = TrapSprite.DOTS; + } + + @Override + public void activate() { + Char ch = Actor.findChar( pos ); + + if (ch != null){ + Buff.affect(ch, Ooze.class); + Splash.at(sprite.center(), 0x000000, 5); + } + } + + @Override + public String desc() { + return "This trap with splash out caustic ooze when activated, which will burn until it is washed away."; + } +} diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/TeleportationTrap.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/TeleportationTrap.java new file mode 100644 index 000000000..6a1cd1e59 --- /dev/null +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/TeleportationTrap.java @@ -0,0 +1,97 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2015 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.levels.traps; + +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.hero.Hero; +import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter; +import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; +import com.shatteredpixel.shatteredpixeldungeon.items.Heap; +import com.shatteredpixel.shatteredpixeldungeon.items.Item; +import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation; +import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; +import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite; +import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; +import com.watabou.noosa.audio.Sample; + +import java.util.LinkedList; + +public class TeleportationTrap extends Trap { + + { + name = "Teleportation trap"; + color = TrapSprite.TEAL; + shape = TrapSprite.DOTS; + } + + @Override + public void activate() { + + CellEmitter.get(pos).start(Speck.factory(Speck.LIGHT), 0.2f, 3); + Sample.INSTANCE.play( Assets.SND_TELEPORT ); + + Char ch = Actor.findChar( pos); + if (ch instanceof Hero){ + ScrollOfTeleportation.teleportHero( (Hero)ch); + } else if (ch != null){ + int count = 10; + int pos; + do { + pos = Dungeon.level.randomRespawnCell(); + if (count-- <= 0) { + break; + } + } while (pos == -1); + + if (pos == -1) { + + GLog.w(ScrollOfTeleportation.TXT_NO_TELEPORT); + + } else { + + ch.pos = pos; + ch.sprite.place(ch.pos); + ch.sprite.visible = Dungeon.visible[pos]; + + } + } + + Heap heap = Dungeon.level.heaps.get(pos); + + if (heap != null){ + int cell = Dungeon.level.randomRespawnCell(); + + Item item = heap.pickUp(); + + if (cell != -1) { + Dungeon.level.drop( item, cell ); + } + } + } + + @Override + public String desc() { + return "Whatever triggers this trap will be warped to some other location on this floor."; + } +} diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/TrapGenerator.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/TrapGenerator.java new file mode 100644 index 000000000..3f1540700 --- /dev/null +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/TrapGenerator.java @@ -0,0 +1,43 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2015 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.levels.traps; + +public class TrapGenerator { + + + public Trap trapforDepth(int depth){ + Class Trapclass; + switch(depth){ + case 1: + return new FireTrap(); + + default: + return new FireTrap(); + } + + } + + + public Class trapforTrapRoom(int depth){ + return FireTrap.class; + } + +} diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/VenomTrap.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/VenomTrap.java new file mode 100644 index 000000000..8b1b253c2 --- /dev/null +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/VenomTrap.java @@ -0,0 +1,52 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2015 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.levels.traps; + +import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob; +import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.VenomGas; +import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; +import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite; + +public class VenomTrap extends Trap { + + { + name = "Venom gas trap"; + color = TrapSprite.VIOLET; + shape = TrapSprite.GRILL; + } + + @Override + public void activate() { + + VenomGas venomGas = Blob.seed(pos, 80 + 5 * Dungeon.depth, VenomGas.class); + + venomGas.setStrength(1+Dungeon.depth/4); + + GameScene.add(venomGas); + + } + + @Override + public String desc() { + return "Triggering this trap will set a cloud of deadly venom gas loose within the immediate area."; + } +} diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/WornTrap.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/WornTrap.java new file mode 100644 index 000000000..7eb36346c --- /dev/null +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/WornTrap.java @@ -0,0 +1,44 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2015 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.levels.traps; + +import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite; +import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; + +public class WornTrap extends Trap { + + { + name = "Worn out trap"; + color = TrapSprite.BLACK; + shape = TrapSprite.DOTS; + } + + @Override + public void activate() { + GLog.i("nothing happens.."); + } + + @Override + public String desc() { + return "Due to age and possibly poor workmanship, " + + "it looks like this trap has worn to the point where it won't do anything when triggered."; + } +}