本文整理汇总了Java中com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter.set方法的典型用法代码示例。如果您正苦于以下问题:Java Painter.set方法的具体用法?Java Painter.set怎么用?Java Painter.set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter
的用法示例。
在下文中一共展示了Painter.set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: set
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; //导入方法依赖的package包/类
public static void set( int cell, int terrain, Level level ) {
Painter.set( level, cell, terrain );
if (terrain != Terrain.TRAP && terrain != Terrain.SECRET_TRAP && terrain != Terrain.INACTIVE_TRAP){
level.traps.remove( cell );
}
int flags = Terrain.flags[terrain];
level.passable[cell] = (flags & Terrain.PASSABLE) != 0;
level.losBlocking[cell] = (flags & Terrain.LOS_BLOCKING) != 0;
level.flamable[cell] = (flags & Terrain.FLAMABLE) != 0;
level.secret[cell] = (flags & Terrain.SECRET) != 0;
level.solid[cell] = (flags & Terrain.SOLID) != 0;
level.avoid[cell] = (flags & Terrain.AVOID) != 0;
level.pit[cell] = (flags & Terrain.PIT) != 0;
level.water[cell] = terrain == Terrain.WATER;
}
示例2: paint
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; //导入方法依赖的package包/类
@Override
public void paint(Level level) {
super.paint(level);
Item i = level.findPrizeItem();
if ( i == null ){
i = new Gold().random();
}
int center = level.pointToCell(center());
Painter.set(level, center, Terrain.PEDESTAL);
if (Random.Int(3) == 0) {
level.drop(i, center).type = Heap.Type.MIMIC;
} else {
level.drop(i, center).type = Heap.Type.CHEST;
}
}
示例3: paint
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; //导入方法依赖的package包/类
public void paint( Level level ) {
Painter.fill( level, this, Terrain.WALL );
Painter.fill( level, this, 1, Terrain.EMPTY );
Point c = center();
Painter.set( level, c.x, c.y, Terrain.WELL );
@SuppressWarnings("unchecked")
Class<? extends WellWater> waterClass =
overrideWater != null ?
overrideWater :
(Class<? extends WellWater>)Random.element( WATERS );
if (waterClass == WaterOfTransmutation.class) {
SpecialRoom.disableGuaranteedWell();
}
WellWater.seed(c.x + level.width() * c.y, 1, waterClass, level);
entrance().set( Door.Type.REGULAR );
}
示例4: paint
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; //导入方法依赖的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);
}
示例5: paint
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; //导入方法依赖的package包/类
public void paint(Level level ) {
Painter.fill( level, this, Terrain.WALL );
Painter.fill( level, this, 1, Terrain.EMPTY );
Painter.fill( level, left+1, top+1, width()-2, 1, Terrain.WALL_DECO);
Painter.fill( level, left+1, top+2, width()-2, 1, Terrain.WATER);
Painter.set( level, left+width()/2, top+1, Terrain.LOCKED_EXIT);
level.exit = level.pointToCell(new Point(left+width()/2, top+1));
do {
level.entrance = level.pointToCell(random(3));
} while (level.findMob(level.entrance) != null);
Painter.set( level, level.entrance, Terrain.ENTRANCE );
for (Room.Door door : connected.values()) {
door.set( Room.Door.Type.REGULAR );
if (door.y == top){
Painter.set( level, door.x, door.y+1, Terrain.WATER);
}
}
}
示例6: set
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; //导入方法依赖的package包/类
public static void set( int cell, int terrain ) {
Painter.set( Dungeon.level, cell, terrain );
int flags = Terrain.flags[terrain];
passable[cell] = (flags & Terrain.PASSABLE) != 0;
losBlocking[cell] = (flags & Terrain.LOS_BLOCKING) != 0;
flamable[cell] = (flags & Terrain.FLAMABLE) != 0;
secret[cell] = (flags & Terrain.SECRET) != 0;
solid[cell] = (flags & Terrain.SOLID) != 0;
avoid[cell] = (flags & Terrain.AVOID) != 0;
pit[cell] = (flags & Terrain.PIT) != 0;
water[cell] = terrain == Terrain.WATER || terrain >= Terrain.WATER_TILES;
}
示例7: paint
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; //导入方法依赖的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.EMPTY );
if (square() <= 25){
//just fill in one tile if the room is tiny
Point p = center();
Painter.set( level, p.x, p.y, Terrain.CHASM);
} else {
int smallestDim = Math.min(width(), height());
int floorW = (int)Math.sqrt(smallestDim);
//chance for a tile at the edge of the floor to remain a floor tile
float edgeFloorChance = (float)Math.sqrt(smallestDim) % 1;
//the wider the floor the more edge chances tend toward 50%
edgeFloorChance = (edgeFloorChance + (floorW-1)*0.5f) / (float)floorW;
for (int i=top + 2; i <= bottom - 2; i++) {
for (int j=left + 2; j <= right - 2; j++) {
int v = Math.min( i - top, bottom - i );
int h = Math.min( j - left, right - j );
if (Math.min( v, h ) > floorW
|| (Math.min( v, h ) == floorW && Random.Float() > edgeFloorChance)) {
Painter.set( level, j, i, Terrain.CHASM );
}
}
}
}
}
示例8: paint
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; //导入方法依赖的package包/类
public void paint(Level level) {
Painter.fill( level, this, Terrain.WALL );
Painter.fill( level, this, 1, Terrain.EMPTY );
for (Room.Door door : connected.values()) {
door.set( Room.Door.Type.REGULAR );
}
level.exit = level.pointToCell(random( 2 ));
Painter.set( level, level.exit, Terrain.EXIT );
}
示例9: paint
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; //导入方法依赖的package包/类
@Override
public void paint( Level level ) {
Painter.fill( level, this, Terrain.WALL );
Painter.fill( level, this, 1 , Terrain.EMPTY );
for (Door door : connected.values()) {
door.set( Door.Type.REGULAR );
//set door areas to be empty to help with create walls logic
Painter.set(level, door, Terrain.EMPTY);
}
createWalls( level, new Rect(left+1, top+1, right-1, bottom-1));
}
示例10: placePlant
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; //导入方法依赖的package包/类
private static void placePlant(Level level, int pos, Mob plant){
plant.pos = pos;
level.mobs.add( plant );
for(int i : PathFinder.NEIGHBOURS8) {
if (level.map[pos + i] == Terrain.GRASS){
Painter.set(level, pos + i, Terrain.HIGH_GRASS);
}
}
}
示例11: paint
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; //导入方法依赖的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);
}
}
}
示例12: paint
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; //导入方法依赖的package包/类
public void paint( Level level ) {
Painter.fill( level, this, Terrain.WALL );
Painter.fill( level, this, 1, Terrain.EMPTY );
Point c = center();
int cx = c.x;
int cy = c.y;
Door entrance = entrance();
entrance.set( Door.Type.LOCKED );
level.addItemToSpawn( new IronKey( Dungeon.depth ) );
if (entrance.x == left) {
Painter.set( level, new Point( right-1, top+1 ), Terrain.STATUE );
Painter.set( level, new Point( right-1, bottom-1 ), Terrain.STATUE );
cx = right - 2;
} else if (entrance.x == right) {
Painter.set( level, new Point( left+1, top+1 ), Terrain.STATUE );
Painter.set( level, new Point( left+1, bottom-1 ), Terrain.STATUE );
cx = left + 2;
} else if (entrance.y == top) {
Painter.set( level, new Point( left+1, bottom-1 ), Terrain.STATUE );
Painter.set( level, new Point( right-1, bottom-1 ), Terrain.STATUE );
cy = bottom - 2;
} else if (entrance.y == bottom) {
Painter.set( level, new Point( left+1, top+1 ), Terrain.STATUE );
Painter.set( level, new Point( right-1, top+1 ), Terrain.STATUE );
cy = top + 2;
}
level.drop( prize( level ), cx + cy * level.width() ).type = Heap.Type.TOMB;
}
示例13: paintDoors
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; //导入方法依赖的package包/类
protected void paintDoors( Room r ) {
for (Room n : r.connected.keySet()) {
if (r.type == Type.NULL) {
continue;
}
Point door = r.connected.get( n );
if (r.type == Room.Type.PASSAGE && n.type == Room.Type.PASSAGE) {
Painter.set( this, door, Terrain.EMPTY );
} else {
Painter.set( this, door, Terrain.DOOR );
}
}
}
示例14: decorate
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; //导入方法依赖的package包/类
@Override
protected void decorate() {
for (int i=WIDTH + 1; i < LENGTH - WIDTH - 1; i++) {
if (map[i] == Terrain.EMPTY) {
float c = 0.15f;
if (map[i + 1] == Terrain.WALL && map[i + WIDTH] == Terrain.WALL) {
c += 0.2f;
}
if (map[i - 1] == Terrain.WALL && map[i + WIDTH] == Terrain.WALL) {
c += 0.2f;
}
if (map[i + 1] == Terrain.WALL && map[i - WIDTH] == Terrain.WALL) {
c += 0.2f;
}
if (map[i - 1] == Terrain.WALL && map[i - WIDTH] == Terrain.WALL) {
c += 0.2f;
}
if (Random.Float() < c) {
map[i] = Terrain.EMPTY_DECO;
}
}
}
for (int i=0; i < WIDTH; i++) {
if (map[i] == Terrain.WALL &&
(map[i + WIDTH] == Terrain.EMPTY || map[i + WIDTH] == Terrain.EMPTY_SP) &&
Random.Int( 4 ) == 0) {
map[i] = Terrain.WALL_DECO;
}
}
for (int i=WIDTH; i < LENGTH - WIDTH; i++) {
if (map[i] == Terrain.WALL &&
map[i - WIDTH] == Terrain.WALL &&
(map[i + WIDTH] == Terrain.EMPTY || map[i + WIDTH] == Terrain.EMPTY_SP) &&
Random.Int( 2 ) == 0) {
map[i] = Terrain.WALL_DECO;
}
}
while (true) {
int pos = roomEntrance.random();
if (pos != entrance) {
map[pos] = Terrain.SIGN;
break;
}
}
Point door = roomExit.entrance();
arenaDoor = door.x + door.y * WIDTH;
Painter.set( this, arenaDoor, Terrain.LOCKED_DOOR );
Painter.fill( this,
roomExit.left + 2,
roomExit.top + 2,
roomExit.width() - 3,
roomExit.height() - 3,
Terrain.INACTIVE_TRAP );
}
示例15: createWalls
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; //导入方法依赖的package包/类
private void createWalls( Level level, Rect area ){
if (Math.max(area.width()+1, area.height()+1) < 5
|| Math.min(area.width()+1, area.height()+1) < 3){
return;
}
int tries = 10;
//splitting top/bottom
if (area.width() > area.height() || (area.width() == area.height() && Random.Int(2) == 0)){
do{
int splitX = Random.IntRange(area.left+2, area.right-2);
if (level.map[splitX + level.width()*(area.top-1)] == Terrain.WALL
&& level.map[splitX + level.width()*(area.bottom+1)] == Terrain.WALL){
tries = 0;
Painter.drawLine(level, new Point(splitX, area.top), new Point(splitX, area.bottom), Terrain.WALL);
int spaceTop = Random.IntRange(area.top, area.bottom-1);
Painter.set(level, splitX, spaceTop, Terrain.EMPTY);
Painter.set(level, splitX, spaceTop+1, Terrain.EMPTY);
createWalls(level, new Rect(area.left, area.top, splitX-1, area.bottom));
createWalls(level, new Rect(splitX+1, area.top, area.right, area.bottom));
}
} while (--tries > 0);
//splitting left/right
} else {
do{
int splitY = Random.IntRange(area.top+2, area.bottom-2);
if (level.map[area.left-1 + level.width()*splitY] == Terrain.WALL
&& level.map[area.right+1 + level.width()*splitY] == Terrain.WALL){
tries = 0;
Painter.drawLine(level, new Point(area.left, splitY), new Point(area.right, splitY), Terrain.WALL);
int spaceLeft = Random.IntRange(area.left, area.right-1);
Painter.set(level, spaceLeft, splitY, Terrain.EMPTY);
Painter.set(level, spaceLeft+1, splitY, Terrain.EMPTY);
createWalls(level, new Rect(area.left, area.top, area.right, splitY-1));
createWalls(level, new Rect(area.left, splitY+1, area.right, area.bottom));
}
} while (--tries > 0);
}
}