use of com.watabou.pixeldungeon.actors.mobs.Mob in project pixel-dungeon by watabou.
the class AlarmTrap method trigger.
// 0xDD3333
public static void trigger(int pos, Char ch) {
for (Mob mob : Dungeon.level.mobs) {
if (mob != ch) {
mob.beckon(pos);
}
}
if (Dungeon.visible[pos]) {
GLog.w("The trap emits a piercing sound that echoes throughout the dungeon!");
CellEmitter.center(pos).start(Speck.factory(Speck.SCREAM), 0.3f, 3);
}
Sample.INSTANCE.play(Assets.SND_ALERT);
}
use of com.watabou.pixeldungeon.actors.mobs.Mob in project pixel-dungeon by watabou.
the class Hero method handle.
public boolean handle(int cell) {
if (cell == -1) {
return false;
}
Char ch;
Heap heap;
if (Dungeon.level.map[cell] == Terrain.ALCHEMY && cell != pos) {
curAction = new HeroAction.Cook(cell);
} else if (Level.fieldOfView[cell] && (ch = Actor.findChar(cell)) instanceof Mob) {
if (ch instanceof NPC) {
curAction = new HeroAction.Interact((NPC) ch);
} else {
curAction = new HeroAction.Attack(ch);
}
} else if (Level.fieldOfView[cell] && (heap = Dungeon.level.heaps.get(cell)) != null && heap.type != Heap.Type.HIDDEN) {
switch(heap.type) {
case HEAP:
curAction = new HeroAction.PickUp(cell);
break;
case FOR_SALE:
curAction = heap.size() == 1 && heap.peek().price() > 0 ? new HeroAction.Buy(cell) : new HeroAction.PickUp(cell);
break;
default:
curAction = new HeroAction.OpenChest(cell);
}
} else if (Dungeon.level.map[cell] == Terrain.LOCKED_DOOR || Dungeon.level.map[cell] == Terrain.LOCKED_EXIT) {
curAction = new HeroAction.Unlock(cell);
} else if (cell == Dungeon.level.exit) {
curAction = new HeroAction.Descend(cell);
} else if (cell == Dungeon.level.entrance) {
curAction = new HeroAction.Ascend(cell);
} else {
curAction = new HeroAction.Move(cell);
lastAction = null;
}
return act();
}
use of com.watabou.pixeldungeon.actors.mobs.Mob in project pixel-dungeon by watabou.
the class SacrificialFire method sacrifice.
public static void sacrifice(Char ch) {
Wound.hit(ch);
SacrificialFire fire = (SacrificialFire) Dungeon.level.blobs.get(SacrificialFire.class);
if (fire != null) {
int exp = 0;
if (ch instanceof Mob) {
exp = ((Mob) ch).exp() * Random.IntRange(1, 3);
} else if (ch instanceof Hero) {
exp = ((Hero) ch).maxExp();
}
if (exp > 0) {
int volume = fire.volume - exp;
if (volume > 0) {
fire.seed(fire.pos, volume);
GLog.w(TXT_WORTHY);
} else {
fire.seed(fire.pos, 0);
Journal.remove(Feature.SACRIFICIAL_FIRE);
GLog.w(TXT_REWARD);
GameScene.effect(new Flare(7, 32).color(0x66FFFF, true).show(ch.sprite.parent, DungeonTilemap.tileCenterToWorld(fire.pos), 2f));
Dungeon.level.drop(new ScrollOfWipeOut(), fire.pos).sprite.drop();
}
} else {
GLog.w(TXT_UNWORTHY);
}
}
}
use of com.watabou.pixeldungeon.actors.mobs.Mob in project pixel-dungeon by watabou.
the class Hero method checkVisibleMobs.
private void checkVisibleMobs() {
ArrayList<Mob> visible = new ArrayList<Mob>();
boolean newMob = false;
for (Mob m : Dungeon.level.mobs) {
if (Level.fieldOfView[m.pos] && m.hostile) {
visible.add(m);
if (!visibleEnemies.contains(m)) {
newMob = true;
}
}
}
if (newMob) {
interrupt();
restoreHealth = false;
}
visibleEnemies = visible;
}
use of com.watabou.pixeldungeon.actors.mobs.Mob in project pixel-dungeon by watabou.
the class Actor method init.
public static void init() {
addDelayed(Dungeon.hero, -Float.MIN_VALUE);
for (Mob mob : Dungeon.level.mobs) {
add(mob);
}
for (Blob blob : Dungeon.level.blobs.values()) {
add(blob);
}
current = null;
}
Aggregations