public List<T> valuesAsList() { return Arrays.asList(values().toArray().toArray()); } }
public static Emitter.Factory factory( final int type, final boolean lightMode ) { Emitter.Factory factory = factories.get( type ); if (factory == null) { factory = new Emitter.Factory() { @Override public void emit ( Emitter emitter, int index, float x, float y ) { Speck p = (Speck)emitter.recycle( Speck.class ); p.reset( index, x, y, type ); } @Override public boolean lightMode() { return lightMode; } }; factories.put( type, factory ); } return factory; } }
public static int getVisualWithAlts(int visual, int pos){ if (tileVariance[pos] >= 95 && rareAltVisuals.containsKey(visual)) return rareAltVisuals.get(visual); else if (tileVariance[pos] >= 50 && commonAltVisuals.containsKey(visual)) return commonAltVisuals.get(visual); else return visual; }
add( plants ); int size = Dungeon.level.plants.size(); for (int i=0; i < size; i++) { addPlantSprite(Dungeon.level.plants.valueAt(i)); add( heaps ); size = Dungeon.level.heaps.size(); for (int i=0; i < size; i++) { addHeapSprite(Dungeon.level.heaps.valueAt(i)); ArrayList<Item> dropped = Dungeon.droppedItems.get( Dungeon.depth ); if (dropped != null) { for (Item item : dropped) { Dungeon.droppedItems.remove( Dungeon.depth );
heaps = new SparseArray<>(); blobs = new HashMap<>(); plants = new SparseArray<>(); traps = new SparseArray<>(); customTiles = new HashSet<>(); customWalls = new HashSet<>(); Heap heap = (Heap)h; if (!heap.isEmpty()) heaps.put( heap.pos, heap ); for (Bundlable p : collection) { Plant plant = (Plant)p; plants.put( plant.pos, plant ); for (Bundlable p : collection) { Trap trap = (Trap)p; traps.put( trap.pos, trap );
@Override public void kill() { if (key != -1) { synchronized (stacks) { stacks.get(key).remove(this); } key = -1; } super.kill(); }
@Override public void activate() { Heap heap = Dungeon.level.heaps.get( pos ); if (heap != null){ for (Item item : heap.items){ Dungeon.dropToChasm(item); } heap.sprite.kill(); GameScene.discard(heap); Dungeon.level.heaps.remove( pos ); } Char ch = Actor.findChar( pos ); if (ch != null && !ch.flying) { if (ch == Dungeon.hero) { Chasm.heroFall(pos); } else { Chasm.mobFall((Mob) ch); } } }
private void clearEntities(Room safeArea){ for (Heap heap : heaps.values()){ if (safeArea == null || !safeArea.inside(cellToPoint(heap.pos))){ for (Item item : heap.items) storedItems.add(item); heap.destroy(); } } for (Mob mob : Dungeon.level.mobs.toArray(new Mob[Dungeon.level.mobs.size()])){ if (mob != tengu && (safeArea == null || !safeArea.inside(cellToPoint(mob.pos)))){ mob.destroy(); if (mob.sprite != null) mob.sprite.killAndErase(); } } for (Plant plant : plants.values()){ if (safeArea == null || !safeArea.inside(cellToPoint(plant.pos))){ plants.remove(plant.pos); } } }
for (Heap heap : Dungeon.level.heaps.values()) { if (heap.type == Heap.Type.BONES && !Dungeon.visible[heap.pos]) { candidates.add( heap ); } else { int pos = Dungeon.level.randomRespawnCell(); while (Dungeon.level.heaps.get( pos ) != null) { pos = Dungeon.level.randomRespawnCell(); while (Dungeon.level.heaps.get( shrubPos ) != null) { shrubPos = Dungeon.level.randomRespawnCell();
heaps = new SparseArray<>(); blobs = new HashMap<>(); plants = new SparseArray<>(); traps = new SparseArray<>(); customTiles = new HashSet<>(); customWalls = new HashSet<>();
private static synchronized void add( Actor actor, float time ) { if (all.contains( actor )) { return; } ids.put( actor.id(), actor ); all.add( actor ); actor.time += time; actor.onAdd(); if (actor instanceof Char) { Char ch = (Char)actor; chars.add( ch ); for (Buff buff : ch.buffs()) { all.add( buff ); buff.onAdd(); } } }
public static synchronized void clear() { now = 0; all.clear(); chars.clear(); ids.clear(); }
add( heaps ); int size = Dungeon.level.heaps.size(); for (int i=0; i < size; i++) { addHeapSprite( Dungeon.level.heaps.valueAt( i ) ); ArrayList<Item> dropped = Dungeon.droppedItems.get( Dungeon.depth ); if (dropped != null) { for (Item item : dropped) { Dungeon.droppedItems.remove( Dungeon.depth ); ArrayList<Item> ported = Dungeon.portedItems.get( Dungeon.depth ); if (ported != null){ pos = Dungeon.level.randomRespawnCell(); tries--; } while (tries > 0 && Dungeon.level.heaps.get(pos) != null); for (Item item : ported) { Dungeon.level.drop( item, pos ).type = Heap.Type.CHEST; Dungeon.level.heaps.get(pos).type = Heap.Type.CHEST; Dungeon.level.heaps.get(pos).sprite.link(); //sprite reset to show chest Dungeon.portedItems.remove( Dungeon.depth );
heaps = new SparseArray<>(); blobs = new HashMap<>(); plants = new SparseArray<>(); traps = new SparseArray<>(); customTiles = new HashSet<>(); customWalls = new HashSet<>(); Heap heap = (Heap)h; if (!heap.isEmpty()) heaps.put( heap.pos, heap ); for (Bundlable p : collection) { Plant plant = (Plant)p; plants.put( plant.pos, plant ); for (Bundlable p : collection) { Trap trap = (Trap)p; traps.put( trap.pos, trap );