From 34d4c63a160960b8e3f9bc5507fff95c5ee593bd Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sun, 15 Feb 2015 05:09:50 -0500 Subject: [PATCH] v0.2.4: potions of liquid flame now work in a 3x3 grid instead of 1x1, all potions now put out flames at the tile they are thrown. --- .../items/potions/Potion.java | 25 +++++++++++++------ .../items/potions/PotionOfLiquidFlame.java | 18 ++++++++++++- 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java index 2cdeddb35..75b6a6119 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java @@ -20,6 +20,11 @@ package com.shatteredpixel.shatteredpixeldungeon.items.potions; import java.util.ArrayList; import java.util.HashSet; +import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; +import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning; import com.watabou.noosa.audio.Sample; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Badges; @@ -190,7 +195,7 @@ public class Potion extends Item { hero.spend( TIME_TO_DRINK ); hero.busy(); - onThrow( hero.pos ); + apply( hero ); Sample.INSTANCE.play( Assets.SND_DRINK ); @@ -199,11 +204,7 @@ public class Potion extends Item { @Override protected void onThrow( int cell ) { - if (Dungeon.hero.pos == cell) { - - apply( Dungeon.hero ); - - } else if (Dungeon.level.map[cell] == Terrain.WELL || Level.pit[cell]) { + if (Dungeon.level.map[cell] == Terrain.WELL || Level.pit[cell]) { super.onThrow( cell ); @@ -291,10 +292,18 @@ public class Potion extends Item { return handler.known().size() == potions.length; } - protected void splash( int cell ) { + protected void splash( int cell ) { final int color = ItemSprite.pick( image, 8, 10 ); Splash.at( cell, color, 5 ); - } + + Fire fire = (Fire)Dungeon.level.blobs.get( Fire.class ); + if (fire != null) + fire.clear( cell ); + + Char ch = Actor.findChar(cell); + if (ch != null) + Buff.detach( ch, Burning.class ); + } @Override public int price() { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfLiquidFlame.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfLiquidFlame.java index cdc449eaa..939c65490 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfLiquidFlame.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfLiquidFlame.java @@ -18,6 +18,10 @@ package com.shatteredpixel.shatteredpixeldungeon.items.potions; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; +import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter; +import com.shatteredpixel.shatteredpixeldungeon.effects.particles.FlameParticle; +import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.watabou.noosa.audio.Sample; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob; @@ -40,7 +44,19 @@ public class PotionOfLiquidFlame extends Potion { Sample.INSTANCE.play( Assets.SND_SHATTER ); } - GameScene.add( Blob.seed( cell, 2, Fire.class ) ); + for (int offset : Level.NEIGHBOURS9){ + if (Level.flamable[cell+offset] + || Actor.findChar(cell+offset) != null + || Dungeon.level.heaps.get(cell+offset) != null) { + + GameScene.add(Blob.seed(cell + offset, 2, Fire.class)); + + } else { + + CellEmitter.get(cell+offset).burst(FlameParticle.FACTORY, 2); + + } + } } @Override