use of com.watabou.pixeldungeon.actors.mobs.Mob in project pixel-dungeon by watabou.
the class Level method create.
public void create() {
resizingNeeded = false;
map = new int[LENGTH];
visited = new boolean[LENGTH];
Arrays.fill(visited, false);
mapped = new boolean[LENGTH];
Arrays.fill(mapped, false);
mobs = new HashSet<Mob>();
heaps = new SparseArray<Heap>();
blobs = new HashMap<Class<? extends Blob>, Blob>();
plants = new SparseArray<Plant>();
if (!Dungeon.bossLevel()) {
addItemToSpawn(Generator.random(Generator.Category.FOOD));
if (Dungeon.posNeeded()) {
addItemToSpawn(new PotionOfStrength());
Dungeon.potionOfStrength++;
}
if (Dungeon.souNeeded()) {
addItemToSpawn(new ScrollOfUpgrade());
Dungeon.scrollsOfUpgrade++;
}
if (Dungeon.soeNeeded()) {
addItemToSpawn(new ScrollOfEnchantment());
Dungeon.scrollsOfEnchantment++;
}
if (Dungeon.depth > 1) {
switch(Random.Int(10)) {
case 0:
if (!Dungeon.bossLevel(Dungeon.depth + 1)) {
feeling = Feeling.CHASM;
}
break;
case 1:
feeling = Feeling.WATER;
break;
case 2:
feeling = Feeling.GRASS;
break;
}
}
}
boolean pitNeeded = Dungeon.depth > 1 && weakFloorCreated;
do {
Arrays.fill(map, feeling == Feeling.CHASM ? Terrain.CHASM : Terrain.WALL);
pitRoomNeeded = pitNeeded;
weakFloorCreated = false;
} while (!build());
decorate();
buildFlagMaps();
cleanWalls();
createMobs();
createItems();
}
use of com.watabou.pixeldungeon.actors.mobs.Mob in project pixel-dungeon by watabou.
the class PrisonBossLevel method press.
@Override
public void press(int cell, Char ch) {
super.press(cell, ch);
if (ch == Dungeon.hero && !enteredArena && roomExit.inside(cell)) {
enteredArena = true;
int pos;
do {
pos = roomExit.random();
} while (pos == cell || Actor.findChar(pos) != null);
Mob boss = Bestiary.mob(Dungeon.depth);
boss.state = boss.HUNTING;
boss.pos = pos;
GameScene.add(boss);
boss.notice();
mobPress(boss);
set(arenaDoor, Terrain.LOCKED_DOOR);
GameScene.updateMap(arenaDoor);
Dungeon.observe();
}
}
use of com.watabou.pixeldungeon.actors.mobs.Mob in project pixel-dungeon by watabou.
the class HuntressArmor method doSpecial.
@Override
public void doSpecial() {
Item proto = new Shuriken();
for (Mob mob : Dungeon.level.mobs) {
if (Level.fieldOfView[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(TXT_NO_ENEMIES);
return;
}
curUser.HP -= (curUser.HP / 3);
curUser.sprite.zap(curUser.pos);
curUser.busy();
}
use of com.watabou.pixeldungeon.actors.mobs.Mob in project pixel-dungeon by watabou.
the class Bounce method proc.
@Override
public int proc(Armor armor, Char attacker, Char defender, int damage) {
int level = Math.max(0, armor.effectiveLevel());
if (Level.adjacent(attacker.pos, defender.pos) && Random.Int(level + 5) >= 4) {
for (int i = 0; i < Level.NEIGHBOURS8.length; i++) {
int ofs = Level.NEIGHBOURS8[i];
if (attacker.pos - defender.pos == ofs) {
int newPos = attacker.pos + ofs;
if ((Level.passable[newPos] || Level.avoid[newPos]) && Actor.findChar(newPos) == null) {
Actor.addDelayed(new Pushing(attacker, attacker.pos, newPos), -1);
attacker.pos = newPos;
// FIXME
if (attacker instanceof Mob) {
Dungeon.level.mobPress((Mob) attacker);
} else {
Dungeon.level.press(newPos, attacker);
}
}
break;
}
}
}
return damage;
}
use of com.watabou.pixeldungeon.actors.mobs.Mob in project pixel-dungeon by watabou.
the class ScrollOfChallenge method doRead.
@Override
protected void doRead() {
for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])) {
mob.beckon(curUser.pos);
if (Dungeon.visible[mob.pos]) {
Buff.affect(mob, Rage.class, Level.distance(curUser.pos, mob.pos));
}
}
for (Heap heap : Dungeon.level.heaps.values()) {
if (heap.type == Heap.Type.MIMIC) {
Mimic m = Mimic.spawnAt(heap.pos, heap.items);
if (m != null) {
m.beckon(curUser.pos);
heap.destroy();
}
}
}
GLog.w("The scroll emits a challenging roar that echoes throughout the dungeon!");
setKnown();
curUser.sprite.centerEmitter().start(Speck.factory(Speck.SCREAM), 0.3f, 3);
Sample.INSTANCE.play(Assets.SND_CHALLENGE);
Invisibility.dispel();
readAnimation();
}
Aggregations