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.scenes.GameScene;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
|
|
||||||
import com.watabou.utils.Bundle;
|
import com.watabou.utils.Bundle;
|
||||||
import com.watabou.utils.Random;
|
import com.watabou.utils.Random;
|
||||||
|
|
||||||
|
@ -76,24 +75,25 @@ public class Burning extends Buff implements Hero.Doom {
|
||||||
|
|
||||||
if (target instanceof Hero) {
|
if (target instanceof Hero) {
|
||||||
|
|
||||||
Item item = ((Hero)target).belongings.randomUnequipped();
|
Hero hero = (Hero)target;
|
||||||
|
Item item = hero.belongings.randomUnequipped();
|
||||||
if (item instanceof Scroll) {
|
if (item instanceof Scroll) {
|
||||||
|
|
||||||
item = item.detach( ((Hero)target).belongings.backpack );
|
item = item.detach( hero.belongings.backpack );
|
||||||
GLog.w( TXT_BURNS_UP, item.toString() );
|
GLog.w( TXT_BURNS_UP, item.toString() );
|
||||||
|
|
||||||
Heap.burnFX( target.pos );
|
Heap.burnFX( hero.pos );
|
||||||
|
|
||||||
} else if (item instanceof MysteryMeat) {
|
} else if (item instanceof MysteryMeat) {
|
||||||
|
|
||||||
item = item.detach( ((Hero)target).belongings.backpack );
|
item = item.detach( hero.belongings.backpack );
|
||||||
ChargrilledMeat steak = new ChargrilledMeat();
|
ChargrilledMeat steak = new ChargrilledMeat();
|
||||||
if (!steak.collect( ((Hero)target).belongings.backpack )) {
|
if (!steak.collect( hero.belongings.backpack )) {
|
||||||
Dungeon.level.drop( steak, target.pos ).sprite.drop();
|
Dungeon.level.drop( steak, hero.pos ).sprite.drop();
|
||||||
}
|
}
|
||||||
GLog.w( TXT_BURNS_UP, item.toString() );
|
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.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
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.Item;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.FrozenCarpaccio;
|
import com.shatteredpixel.shatteredpixeldungeon.items.food.FrozenCarpaccio;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.MysteryMeat;
|
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.items.rings.RingOfElements.Resistance;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||||
|
|
||||||
public class Frost extends FlavourBuff {
|
public class Frost extends FlavourBuff {
|
||||||
|
|
||||||
|
private static final String TXT_FREEZES = "%s freezes!";
|
||||||
|
|
||||||
private static final float DURATION = 5f;
|
private static final float DURATION = 5f;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -36,18 +41,35 @@ public class Frost extends FlavourBuff {
|
||||||
|
|
||||||
target.paralysed = true;
|
target.paralysed = true;
|
||||||
Burning.detach( target, Burning.class );
|
Burning.detach( target, Burning.class );
|
||||||
|
|
||||||
if (target instanceof Hero) {
|
if (target instanceof Hero) {
|
||||||
|
|
||||||
Hero hero = (Hero)target;
|
Hero hero = (Hero)target;
|
||||||
Item item = hero.belongings.randomUnequipped();
|
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 );
|
item = item.detach( hero.belongings.backpack );
|
||||||
FrozenCarpaccio carpaccio = new FrozenCarpaccio();
|
FrozenCarpaccio carpaccio = new FrozenCarpaccio();
|
||||||
if (!carpaccio.collect( hero.belongings.backpack )) {
|
if (!carpaccio.collect( hero.belongings.backpack )) {
|
||||||
Dungeon.level.drop( carpaccio, target.pos ).sprite.drop();
|
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;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -218,11 +218,13 @@ public class Potion extends Item {
|
||||||
shatter( hero.pos );
|
shatter( hero.pos );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void shatter( int cell ) {
|
public void shatter( int cell ) {
|
||||||
|
if (Dungeon.visible[cell]) {
|
||||||
GLog.i( "The flask shatters and " + color() + " liquid splashes harmlessly" );
|
GLog.i( "The flask shatters and " + color() + " liquid splashes harmlessly" );
|
||||||
Sample.INSTANCE.play( Assets.SND_SHATTER );
|
Sample.INSTANCE.play( Assets.SND_SHATTER );
|
||||||
splash( cell );
|
splash( cell );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void cast( final Hero user, int dst ) {
|
public void cast( final Hero user, int dst ) {
|
||||||
|
|
|
@ -35,23 +35,26 @@ public class PotionOfFrost extends Potion {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void shatter( int cell ) {
|
public void shatter( int cell ) {
|
||||||
|
|
||||||
PathFinder.buildDistanceMap( cell, BArray.not( Level.losBlocking, null ), DISTANCE );
|
PathFinder.buildDistanceMap( cell, BArray.not( Level.losBlocking, null ), DISTANCE );
|
||||||
|
|
||||||
Fire fire = (Fire)Dungeon.level.blobs.get( Fire.class );
|
Fire fire = (Fire)Dungeon.level.blobs.get( Fire.class );
|
||||||
|
|
||||||
|
boolean visible = false;
|
||||||
for (int i=0; i < Level.LENGTH; i++) {
|
for (int i=0; i < Level.LENGTH; i++) {
|
||||||
if (PathFinder.distance[i] < Integer.MAX_VALUE) {
|
if (PathFinder.distance[i] < Integer.MAX_VALUE) {
|
||||||
Freezing.affect( i, fire );
|
visible = Freezing.affect( i, fire ) || visible;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (visible) {
|
||||||
splash( cell );
|
splash( cell );
|
||||||
Sample.INSTANCE.play( Assets.SND_SHATTER );
|
Sample.INSTANCE.play( Assets.SND_SHATTER );
|
||||||
|
|
||||||
setKnown();
|
setKnown();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String desc() {
|
public String desc() {
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.items.potions;
|
package com.shatteredpixel.shatteredpixeldungeon.items.potions;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ConfusionGas;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ConfusionGas;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||||
|
@ -34,12 +35,14 @@ public class PotionOfLevitation extends Potion {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void shatter( int cell ) {
|
public void shatter( int cell ) {
|
||||||
|
|
||||||
|
if (Dungeon.visible[cell]) {
|
||||||
setKnown();
|
setKnown();
|
||||||
|
|
||||||
splash( cell );
|
splash( cell );
|
||||||
Sample.INSTANCE.play( Assets.SND_SHATTER );
|
Sample.INSTANCE.play( Assets.SND_SHATTER );
|
||||||
|
}
|
||||||
|
|
||||||
GameScene.add( Blob.seed( cell, 1000, ConfusionGas.class ) );
|
GameScene.add( Blob.seed( cell, 1000, ConfusionGas.class ) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
*/
|
*/
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.items.potions;
|
package com.shatteredpixel.shatteredpixeldungeon.items.potions;
|
||||||
|
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.watabou.noosa.audio.Sample;
|
import com.watabou.noosa.audio.Sample;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
|
||||||
|
@ -30,15 +31,16 @@ public class PotionOfLiquidFlame extends Potion {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void shatter( int cell ) {
|
public void shatter( int cell ) {
|
||||||
|
|
||||||
|
if (Dungeon.visible[cell]) {
|
||||||
setKnown();
|
setKnown();
|
||||||
|
|
||||||
splash( cell );
|
splash( cell );
|
||||||
Sample.INSTANCE.play( Assets.SND_SHATTER );
|
Sample.INSTANCE.play( Assets.SND_SHATTER );
|
||||||
|
}
|
||||||
|
|
||||||
Fire fire = Blob.seed( cell, 2, Fire.class );
|
GameScene.add( Blob.seed( cell, 2, Fire.class ) );
|
||||||
GameScene.add( fire );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
*/
|
*/
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.items.potions;
|
package com.shatteredpixel.shatteredpixeldungeon.items.potions;
|
||||||
|
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.watabou.noosa.audio.Sample;
|
import com.watabou.noosa.audio.Sample;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
|
||||||
|
@ -30,12 +31,14 @@ public class PotionOfParalyticGas extends Potion {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void shatter( int cell ) {
|
public void shatter( int cell ) {
|
||||||
|
|
||||||
|
if (Dungeon.visible[cell]) {
|
||||||
setKnown();
|
setKnown();
|
||||||
|
|
||||||
splash( cell );
|
splash( cell );
|
||||||
Sample.INSTANCE.play( Assets.SND_SHATTER );
|
Sample.INSTANCE.play( Assets.SND_SHATTER );
|
||||||
|
}
|
||||||
|
|
||||||
GameScene.add( Blob.seed( cell, 1000, ParalyticGas.class ) );
|
GameScene.add( Blob.seed( cell, 1000, ParalyticGas.class ) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class PotionOfPurity extends Potion {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void shatter( int cell ) {
|
public void shatter( int cell ) {
|
||||||
|
|
||||||
PathFinder.buildDistanceMap( cell, BArray.not( Level.losBlocking, null ), DISTANCE );
|
PathFinder.buildDistanceMap( cell, BArray.not( Level.losBlocking, null ), DISTANCE );
|
||||||
|
|
||||||
|
@ -77,8 +77,10 @@ public class PotionOfPurity extends Potion {
|
||||||
blob.volume -= value;
|
blob.volume -= value;
|
||||||
procd = true;
|
procd = true;
|
||||||
|
|
||||||
|
if (Dungeon.visible[i]) {
|
||||||
CellEmitter.get( i ).burst( Speck.factory( Speck.DISCOVER ), 1 );
|
CellEmitter.get( i ).burst( Speck.factory( Speck.DISCOVER ), 1 );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,8 +90,10 @@ public class PotionOfPurity extends Potion {
|
||||||
|
|
||||||
if (procd) {
|
if (procd) {
|
||||||
|
|
||||||
|
if (Dungeon.visible[cell]) {
|
||||||
splash( cell );
|
splash( cell );
|
||||||
Sample.INSTANCE.play( Assets.SND_SHATTER );
|
Sample.INSTANCE.play( Assets.SND_SHATTER );
|
||||||
|
}
|
||||||
|
|
||||||
setKnown();
|
setKnown();
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
*/
|
*/
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.items.potions;
|
package com.shatteredpixel.shatteredpixeldungeon.items.potions;
|
||||||
|
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.watabou.noosa.audio.Sample;
|
import com.watabou.noosa.audio.Sample;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||||
|
@ -31,16 +32,16 @@ public class PotionOfToxicGas extends Potion {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void shatter( int cell ) {
|
public void shatter( int cell ) {
|
||||||
|
|
||||||
|
if (Dungeon.visible[cell]) {
|
||||||
setKnown();
|
setKnown();
|
||||||
|
|
||||||
splash( cell );
|
splash( cell );
|
||||||
Sample.INSTANCE.play( Assets.SND_SHATTER );
|
Sample.INSTANCE.play( Assets.SND_SHATTER );
|
||||||
|
}
|
||||||
|
|
||||||
ToxicGas gas = Blob.seed( cell, 1000, ToxicGas.class );
|
GameScene.add( Blob.seed( cell, 1000, ToxicGas.class ) );
|
||||||
Actor.add( gas );
|
|
||||||
GameScene.add( gas );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue
Block a user