use of com.watabou.pixeldungeon.actors.mobs.npcs.MirrorImage in project pixel-dungeon by watabou.
the class ScrollOfMirrorImage method doRead.
@Override
protected void doRead() {
ArrayList<Integer> respawnPoints = new ArrayList<Integer>();
for (int i = 0; i < Level.NEIGHBOURS8.length; i++) {
int p = curUser.pos + Level.NEIGHBOURS8[i];
if (Actor.findChar(p) == null && (Level.passable[p] || Level.avoid[p])) {
respawnPoints.add(p);
}
}
int nImages = NIMAGES;
while (nImages > 0 && respawnPoints.size() > 0) {
int index = Random.index(respawnPoints);
MirrorImage mob = new MirrorImage();
mob.duplicate(curUser);
GameScene.add(mob);
WandOfBlink.appear(mob, respawnPoints.get(index));
respawnPoints.remove(index);
nImages--;
}
if (nImages < NIMAGES) {
setKnown();
}
Sample.INSTANCE.play(Assets.SND_READ);
Invisibility.dispel();
readAnimation();
}
use of com.watabou.pixeldungeon.actors.mobs.npcs.MirrorImage in project pixel-dungeon-remix by NYRDS.
the class ScrollOfMirrorImage method doRead.
@Override
protected void doRead() {
int nImages = NIMAGES;
while (nImages > 0) {
int cell = Dungeon.level.getEmptyCellNextTo(getCurUser().getPos());
if (!Dungeon.level.cellValid(cell))
break;
MirrorImage mob = new MirrorImage(getCurUser());
Dungeon.level.spawnMob(mob);
WandOfBlink.appear(mob, cell);
nImages--;
}
if (nImages < NIMAGES) {
setKnown();
}
Sample.INSTANCE.play(Assets.SND_READ);
Invisibility.dispel(getCurUser());
getCurUser().spendAndNext(TIME_TO_READ);
}
use of com.watabou.pixeldungeon.actors.mobs.npcs.MirrorImage in project pixel-dungeon-remix by NYRDS.
the class Multiplicity method proc.
@Override
public int proc(Armor armor, Char attacker, Char defender, int damage) {
int level = Math.max(0, armor.level());
if (Random.Int(level / 2 + 6) >= 5) {
int imgCell = Dungeon.level.getEmptyCellNextTo(defender.getPos());
if (Dungeon.level.cellValid(imgCell)) {
if (defender instanceof Hero) {
MirrorImage img = new MirrorImage((Hero) defender);
Dungeon.level.spawnMob(img);
WandOfBlink.appear(img, imgCell);
}
if (defender instanceof Mob) {
((Mob) defender).split(imgCell, damage);
}
defender.damage(Random.IntRange(1, defender.ht() / 6), /*attacker*/
this);
checkOwner(defender);
}
}
return damage;
}
use of com.watabou.pixeldungeon.actors.mobs.npcs.MirrorImage in project pixel-dungeon by watabou.
the class Multiplicity method proc.
@Override
public int proc(Armor armor, Char attacker, Char defender, int damage) {
int level = Math.max(0, armor.effectiveLevel());
if (Random.Int(level / 2 + 6) >= 5) {
ArrayList<Integer> respawnPoints = new ArrayList<Integer>();
for (int i = 0; i < Level.NEIGHBOURS8.length; i++) {
int p = defender.pos + Level.NEIGHBOURS8[i];
if (Actor.findChar(p) == null && (Level.passable[p] || Level.avoid[p])) {
respawnPoints.add(p);
}
}
if (respawnPoints.size() > 0) {
MirrorImage mob = new MirrorImage();
mob.duplicate((Hero) defender);
GameScene.add(mob);
WandOfBlink.appear(mob, Random.element(respawnPoints));
defender.damage(Random.IntRange(1, defender.HT / 6), this);
checkOwner(defender);
}
}
return damage;
}
Aggregations