Merging 1.7.5 Source: items/ changes
This commit is contained in:
@@ -22,15 +22,18 @@ import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Frost;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mimic;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Wraith;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Splash;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ElmoParticle;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.FlameParticle;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShadowParticle;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.AlchemistsToolkit;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.Artifact;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.Blandfruit;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.ChargrilledMeat;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.FrozenCarpaccio;
|
||||
@@ -39,8 +42,11 @@ import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfExperience
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant.Seed;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndTitledMessage;
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
import com.watabou.utils.Bundlable;
|
||||
import com.watabou.utils.Bundle;
|
||||
@@ -52,6 +58,8 @@ import java.util.LinkedList;
|
||||
|
||||
public class Heap implements Bundlable {
|
||||
|
||||
private static final String TXT_MIMIC = "This is a mimic!";
|
||||
|
||||
private static final int SEEDS_TO_POTION = 3;
|
||||
|
||||
public enum Type {
|
||||
@@ -62,7 +70,8 @@ public class Heap implements Bundlable {
|
||||
CRYSTAL_CHEST,
|
||||
TOMB,
|
||||
SKELETON,
|
||||
REMAINS
|
||||
REMAINS,
|
||||
MIMIC
|
||||
}
|
||||
public Type type = Type.HEAP;
|
||||
|
||||
@@ -70,7 +79,7 @@ public class Heap implements Bundlable {
|
||||
|
||||
public ItemSprite sprite;
|
||||
|
||||
protected LinkedList<Item> items = new LinkedList<Item>();
|
||||
public LinkedList<Item> items = new LinkedList<Item>();
|
||||
|
||||
public int image() {
|
||||
switch (type) {
|
||||
@@ -78,6 +87,7 @@ public class Heap implements Bundlable {
|
||||
case FOR_SALE:
|
||||
return size() > 0 ? items.peek().image() : 0;
|
||||
case CHEST:
|
||||
case MIMIC:
|
||||
return ItemSpriteSheet.CHEST;
|
||||
case LOCKED_CHEST:
|
||||
return ItemSpriteSheet.LOCKED_CHEST;
|
||||
@@ -100,6 +110,14 @@ public class Heap implements Bundlable {
|
||||
|
||||
public void open( Hero hero ) {
|
||||
switch (type) {
|
||||
case MIMIC:
|
||||
if (Mimic.spawnAt(pos, items) != null) {
|
||||
GLog.n(TXT_MIMIC);
|
||||
destroy();
|
||||
} else {
|
||||
type = Type.CHEST;
|
||||
}
|
||||
break;
|
||||
case TOMB:
|
||||
Wraith.spawnAround( hero.pos );
|
||||
break;
|
||||
@@ -119,10 +137,12 @@ public class Heap implements Bundlable {
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
type = Type.HEAP;
|
||||
sprite.link();
|
||||
sprite.drop();
|
||||
|
||||
if (type != Type.MIMIC) {
|
||||
type = Type.HEAP;
|
||||
sprite.link();
|
||||
sprite.drop();
|
||||
}
|
||||
}
|
||||
|
||||
public int size() {
|
||||
@@ -180,7 +200,16 @@ public class Heap implements Bundlable {
|
||||
}
|
||||
|
||||
public void burn() {
|
||||
|
||||
|
||||
if (type == Type.MIMIC) {
|
||||
Mimic m = Mimic.spawnAt( pos, items );
|
||||
if (m != null) {
|
||||
Buff.affect( m, Burning.class ).reignite( m );
|
||||
m.sprite.emitter().burst( FlameParticle.FACTORY, 5 );
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
|
||||
if (type != Type.HEAP) {
|
||||
return;
|
||||
}
|
||||
@@ -221,7 +250,15 @@ public class Heap implements Bundlable {
|
||||
}
|
||||
|
||||
public void freeze() {
|
||||
|
||||
|
||||
if (type == Type.MIMIC) {
|
||||
Mimic m = Mimic.spawnAt( pos, items );
|
||||
if (m != null) {
|
||||
Buff.prolong( m, Frost.class, Frost.duration( m ) * Random.Float( 1.0f, 1.5f ) );
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
|
||||
if (type != Type.HEAP) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user