use of com.shatteredpixel.shatteredpixeldungeon.items.food.ChargrilledMeat in project shattered-pixel-dungeon-gdx by 00-Evan.
the class Burning method act.
@Override
public boolean act() {
if (target.isAlive()) {
int damage = Random.NormalIntRange(1, 3 + target.HT / 40);
Buff.detach(target, Chill.class);
if (target instanceof Hero) {
Hero hero = (Hero) target;
if (hero.belongings.armor != null && hero.belongings.armor.hasGlyph(Brimstone.class)) {
Buff.affect(target, Brimstone.BrimstoneShield.class);
} else {
hero.damage(damage, this);
burnIncrement++;
// at 4+ turns, there is a (turns-3)/3 chance an item burns
if (Random.Int(3) < (burnIncrement - 3)) {
burnIncrement = 0;
ArrayList<Item> burnable = new ArrayList<>();
// does not reach inside of containers
for (Item i : hero.belongings.backpack.items) {
if ((i instanceof Scroll && !(i instanceof ScrollOfUpgrade || i instanceof ScrollOfMagicalInfusion)) || i instanceof MysteryMeat) {
burnable.add(i);
}
}
if (!burnable.isEmpty()) {
Item toBurn = Random.element(burnable).detach(hero.belongings.backpack);
if (toBurn instanceof MysteryMeat) {
ChargrilledMeat steak = new ChargrilledMeat();
if (!steak.collect(hero.belongings.backpack)) {
Dungeon.level.drop(steak, hero.pos).sprite.drop();
}
}
Heap.burnFX(hero.pos);
GLog.w(Messages.get(this, "burnsup", Messages.capitalize(toBurn.toString())));
}
}
}
} else {
target.damage(damage, this);
}
if (target instanceof Thief) {
Item item = ((Thief) target).item;
if (item instanceof Scroll && !(item instanceof ScrollOfUpgrade || item instanceof ScrollOfMagicalInfusion)) {
target.sprite.emitter().burst(ElmoParticle.FACTORY, 6);
((Thief) target).item = null;
} else if (item instanceof MysteryMeat) {
target.sprite.emitter().burst(ElmoParticle.FACTORY, 6);
((Thief) target).item = new ChargrilledMeat();
}
}
} else {
Brimstone.BrimstoneShield brimShield = target.buff(Brimstone.BrimstoneShield.class);
if (brimShield != null)
brimShield.startDecay();
detach();
}
if (Dungeon.level.flamable[target.pos] && Blob.volumeAt(target.pos, Fire.class) == 0) {
GameScene.add(Blob.seed(target.pos, 4, Fire.class));
}
spend(TICK);
left -= TICK;
if (left <= 0 || (Dungeon.level.water[target.pos] && !target.flying)) {
detach();
}
return true;
}
use of com.shatteredpixel.shatteredpixeldungeon.items.food.ChargrilledMeat in project shattered-pixel-dungeon-gdx by 00-Evan.
the class SecretLarderRoom method paint.
@Override
public void paint(Level level) {
Painter.fill(level, this, Terrain.WALL);
Painter.fill(level, this, 1, Terrain.EMPTY_SP);
Point c = center();
Painter.fill(level, c.x - 1, c.y - 1, 3, 3, Terrain.WATER);
Painter.set(level, c, Terrain.GRASS);
level.plant(new BlandfruitBush.Seed(), level.pointToCell(c));
int extraFood = (int) (Hunger.STARVING - Hunger.HUNGRY) * (1 + Dungeon.depth / 5);
while (extraFood > 0) {
Food food;
if (extraFood >= Hunger.STARVING) {
food = new Pasty();
extraFood -= Hunger.STARVING;
} else {
food = new ChargrilledMeat();
extraFood -= (Hunger.STARVING - Hunger.HUNGRY);
}
int foodPos;
do {
foodPos = level.pointToCell(random());
} while (level.map[foodPos] != Terrain.EMPTY_SP || level.heaps.get(foodPos) != null);
level.drop(food, foodPos);
}
entrance().set(Door.Type.HIDDEN);
}
Aggregations