From 0b15d8caace9dc521dfcd68d92b1293b91195109 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Mon, 25 May 2015 02:25:36 -0400 Subject: [PATCH] v0.3.0: removed now unusued wands (mostly) --- .../actors/mobs/npcs/Wandmaker.java | 47 +---- .../items/wands/WandOfAmok.java | 75 -------- .../items/wands/WandOfAvalanche.java | 108 ----------- .../items/wands/WandOfBlink.java | 49 +---- .../items/wands/WandOfFlock.java | 79 +------- .../items/wands/WandOfPoison.java | 73 ------- .../items/wands/WandOfSlowness.java | 71 ------- .../items/wands/WandOfTelekinesis.java | 180 ------------------ .../items/wands/WandOfTeleportation.java | 96 ---------- 9 files changed, 8 insertions(+), 770 deletions(-) delete mode 100644 src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfAmok.java delete mode 100644 src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfAvalanche.java delete mode 100644 src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfPoison.java delete mode 100644 src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfSlowness.java delete mode 100644 src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfTelekinesis.java delete mode 100644 src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfTeleportation.java diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Wandmaker.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Wandmaker.java index 21ee75923..d30466c4d 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Wandmaker.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Wandmaker.java @@ -38,16 +38,8 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength; import com.shatteredpixel.shatteredpixeldungeon.items.quest.CorpseDust; import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand; -import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfAmok; -import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfAvalanche; -import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfBlink; import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfDisintegration; -import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfFireblast; -import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfLightning; -import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfPoison; import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfRegrowth; -import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfSlowness; -import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfTelekinesis; import com.shatteredpixel.shatteredpixeldungeon.levels.PrisonLevel; import com.shatteredpixel.shatteredpixeldungeon.levels.Room; import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; @@ -229,43 +221,12 @@ public class Wandmaker extends NPC { alternative = Random.Int( 2 ) == 0; given = false; - - switch (Random.Int( 5 )) { - case 0: - wand1 = new WandOfAvalanche(); - break; - case 1: - wand1 = new WandOfDisintegration(); - break; - case 2: - wand1 = new WandOfFireblast(); - break; - case 3: - wand1 = new WandOfLightning(); - break; - case 4: - wand1 = new WandOfPoison(); - break; - } + //TODO: implement new logic + wand1 = new WandOfDisintegration(); wand1.random().upgrade(); - switch (Random.Int( 5 )) { - case 0: - wand2 = new WandOfAmok(); - break; - case 1: - wand2 = new WandOfBlink(); - break; - case 2: - wand2 = new WandOfRegrowth(); - break; - case 3: - wand2 = new WandOfSlowness(); - break; - case 4: - wand2 = new WandOfTelekinesis(); - break; - } + + wand2 = new WandOfRegrowth(); wand2.random().upgrade(); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfAmok.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfAmok.java deleted file mode 100644 index cab9533f8..000000000 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfAmok.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Pixel Dungeon - * Copyright (C) 2012-2014 Oleg Dolya - * - * 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.wands; - -import com.shatteredpixel.shatteredpixeldungeon.Dungeon; -import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Vertigo; -import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff; -import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; -import com.watabou.noosa.audio.Sample; -import com.shatteredpixel.shatteredpixeldungeon.Assets; -import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; -import com.shatteredpixel.shatteredpixeldungeon.actors.Char; -import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Amok; -import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; -import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile; -import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; -import com.watabou.utils.Callback; - -public class WandOfAmok extends Wand { - - { - name = "Wand of Amok"; - } - - @Override - protected void onZap( Ballistica bolt) { - Char ch = Actor.findChar( bolt.collisionPos ); - if (ch != null) { - - if (ch == Dungeon.hero) { - Buff.affect( ch, Vertigo.class, Vertigo.duration(ch) ); - } else { - Buff.affect( ch, Amok.class, 3f + level() ); - } - - } else { - - GLog.i( "nothing happened" ); - - } - } - - @Override - public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) { - - } - - @Override - protected void fx( Ballistica bolt, Callback callback ) { - MagicMissile.purpleLight( curUser.sprite.parent, bolt.sourcePos, bolt.collisionPos, callback ); - Sample.INSTANCE.play( Assets.SND_ZAP ); - } - - @Override - public String desc() { - return - "The purple light from this wand will make the target run amok " + - "attacking random creatures in its vicinity."; - } -} diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfAvalanche.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfAvalanche.java deleted file mode 100644 index 8869d70cd..000000000 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfAvalanche.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Pixel Dungeon - * Copyright (C) 2012-2014 Oleg Dolya - * - * 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.wands; - -import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff; -import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; -import com.watabou.noosa.Camera; -import com.watabou.noosa.audio.Sample; -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.Buff; -import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis; -import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter; -import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile; -import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; -import com.shatteredpixel.shatteredpixeldungeon.levels.Level; -import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; -import com.shatteredpixel.shatteredpixeldungeon.utils.BArray; -import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; -import com.shatteredpixel.shatteredpixeldungeon.utils.Utils; -import com.watabou.utils.Callback; -import com.watabou.utils.PathFinder; -import com.watabou.utils.Random; - -public class WandOfAvalanche extends Wand { - - { - name = "Wand of Avalanche"; - image = ItemSpriteSheet.WAND_LIVING_EARTH; - - collisionProperties = Ballistica.STOP_TERRAIN; - } - - @Override - protected void onZap( Ballistica bolt ) { - - Sample.INSTANCE.play( Assets.SND_ROCKS ); - - int level = level(); - - int size = 1 + level / 3; - PathFinder.buildDistanceMap( bolt.collisionPos, BArray.not( Level.solid, null ), size ); - - for (int i=0; i < Level.LENGTH; i++) { - - int d = PathFinder.distance[i]; - - if (d < Integer.MAX_VALUE) { - - Char ch = Actor.findChar( i ); - if (ch != null) { - - ch.sprite.flash(); - - ch.damage( Random.Int( 2, 6 + (size - d) * 2 ), this ); - - if (ch.isAlive() && Random.Int( 2 + d ) == 0) { - Buff.prolong( ch, Paralysis.class, Random.IntRange( 2, 6 ) ); - } - } - - CellEmitter.get( i ).start( Speck.factory( Speck.ROCK ), 0.07f, 3 + (size - d) ); - Camera.main.shake( 3, 0.07f * (3 + (size - d)) ); - } - } - - if (!curUser.isAlive()) { - Dungeon.fail( Utils.format( ResultDescriptions.ITEM, name ) ); - GLog.n( "You killed yourself with your own Wand of Avalanche..." ); - } - } - - @Override - public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) { - - } - - @Override - protected void fx( Ballistica bolt, Callback callback ) { - MagicMissile.earth( curUser.sprite.parent, bolt.sourcePos, bolt.collisionPos, callback ); - Sample.INSTANCE.play( Assets.SND_ZAP ); - } - - @Override - public String desc() { - return - "When a discharge of this wand hits a wall (or any other solid obstacle) it causes " + - "an avalanche of stones, damaging and stunning all creatures in the affected area."; - } -} diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlink.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlink.java index 9cb7840ad..1be6bbc86 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlink.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlink.java @@ -17,53 +17,15 @@ */ package com.shatteredpixel.shatteredpixeldungeon.items.wands; -import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff; import com.watabou.noosa.audio.Sample; import com.watabou.noosa.tweeners.AlphaTweener; 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.effects.MagicMissile; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; -import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; -import com.watabou.utils.Callback; -public class WandOfBlink extends Wand { +//TODO: pull visual logic out of here to another place, then remove +public abstract class WandOfBlink extends Wand { - { - name = "Wand of Blink"; - } - - @Override - protected void onZap( Ballistica bolt ) { - - int level = level(); - - //TODO: don't care about this atm as this wand is marked for death, should correct this logic if I end up keeping it. - /*if (Ballistica.distance > level + 4) { - cell = Ballistica.trace[level + 3]; - } else if (Actor.findChar( cell ) != null && Ballistica.distance > 1) { - cell = Ballistica.trace[Ballistica.distance - 2]; - }*/ - - curUser.sprite.visible = true; - appear( Dungeon.hero, bolt.collisionPos ); - Dungeon.observe(); - } - - @Override - public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) { - - } - - @Override - protected void fx( Ballistica bolt, Callback callback ) { - MagicMissile.whiteLight( curUser.sprite.parent, bolt.sourcePos, bolt.collisionPos, callback ); - Sample.INSTANCE.play( Assets.SND_ZAP ); - curUser.sprite.visible = false; - } - public static void appear( Char ch, int pos ) { ch.sprite.interruptMotion(); @@ -79,11 +41,4 @@ public class WandOfBlink extends Wand { ch.sprite.emitter().start( Speck.factory( Speck.LIGHT ), 0.2f, 3 ); Sample.INSTANCE.play( Assets.SND_TELEPORT ); } - - @Override - public String desc() { - return - "This wand will allow you to teleport in the chosen direction. " + - "Creatures and inanimate obstructions will block the teleportation."; - } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFlock.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFlock.java index 225f8fcb0..ce8a9ce56 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFlock.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFlock.java @@ -36,83 +36,8 @@ import com.watabou.utils.Callback; import com.watabou.utils.PathFinder; import com.watabou.utils.Random; -public class WandOfFlock extends Wand { - - { - name = "Wand of Flock"; - } - - @Override - protected void onZap( Ballistica bolt ) { - - int level = level(); - - int n = level + 2; - - //TODO: don't care about this atm as this wand is marked for death, should correct this logic if I end up keeping it - /** - if (Actor.findChar( cell ) != null && Ballistica.distance > 2) { - cell = Ballistica.trace[Ballistica.distance - 2]; - }*/ - - boolean[] passable = BArray.or( Level.passable, Level.avoid, null ); - for (Actor actor : Actor.all()) { - if (actor instanceof Char) { - passable[((Char)actor).pos] = false; - } - } - - int cell = bolt.collisionPos; - - PathFinder.buildDistanceMap( cell, passable, n ); - int dist = 0; - - if (Actor.findChar( cell ) != null) { - PathFinder.distance[cell] = Integer.MAX_VALUE; - dist = 1; - } - - float lifespan = level + 3; - - sheepLabel: - for (int i=0; i < n; i++) { - do { - for (int j=0; j < Level.LENGTH; j++) { - if (PathFinder.distance[j] == dist) { - - Sheep sheep = new Sheep(); - sheep.lifespan = lifespan; - sheep.pos = j; - GameScene.add( sheep ); - Dungeon.level.mobPress( sheep ); - - CellEmitter.get( j ).burst( Speck.factory( Speck.WOOL ), 4 ); - - PathFinder.distance[j] = Integer.MAX_VALUE; - - continue sheepLabel; - } - } - dist++; - } while (dist < n); - } - } - - @Override - public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) { - - } - - protected void fx( int cell, Callback callback ) { - MagicMissile.wool( curUser.sprite.parent, curUser.pos, cell, callback ); - Sample.INSTANCE.play( Assets.SND_ZAP ); - } - - @Override - public String desc() { - return - "A flick of this wand summons a flock of magic sheep, creating temporary impenetrable obstacle."; - } +//TODO: pull sheep out of here, and delete +public abstract class WandOfFlock extends Wand { public static class Sheep extends NPC { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfPoison.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfPoison.java deleted file mode 100644 index a75652abd..000000000 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfPoison.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Pixel Dungeon - * Copyright (C) 2012-2014 Oleg Dolya - * - * 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.wands; - -import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff; -import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; -import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; -import com.watabou.noosa.audio.Sample; -import com.shatteredpixel.shatteredpixeldungeon.Assets; -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.Poison; -import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile; -import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; -import com.watabou.utils.Callback; - -public class WandOfPoison extends Wand { - - { - name = "Wand of Poison"; - image = ItemSpriteSheet.WAND_VENOM; - } - - @Override - protected void onZap( Ballistica bolt ) { - Char ch = Actor.findChar( bolt.collisionPos ); - if (ch != null) { - - Buff.affect( ch, Poison.class ).set( Poison.durationFactor( ch ) * (5 + level()) ); - - } else { - - GLog.i( "nothing happened" ); - - } - } - - @Override - public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) { - - } - - @Override - protected void fx( Ballistica bolt, Callback callback ) { - MagicMissile.poison( curUser.sprite.parent, bolt.sourcePos, bolt.collisionPos, callback ); - Sample.INSTANCE.play( Assets.SND_ZAP ); - } - - @Override - public String desc() { - return - "The vile blast of this twisted bit of wood will imbue its target " + - "with a deadly venom. A creature that is poisoned will suffer periodic " + - "damage until the effect ends. The duration of the effect increases " + - "with the level of the staff."; - } -} diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfSlowness.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfSlowness.java deleted file mode 100644 index 3117decd1..000000000 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfSlowness.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Pixel Dungeon - * Copyright (C) 2012-2014 Oleg Dolya - * - * 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.wands; - -import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff; -import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; -import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; -import com.watabou.noosa.audio.Sample; -import com.shatteredpixel.shatteredpixeldungeon.Assets; -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.effects.MagicMissile; -import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; -import com.watabou.utils.Callback; - -public class WandOfSlowness extends Wand { - - { - name = "Wand of Slowness"; - image = ItemSpriteSheet.WAND_FROST; - } - - @Override - protected void onZap( Ballistica bolt) { - Char ch = Actor.findChar( bolt.collisionPos ); - if (ch != null) { - - Buff.affect( ch, Slow.class, Slow.duration( ch ) / 3 + level() ); - - } else { - - GLog.i( "nothing happened" ); - - } - } - - @Override - public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) { - - } - - @Override - protected void fx( Ballistica bolt, Callback callback ) { - MagicMissile.slowness( curUser.sprite.parent, bolt.sourcePos, bolt.collisionPos, callback ); - Sample.INSTANCE.play( Assets.SND_ZAP ); - } - - @Override - public String desc() { - return - "This wand will cause a creature to move and attack " + - "at half its ordinary speed until the effect ends"; - } -} diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfTelekinesis.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfTelekinesis.java deleted file mode 100644 index 64f693262..000000000 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfTelekinesis.java +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Pixel Dungeon - * Copyright (C) 2012-2014 Oleg Dolya - * - * 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.wands; - -import com.shatteredpixel.shatteredpixeldungeon.actors.Char; -import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff; -import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; -import com.watabou.noosa.audio.Sample; -import com.shatteredpixel.shatteredpixeldungeon.Assets; -import com.shatteredpixel.shatteredpixeldungeon.Dungeon; -import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile; -import com.shatteredpixel.shatteredpixeldungeon.items.Dewdrop; -import com.shatteredpixel.shatteredpixeldungeon.items.Heap; -import com.shatteredpixel.shatteredpixeldungeon.items.Item; -import com.shatteredpixel.shatteredpixeldungeon.items.Heap.Type; -import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength; -import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade; -import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; -import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; -import com.watabou.utils.Callback; - -public class WandOfTelekinesis extends Wand { - - private static final String TXT_YOU_NOW_HAVE = "You have magically transported %s into your backpack"; - - { - name = "Wand of Telekinesis"; - image = ItemSpriteSheet.WAND_BLAST_WAVE; - - collisionProperties = Ballistica.STOP_TERRAIN; - } - - @Override - protected void onZap( Ballistica bolt ) { - - //TODO: this whole wand is getting reworked anyway, so screw trying to correct this logic, just rewrite. - /* - boolean mapUpdated = false; - - int maxDistance = level() + 4; - Ballistica.distance = Math.min( Ballistica.distance, maxDistance ); - - Char ch; - Heap heap = null; - - for (int i=1; i < Ballistica.distance; i++) { - - int c = Ballistica.trace[i]; - - int before = Dungeon.level.map[c]; - - if ((ch = Actor.findChar( c )) != null) { - - if (i == Ballistica.distance-1) { - - ch.damage( maxDistance-1 - i, this ); - - } else { - - int next = Ballistica.trace[i + 1]; - if ((Level.passable[next] || Level.avoid[next]) && Actor.findChar( next ) == null) { - - Actor.addDelayed( new Pushing( ch, ch.pos, next ), -1 ); - - ch.pos = next; - Actor.freeCell( next ); - - if (ch instanceof Shopkeeper) - ch.damage( 0, this ); - - // FIXME - if (ch instanceof Mob) { - Dungeon.level.mobPress( (Mob)ch ); - } else { - Dungeon.level.press( ch.pos, ch ); - } - - } else { - - ch.damage( maxDistance-1 - i, this ); - - } - } - } - - if (heap == null && (heap = Dungeon.level.heaps.get( c )) != null) { - switch (heap.type) { - case HEAP: - transport( heap ); - break; - case CHEST: - open( heap ); - break; - default: - } - } - - Dungeon.level.press( c, null ); - if (before == Terrain.OPEN_DOOR && Actor.findChar( c ) == null) { - - Level.set( c, Terrain.DOOR ); - GameScene.updateMap( c ); - - } else if (Level.water[c]) { - - GameScene.ripple( c ); - - } - - if (!mapUpdated && Dungeon.level.map[c] != before) { - mapUpdated = true; - } - } - - if (mapUpdated) { - Dungeon.observe(); - } - */ - } - - @Override - public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) { - - } - - private void transport( Heap heap ) { - Item item = heap.pickUp(); - if (item.doPickUp( curUser )) { - - if (item instanceof Dewdrop) { - - } else { - - if ((item instanceof ScrollOfUpgrade && ((ScrollOfUpgrade)item).isKnown()) || - (item instanceof PotionOfStrength && ((PotionOfStrength)item).isKnown())) { - GLog.p( TXT_YOU_NOW_HAVE, item.name() ); - } else { - GLog.i( TXT_YOU_NOW_HAVE, item.name() ); - } - } - - } else { - Dungeon.level.drop( item, curUser.pos ).sprite.drop(); - } - } - - private void open( Heap heap ) { - heap.type = Type.HEAP; - heap.sprite.link(); - heap.sprite.drop(); - } - - @Override - protected void fx( Ballistica bolt, Callback callback ) { - MagicMissile.force( curUser.sprite.parent, bolt.sourcePos, bolt.collisionPos, callback ); - Sample.INSTANCE.play( Assets.SND_ZAP ); - } - - @Override - public String desc() { - return - "Waves of magic force from this wand will affect all cells on their way triggering traps, trampling high vegetation, " + - "opening closed doors and closing open ones. They also push back monsters."; - } -} diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfTeleportation.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfTeleportation.java deleted file mode 100644 index 9a4cde359..000000000 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfTeleportation.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Pixel Dungeon - * Copyright (C) 2012-2014 Oleg Dolya - * - * 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.wands; - -import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.NPC; -import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff; -import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; -import com.watabou.noosa.audio.Sample; -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.effects.MagicMissile; -import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation; -import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; -import com.watabou.utils.Callback; - -public class WandOfTeleportation extends Wand { - - { - name = "Wand of Teleportation"; - } - - @Override - protected void onZap( Ballistica bolt ) { - - Char ch = Actor.findChar( bolt.collisionPos ); - - if (ch == curUser) { - - ScrollOfTeleportation.teleportHero( curUser ); - - } else if (ch != null && !(ch instanceof NPC)) { - - 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]; - GLog.i( curUser.name + " teleported " + ch.name + " to somewhere" ); - - } - - } else { - - GLog.i( "nothing happened" ); - - } - } - - @Override - public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) { - - } - - @Override - protected void fx( Ballistica bolt, Callback callback ) { - MagicMissile.coldLight( curUser.sprite.parent, bolt.sourcePos, bolt.collisionPos, callback ); - Sample.INSTANCE.play( Assets.SND_ZAP ); - } - - @Override - public String desc() { - return - "A blast from this wand will teleport a creature against " + - "its will to a random place on the current level."; - } -}