use of com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob in project shattered-pixel-dungeon-gdx by 00-Evan.
the class CavesBossLevel method press.
@Override
public void press(int cell, Char hero) {
super.press(cell, hero);
if (!enteredArena && outsideEntraceRoom(cell) && hero == Dungeon.hero) {
enteredArena = true;
seal();
for (Mob m : mobs) {
// bring the first ally with you
if (m.alignment == Char.Alignment.ALLY) {
m.pos = Dungeon.hero.pos + (Random.Int(2) == 0 ? +1 : -1);
m.sprite.place(m.pos);
break;
}
}
DM300 boss = new DM300();
boss.state = boss.WANDERING;
do {
boss.pos = Random.Int(length());
} while (!passable[boss.pos] || !outsideEntraceRoom(boss.pos) || heroFOV[boss.pos]);
GameScene.add(boss);
set(arenaDoor, Terrain.WALL);
GameScene.updateMap(arenaDoor);
Dungeon.observe();
CellEmitter.get(arenaDoor).start(Speck.factory(Speck.ROCK), 0.07f, 10);
Camera.main.shake(3, 0.7f);
Sample.INSTANCE.play(Assets.SND_ROCKS);
}
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob in project shattered-pixel-dungeon-gdx by 00-Evan.
the class CityBossLevel method press.
@Override
public void press(int cell, Char hero) {
super.press(cell, hero);
if (!enteredArena && outsideEntraceRoom(cell) && hero == Dungeon.hero) {
enteredArena = true;
seal();
for (Mob m : mobs) {
// bring the first ally with you
if (m.alignment == Char.Alignment.ALLY) {
m.pos = Dungeon.hero.pos + (Random.Int(2) == 0 ? +1 : -1);
m.sprite.place(m.pos);
break;
}
}
King boss = new King();
boss.state = boss.WANDERING;
int count = 0;
do {
boss.pos = Random.Int(length());
} while (!passable[boss.pos] || !outsideEntraceRoom(boss.pos) || (heroFOV[boss.pos] && count++ < 20));
GameScene.add(boss);
if (heroFOV[boss.pos]) {
boss.notice();
boss.sprite.alpha(0);
boss.sprite.parent.add(new AlphaTweener(boss.sprite, 1, 0.1f));
}
set(arenaDoor, Terrain.LOCKED_DOOR);
GameScene.updateMap(arenaDoor);
Dungeon.observe();
}
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob in project shattered-pixel-dungeon-gdx by 00-Evan.
the class HuntressArmor method doSpecial.
@Override
public void doSpecial() {
Item proto = new Shuriken();
for (Mob mob : Dungeon.level.mobs) {
if (Dungeon.level.heroFOV[mob.pos]) {
Callback callback = new Callback() {
@Override
public void call() {
curUser.attack(targets.get(this));
targets.remove(this);
if (targets.isEmpty()) {
curUser.spendAndNext(curUser.attackDelay());
}
}
};
((MissileSprite) curUser.sprite.parent.recycle(MissileSprite.class)).reset(curUser.pos, mob.pos, proto, callback);
targets.put(callback, mob);
}
}
if (targets.size() == 0) {
GLog.w(Messages.get(this, "no_enemies"));
return;
}
curUser.HP -= (curUser.HP / 3);
curUser.sprite.zap(curUser.pos);
curUser.busy();
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob in project shattered-pixel-dungeon-gdx by 00-Evan.
the class MageArmor method doSpecial.
@Override
public void doSpecial() {
for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])) {
if (Dungeon.level.heroFOV[mob.pos]) {
Buff.affect(mob, Burning.class).reignite(mob);
Buff.prolong(mob, Roots.class, 3);
}
}
curUser.HP -= (curUser.HP / 3);
curUser.spend(Actor.TICK);
curUser.sprite.operate(curUser.pos);
curUser.busy();
curUser.sprite.centerEmitter().start(ElmoParticle.FACTORY, 0.15f, 4);
Sample.INSTANCE.play(Assets.SND_READ);
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob in project shattered-pixel-dungeon-gdx by 00-Evan.
the class Multiplicity method proc.
@Override
public int proc(Armor armor, Char attacker, Char defender, int damage) {
if (Random.Int(20) == 0) {
ArrayList<Integer> spawnPoints = new ArrayList<>();
for (int i = 0; i < PathFinder.NEIGHBOURS8.length; i++) {
int p = defender.pos + PathFinder.NEIGHBOURS8[i];
if (Actor.findChar(p) == null && (Dungeon.level.passable[p] || Dungeon.level.avoid[p])) {
spawnPoints.add(p);
}
}
if (spawnPoints.size() > 0) {
Mob m = null;
if (Random.Int(2) == 0 && defender instanceof Hero) {
m = new MirrorImage();
((MirrorImage) m).duplicate((Hero) defender);
} else {
// FIXME should probably have a mob property for this
if (attacker.properties().contains(Char.Property.BOSS) || attacker.properties().contains(Char.Property.MINIBOSS) || attacker instanceof Mimic || attacker instanceof Statue) {
m = Dungeon.level.createMob();
} else {
try {
Actor.fixTime();
m = (Mob) attacker.getClass().newInstance();
Bundle store = new Bundle();
attacker.storeInBundle(store);
m.restoreFromBundle(store);
m.HP = m.HT;
// If a thief has stolen an item, that item is not duplicated.
if (m instanceof Thief) {
((Thief) m).item = null;
}
} catch (Exception e) {
ShatteredPixelDungeon.reportException(e);
m = null;
}
}
}
if (m != null) {
GameScene.add(m);
ScrollOfTeleportation.appear(m, Random.element(spawnPoints));
}
}
}
return damage;
}
Aggregations