use of com.watabou.pixeldungeon.items.food.MysteryMeat in project pixel-dungeon by watabou.
the class Heap method 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) {
return;
}
boolean frozen = false;
for (Item item : items.toArray(new Item[0])) {
if (item instanceof MysteryMeat) {
replace(item, FrozenCarpaccio.cook((MysteryMeat) item));
frozen = true;
}
}
if (frozen) {
if (isEmpty()) {
destroy();
} else if (sprite != null) {
sprite.view(image(), glowing());
}
}
}
use of com.watabou.pixeldungeon.items.food.MysteryMeat in project pixel-dungeon by watabou.
the class Burning method act.
@Override
public boolean act() {
if (target.isAlive()) {
if (target instanceof Hero) {
Buff.prolong(target, Light.class, TICK * 1.01f);
}
target.damage(Random.Int(1, 5), this);
if (target instanceof Hero) {
Item item = ((Hero) target).belongings.randomUnequipped();
if (item instanceof Scroll) {
item = item.detach(((Hero) target).belongings.backpack);
GLog.w(TXT_BURNS_UP, item.toString());
Heap.burnFX(target.pos);
} else if (item instanceof MysteryMeat) {
item = item.detach(((Hero) target).belongings.backpack);
ChargrilledMeat steak = new ChargrilledMeat();
if (!steak.collect(((Hero) target).belongings.backpack)) {
Dungeon.level.drop(steak, target.pos).sprite.drop();
}
GLog.w(TXT_BURNS_UP, item.toString());
Heap.burnFX(target.pos);
}
} else if (target instanceof Thief && ((Thief) target).item instanceof Scroll) {
((Thief) target).item = null;
target.sprite.emitter().burst(ElmoParticle.FACTORY, 6);
}
} else {
detach();
}
if (Level.flamable[target.pos]) {
GameScene.add(Blob.seed(target.pos, 4, Fire.class));
}
spend(TICK);
left -= TICK;
if (left <= 0 || Random.Float() > (2 + (float) target.HP / target.HT) / 3 || (Level.water[target.pos] && !target.flying)) {
detach();
}
return true;
}
use of com.watabou.pixeldungeon.items.food.MysteryMeat in project pixel-dungeon by watabou.
the class Frost method attachTo.
@Override
public boolean attachTo(Char target) {
if (super.attachTo(target)) {
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) {
item = item.detach(hero.belongings.backpack);
FrozenCarpaccio carpaccio = new FrozenCarpaccio();
if (!carpaccio.collect(hero.belongings.backpack)) {
Dungeon.level.drop(carpaccio, target.pos).sprite.drop();
}
}
}
return true;
} else {
return false;
}
}
use of com.watabou.pixeldungeon.items.food.MysteryMeat in project pixel-dungeon by watabou.
the class Piranha method die.
@Override
public void die(Object cause) {
Dungeon.level.drop(new MysteryMeat(), pos).sprite.drop();
super.die(cause);
Statistics.piranhasKilled++;
Badges.validatePiranhasKilled();
}
use of com.watabou.pixeldungeon.items.food.MysteryMeat in project pixel-dungeon by watabou.
the class Heap method 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) {
return;
}
boolean burnt = false;
boolean evaporated = false;
for (Item item : items.toArray(new Item[0])) {
if (item instanceof Scroll) {
items.remove(item);
burnt = true;
} else if (item instanceof Dewdrop) {
items.remove(item);
evaporated = true;
} else if (item instanceof MysteryMeat) {
replace(item, ChargrilledMeat.cook((MysteryMeat) item));
burnt = true;
}
}
if (burnt || evaporated) {
if (Dungeon.visible[pos]) {
if (burnt) {
burnFX(pos);
} else {
evaporateFX(pos);
}
}
if (isEmpty()) {
destroy();
} else if (sprite != null) {
sprite.view(image(), glowing());
}
}
}
Aggregations