use of com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob in project shattered-pixel-dungeon-gdx by 00-Evan.
the class WandOfTransfusion method onZap.
@Override
protected void onZap(Ballistica beam) {
for (int c : beam.subPath(0, beam.dist)) CellEmitter.center(c).burst(BloodParticle.BURST, 1);
int cell = beam.collisionPos;
Char ch = Actor.findChar(cell);
Heap heap = Dungeon.level.heaps.get(cell);
// if we find a character..
if (ch != null && ch instanceof Mob) {
processSoulMark(ch, chargesPerCast());
// heals an ally, or a charmed enemy
if (ch.alignment == Char.Alignment.ALLY || ch.buff(Charm.class) != null) {
int missingHP = ch.HT - ch.HP;
// heals 30%+3%*lvl missing HP.
int healing = (int) Math.ceil((missingHP * (0.30f + (0.03f * level()))));
ch.HP += healing;
ch.sprite.emitter().burst(Speck.factory(Speck.HEALING), 1 + level() / 2);
ch.sprite.showStatus(CharSprite.POSITIVE, "+%dHP", healing);
// harms the undead
} else if (ch.properties().contains(Char.Property.UNDEAD)) {
// deals 30%+5%*lvl total HP.
int damage = (int) Math.ceil(ch.HT * (0.3f + (0.05f * level())));
ch.damage(damage, this);
ch.sprite.emitter().start(ShadowParticle.UP, 0.05f, 10 + level());
Sample.INSTANCE.play(Assets.SND_BURNING);
// charms an enemy
} else {
float duration = 5 + level();
Buff.affect(ch, Charm.class, duration).object = curUser.id();
duration *= Random.Float(0.75f, 1f);
Buff.affect(curUser, Charm.class, duration).object = ch.id();
ch.sprite.centerEmitter().start(Speck.factory(Speck.HEART), 0.2f, 5);
curUser.sprite.centerEmitter().start(Speck.factory(Speck.HEART), 0.2f, 5);
}
// if we find an item...
} else if (heap != null && heap.type == Heap.Type.HEAP) {
Item item = heap.peek();
// 30% + 10%*lvl chance to uncurse the item and reset it to base level if degraded.
if (item != null && Random.Float() <= 0.3f + level() * 0.1f) {
if (item.cursed) {
item.cursed = false;
CellEmitter.get(cell).start(ShadowParticle.UP, 0.05f, 10);
Sample.INSTANCE.play(Assets.SND_BURNING);
}
int lvldiffFromBase = item.level() - (item instanceof Ring ? 1 : 0);
if (lvldiffFromBase < 0) {
item.upgrade(-lvldiffFromBase);
CellEmitter.get(cell).start(Speck.factory(Speck.UP), 0.2f, 3);
Sample.INSTANCE.play(Assets.SND_BURNING);
}
}
// if we find some trampled grass...
} else if (Dungeon.level.map[cell] == Terrain.GRASS) {
// regrow one grass tile, suuuuuper useful...
Dungeon.level.set(cell, Terrain.HIGH_GRASS);
GameScene.updateMap(cell);
CellEmitter.get(cell).burst(LeafParticle.LEVEL_SPECIFIC, 4);
// If we find embers...
} else if (Dungeon.level.map[cell] == Terrain.EMBERS) {
// 30% + 3%*lvl chance to grow a random plant, or just regrow grass.
if (Random.Float() <= 0.3f + level() * 0.03f) {
Dungeon.level.plant((Plant.Seed) Generator.random(Generator.Category.SEED), cell);
CellEmitter.get(cell).burst(LeafParticle.LEVEL_SPECIFIC, 8);
GameScene.updateMap(cell);
} else {
Dungeon.level.set(cell, Terrain.HIGH_GRASS);
GameScene.updateMap(cell);
CellEmitter.get(cell).burst(LeafParticle.LEVEL_SPECIFIC, 4);
}
} else
// don't damage the hero if we can't find a target;
return;
if (!freeCharge) {
damageHero();
} else {
freeCharge = false;
}
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob in project shattered-pixel-dungeon-gdx by 00-Evan.
the class ScrollOfRage method empoweredRead.
@Override
public void empoweredRead() {
for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])) {
if (Dungeon.level.heroFOV[mob.pos]) {
Buff.prolong(mob, Amok.class, 5f);
}
}
setKnown();
curUser.sprite.centerEmitter().start(Speck.factory(Speck.SCREAM), 0.3f, 3);
Sample.INSTANCE.play(Assets.SND_READ);
Invisibility.dispel();
readAnimation();
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob in project shattered-pixel-dungeon-gdx by 00-Evan.
the class ScrollOfLullaby method doRead.
@Override
public void doRead() {
curUser.sprite.centerEmitter().start(Speck.factory(Speck.NOTE), 0.3f, 5);
Sample.INSTANCE.play(Assets.SND_LULLABY);
Invisibility.dispel();
for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])) {
if (Dungeon.level.heroFOV[mob.pos]) {
Buff.affect(mob, Drowsy.class);
mob.sprite.centerEmitter().start(Speck.factory(Speck.NOTE), 0.3f, 5);
}
}
Buff.affect(curUser, Drowsy.class);
GLog.i(Messages.get(this, "sooth"));
setKnown();
readAnimation();
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob in project shattered-pixel-dungeon-gdx by 00-Evan.
the class ScrollOfPsionicBlast method doRead.
@Override
public void doRead() {
GameScene.flash(0xFFFFFF);
Sample.INSTANCE.play(Assets.SND_BLAST);
Invisibility.dispel();
for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])) {
if (Dungeon.level.heroFOV[mob.pos]) {
mob.damage(mob.HP, this);
}
}
curUser.damage(Math.max(curUser.HT / 5, curUser.HP / 2), this);
if (curUser.isAlive()) {
Buff.prolong(curUser, Paralysis.class, Random.Int(4, 6));
Buff.prolong(curUser, Blindness.class, Random.Int(6, 9));
Dungeon.observe();
}
setKnown();
readAnimation();
if (!curUser.isAlive()) {
Dungeon.fail(getClass());
GLog.n(Messages.get(this, "ondeath"));
}
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob in project shattered-pixel-dungeon-gdx by 00-Evan.
the class ScrollOfTerror method empoweredRead.
@Override
public void empoweredRead() {
doRead();
for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])) {
if (Dungeon.level.heroFOV[mob.pos]) {
Terror t = mob.buff(Terror.class);
if (t != null) {
Buff.prolong(mob, Terror.class, Terror.DURATION * 1.5f);
Buff.affect(mob, Paralysis.class, Terror.DURATION * .5f);
}
}
}
}
Aggregations