本文整理汇总了Java中com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Alchemy类的典型用法代码示例。如果您正苦于以下问题:Java Alchemy类的具体用法?Java Alchemy怎么用?Java Alchemy使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Alchemy类属于com.shatteredpixel.shatteredpixeldungeon.actors.blobs包,在下文中一共展示了Alchemy类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: paint
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Alchemy; //导入依赖的package包/类
public void paint( Level level ) {
Painter.fill( level, this, Terrain.WALL );
Painter.fill( level, this, 1, Terrain.EMPTY_SP );
entrance().set( Door.Type.HIDDEN );
Point pot = center();
Painter.set( level, pot, Terrain.ALCHEMY );
Alchemy alchemy = new Alchemy();
alchemy.seed( level, pot.x + level.width() * pot.y, Random.IntRange(30, 60) );
level.blobs.put( Alchemy.class, alchemy );
int n = Random.IntRange( 2, 3 );
HashMap<Class<? extends Potion>, Float> chances = new HashMap<>(potionChances);
for (int i=0; i < n; i++) {
int pos;
do {
pos = level.pointToCell(random());
} while (level.map[pos] != Terrain.EMPTY_SP || level.heaps.get( pos ) != null);
try{
Class<?extends Potion> potionCls = Random.chances(chances);
chances.put(potionCls, 0f);
level.drop( potionCls.newInstance(), pos );
} catch (Exception e){
ShatteredPixelDungeon.reportException(e);
}
}
}