@Override public boolean attack(Char enemy) { for (int i = 1; i < Ballistica.distance; i++) { int pos = Ballistica.trace[i]; Char ch = Actor.findChar(pos); if (ch == null) { continue; } if (hit(this, ch, true)) { ch.damage(Random.NormalIntRange(14, 20), this); if (Dungeon.visible[pos]) { ch.getSprite().flash(); CellEmitter.center(pos).burst(PurpleParticle.BURST, Random.IntRange(1, 2)); } if (!ch.isAlive() && ch == Dungeon.hero) { Dungeon.fail( Utils.format(ResultDescriptions.MOB, Utils.indefinite(getName()), Dungeon.depth)); GLog.n(TXT_DEATHGAZE_KILLED, getName()); } } else { ch.getSprite().showStatus(CharSprite.NEUTRAL, ch.defenseVerb()); } } return true; }
public static void saveLevel() throws IOException { Bundle bundle = new Bundle(); bundle.put(LEVEL, level); OutputStream output = Game.instance.openFileOutput( Utils.format(depthFile(hero.heroClass), depth), Game.MODE_PRIVATE); Bundle.write(bundle, output); output.close(); }
@Override public String info() { switch (quantity) { case 0: return TXT_COLLECT; case 1: return TXT_INFO_1; default: return Utils.format(TXT_INFO, quantity); } }
public static Level loadLevel(HeroClass cl) throws IOException { Dungeon.level = null; Actor.clear(); InputStream input = Game.instance.openFileInput(Utils.format(depthFile(cl), depth)); Bundle bundle = Bundle.read(input); input.close(); return (Level) bundle.get("level"); }
public static void deleteGame(HeroClass cl, boolean deleteLevels) { Game.instance.deleteFile(gameFile(cl)); if (deleteLevels) { int depth = 1; while (Game.instance.deleteFile(Utils.format(depthFile(cl), depth))) { depth++; } } GamesInProgress.delete(cl); }
public void showStatus(int color, String text, Object... args) { if (getVisible()) { if (args.length > 0) { text = Utils.format(text, args); } if (ModdingMode.getClassicTextRenderingMode()) { if (ch != null) { FloatingText.show(x + width * 0.5f, y, ch.getPos(), text, color); } else { FloatingText.show(x + width * 0.5f, y, text, color); } } else { if (ch != null) { SystemFloatingText.show(x + width * 0.5f, y, ch.getPos(), text, color); } else { SystemFloatingText.show(x + width * 0.5f, y, text, color); } } } }
@Override public String info() { return String.format(TXT_INFO, Utils.indefinite(plantName), desc()); }
@Override public String toString() { return levelKnown ? Utils.format(TXT_TO_STRING, super.toString(), STR) : super.toString(); }