v0.2.4: made potions susceptible to cold, refactored a bit of buff logic.
This commit is contained in:
parent
ae2ba8be0e
commit
72975a49cc
|
@ -36,7 +36,6 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
|
||||
import com.watabou.utils.Bundle;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
|
@ -75,25 +74,26 @@ public class Burning extends Buff implements Hero.Doom {
|
|||
target.damage( Random.Int( 1, 5 ), this );
|
||||
|
||||
if (target instanceof Hero) {
|
||||
|
||||
Item item = ((Hero)target).belongings.randomUnequipped();
|
||||
|
||||
Hero hero = (Hero)target;
|
||||
Item item = hero.belongings.randomUnequipped();
|
||||
if (item instanceof Scroll) {
|
||||
|
||||
item = item.detach( ((Hero)target).belongings.backpack );
|
||||
item = item.detach( hero.belongings.backpack );
|
||||
GLog.w( TXT_BURNS_UP, item.toString() );
|
||||
|
||||
Heap.burnFX( target.pos );
|
||||
Heap.burnFX( hero.pos );
|
||||
|
||||
} else if (item instanceof MysteryMeat) {
|
||||
|
||||
item = item.detach( ((Hero)target).belongings.backpack );
|
||||
item = item.detach( hero.belongings.backpack );
|
||||
ChargrilledMeat steak = new ChargrilledMeat();
|
||||
if (!steak.collect( ((Hero)target).belongings.backpack )) {
|
||||
Dungeon.level.drop( steak, target.pos ).sprite.drop();
|
||||
if (!steak.collect( hero.belongings.backpack )) {
|
||||
Dungeon.level.drop( steak, hero.pos ).sprite.drop();
|
||||
}
|
||||
GLog.w( TXT_BURNS_UP, item.toString() );
|
||||
|
||||
Heap.burnFX( target.pos );
|
||||
Heap.burnFX( hero.pos );
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -20,14 +20,19 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Thief;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.FrozenCarpaccio;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.MysteryMeat;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements.Resistance;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
|
||||
public class Frost extends FlavourBuff {
|
||||
|
||||
private static final String TXT_FREEZES = "%s freezes!";
|
||||
|
||||
private static final float DURATION = 5f;
|
||||
|
||||
@Override
|
||||
|
@ -36,18 +41,35 @@ public class Frost extends FlavourBuff {
|
|||
|
||||
target.paralysed = true;
|
||||
Burning.detach( target, Burning.class );
|
||||
|
||||
if (target instanceof Hero) {
|
||||
|
||||
Hero hero = (Hero)target;
|
||||
Item item = hero.belongings.randomUnequipped();
|
||||
if (item instanceof MysteryMeat) {
|
||||
if (item instanceof Potion) {
|
||||
|
||||
item = item.detach( hero.belongings.backpack );
|
||||
GLog.w(TXT_FREEZES, item.toString());
|
||||
((Potion) item).shatter(hero.pos);
|
||||
|
||||
} else if (item instanceof MysteryMeat) {
|
||||
|
||||
item = item.detach( hero.belongings.backpack );
|
||||
FrozenCarpaccio carpaccio = new FrozenCarpaccio();
|
||||
if (!carpaccio.collect( hero.belongings.backpack )) {
|
||||
Dungeon.level.drop( carpaccio, target.pos ).sprite.drop();
|
||||
}
|
||||
GLog.w(TXT_FREEZES, item.toString());
|
||||
|
||||
}
|
||||
} else if (target instanceof Thief && ((Thief)target).item instanceof Potion) {
|
||||
|
||||
((Potion) ((Thief)target).item).shatter( target.pos );
|
||||
((Thief) target).item = null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user