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.

This commit is contained in:
Evan Debenham 2015-02-15 05:09:50 -05:00
parent 1e5a6663be
commit 34d4c63a16
2 changed files with 34 additions and 9 deletions

View File

@ -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() {

View File

@ -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