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


Java Generator类代码示例

本文整理汇总了Java中com.shatteredpixel.shatteredpixeldungeon.items.Generator的典型用法代码示例。如果您正苦于以下问题:Java Generator类的具体用法?Java Generator怎么用?Java Generator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: spawn

import com.shatteredpixel.shatteredpixeldungeon.items.Generator; //导入依赖的package包/类
public static void spawn( CityLevel level ) {
	if (!spawned && Dungeon.depth > 16 && Random.Int( 20 - Dungeon.depth ) == 0) {
		
		Imp npc = new Imp();
		do {
			npc.pos = level.randomRespawnCell();
		} while (npc.pos == -1 || level.heaps.get( npc.pos ) != null);
		level.mobs.add( npc );
		Actor.occupyCell( npc );
		
		spawned = true;	
		alternative = Random.Int( 2 ) == 0;
		
		given = false;
		
		do {
			reward = (Ring)Generator.random( Generator.Category.RING );
		} while (reward.cursed);
		reward.upgrade( 2 );
		reward.cursed = true;
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:23,代码来源:Imp.java

示例2: paintGraveyard

import com.shatteredpixel.shatteredpixeldungeon.items.Generator; //导入依赖的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: createLoot

import com.shatteredpixel.shatteredpixeldungeon.items.Generator; //导入依赖的package包/类
@Override
protected Item createLoot() {
	//first see if we drop armor, overall chance is 1/8
	if (Random.Int(2) == 0){
		Armor loot;
		do{
			loot = Generator.randomArmor();
			//50% chance of re-rolling tier 4 or 5 items
		} while (loot.tier >= 4 && Random.Int(2) == 0);
		loot.level(0);
		return loot;
	//otherwise, we may drop a health potion. overall chance is 7/(8 * (7 + potions dropped))
	//with 0 potions dropped that simplifies to 1/8
	} else {
		if (Random.Int(7 + Dungeon.LimitedDrops.GUARD_HP.count) < 7){
			Dungeon.LimitedDrops.GUARD_HP.drop();
			return new PotionOfHealing();
		}
	}

	return null;
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:23,代码来源:Guard.java

示例4: spawnWandmaker

import com.shatteredpixel.shatteredpixeldungeon.items.Generator; //导入依赖的package包/类
public static void spawnWandmaker( Level level, Room room ) {
	if (questRoomSpawned) {
		
		questRoomSpawned = false;
		
		Wandmaker npc = new Wandmaker();
		do {
			npc.pos = level.pointToCell(room.random());
		} while (npc.pos == level.entrance);
		level.mobs.add( npc );

		spawned = true;

		given = false;
		wand1 = (Wand) Generator.random(Generator.Category.WAND);
		wand1.cursed = false;
		wand1.upgrade();

		do {
			wand2 = (Wand) Generator.random(Generator.Category.WAND);
		} while (wand2.getClass().equals(wand1.getClass()));
		wand2.cursed = false;
		wand2.upgrade();
		
	}
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:27,代码来源:Wandmaker.java

示例5: paint

import com.shatteredpixel.shatteredpixeldungeon.items.Generator; //导入依赖的package包/类
@Override
public void paint(Level level) {
	
	Painter.fill( level, this, Terrain.WALL );
	for (Door door : connected.values()) {
		door.set( Door.Type.REGULAR );
	}
	
	Painter.fill( level, this, 1 , Terrain.GRASS );
	
	int w = width() - 2;
	int h = height() - 2;
	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 ?
				left + 1 + shift + i * 2 + (top + 2 + Random.Int( h-2 )) * level.width() :
				(left + 2 + Random.Int( w-2 )) + (top + 1 + shift + i * 2) * level.width();
		level.drop( i == index ? Generator.random() : new Gold().random(), pos ).type = Heap.Type.TOMB;
	}
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:25,代码来源:GrassyGraveRoom.java

示例6: paint

import com.shatteredpixel.shatteredpixeldungeon.items.Generator; //导入依赖的package包/类
@Override
public void paint(Level level) {
	super.paint(level);
	
	Painter.fill(level, this, Terrain.WALL);
	Painter.fill(level, this, 1, Terrain.EMPTY_SP);
	
	Painter.set(level, center(), Terrain.STATUE_SP);
	
	for (int i = 0; i < 4; i++){
		int itemPos;
		do{
			itemPos = level.pointToCell(random());
		} while ( level.map[itemPos] != Terrain.EMPTY_SP
				|| level.heaps.get(itemPos) != null);
		
		Item item;
		do{
			item = Generator.randomWeapon();
		} while (!(item instanceof MissileWeapon));
		
		level.drop(item, itemPos);
	}
	
	entrance().set(Door.Type.HIDDEN);
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:27,代码来源:SecretArtilleryRoom.java

示例7: paint

import com.shatteredpixel.shatteredpixeldungeon.items.Generator; //导入依赖的package包/类
@Override
public void paint(Level level) {
	super.paint(level);
	
	Painter.fill(level, this, Terrain.WALL);
	Painter.fill(level, this, 1, Terrain.SECRET_TRAP);
	
	Point center = center();
	level.drop(Generator.random(), level.pointToCell(center)).type = Heap.Type.SKELETON;
	
	for (Point p : getPoints()){
		int cell = level.pointToCell(p);
		if (level.map[cell] == Terrain.SECRET_TRAP){
			level.setTrap(new SummoningTrap().hide(), cell);
		}
	}
	
	entrance().set(Door.Type.HIDDEN);
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:20,代码来源:SecretSummoningRoom.java

示例8: activate

import com.shatteredpixel.shatteredpixeldungeon.items.Generator; //导入依赖的package包/类
@Override
public void activate() {

	int nSeeds = Random.NormalIntRange(2, 4);

	ArrayList<Integer> candidates = new ArrayList<Integer>();
	for (int i : PathFinder.NEIGHBOURS8){
		if (Dungeon.level.passable[pos+i]){
			candidates.add(pos+i);
		}
	}

	for (int i = 0; i < nSeeds && !candidates.isEmpty(); i++){
		Integer c = Random.element(candidates);
		Dungeon.level.drop(Generator.random(Generator.Category.SEED), c).sprite.drop(pos);
		candidates.remove(c);
	}

}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:20,代码来源:WandOfRegrowth.java

示例9: changeArtifact

import com.shatteredpixel.shatteredpixeldungeon.items.Generator; //导入依赖的package包/类
private Artifact changeArtifact( Artifact a ) {
     Artifact n = Generator.randomArtifact();

     if (n != null){
         n.cursedKnown = a.cursedKnown;
         n.cursed = a.cursed;
         n.levelKnown = a.levelKnown;
n.transferUpgrade(a.visiblyUpgraded());
         Journal.remove( Feature.WELL_OF_TRANSMUTATION );
     }

     return n;
 }
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:14,代码来源:WaterOfTransmutation.java

示例10: Statue

import com.shatteredpixel.shatteredpixeldungeon.items.Generator; //导入依赖的package包/类
public Statue() {
	super();
	
	do {
		weapon = (Weapon)Generator.random( Generator.Category.WEAPON );
	} while (!(weapon instanceof MeleeWeapon) || weapon.level < 0);
	
	weapon.identify();
	weapon.enchant( Enchantment.random() );
	
	HP = HT = 15 + Dungeon.depth * 5;
	defenseSkill = 4 + Dungeon.depth;
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:14,代码来源:Statue.java

示例11: createLoot

import com.shatteredpixel.shatteredpixeldungeon.items.Generator; //导入依赖的package包/类
@Override
protected Item createLoot() {
       Item loot = Generator.random( Generator.Category.WEAPON );
       for (int i=0; i < 2; i++) {
           Item l = Generator.random( Generator.Category.WEAPON );
           if (l.level < loot.level) {
               loot = l;
           }
       }
       return loot;
   }
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:12,代码来源:Skeleton.java

示例12: process

import com.shatteredpixel.shatteredpixeldungeon.items.Generator; //导入依赖的package包/类
public static void process() {
	if (spawned && given && !processed && (depth == Dungeon.depth)) {
		GLog.n("sad ghost: Thank you... come find me...");
              Sample.INSTANCE.play( Assets.SND_GHOST );
              processed = true;
              Generator.Category.ARTIFACT.probs[10] = 1; //flags the dried rose as spawnable.
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:9,代码来源:Ghost.java

示例13: paint

import com.shatteredpixel.shatteredpixeldungeon.items.Generator; //导入依赖的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

示例14: paintStudy

import com.shatteredpixel.shatteredpixeldungeon.items.Generator; //导入依赖的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

示例15: prize

import com.shatteredpixel.shatteredpixeldungeon.items.Generator; //导入依赖的package包/类
private static Item prize( Level level ) {
	return Generator.random( Random.oneOf(  
		Generator.Category.WAND, 
		Generator.Category.RING,
           Generator.Category.ARTIFACT
	) );
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:8,代码来源:VaultPainter.java


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