diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java b/src/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java index 120150fb8..1831177f3 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java @@ -55,6 +55,11 @@ public class ShatteredPixelDungeon extends Game { com.shatteredpixel.shatteredpixeldungeon.items.artifacts.LloydsBeacon.class, "com.shatteredpixel.shatteredpixeldungeon.items.LloydsBeacon" ); + // 0.3.0 + com.watabou.utils.Bundle.addAlias( + com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfVenom.class, + "com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfPoison" ); + } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/VenomGas.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/VenomGas.java new file mode 100644 index 000000000..9fda9e40c --- /dev/null +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/VenomGas.java @@ -0,0 +1,40 @@ +package com.shatteredpixel.shatteredpixeldungeon.actors.blobs; + +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.Venom; +import com.shatteredpixel.shatteredpixeldungeon.effects.BlobEmitter; +import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; + +/** + * Created by Evan on 12/04/2015. + */ +public class VenomGas extends Blob { + //TODO: do I want mobs to avoid this gas? + + @Override + protected void evolve() { + super.evolve(); + + Char ch; + for (int i=0; i < LENGTH; i++) { + if (cur[i] > 0 && (ch = Actor.findChar(i)) != null) { + if (!ch.immunities().contains(this.getClass())) + Buff.affect(ch, Venom.class).set(2f); + } + } + } + + @Override + public void use( BlobEmitter emitter ) { + super.use( emitter ); + + emitter.pour( Speck.factory(Speck.VENOM), 0.6f ); + } + + @Override + public String tileDesc() { + return "A could of foul acidic venom is swirling here."; + } +} diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/GasesImmunity.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/GasesImmunity.java index f249509b0..5c8c6c937 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/GasesImmunity.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/GasesImmunity.java @@ -21,13 +21,12 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ConfusionGas; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ParalyticGas; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.StenchGas; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ToxicGas; +import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.VenomGas; import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; -import java.util.HashSet; - public class GasesImmunity extends FlavourBuff { - public static final float DURATION = 10f; + public static final float DURATION = 15f; @Override public int icon() { @@ -44,5 +43,6 @@ public class GasesImmunity extends FlavourBuff { immunities.add( ToxicGas.class ); immunities.add( ConfusionGas.class ); immunities.add( StenchGas.class ); + immunities.add( VenomGas.class ); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Venom.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Venom.java new file mode 100644 index 000000000..b49a25865 --- /dev/null +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Venom.java @@ -0,0 +1,58 @@ +package com.shatteredpixel.shatteredpixeldungeon.actors.buffs; + +import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; +import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; +import com.watabou.utils.Bundle; + +/** + * Created by Evan on 12/04/2015. + */ +public class Venom extends Poison implements Hero.Doom { + + private int damage = 1+ Dungeon.depth/5; + + private static final String DAMAGE = "damage"; + + @Override + public void storeInBundle( Bundle bundle ) { + super.storeInBundle( bundle ); + bundle.put( DAMAGE, damage ); + + } + + @Override + public void restoreFromBundle( Bundle bundle ) { + super.restoreFromBundle( bundle ); + damage = bundle.getInt( DAMAGE ); + } + + @Override + public int icon() { + return BuffIndicator.POISON; + } + + @Override + public String toString() { + return "Venomed"; + } + + @Override + public boolean act() { + if (target.isAlive()) { + target.damage(damage, this); + damage = Math.min(damage+1+Dungeon.depth/10, Dungeon.depth+1); + + //want it to act after the cloud of venom it came from. + spend( TICK+0.1f ); + if ((left -= TICK) <= 0) { + detach(); + } + } else { + detach(); + } + + return true; + } + +} diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/Speck.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/Speck.java index a79d558ca..6fa16948e 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/Speck.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/Speck.java @@ -54,11 +54,12 @@ public class Speck extends Image { public static final int RATTLE = 105; public static final int JET = 106; public static final int TOXIC = 107; - public static final int PARALYSIS = 108; - public static final int DUST = 109; - public static final int STENCH = 110; - public static final int FORGE = 111; - public static final int CONFUSION = 112; + public static final int VENOM = 108; + public static final int PARALYSIS = 109; + public static final int DUST = 110; + public static final int STENCH = 111; + public static final int FORGE = 112; + public static final int CONFUSION = 113; private static final int SIZE = 7; @@ -100,6 +101,7 @@ public class Speck extends Image { break; case JET: case TOXIC: + case VENOM: case PARALYSIS: case STENCH: case CONFUSION: @@ -269,6 +271,13 @@ public class Speck extends Image { angle = Random.Float( 360 ); lifespan = Random.Float( 1f, 3f ); break; + + case VENOM: + hardlight( 0x330033 ); + angularSpeed = 30; + angle = Random.Float( 360 ); + lifespan = Random.Float( 1f, 3f ); + break; case PARALYSIS: hardlight( 0xFFFF66 ); @@ -404,6 +413,7 @@ public class Speck extends Image { scale.set( 1 + p * 2 ); break; + case VENOM: case STENCH: am = (p < 0.5f ? p : 1 - p) * 2; scale.set( 1 + p * 2 ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfPurity.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfPurity.java index f2b9a78d8..ea722499f 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfPurity.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfPurity.java @@ -19,6 +19,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.potions; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ConfusionGas; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.StenchGas; +import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.VenomGas; import com.watabou.noosa.audio.Sample; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; @@ -58,7 +59,8 @@ public class PotionOfPurity extends Potion { Dungeon.level.blobs.get( ToxicGas.class ), Dungeon.level.blobs.get( ParalyticGas.class ), Dungeon.level.blobs.get( ConfusionGas.class ), - Dungeon.level.blobs.get( StenchGas.class ) + Dungeon.level.blobs.get( StenchGas.class ), + Dungeon.level.blobs.get( VenomGas.class ) }; for (int j=0; j < blobs.length; j++) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfPoison.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfPoison.java index 4cc85fa5e..a75652abd 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfPoison.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfPoison.java @@ -34,7 +34,7 @@ public class WandOfPoison extends Wand { { name = "Wand of Poison"; - image = ItemSpriteSheet.WAND_ACID; + image = ItemSpriteSheet.WAND_VENOM; } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfVenom.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfVenom.java new file mode 100644 index 000000000..9a98c2052 --- /dev/null +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfVenom.java @@ -0,0 +1,55 @@ +package com.shatteredpixel.shatteredpixeldungeon.items.wands; + +import com.shatteredpixel.shatteredpixeldungeon.Assets; +import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob; +import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.VenomGas; +import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Poison; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff; +import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; +import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; +import com.watabou.noosa.audio.Sample; +import com.watabou.utils.Callback; + +/** + * Created by Evan on 12/04/2015. + */ +public class WandOfVenom extends Wand { + + { + name = "Wand of Venom"; + //TODO: final sprite + image = ItemSpriteSheet.WAND_VENOM; + + collisionProperties = Ballistica.STOP_TARGET | Ballistica.STOP_TERRAIN; + } + + @Override + protected void onZap(Ballistica bolt) { + //TODO: final balancing + GameScene.add(Blob.seed(bolt.collisionPos, 40+20*level, VenomGas.class)); + } + + @Override + protected void fx(Ballistica bolt, Callback callback) { + //TODO: final visuals + MagicMissile.poison(curUser.sprite.parent, bolt.sourcePos, bolt.collisionPos, callback); + Sample.INSTANCE.play(Assets.SND_ZAP); + } + + @Override + public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) { + new Poison().proc(staff, attacker, defender, damage); + } + + @Override + public String desc() { + return + "This wand has a purple body which opens to a shining green gem. " + + "A small amount of foul smelling gas leaks from the gem.\n\n" + + "This wand shoots a bolt which explodes into a cloud of vile venomous gas at a targeted location. " + + "Anything caught inside this cloud will constantly take damage, increasing with time."; + } +} diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java index b8f218133..ffb7bac04 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java @@ -118,7 +118,7 @@ public class ItemSpriteSheet { public static final int WAND_LIGHTNING = ROW6+3; public static final int WAND_DISINTEGRATION = ROW6+4; public static final int WAND_PRISMATIC_LIGHT= ROW6+5; - public static final int WAND_ACID = ROW6+6; + public static final int WAND_VENOM = ROW6+6; public static final int WAND_CORRUPTION = ROW6+7; public static final int WAND_WARDING = ROW6+8; public static final int WAND_REGROWTH = ROW6+9;