v0.2.4: made potions susceptible to cold, refactored a bit of buff logic.

This commit is contained in:
Evan Debenham
2015-02-10 02:09:57 -05:00
parent ae2ba8be0e
commit 72975a49cc
9 changed files with 101 additions and 61 deletions
@@ -218,10 +218,12 @@ public class Potion extends Item {
shatter( hero.pos );
}
protected void shatter( int cell ) {
GLog.i( "The flask shatters and " + color() + " liquid splashes harmlessly" );
Sample.INSTANCE.play( Assets.SND_SHATTER );
splash( cell );
public void shatter( int cell ) {
if (Dungeon.visible[cell]) {
GLog.i( "The flask shatters and " + color() + " liquid splashes harmlessly" );
Sample.INSTANCE.play( Assets.SND_SHATTER );
splash( cell );
}
}
@Override
@@ -35,22 +35,25 @@ public class PotionOfFrost extends Potion {
}
@Override
protected void shatter( int cell ) {
public void shatter( int cell ) {
PathFinder.buildDistanceMap( cell, BArray.not( Level.losBlocking, null ), DISTANCE );
Fire fire = (Fire)Dungeon.level.blobs.get( Fire.class );
boolean visible = false;
for (int i=0; i < Level.LENGTH; i++) {
if (PathFinder.distance[i] < Integer.MAX_VALUE) {
Freezing.affect( i, fire );
visible = Freezing.affect( i, fire ) || visible;
}
}
splash( cell );
Sample.INSTANCE.play( Assets.SND_SHATTER );
setKnown();
if (visible) {
splash( cell );
Sample.INSTANCE.play( Assets.SND_SHATTER );
setKnown();
}
}
@Override
@@ -18,6 +18,7 @@
package com.shatteredpixel.shatteredpixeldungeon.items.potions;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ConfusionGas;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
@@ -34,14 +35,16 @@ public class PotionOfLevitation extends Potion {
}
@Override
protected void shatter( int cell ) {
public void shatter( int cell ) {
setKnown();
if (Dungeon.visible[cell]) {
setKnown();
splash( cell );
Sample.INSTANCE.play( Assets.SND_SHATTER );
splash( cell );
Sample.INSTANCE.play( Assets.SND_SHATTER );
}
GameScene.add( Blob.seed( cell, 1000, ConfusionGas.class ) );
GameScene.add( Blob.seed( cell, 1000, ConfusionGas.class ) );
}
@Override
@@ -17,6 +17,7 @@
*/
package com.shatteredpixel.shatteredpixeldungeon.items.potions;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.watabou.noosa.audio.Sample;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
@@ -30,15 +31,16 @@ public class PotionOfLiquidFlame extends Potion {
}
@Override
protected void shatter( int cell ) {
setKnown();
splash( cell );
Sample.INSTANCE.play( Assets.SND_SHATTER );
Fire fire = Blob.seed( cell, 2, Fire.class );
GameScene.add( fire );
public void shatter( int cell ) {
if (Dungeon.visible[cell]) {
setKnown();
splash( cell );
Sample.INSTANCE.play( Assets.SND_SHATTER );
}
GameScene.add( Blob.seed( cell, 2, Fire.class ) );
}
@Override
@@ -17,6 +17,7 @@
*/
package com.shatteredpixel.shatteredpixeldungeon.items.potions;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.watabou.noosa.audio.Sample;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
@@ -30,13 +31,15 @@ public class PotionOfParalyticGas extends Potion {
}
@Override
protected void shatter( int cell ) {
setKnown();
splash( cell );
Sample.INSTANCE.play( Assets.SND_SHATTER );
public void shatter( int cell ) {
if (Dungeon.visible[cell]) {
setKnown();
splash( cell );
Sample.INSTANCE.play( Assets.SND_SHATTER );
}
GameScene.add( Blob.seed( cell, 1000, ParalyticGas.class ) );
}
@@ -47,7 +47,7 @@ public class PotionOfPurity extends Potion {
}
@Override
protected void shatter( int cell ) {
public void shatter( int cell ) {
PathFinder.buildDistanceMap( cell, BArray.not( Level.losBlocking, null ), DISTANCE );
@@ -76,8 +76,10 @@ public class PotionOfPurity extends Potion {
blob.cur[i] = 0;
blob.volume -= value;
procd = true;
CellEmitter.get( i ).burst( Speck.factory( Speck.DISCOVER ), 1 );
if (Dungeon.visible[i]) {
CellEmitter.get( i ).burst( Speck.factory( Speck.DISCOVER ), 1 );
}
}
}
@@ -87,12 +89,14 @@ public class PotionOfPurity extends Potion {
boolean heroAffected = PathFinder.distance[Dungeon.hero.pos] < Integer.MAX_VALUE;
if (procd) {
splash( cell );
Sample.INSTANCE.play( Assets.SND_SHATTER );
if (Dungeon.visible[cell]) {
splash( cell );
Sample.INSTANCE.play( Assets.SND_SHATTER );
}
setKnown();
if (heroAffected) {
GLog.p( TXT_FRESHNESS );
}
@@ -17,6 +17,7 @@
*/
package com.shatteredpixel.shatteredpixeldungeon.items.potions;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.watabou.noosa.audio.Sample;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
@@ -31,16 +32,16 @@ public class PotionOfToxicGas extends Potion {
}
@Override
protected void shatter( int cell ) {
setKnown();
splash( cell );
Sample.INSTANCE.play( Assets.SND_SHATTER );
ToxicGas gas = Blob.seed( cell, 1000, ToxicGas.class );
Actor.add( gas );
GameScene.add( gas );
public void shatter( int cell ) {
if (Dungeon.visible[cell]) {
setKnown();
splash( cell );
Sample.INSTANCE.play( Assets.SND_SHATTER );
}
GameScene.add( Blob.seed( cell, 1000, ToxicGas.class ) );
}
@Override