Merging 1.7.5 Source: items/ changes
This commit is contained in:
parent
a6c89490b0
commit
41e1f20e95
|
@ -96,7 +96,7 @@ public abstract class EquipableItem extends Item {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean doUnequip( Hero hero, boolean collect ) {
|
final public boolean doUnequip( Hero hero, boolean collect ) {
|
||||||
return doUnequip( hero, collect, true );
|
return doUnequip( hero, collect, true );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,15 +22,18 @@ import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
|
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
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.hero.Hero;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mimic;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Wraith;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Wraith;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Splash;
|
import com.shatteredpixel.shatteredpixeldungeon.effects.Splash;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ElmoParticle;
|
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.effects.particles.ShadowParticle;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.AlchemistsToolkit;
|
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.Blandfruit;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.ChargrilledMeat;
|
import com.shatteredpixel.shatteredpixeldungeon.items.food.ChargrilledMeat;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.FrozenCarpaccio;
|
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.potions.PotionOfHealing;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
|
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant.Seed;
|
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant.Seed;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
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.noosa.audio.Sample;
|
||||||
import com.watabou.utils.Bundlable;
|
import com.watabou.utils.Bundlable;
|
||||||
import com.watabou.utils.Bundle;
|
import com.watabou.utils.Bundle;
|
||||||
|
@ -52,6 +58,8 @@ import java.util.LinkedList;
|
||||||
|
|
||||||
public class Heap implements Bundlable {
|
public class Heap implements Bundlable {
|
||||||
|
|
||||||
|
private static final String TXT_MIMIC = "This is a mimic!";
|
||||||
|
|
||||||
private static final int SEEDS_TO_POTION = 3;
|
private static final int SEEDS_TO_POTION = 3;
|
||||||
|
|
||||||
public enum Type {
|
public enum Type {
|
||||||
|
@ -62,7 +70,8 @@ public class Heap implements Bundlable {
|
||||||
CRYSTAL_CHEST,
|
CRYSTAL_CHEST,
|
||||||
TOMB,
|
TOMB,
|
||||||
SKELETON,
|
SKELETON,
|
||||||
REMAINS
|
REMAINS,
|
||||||
|
MIMIC
|
||||||
}
|
}
|
||||||
public Type type = Type.HEAP;
|
public Type type = Type.HEAP;
|
||||||
|
|
||||||
|
@ -70,7 +79,7 @@ public class Heap implements Bundlable {
|
||||||
|
|
||||||
public ItemSprite sprite;
|
public ItemSprite sprite;
|
||||||
|
|
||||||
protected LinkedList<Item> items = new LinkedList<Item>();
|
public LinkedList<Item> items = new LinkedList<Item>();
|
||||||
|
|
||||||
public int image() {
|
public int image() {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -78,6 +87,7 @@ public class Heap implements Bundlable {
|
||||||
case FOR_SALE:
|
case FOR_SALE:
|
||||||
return size() > 0 ? items.peek().image() : 0;
|
return size() > 0 ? items.peek().image() : 0;
|
||||||
case CHEST:
|
case CHEST:
|
||||||
|
case MIMIC:
|
||||||
return ItemSpriteSheet.CHEST;
|
return ItemSpriteSheet.CHEST;
|
||||||
case LOCKED_CHEST:
|
case LOCKED_CHEST:
|
||||||
return ItemSpriteSheet.LOCKED_CHEST;
|
return ItemSpriteSheet.LOCKED_CHEST;
|
||||||
|
@ -100,6 +110,14 @@ public class Heap implements Bundlable {
|
||||||
|
|
||||||
public void open( Hero hero ) {
|
public void open( Hero hero ) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
case MIMIC:
|
||||||
|
if (Mimic.spawnAt(pos, items) != null) {
|
||||||
|
GLog.n(TXT_MIMIC);
|
||||||
|
destroy();
|
||||||
|
} else {
|
||||||
|
type = Type.CHEST;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case TOMB:
|
case TOMB:
|
||||||
Wraith.spawnAround( hero.pos );
|
Wraith.spawnAround( hero.pos );
|
||||||
break;
|
break;
|
||||||
|
@ -120,10 +138,12 @@ public class Heap implements Bundlable {
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (type != Type.MIMIC) {
|
||||||
type = Type.HEAP;
|
type = Type.HEAP;
|
||||||
sprite.link();
|
sprite.link();
|
||||||
sprite.drop();
|
sprite.drop();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public int size() {
|
public int size() {
|
||||||
return items.size();
|
return items.size();
|
||||||
|
@ -181,6 +201,15 @@ public class Heap implements Bundlable {
|
||||||
|
|
||||||
public void burn() {
|
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) {
|
if (type != Type.HEAP) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -222,6 +251,14 @@ public class Heap implements Bundlable {
|
||||||
|
|
||||||
public void freeze() {
|
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) {
|
if (type != Type.HEAP) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -270,7 +270,7 @@ public class Item implements Bundlable {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Item upgrade( int n ) {
|
final public Item upgrade( int n ) {
|
||||||
for (int i=0; i < n; i++) {
|
for (int i=0; i < n; i++) {
|
||||||
upgrade();
|
upgrade();
|
||||||
}
|
}
|
||||||
|
@ -285,7 +285,7 @@ public class Item implements Bundlable {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Item degrade( int n ) {
|
final public Item degrade( int n ) {
|
||||||
for (int i=0; i < n; i++) {
|
for (int i=0; i < n; i++) {
|
||||||
degrade();
|
degrade();
|
||||||
}
|
}
|
||||||
|
@ -455,17 +455,24 @@ public class Item implements Bundlable {
|
||||||
user.sprite.zap( cell );
|
user.sprite.zap( cell );
|
||||||
user.busy();
|
user.busy();
|
||||||
|
|
||||||
|
Sample.INSTANCE.play( Assets.SND_MISS, 0.6f, 0.6f, 1.5f );
|
||||||
|
|
||||||
Char enemy = Actor.findChar( cell );
|
Char enemy = Actor.findChar( cell );
|
||||||
QuickSlotButton.target(enemy);
|
QuickSlotButton.target(enemy);
|
||||||
|
|
||||||
|
// FIXME!!!
|
||||||
float delay = TIME_TO_THROW;
|
float delay = TIME_TO_THROW;
|
||||||
if (this instanceof MissileWeapon) {
|
if (this instanceof MissileWeapon) {
|
||||||
|
|
||||||
// FIXME
|
|
||||||
delay *= ((MissileWeapon)this).speedFactor( user );
|
delay *= ((MissileWeapon)this).speedFactor( user );
|
||||||
if (enemy != null && enemy.buff( SnipersMark.class ) != null) {
|
if (enemy != null) {
|
||||||
|
SnipersMark mark = user.buff( SnipersMark.class );
|
||||||
|
if (mark != null) {
|
||||||
|
if (mark.object == enemy.id()) {
|
||||||
delay *= 0.5f;
|
delay *= 0.5f;
|
||||||
}
|
}
|
||||||
|
user.remove( mark );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
final float finalDelay = delay;
|
final float finalDelay = delay;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user