当前位置: 首页>>代码示例>>Java>>正文


Java Level.drop方法代码示例

本文整理汇总了Java中com.shatteredpixel.shatteredpixeldungeon.levels.Level.drop方法的典型用法代码示例。如果您正苦于以下问题:Java Level.drop方法的具体用法?Java Level.drop怎么用?Java Level.drop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.shatteredpixel.shatteredpixeldungeon.levels.Level的用法示例。


在下文中一共展示了Level.drop方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: paint

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
public static void paint( Level level, Room room ) {
	
	final int floor = Terrain.EMPTY_SP;
	
	fill( level, room, Terrain.WALL );
	fill( level, room, 1, floor );
	
	int n = Random.IntRange( 3, 4 );
	for (int i=0; i < n; i++) {
		int pos;
		do {
			pos = room.random();
		} while (level.map[pos] != floor);
		level.drop( prize( level ), pos );
	}
	
	room.entrance().set( Room.Door.Type.BARRICADE );
	level.addItemToSpawn( new PotionOfLiquidFlame() );
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:20,代码来源:StoragePainter.java

示例2: paintGraveyard

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
private static void paintGraveyard( Level level, Room room ) {
	fill( level, room.left + 1, room.top + 1, room.width() - 1, room.height() - 1 , Terrain.GRASS );
	
	int w = room.width() - 1;
	int h = room.height() - 1;
	int nGraves = Math.max( w, h ) / 2;
	
	int index = Random.Int( nGraves );
	
	int shift = Random.Int( 2 );
	for (int i=0; i < nGraves; i++) {
		int pos = w > h ?
			room.left + 1 + shift + i * 2 + (room.top + 2 + Random.Int( h-2 )) * Level.WIDTH :
			(room.left + 2 + Random.Int( w-2 )) + (room.top + 1 + shift + i * 2) * Level.WIDTH;	
		level.drop( i == index ? Generator.random() : new Gold(), pos ).type = Heap.Type.TOMB;
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:18,代码来源:StandardPainter.java

示例3: fall

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
private void fall() throws IOException {

        Level level = Dungeon.level;

        ArrayList<Item> fallingItems = level.fallingItems;
        level.fallingItems = new ArrayList<Item>();

        Actor.fixTime();
		Dungeon.saveLevel();

		if (Dungeon.depth >= Statistics.deepestFloor) {
			level = Dungeon.newLevel();
		} else {
			Dungeon.depth++;
			level = Dungeon.loadLevel( Dungeon.hero.heroClass );
		}

        for (Item item : fallingItems){
            int cell = level.randomRespawnCell();
            while (cell == -1)
                cell = level.randomRespawnCell();

            if (!(item instanceof Potion))
                level.drop(item, cell);
            else
                level.fallingPotions.add((Potion)item);
        }

		Dungeon.switchLevel( level, fallIntoPit ? level.pitCell() : level.randomRespawnCell() );
	}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:31,代码来源:InterlevelScene.java

示例4: paint

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
public static void paint( Level level, Room room ) {
	
	fill( level, room, Terrain.WALL );
	fill( level, room, 1, Terrain.EMPTY_SP );
	
	pasWidth = room.width() - 2;
	pasHeight = room.height() - 2;
	int per = pasWidth * 2 + pasHeight * 2;
	
	if (itemsToSpawn == null)
		generateItems();
	
	int pos = xy2p( room, room.entrance() ) + (per - itemsToSpawn.size()) / 2;
	for (Item item : itemsToSpawn) {
		
		Point xy = p2xy( room, (pos + per) % per );
		int cell = xy.x + xy.y * Level.WIDTH;
		
		if (level.heaps.get( cell ) != null) {
			do {
				cell = room.random();
			} while (level.heaps.get( cell ) != null);
		}
		
		level.drop( item, cell ).type = Heap.Type.FOR_SALE;
		
		pos++;
	}
	
	placeShopkeeper( level, room );
	
	for (Room.Door door : room.connected.values()) {
		door.set( Room.Door.Type.REGULAR );
	}

	itemsToSpawn = null;
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:38,代码来源:ShopPainter.java

示例5: paint

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
public static void paint( Level level, Room room ) {

		fill( level, room, Terrain.WALL );
		fill( level, room, 1, Terrain.EMPTY );

		Point c = room.center();
		int cx = c.x;
		int cy = c.y;
		
		Room.Door entrance = room.entrance();
		
		entrance.set( Room.Door.Type.LOCKED );
		level.addItemToSpawn( new IronKey( Dungeon.depth ) );
		
		if (entrance.x == room.left) {
			set( level, new Point( room.right-1, room.top+1 ), Terrain.STATUE );
			set( level, new Point( room.right-1, room.bottom-1 ), Terrain.STATUE );
			cx = room.right - 2;
		} else if (entrance.x == room.right) {
			set( level, new Point( room.left+1, room.top+1 ), Terrain.STATUE );
			set( level, new Point( room.left+1, room.bottom-1 ), Terrain.STATUE );
			cx = room.left + 2;
		} else if (entrance.y == room.top) {
			set( level, new Point( room.left+1, room.bottom-1 ), Terrain.STATUE );
			set( level, new Point( room.right-1, room.bottom-1 ), Terrain.STATUE );
			cy = room.bottom - 2;
		} else if (entrance.y == room.bottom) {
			set( level, new Point( room.left+1, room.top+1 ), Terrain.STATUE );
			set( level, new Point( room.right-1, room.top+1 ), Terrain.STATUE );
			cy = room.top + 2;
		}
		
		level.drop( prize( level ), cx + cy * Level.WIDTH ).type = Type.TOMB;
	}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:35,代码来源:CryptPainter.java

示例6: paint

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
public static void paint( Level level, Room room ) {

		fill( level, room, Terrain.WALL );
		fill( level, room, 1, Terrain.FIRE_TRAP );
		fill( level, room, 2, Terrain.EMPTY_SP );
		
		for (int i=0; i < 2; i++) {
			int pos;
			do {
				pos = room.random();
			} while (level.map[pos] != Terrain.EMPTY_SP);
			level.drop( 
				Generator.random( Random.oneOf( 
					Generator.Category.ARMOR, 
					Generator.Category.WEAPON
				) ), pos );
		}
		
		for (Room.Door door : room.connected.values()) {
			door.set( Room.Door.Type.UNLOCKED );
			drawInside( level, room, door, 1, Terrain.EMPTY );
		}
		
		Blacksmith npc = new Blacksmith();
		do {
			npc.pos = room.random( 1 );
		} while (level.heaps.get( npc.pos ) != null);
		level.mobs.add( npc );
		Actor.occupyCell( npc );
	}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:31,代码来源:BlacksmithPainter.java

示例7: paintStudy

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
private static void paintStudy( Level level, Room room ) {
fill( level, room.left + 1, room.top + 1, room.width() - 1, room.height() - 1 , Terrain.BOOKSHELF );
fill( level, room.left + 2, room.top + 2, room.width() - 3, room.height() - 3 , Terrain.EMPTY_SP );

      for (Point door : room.connected.values()) {
          if (door.x == room.left) {
              set( level, door.x + 1, door.y, Terrain.EMPTY );
          } else if (door.x == room.right) {
              set( level, door.x - 1, door.y, Terrain.EMPTY );
          } else if (door.y == room.top) {
              set( level, door.x, door.y + 1, Terrain.EMPTY );
          } else if (door.y == room.bottom) {
              set( level, door.x , door.y - 1, Terrain.EMPTY );
          }
      }
Point center = room.center();
set( level, center, Terrain.PEDESTAL );
      if (Random.Int(2) != 0){
          Item prize = level.findPrizeItem();
          if (prize != null) {
              level.drop(prize, (room.center().x + center.y * level.WIDTH));
              return;
          }
      }

      level.drop(Generator.random( Random.oneOf(
              Generator.Category.POTION,
              Generator.Category.SCROLL)), (room.center().x + center.y * level.WIDTH));
  }
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:30,代码来源:StandardPainter.java

示例8: paint

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
public static void paint( Level level, Room room ) {

		fill( level, room, Terrain.WALL );
		fill( level, room, 1, Terrain.EMPTY );
		
		int cx = (room.left + room.right) / 2;
		int cy = (room.top + room.bottom) / 2;
		int c = cx + cy * Level.WIDTH;
		
		switch (Random.Int( 3 )) {
		
		case 0:
			level.drop( prize( level ), c ).type = Type.LOCKED_CHEST;
			level.addItemToSpawn( new GoldenKey( Dungeon.depth ) );
			break;
			
		case 1:
			Item i1, i2;
			do {
				i1 = prize( level );
				i2 = prize( level );
			} while (i1.getClass() == i2.getClass());
			level.drop( i1, c ).type = Type.CRYSTAL_CHEST;
			level.drop( i2, c + Level.NEIGHBOURS8[Random.Int( 8 )]).type = Type.CRYSTAL_CHEST;
			level.addItemToSpawn( new GoldenKey( Dungeon.depth ) );
			break;
			
		case 2:
			level.drop( prize( level ), c );
			set( level, c, Terrain.PEDESTAL );
			break;
		}
		
		room.entrance().set( Room.Door.Type.LOCKED );
		level.addItemToSpawn( new IronKey( Dungeon.depth ) );
	}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:37,代码来源:VaultPainter.java

示例9: descend

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
private void descend() throws IOException {

        Level level;
        ArrayList<Item> fallingItems = new ArrayList<Item>();

        Actor.fixTime();
		if (Dungeon.hero == null) {
			Dungeon.init();
			if (noStory) {
				Dungeon.chapters.add( WndStory.ID_SEWERS );
				noStory = false;
			}
		} else {
            level = Dungeon.level;

            fallingItems = level.fallingItems;
            level.fallingItems = new ArrayList<Item>();

			Dungeon.saveLevel();
		}

		if (Dungeon.depth >= Statistics.deepestFloor) {
			level = Dungeon.newLevel();
		} else {
			Dungeon.depth++;
			level = Dungeon.loadLevel( Dungeon.hero.heroClass );
		}

        for (Item item : fallingItems){
            int cell = level.randomRespawnCell();
            while (cell == -1)
                cell = level.randomRespawnCell();

            if (!(item instanceof Potion))
                level.drop(item, cell);
            else
                level.fallingPotions.add((Potion)item);
        }

		Dungeon.switchLevel( level, level.entrance );

	}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:43,代码来源:InterlevelScene.java

示例10: paint

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
public static void paint( Level level, Room room ) {
	 
	Integer traps[] = {
		Terrain.TOXIC_TRAP, Terrain.TOXIC_TRAP, Terrain.TOXIC_TRAP, 
		Terrain.PARALYTIC_TRAP, Terrain.PARALYTIC_TRAP, 
		!Dungeon.bossLevel( Dungeon.depth + 1 ) ? Terrain.CHASM : Terrain.SUMMONING_TRAP };
	fill( level, room, Terrain.WALL );
	fill( level, room, 1, Random.element( traps ) );
	
	Room.Door door = room.entrance(); 
	door.set( Room.Door.Type.REGULAR );
	
	int lastRow = level.map[room.left + 1 + (room.top + 1) * Level.WIDTH] == Terrain.CHASM ? Terrain.CHASM : Terrain.EMPTY;

	int x = -1;
	int y = -1;
	if (door.x == room.left) {
		x = room.right - 1;
		y = room.top + room.height() / 2;
		fill( level, x, room.top + 1, 1, room.height() - 1 , lastRow );
	} else if (door.x == room.right) {
		x = room.left + 1;
		y = room.top + room.height() / 2;
		fill( level, x, room.top + 1, 1, room.height() - 1 , lastRow );
	} else if (door.y == room.top) {
		x = room.left + room.width() / 2;
		y = room.bottom - 1;
		fill( level, room.left + 1, y, room.width() - 1, 1 , lastRow );
	} else if (door.y == room.bottom) {
		x = room.left + room.width() / 2;
		y = room.top + 1;
		fill( level, room.left + 1, y, room.width() - 1, 1 , lastRow );
	}
	
	int pos = x + y * Level.WIDTH;
	if (Random.Int( 3 ) == 0) {
		if (lastRow == Terrain.CHASM) {
			set( level, pos, Terrain.EMPTY );
		}
		level.drop( prize( level ), pos ).type = Heap.Type.CHEST;
	} else {
		set( level, pos, Terrain.PEDESTAL );
		level.drop( prize( level ), pos );
	}
	
	level.addItemToSpawn( new PotionOfLevitation() );
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:48,代码来源:TrapsPainter.java

示例11: paint

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
public static void paint( Level level, Room room ) {
	
	fill( level, room, Terrain.WALL );
	fill( level, room, 1, Terrain.WATER );
	
	Room.Door door = room.entrance(); 
	door.set( Room.Door.Type.REGULAR );

	int x = -1;
	int y = -1;
	if (door.x == room.left) {
		
		x = room.right - 1;
		y = room.top + room.height() / 2;
		
	} else if (door.x == room.right) {
		
		x = room.left + 1;
		y = room.top + room.height() / 2;
		
	} else if (door.y == room.top) {
		
		x = room.left + room.width() / 2;
		y = room.bottom - 1;
		
	} else if (door.y == room.bottom) {
		
		x = room.left + room.width() / 2;
		y = room.top + 1;
		
	}
	
	int pos = x + y * Level.WIDTH;
	level.drop( prize( level ), pos ).type = 
		Random.Int( 3 ) == 0 ? Heap.Type.CHEST : Heap.Type.HEAP;
	set( level, pos, Terrain.PEDESTAL );
	
	level.addItemToSpawn( new PotionOfInvisibility() );
	
	for (int i=0; i < NPIRANHAS; i++) {
		Piranha piranha = new Piranha();
		do {
			piranha.pos = room.random();
		} while (level.map[piranha.pos] != Terrain.WATER|| Actor.findChar( piranha.pos ) != null);
		level.mobs.add( piranha );
		Actor.occupyCell( piranha );
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:49,代码来源:PoolPainter.java


注:本文中的com.shatteredpixel.shatteredpixeldungeon.levels.Level.drop方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。