com.watabou.utils.SparseArray Java Examples
The following examples show how to use
com.watabou.utils.SparseArray.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Level.java From remixed-dungeon with GNU General Public License v3.0 | 6 votes |
@Nullable public LevelObject getTopLevelObject(int pos) { LevelObject top = null; for (int i = 0; i < objects.size(); i++) { SparseArray<LevelObject> objectLayer = objects.valueAt(i); LevelObject candidate = objectLayer.get(pos); if (top == null) { top = candidate; } else { if (candidate != null && candidate.getLayer() > top.getLayer()) { top = candidate; } } } return top; }
Example #2
Source File: Level.java From remixed-dungeon with GNU General Public License v3.0 | 6 votes |
public boolean remove(LevelObject levelObject) { SparseArray<LevelObject> objectsLayer = objects.get(levelObject.getLayer()); if (objectsLayer == null) { return false; } int index = objectsLayer.indexOfValue(levelObject); if (index >= 0) { objectsLayer.remove(objectsLayer.keyAt(index)); return true; } return false; }
Example #3
Source File: Level.java From remixed-dungeon with GNU General Public License v3.0 | 5 votes |
public void putLevelObject(LevelObject levelObject) { SparseArray<LevelObject> objectsLayer = objects.get(levelObject.getLayer()); if (objectsLayer == null) { objectsLayer = new SparseArray<>(); objects.put(levelObject.getLayer(), objectsLayer); } objectsLayer.put(levelObject.getPos(), levelObject); }
Example #4
Source File: Level.java From remixed-dungeon with GNU General Public License v3.0 | 5 votes |
@Nullable public LevelObject getLevelObject(int pos, int layer) { SparseArray<LevelObject> objectsLayer = objects.get(layer); if (objectsLayer == null) { return null; } return objectsLayer.get(pos); }
Example #5
Source File: Dungeon.java From remixed-dungeon with GNU General Public License v3.0 | 5 votes |
private static void markObjects(Char ch) { for (int i = 0; i < level.objects.size(); i++) { SparseArray<LevelObject> objectLayer = level.objects.valueAt(i); for (int j = 0; j < objectLayer.size(); j++) { LevelObject object = objectLayer.valueAt(j); if (object.nonPassable(ch)) { passable[object.getPos()] = false; } } } }
Example #6
Source File: Level.java From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 | 4 votes |
public void create() { Random.seed( Dungeon.seedCurDepth() ); if (!(Dungeon.bossLevel() || Dungeon.depth == 21) /*final shop floor*/) { if (Dungeon.isChallenged(Challenges.NO_FOOD)){ addItemToSpawn( new SmallRation() ); } else { addItemToSpawn(Generator.random(Generator.Category.FOOD)); } if (Dungeon.isChallenged(Challenges.DARKNESS)){ addItemToSpawn( new Torch() ); } if (Dungeon.posNeeded()) { addItemToSpawn( new PotionOfStrength() ); Dungeon.LimitedDrops.STRENGTH_POTIONS.count++; } if (Dungeon.souNeeded()) { addItemToSpawn( new ScrollOfUpgrade() ); Dungeon.LimitedDrops.UPGRADE_SCROLLS.count++; } if (Dungeon.asNeeded()) { addItemToSpawn( new Stylus() ); Dungeon.LimitedDrops.ARCANE_STYLI.count++; } //one scroll of transmutation is guaranteed to spawn somewhere on chapter 2-4 int enchChapter = (int)((Dungeon.seed / 10) % 3) + 1; if ( Dungeon.depth / 5 == enchChapter && Dungeon.seed % 4 + 1 == Dungeon.depth % 5){ addItemToSpawn( new StoneOfEnchantment() ); } if ( Dungeon.depth == ((Dungeon.seed % 3) + 1)){ addItemToSpawn( new StoneOfIntuition() ); } DriedRose rose = Dungeon.hero.belongings.getItem( DriedRose.class ); if (rose != null && rose.isIdentified() && !rose.cursed){ //aim to drop 1 petal every 2 floors int petalsNeeded = (int) Math.ceil((float)((Dungeon.depth / 2) - rose.droppedPetals) / 3); for (int i=1; i <= petalsNeeded; i++) { //the player may miss a single petal and still max their rose. if (rose.droppedPetals < 11) { addItemToSpawn(new DriedRose.Petal()); rose.droppedPetals++; } } } 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; case 3: feeling = Feeling.DARK; addItemToSpawn(new Torch()); viewDistance = Math.round(viewDistance/2f); break; } } } do { width = height = length = 0; mobs = new HashSet<>(); heaps = new SparseArray<>(); blobs = new HashMap<>(); plants = new SparseArray<>(); traps = new SparseArray<>(); customTiles = new HashSet<>(); customWalls = new HashSet<>(); } while (!build()); buildFlagMaps(); cleanWalls(); createMobs(); createItems(); Random.seed(); }
Example #7
Source File: Level.java From remixed-dungeon with GNU General Public License v3.0 | 4 votes |
@Override public void storeInBundle(Bundle bundle) { bundle.put(MAP, map); for(LayerId layerId: LayerId.values()) { bundle.put(layerId.name(),customLayers.get(layerId)); } bundle.put(VISITED, visited); bundle.put(MAPPED, mapped); bundle.put(ENTRANCE, entrance); bundle.put(COMPASS_TARGET, compassTarget); int[] exits = new int[exitMap.size()]; for (int i = 0; i < exitMap.size(); ++i) { exits[i] = exitMap.get(i); } bundle.put(EXIT, exits); bundle.put(HEAPS, heaps.values()); ArrayList<LevelObject> objectsArray = new ArrayList<>(); for (int i = 0; i < objects.size(); i++) { SparseArray<LevelObject> objectLayer = objects.valueAt(i); for (int j = 0; j < objectLayer.size(); j++) { objectsArray.add(objectLayer.valueAt(j)); } } bundle.put(OBJECTS, objectsArray); bundle.put(MOBS, mobs); bundle.put(BLOBS, blobs.values()); bundle.put(SCRIPTS, scripts); bundle.put(WIDTH, width); bundle.put(HEIGHT, height); }
Example #8
Source File: Level.java From remixed-dungeon with GNU General Public License v3.0 | 4 votes |
@Override public void restoreFromBundle(Bundle bundle) { scripts = new HashSet<>(); mobs = new HashSet<>(); heaps = new SparseArray<>(); blobs = new HashMap<>(); width = bundle.optInt(WIDTH, 32); // old levels compat height = bundle.optInt(HEIGHT, 32); initSizeDependentStuff(); map = bundle.getIntArray(MAP); for(LayerId layerId: LayerId.values()) { int [] layer = bundle.getIntArray(layerId.name()); if(layer.length == map.length) { customLayers.put(layerId, layer); } } visited = bundle.getBooleanArray(VISITED); mapped = bundle.getBooleanArray(MAPPED); entrance = bundle.getInt(ENTRANCE); compassTarget = bundle.optInt(COMPASS_TARGET, INVALID_CELL); int[] exits = bundle.getIntArray(EXIT); if (exits.length > 0) { for (int i = 0; i < exits.length; ++i) { setExit(exits[i], i); } } else { setExit(bundle.getInt(EXIT), 0); int secondaryExit = bundle.optInt(SECONDARY_EXIT, INVALID_CELL); if (cellValid(secondaryExit)) { setExit(secondaryExit, 1); } } weakFloorCreated = false; for (Heap heap : bundle.getCollection(HEAPS, Heap.class)) { heaps.put(heap.pos, heap); } ///Pre 28.6 saves compatibility for (Plant plant : bundle.getCollection(PLANTS, Plant.class)) { putLevelObject(plant); } for (LevelObject object : bundle.getCollection(OBJECTS, LevelObject.class)) { putLevelObject(object); } var loadedMobs = bundle.getCollection(MOBS, Mob.class); for (Mob mob : loadedMobs) { if (mob != null && cellValid(mob.getPos())) { mobs.add(mob); } } for (Blob blob : bundle.getCollection(BLOBS, Blob.class)) { blobs.put(blob.getClass(), blob); } for (ScriptedActor actor : bundle.getCollection(SCRIPTS, ScriptedActor.class)) { addScriptedActor(actor); } buildFlagMaps(); cleanWalls(); }
Example #9
Source File: Level.java From shattered-pixel-dungeon with GNU General Public License v3.0 | 4 votes |
public void create() { Random.pushGenerator( Dungeon.seedCurDepth() ); if (!(Dungeon.bossLevel())) { if (Dungeon.isChallenged(Challenges.NO_FOOD)){ addItemToSpawn( new SmallRation() ); } else { addItemToSpawn(Generator.random(Generator.Category.FOOD)); } if (Dungeon.isChallenged(Challenges.DARKNESS)){ addItemToSpawn( new Torch() ); } if (Dungeon.posNeeded()) { addItemToSpawn( new PotionOfStrength() ); Dungeon.LimitedDrops.STRENGTH_POTIONS.count++; } if (Dungeon.souNeeded()) { addItemToSpawn( new ScrollOfUpgrade() ); Dungeon.LimitedDrops.UPGRADE_SCROLLS.count++; } if (Dungeon.asNeeded()) { addItemToSpawn( new Stylus() ); Dungeon.LimitedDrops.ARCANE_STYLI.count++; } //one scroll of transmutation is guaranteed to spawn somewhere on chapter 2-4 int enchChapter = (int)((Dungeon.seed / 10) % 3) + 1; if ( Dungeon.depth / 5 == enchChapter && Dungeon.seed % 4 + 1 == Dungeon.depth % 5){ addItemToSpawn( new StoneOfEnchantment() ); } if ( Dungeon.depth == ((Dungeon.seed % 3) + 1)){ addItemToSpawn( new StoneOfIntuition() ); } 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; case 3: feeling = Feeling.DARK; addItemToSpawn(new Torch()); viewDistance = Math.round(viewDistance/2f); break; } } } do { width = height = length = 0; mobs = new HashSet<>(); heaps = new SparseArray<>(); blobs = new HashMap<>(); plants = new SparseArray<>(); traps = new SparseArray<>(); customTiles = new HashSet<>(); customWalls = new HashSet<>(); } while (!build()); buildFlagMaps(); cleanWalls(); createMobs(); createItems(); Random.popGenerator(); }
Example #10
Source File: Level.java From pixel-dungeon with GNU General Public License v3.0 | 4 votes |
@Override public void restoreFromBundle( Bundle bundle ) { mobs = new HashSet<Mob>(); heaps = new SparseArray<Heap>(); blobs = new HashMap<Class<? extends Blob>, Blob>(); plants = new SparseArray<Plant>(); map = bundle.getIntArray( MAP ); visited = bundle.getBooleanArray( VISITED ); mapped = bundle.getBooleanArray( MAPPED ); entrance = bundle.getInt( ENTRANCE ); exit = bundle.getInt( EXIT ); weakFloorCreated = false; adjustMapSize(); Collection<Bundlable> collection = bundle.getCollection( HEAPS ); for (Bundlable h : collection) { Heap heap = (Heap)h; if (resizingNeeded) { heap.pos = adjustPos( heap.pos ); } heaps.put( heap.pos, heap ); } collection = bundle.getCollection( PLANTS ); for (Bundlable p : collection) { Plant plant = (Plant)p; if (resizingNeeded) { plant.pos = adjustPos( plant.pos ); } plants.put( plant.pos, plant ); } collection = bundle.getCollection( MOBS ); for (Bundlable m : collection) { Mob mob = (Mob)m; if (mob != null) { if (resizingNeeded) { mob.pos = adjustPos( mob.pos ); } mobs.add( mob ); } } collection = bundle.getCollection( BLOBS ); for (Bundlable b : collection) { Blob blob = (Blob)b; blobs.put( blob.getClass(), blob ); } buildFlagMaps(); cleanWalls(); }
Example #11
Source File: Level.java From pixel-dungeon with GNU General Public License v3.0 | 4 votes |
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(); }
Example #12
Source File: Dungeon.java From pixel-dungeon with GNU General Public License v3.0 | 4 votes |
public static void loadGame( String fileName, boolean fullLoad ) throws IOException { Bundle bundle = gameBundle( fileName ); Dungeon.challenges = bundle.getInt( CHALLENGES ); Dungeon.level = null; Dungeon.depth = -1; if (fullLoad) { PathFinder.setMapSize( Level.WIDTH, Level.HEIGHT ); } Scroll.restore( bundle ); Potion.restore( bundle ); Wand.restore( bundle ); Ring.restore( bundle ); potionOfStrength = bundle.getInt( POS ); scrollsOfUpgrade = bundle.getInt( SOU ); scrollsOfEnchantment = bundle.getInt( SOE ); dewVial = bundle.getBoolean( DV ); if (fullLoad) { chapters = new HashSet<Integer>(); int ids[] = bundle.getIntArray( CHAPTERS ); if (ids != null) { for (int id : ids) { chapters.add( id ); } } Bundle quests = bundle.getBundle( QUESTS ); if (!quests.isNull()) { Ghost.Quest.restoreFromBundle( quests ); Wandmaker.Quest.restoreFromBundle( quests ); Blacksmith.Quest.restoreFromBundle( quests ); Imp.Quest.restoreFromBundle( quests ); } else { Ghost.Quest.reset(); Wandmaker.Quest.reset(); Blacksmith.Quest.reset(); Imp.Quest.reset(); } Room.restoreRoomsFromBundle( bundle ); } Bundle badges = bundle.getBundle( BADGES ); if (!badges.isNull()) { Badges.loadLocal( badges ); } else { Badges.reset(); } QuickSlot.restore( bundle ); @SuppressWarnings("unused") String version = bundle.getString( VERSION ); hero = null; hero = (Hero)bundle.get( HERO ); QuickSlot.compress(); gold = bundle.getInt( GOLD ); depth = bundle.getInt( DEPTH ); Statistics.restoreFromBundle( bundle ); Journal.restoreFromBundle( bundle ); droppedItems = new SparseArray<ArrayList<Item>>(); for (int i=2; i <= Statistics.deepestFloor + 1; i++) { ArrayList<Item> dropped = new ArrayList<Item>(); for (Bundlable b : bundle.getCollection( String.format( DROPPED, i ) ) ) { dropped.add( (Item)b ); } if (!dropped.isEmpty()) { droppedItems.put( i, dropped ); } } }
Example #13
Source File: Dungeon.java From YetAnotherPixelDungeon with GNU General Public License v3.0 | 4 votes |
public static void init() { challenges = YetAnotherPixelDungeon.challenges(); Actor.clear(); PathFinder.setMapSize( Level.WIDTH, Level.HEIGHT ); Scroll.initLabels(); Potion.initColors(); Wand.initWoods(); Ring.initGems(); Statistics.reset(); Journal.reset(); depth = 0; gold = 0; droppedItems = new SparseArray<ArrayList<Item>>(); potionOfStrength = 0; potionOfExperience = 0; scrollsOfUpgrade = 0; scrollsOfEnchantment = 0; ankhs = 0; wands = 0; rings = 0; ammos = 0; bottles = 0; scrolls = 0; torches = 0; chapters = new HashSet<Integer>(); Ghost.Quest.reset(); Wandmaker.Quest.reset(); Blacksmith.Quest.reset(); AmbitiousImp.Quest.reset(); Room.shuffleTypes(); ShopPainter.initAssortment(); QuickSlot.quickslotValue_1 = null; QuickSlot.quickslotValue_2 = null; QuickSlot.quickslotValue_3 = null; hero = new Hero(); Buff.affect( hero, Satiety.class ).setValue( Satiety.MAXIMUM ); Buff.affect( hero, Recharging.class ); Badges.reset(); StartScene.curClass.initHero( hero ); }
Example #14
Source File: Level.java From unleashed-pixel-dungeon with GNU General Public License v3.0 | 4 votes |
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 ); if (!Dungeon.bossLevel()) { addItemToSpawn( Generator.random( Generator.Category.FOOD ) ); if (Dungeon.posNeeded()) { addItemToSpawn( new PotionOfStrength() ); Dungeon.limitedDrops.strengthPotions.count++; } if (Dungeon.souNeeded()) { addItemToSpawn( new ScrollOfUpgrade() ); Dungeon.limitedDrops.upgradeScrolls.count++; } if (Dungeon.asNeeded()) { addItemToSpawn( new Stylus() ); Dungeon.limitedDrops.arcaneStyli.count++; } int bonus = 0; for (Buff buff : Dungeon.hero.buffs(RingOfWealth.Wealth.class)) { bonus += ((RingOfWealth.Wealth) buff).level; } if (Random.Float() > Math.pow(0.95, bonus)){ if (Random.Int(2) == 0) addItemToSpawn( new ScrollOfMagicalInfusion() ); else addItemToSpawn( new PotionOfMight() ); } DriedRose rose = Dungeon.hero.belongings.getItem( DriedRose.class ); if (rose != null && !rose.cursed){ //this way if a rose is dropped later in the game, player still has a chance to max it out. int petalsNeeded = (int) Math.ceil((float)((Dungeon.depth / 2) - rose.droppedPetals) / 3); for (int i=1; i <= petalsNeeded; i++) { //the player may miss a single petal and still max their rose. if (rose.droppedPetals < 11) { addItemToSpawn(new DriedRose.Petal()); rose.droppedPetals++; } } } 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; case 3: feeling = Feeling.DARK; addItemToSpawn(new Torch()); viewDistance = (int)Math.ceil(viewDistance/3f); break; case 4: feeling = Feeling.BURNT; break; } } } boolean pitNeeded = Dungeon.depth > 1 && weakFloorCreated; do { Arrays.fill( map, feeling == Feeling.CHASM ? Terrain.CHASM : Terrain.WALL ); pitRoomNeeded = pitNeeded; weakFloorCreated = false; mobs = new HashSet<>(); heaps = new SparseArray<>(); blobs = new HashMap<>(); plants = new SparseArray<>(); traps = new SparseArray<>(); } while (!build()); decorate(); buildFlagMaps(); cleanWalls(); createMobs(); createItems(); }
Example #15
Source File: Dungeon.java From unleashed-pixel-dungeon with GNU General Public License v3.0 | 4 votes |
public static void init() { difficultyLevel = ShatteredPixelDungeon.getDifficulty(); version = Game.versionCode; challenges = ShatteredPixelDungeon.challenges(); Generator.initArtifacts(); Actor.clear(); Actor.resetNextID(); PathFinder.setMapSize( Level.WIDTH, Level.HEIGHT ); Scroll.initLabels(); Potion.initColors(); Ring.initGems(); Statistics.reset(); Journal.reset(); quickslot.reset(); QuickSlotButton.reset(); depth = 0; gold = 0; if (difficultyLevel == DIFF_TUTOR) { tutorial_mob_seen = false; tutorial_tactics_tip = false; tutorial_food_found = false; tutorial_sign_seen = false; tutorial_key_found = false; tutorial_altar_seen = false; tutorial_wellA_seen = false; tutorial_wellT_seen = false; tutorial_wellH_seen = false; tutorial_boss_found = false; tutorial_garden_found = false; } droppedItems = new SparseArray<>(); for (limitedDrops a : limitedDrops.values()) a.count = 0; switch (difficultyLevel) { case DIFF_ENDLESS: transmutation = Random.IntRange( 6, 14 ); altarLevel = 5; break; case DIFF_TUTOR: case DIFF_EASY: transmutation = Random.IntRange( 4, 10 ); altarLevel = Random.IntRange(1, 3); break; case DIFF_HARD: transmutation = Random.IntRange( 6, 14 ); altarLevel = Random.IntRange(3, 5); break; case DIFF_NTMARE: transmutation = Random.IntRange( 6, 15 ); altarLevel = Random.IntRange(3, 6); break; case DIFF_TEST: case DIFF_NORM: default: transmutation = Random.IntRange( 6, 14 ); altarLevel = Random.IntRange(2, 4); break; } chapters = new HashSet<>(); Ghost.Quest.reset(); Wandmaker.Quest.reset(); Blacksmith.Quest.reset(); Imp.Quest.reset(); Room.shuffleTypes(); hero = new Hero(); hero.live(); Badges.reset(); StartScene.curClass.initHero( hero ); // remove in progress game files.. // DSM-xxxx this is what is destroying our Rankings scene //for(String fileName : Game.instance.fileList()){ // if(fileName.startsWith("game_") || fileName.endsWith(".dat") && (fileName.startsWith(hero.heroClass.title()))){ // Game.instance.deleteFile(fileName); // } //} }
Example #16
Source File: Level.java From YetAnotherPixelDungeon with GNU General Public License v3.0 | 4 votes |
@Override public void restoreFromBundle( Bundle bundle ) { heaps = new SparseArray<Heap>(); hazards = new HashSet<Hazard>(); mobs = new HashSet<Mob>(); blobs = new HashMap<Class<? extends Blob>, Blob>(); map = bundle.getIntArray( MAP ); visited = bundle.getBooleanArray( VISITED ); mapped = bundle.getBooleanArray( MAPPED ); mobsSpawned = bundle.getInt(MOBS_SPAWNED); entrance = bundle.getInt( ENTRANCE ); exit = bundle.getInt( EXIT ); weakFloorCreated = false; adjustMapSize(); Collection<Bundlable> collection = bundle.getCollection( HEAPS ); for (Bundlable h : collection) { Heap heap = (Heap)h; if( heap != null ){ if( resizingNeeded ){ heap.pos = adjustPos( heap.pos ); } heaps.put( heap.pos, heap ); } } collection = bundle.getCollection( HAZARDS ); for (Bundlable z : collection) { Hazard hazard = (Hazard)z; if (hazard != null){ if( resizingNeeded ){ hazard.pos = adjustPos( hazard.pos ); } hazards.add( hazard ); } } collection = bundle.getCollection( MOBS ); for (Bundlable m : collection) { Mob mob = (Mob)m; if (mob != null) { if (resizingNeeded) { mob.pos = adjustPos( mob.pos ); } mobs.add( mob ); } } collection = bundle.getCollection( BLOBS ); for (Bundlable b : collection) { Blob blob = (Blob)b; blobs.put( blob.getClass(), blob ); } buildFlagMaps(); cleanWalls(); }
Example #17
Source File: TerrainFeaturesTilemap.java From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 | 3 votes |
public TerrainFeaturesTilemap(SparseArray<Plant> plants, SparseArray<Trap> traps) { super(Assets.TERRAIN_FEATURES); this.plants = plants; this.traps = traps; map( Dungeon.level.map, Dungeon.level.width() ); instance = this; }
Example #18
Source File: TerrainFeaturesTilemap.java From shattered-pixel-dungeon with GNU General Public License v3.0 | 3 votes |
public TerrainFeaturesTilemap(SparseArray<Plant> plants, SparseArray<Trap> traps) { super(Assets.Environment.TERRAIN_FEATURES); this.plants = plants; this.traps = traps; map( Dungeon.level.map, Dungeon.level.width() ); instance = this; }
Example #19
Source File: Dungeon.java From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 | 2 votes |
public static void init() { version = Game.versionCode; challenges = SPDSettings.challenges(); seed = DungeonSeed.randomSeed(); Actor.clear(); Actor.resetNextID(); Random.seed( seed ); Scroll.initLabels(); Potion.initColors(); Ring.initGems(); SpecialRoom.initForRun(); SecretRoom.initForRun(); Random.seed(); Statistics.reset(); Notes.reset(); quickslot.reset(); QuickSlotButton.reset(); depth = 0; gold = 0; droppedItems = new SparseArray<>(); portedItems = new SparseArray<>(); for (LimitedDrops a : LimitedDrops.values()) a.count = 0; chapters = new HashSet<>(); Ghost.Quest.reset(); Wandmaker.Quest.reset(); Blacksmith.Quest.reset(); Imp.Quest.reset(); Generator.reset(); Generator.initArtifacts(); hero = new Hero(); hero.live(); Badges.reset(); GamesInProgress.selectedClass.initHero( hero ); }
Example #20
Source File: Dungeon.java From shattered-pixel-dungeon with GNU General Public License v3.0 | 2 votes |
public static void init() { version = Game.versionCode; challenges = SPDSettings.challenges(); seed = DungeonSeed.randomSeed(); Actor.clear(); Actor.resetNextID(); Random.pushGenerator( seed ); Scroll.initLabels(); Potion.initColors(); Ring.initGems(); SpecialRoom.initForRun(); SecretRoom.initForRun(); Random.resetGenerators(); Statistics.reset(); Notes.reset(); quickslot.reset(); QuickSlotButton.reset(); depth = 0; gold = 0; droppedItems = new SparseArray<>(); portedItems = new SparseArray<>(); for (LimitedDrops a : LimitedDrops.values()) a.count = 0; chapters = new HashSet<>(); Ghost.Quest.reset(); Wandmaker.Quest.reset(); Blacksmith.Quest.reset(); Imp.Quest.reset(); Generator.reset(); hero = new Hero(); hero.live(); Badges.reset(); GamesInProgress.selectedClass.initHero( hero ); }
Example #21
Source File: Dungeon.java From pixel-dungeon with GNU General Public License v3.0 | 2 votes |
public static void init() { challenges = PixelDungeon.challenges(); Actor.clear(); PathFinder.setMapSize( Level.WIDTH, Level.HEIGHT ); Scroll.initLabels(); Potion.initColors(); Wand.initWoods(); Ring.initGems(); Statistics.reset(); Journal.reset(); depth = 0; gold = 0; droppedItems = new SparseArray<ArrayList<Item>>(); potionOfStrength = 0; scrollsOfUpgrade = 0; scrollsOfEnchantment = 0; dewVial = true; chapters = new HashSet<Integer>(); Ghost.Quest.reset(); Wandmaker.Quest.reset(); Blacksmith.Quest.reset(); Imp.Quest.reset(); Room.shuffleTypes(); QuickSlot.primaryValue = null; QuickSlot.secondaryValue = null; hero = new Hero(); hero.live(); Badges.reset(); StartScene.curClass.initHero( hero ); }