@Override public int defenseProc(Char enemy, int damage) { if (HP >= damage + 2) { ArrayList<Integer> candidates = new ArrayList<Integer>(); boolean[] passable = Level.passable; int[] neighbours = {pos + 1, pos - 1, pos + Level.getWidth(), pos - Level.getWidth()}; for (int n : neighbours) { if (passable[n] && Actor.findChar(n) == null) { candidates.add(n); } } if (candidates.size() > 0) { GLog.n("Demon Goo divides!"); DemonGoo clone = split(); clone.HP = (HP - damage) / 2; clone.pos = Random.element(candidates); clone.state = clone.HUNTING; if (Dungeon.level.map[clone.pos] == Terrain.DOOR) { Door.enter(clone.pos); } GameScene.add(clone, SPLIT_DELAY); Actor.addDelayed(new Pushing(clone, pos, clone.pos), -1); HP -= clone.HP; } } return damage; }
@Override public void move(int step) { if (state == FLEEING) { GameScene.add(Blob.seed(pos, Random.Int(5, 7), Web.class)); } super.move(step); }
public static void trigger(int pos, Char ch) { GameScene.add(Blob.seed(pos, 300 + 20 * Dungeon.depth, ToxicGas.class)); }