diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/ChillingTrap.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/ChillingTrap.java index 2d76305b6..c6673e4c7 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/ChillingTrap.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/ChillingTrap.java @@ -44,15 +44,16 @@ public class ChillingTrap extends Trap{ @Override public void activate() { + if (Dungeon.visible[ pos ]){ + Splash.at( sprite.center(), 0xFFB2D6FF, 5); + Sample.INSTANCE.play( Assets.SND_SHATTER ); + } + 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){ diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/CursingTrap.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/CursingTrap.java new file mode 100644 index 000000000..90f779dda --- /dev/null +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/CursingTrap.java @@ -0,0 +1,77 @@ +/* + * 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.hero.Hero; +import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter; +import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShadowParticle; +import com.shatteredpixel.shatteredpixeldungeon.items.*; +import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; +import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite; +import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; +import com.watabou.noosa.audio.Sample; + +public class CursingTrap extends Trap { + + { + name = "Cursing trap"; + color = TrapSprite.VIOLET; + shape = TrapSprite.WAVES; + } + + @Override + public void activate() { + if (Dungeon.visible[ pos ]) { + CellEmitter.get(pos).burst(ShadowParticle.UP, 5); + Sample.INSTANCE.play(Assets.SND_CURSED); + } + + Heap heap = Dungeon.level.heaps.get( pos ); + if (heap != null){ + for (Item item : heap.items){ + if (item.isUpgradable()) + item.cursed = item.cursedKnown = true; + } + } + + if (Dungeon.hero.pos == pos){ + Hero hero = Dungeon.hero; + KindOfWeapon weapon = hero.belongings.weapon; + Armor armor = hero.belongings.armor; + KindofMisc misc1 = hero.belongings.misc1; + KindofMisc misc2 = hero.belongings.misc2; + if (weapon != null) weapon.cursed = weapon.cursedKnown = true; + if (armor != null) armor.cursed = armor.cursedKnown = true; + if (misc1 != null) misc1.cursed = misc1.cursedKnown = true; + if (misc2 != null) misc2.cursed = misc2.cursedKnown = true; + EquipableItem.equipCursed(hero); + GLog.n("Your worn equipment becomes cursed!"); + } + } + + @Override + public String desc() { + return "This trap contains the same malevolent magic found in cursed equipment. " + + "Trigger it will curse all worn items, and all items in the immediate area."; + } +} diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/DistortionTrap.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/DistortionTrap.java new file mode 100644 index 000000000..5f593c69b --- /dev/null +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/DistortionTrap.java @@ -0,0 +1,59 @@ +/* + * 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.items.Item; +import com.shatteredpixel.shatteredpixeldungeon.items.keys.Key; +import com.shatteredpixel.shatteredpixeldungeon.levels.Level; +import com.shatteredpixel.shatteredpixeldungeon.scenes.InterlevelScene; +import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite; +import com.watabou.noosa.Game; + +public class DistortionTrap extends Trap{ + + { + name = "Distortion trap"; + color = TrapSprite.TEAL; + shape = TrapSprite.LARGE_DOT; + } + + @Override + public void activate() { + InterlevelScene.returnDepth = Dungeon.depth; + for (Item item : Dungeon.hero.belongings.backpack.items){ + if (item instanceof Key && ((Key)item).depth == Dungeon.depth){ + item.detachAll(Dungeon.hero.belongings.backpack); + } + } + Dungeon.depth--; + Level level = Dungeon.newLevel(); + Dungeon.switchLevel( level, level.entrance); + InterlevelScene.returnPos = level.entrance; + InterlevelScene.mode = InterlevelScene.Mode.RETURN; + Game.switchScene(InterlevelScene.class); + } + + @Override + public String desc() { + return "Build from strange magic of unknown origin, this trap will shift and morph the world around you."; + } +} diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/FrostTrap.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/FrostTrap.java new file mode 100644 index 000000000..45aa20462 --- /dev/null +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/FrostTrap.java @@ -0,0 +1,72 @@ +/* + * 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.actors.buffs.Frost; +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 FrostTrap extends Trap { + + { + name = "Frost trap"; + color = TrapSprite.WHITE; + shape = TrapSprite.STARS; + } + + @Override + public void activate() { + + if (Dungeon.visible[ pos ]){ + Splash.at( sprite.center(), 0xFFB2D6FF, 10); + Sample.INSTANCE.play( Assets.SND_SHATTER ); + } + + Heap heap = Dungeon.level.heaps.get( pos ); + if (heap != null) heap.freeze(); + + Char ch = Actor.findChar(pos); + if (ch != null){ + ch.damage(Random.NormalIntRange(1 , Dungeon.depth), this); + Chill.prolong(ch, Frost.class, 10f + Random.Int(Dungeon.depth)); + if (!ch.isAlive() && ch == Dungeon.hero){ + Dungeon.fail( Utils.format(ResultDescriptions.TRAP, name) ); + GLog.n("You succumb to the freezing trap..."); + } + } + } + + @Override + public String desc() { + return "when activated, chemicals in this trap will trigger a powerful snap-frost at its location."; + } +} diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/PitfallTrap.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/PitfallTrap.java index ac95293dc..b9af5018a 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/PitfallTrap.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/PitfallTrap.java @@ -24,7 +24,6 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; -import com.shatteredpixel.shatteredpixeldungeon.effects.particles.FlowParticle; import com.shatteredpixel.shatteredpixeldungeon.effects.particles.WindParticle; import com.shatteredpixel.shatteredpixeldungeon.items.Heap; import com.shatteredpixel.shatteredpixeldungeon.items.Item; @@ -88,6 +87,6 @@ public class PitfallTrap extends Trap { @Override public String desc() { - return super.desc(); + return "This pressure plate rests ontop of a fairly weak floor, and will likely collapse into a pit if it is pressed."; } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/WarpingTrap.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/WarpingTrap.java new file mode 100644 index 000000000..f88df0a90 --- /dev/null +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/WarpingTrap.java @@ -0,0 +1,98 @@ +/* + * 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.Buff; +import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; +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.artifacts.DriedRose; +import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass; +import com.shatteredpixel.shatteredpixeldungeon.scenes.InterlevelScene; +import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite; +import com.watabou.noosa.Game; +import com.watabou.noosa.audio.Sample; +import com.watabou.utils.Random; + +import java.util.ArrayList; + +public class WarpingTrap extends Trap { + + { + name = "Warping trap"; + color = TrapSprite.TEAL; + shape = TrapSprite.STARS; + } + + @Override + public void activate() { + CellEmitter.get(pos).start(Speck.factory(Speck.LIGHT), 0.2f, 3); + Sample.INSTANCE.play( Assets.SND_TELEPORT ); + + if (Dungeon.depth > 1 && !Dungeon.bossLevel()) { + + int depth = Random.Int(Dungeon.depth - 1)+1; + + Heap heap = Dungeon.level.heaps.get(pos); + if (heap != null) { + ArrayList dropped = Dungeon.droppedItems.get( depth ); + if (dropped == null) { + Dungeon.droppedItems.put( depth, dropped = new ArrayList() ); + } + for (Item item : heap.items){ + dropped.add(item); + } + heap.destroy(); + } + + Char ch = Actor.findChar( pos ); + if (ch == Dungeon.hero){ + Buff buff = Dungeon.hero.buff(TimekeepersHourglass.timeFreeze.class); + if (buff != null) buff.detach(); + + for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) + if (mob instanceof DriedRose.GhostHero) mob.destroy(); + + InterlevelScene.mode = InterlevelScene.Mode.RETURN; + InterlevelScene.returnDepth = depth; + InterlevelScene.returnPos = -1; + Game.switchScene(InterlevelScene.class); + } else if (ch != null) { + ch.destroy(); + ch.sprite.killAndErase(); + Dungeon.level.mobs.remove(ch); + } + + } + + } + + @Override + public String desc() { + return "Whatever triggers this trap will be warped to some other location in the dungeon."; + } +} diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/WeakeningTrap.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/WeakeningTrap.java new file mode 100644 index 000000000..5ae91d748 --- /dev/null +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/WeakeningTrap.java @@ -0,0 +1,59 @@ +/* + * 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.Actor; +import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Slow; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Weakness; +import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter; +import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShadowParticle; +import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite; + +public class WeakeningTrap extends Trap{ + + { + name = "Weakening trap"; + color = TrapSprite.GREEN; + shape = TrapSprite.WAVES; + } + + @Override + public void activate() { + if (Dungeon.visible[ pos ]){ + CellEmitter.get(pos).burst(ShadowParticle.UP, 5); + } + + Char ch = Actor.findChar( pos ); + if (ch == Dungeon.hero){ + Buff.prolong( ch, Weakness.class, Weakness.duration(ch)*2f); + } else if (ch != null) { + Buff.prolong( ch, Slow.class, Slow.duration(ch)); + } + } + + @Override + public String desc() { + return "Dark magic in this trap sucks the energy out of anything that comes into contact with it."; + } +}