本文整理汇总了Java中com.watabou.pixeldungeon.levels.Terrain.EMPTY属性的典型用法代码示例。如果您正苦于以下问题:Java Terrain.EMPTY属性的具体用法?Java Terrain.EMPTY怎么用?Java Terrain.EMPTY使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.watabou.pixeldungeon.levels.Terrain
的用法示例。
在下文中一共展示了Terrain.EMPTY属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: paintBurned
private static void paintBurned( Level level, Room room ) {
for (int i=room.top + 1; i < room.bottom; i++) {
for (int j=room.left + 1; j < room.right; j++) {
int t = Terrain.EMBERS;
switch (Random.Int( 5 )) {
case 0:
t = Terrain.EMPTY;
break;
case 1:
t = Terrain.FIRE_TRAP;
break;
case 2:
t = Terrain.SECRET_FIRE_TRAP;
break;
case 3:
t = Terrain.INACTIVE_TRAP;
break;
}
level.map[i * Level.WIDTH + j] = t;
}
}
}
示例2: attackProc
@Override
public int attackProc(@NonNull Char enemy, int damage) {
int cell = enemy.getPos();
if (Random.Int(2) == 0) {
int c = Dungeon.level.map[cell];
if (c == Terrain.EMPTY || c == Terrain.EMBERS
|| c == Terrain.EMPTY_DECO || c == Terrain.GRASS
|| c == Terrain.HIGH_GRASS) {
GameScene.add(Blob.seed(cell, Math.max(exp,10) * 15, Regrowth.class));
}
}
return damage;
}
示例3: paintBurned
private static void paintBurned( Level level, Room room ) {
for (int i=room.top + 1; i < room.bottom; i++) {
for (int j=room.left + 1; j < room.right; j++) {
int t = Terrain.EMBERS;
switch (Random.Int( 5 )) {
case 0:
t = Terrain.EMPTY;
break;
case 1:
t = Terrain.FIRE_TRAP;
break;
case 2:
t = Terrain.SECRET_FIRE_TRAP;
break;
case 3:
t = Terrain.INACTIVE_TRAP;
break;
}
level.map[i * level.getWidth() + j] = t;
}
}
}
示例4: evolve
@Override
protected void evolve() {
super.evolve();
if (volume > 0) {
boolean mapUpdated = false;
for (int i=0; i < LENGTH; i++) {
if (off[i] > 0) {
int c = Dungeon.level.map[i];
int c1 = c;
if (c == Terrain.EMPTY || c == Terrain.EMBERS || c == Terrain.EMPTY_DECO) {
c1 = cur[i] > 9 ? Terrain.HIGH_GRASS : Terrain.GRASS;
} else if (c == Terrain.GRASS && cur[i] > 9) {
c1 = Terrain.HIGH_GRASS ;
}
if (c1 != c) {
Level.set( i, Terrain.HIGH_GRASS );
mapUpdated = true;
GameScene.updateMap( i );
if (Dungeon.visible[i]) {
GameScene.discoverTile( i, c );
}
}
Char ch = Actor.findChar( i );
if (ch != null) {
Buff.prolong( ch, Roots.class, TICK );
}
}
}
if (mapUpdated) {
Dungeon.observe();
}
}
}
示例5: evolve
@Override
protected void evolve() {
super.evolve();
if (volume > 0) {
boolean mapUpdated = false;
for (int i=0; i < LENGTH; i++) {
if (off[i] > 0) {
int c = Dungeon.level.map[i];
if (c == Terrain.EMPTY || c == Terrain.EMBERS || c == Terrain.EMPTY_DECO) {
Level.set( i, cur[i] > 9 ? Terrain.HIGH_GRASS : Terrain.GRASS );
mapUpdated = true;
} else if (c == Terrain.GRASS && cur[i] > 9) {
Level.set( i, Terrain.HIGH_GRASS );
mapUpdated = true;
}
Char ch = Actor.findChar( i );
if (ch != null) {
Buff.prolong( ch, Roots.class, TICK );
}
}
}
if (mapUpdated) {
GameScene.updateMap();
Dungeon.observe();
}
}
}
示例6: decorateCell
private void decorateCell(Level level, int cellId) {
level.map[cellId] = Terrain.EMPTY;
switch(interior){
case 0: //simple cave
switch(Random.Int(3)){
case 0:
level.map[cellId] = Terrain.WATER;
break;
case 1:
level.map[cellId] = Terrain.HIGH_GRASS;
break;
}
break;
case 1: //garden
level.map[cellId] = Terrain.HIGH_GRASS;
if(Random.Int(5)==0) {
level.plant( (Seed)Generator.random(Generator.Category.SEED), cellId);
}
break;
case 2: //water
level.map[cellId] = Terrain.WATER;
if(Random.Int(5)==0) {
level.map[cellId] = Terrain.GRASS;
}
break;
}
}
示例7: decorate
@Override
protected void decorate() {
for (int i=0; i < getWidth(); i++) {
if (map[i] == Terrain.WALL &&
map[i + getWidth()] == Terrain.WATER &&
Random.Int( 4 ) == 0) {
map[i] = Terrain.WALL_DECO;
}
}
for (int i=getWidth(); i < getLength() - getWidth(); i++) {
if (map[i] == Terrain.WALL &&
map[i - getWidth()] == Terrain.WALL &&
map[i + getWidth()] == Terrain.WATER &&
Random.Int( 2 ) == 0) {
map[i] = Terrain.WALL_DECO;
}
}
for (int i=getWidth() + 1; i < getLength() - getWidth() - 1; i++) {
if (map[i] == Terrain.EMPTY) {
int count =
(map[i + 1] == Terrain.WALL ? 1 : 0) +
(map[i - 1] == Terrain.WALL ? 1 : 0) +
(map[i + getWidth()] == Terrain.WALL ? 1 : 0) +
(map[i - getWidth()] == Terrain.WALL ? 1 : 0);
if (Random.Int( 16 ) < count * count) {
map[i] = Terrain.EMPTY_DECO;
}
}
}
placeEntranceSign();
}
示例8: decorate
@Override
protected void decorate() {
for (int i=0; i < getLength(); i++) {
if (map[i] == Terrain.EMPTY && Random.Int( 10 ) == 0) {
map[i] = Terrain.EMPTY_DECO;
} else if (map[i] == Terrain.WALL && Random.Int( 8 ) == 0) {
map[i] = Terrain.WALL_DECO;
}
}
}
示例9: decorate
@Override
protected void decorate() {
for (int i=0; i < getLength(); i++) {
if (map[i] == Terrain.EMPTY && Random.Int( 10 ) == 0) {
map[i] = Terrain.EMPTY_DECO;
}
}
}
示例10: evolve
@Override
protected void evolve() {
super.evolve();
if (volume > 0) {
boolean mapUpdated = false;
for (int i=0; i < getLength(); i++) {
if (off[i] > 0) {
int c = Dungeon.level.map[i];
if (c == Terrain.EMPTY || c == Terrain.EMBERS || c == Terrain.EMPTY_DECO) {
Dungeon.level.set( i, cur[i] > 9 ? Terrain.HIGH_GRASS : Terrain.GRASS );
mapUpdated = true;
} else if (c == Terrain.GRASS && cur[i] > 9) {
Dungeon.level.set( i, Terrain.HIGH_GRASS );
mapUpdated = true;
}
Char ch = Actor.findChar( i );
if (ch != null) {
Buff.prolong( ch, Roots.class, TICK );
}
}
}
if (mapUpdated) {
GameScene.updateMap();
Dungeon.observe();
}
}
}
示例11: move
@Override
public void move( int step ) {
super.move( step );
if (Dungeon.level.map[step] == Terrain.INACTIVE_TRAP && hp() < ht()) {
hp(hp() + Random.Int( 1, ht() - hp() ));
getSprite().emitter().burst( ElmoParticle.FACTORY, 5 );
if (Dungeon.visible[step] && Dungeon.hero.isAlive()) {
GLog.n(Game.getVar(R.string.DM300_Info1));
}
}
int cell = step + Level.NEIGHBOURS8[Random.Int( Level.NEIGHBOURS8.length )];
if (Dungeon.visible[cell]) {
CellEmitter.get( cell ).start( Speck.factory( Speck.ROCK ), 0.07f, 10 );
Camera.main.shake( 3, 0.7f );
Sample.INSTANCE.play( Assets.SND_ROCKS );
if (Dungeon.level.water[cell]) {
GameScene.ripple( cell );
} else if (Dungeon.level.map[cell] == Terrain.EMPTY) {
Dungeon.level.set( cell, Terrain.EMPTY_DECO );
GameScene.updateMap( cell );
}
}
Char ch = Actor.findChar( cell );
if (ch != null && ch != this) {
Buff.prolong( ch, Paralysis.class, 2 );
}
}
示例12: move
@Override
public void move( int step ) {
super.move( step );
if (Dungeon.level.map[step] == Terrain.INACTIVE_TRAP && HP < HT) {
HP += Random.Int( 1, HT - HP );
sprite.emitter().burst( ElmoParticle.FACTORY, 5 );
if (Dungeon.visible[step] && Dungeon.hero.isAlive()) {
GLog.n( name + " repairs itself!" );
}
}
int[] cells = {
step-1, step+1, step-Level.WIDTH, step+Level.WIDTH,
step-1-Level.WIDTH,
step-1+Level.WIDTH,
step+1-Level.WIDTH,
step+1+Level.WIDTH
};
int cell = cells[Random.Int( cells.length )];
if (Dungeon.visible[cell]) {
CellEmitter.get( cell ).start( Speck.factory( Speck.ROCK ), 0.07f, 10 );
Camera.main.shake( 3, 0.7f );
Sample.INSTANCE.play( Assets.SND_ROCKS );
if (Level.water[cell]) {
GameScene.ripple( cell );
} else if (Dungeon.level.map[cell] == Terrain.EMPTY) {
Level.set( cell, Terrain.EMPTY_DECO );
GameScene.updateMap( cell );
}
}
Char ch = Actor.findChar( cell );
if (ch != null && ch != this) {
Buff.prolong( ch, Paralysis.class, 2 );
}
}
示例13: paint
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() );
}
示例14: move
@Override
public void move( int step ) {
super.move( step );
if (Dungeon.level.map[step] == Terrain.INACTIVE_TRAP && HP < HT) {
HP += Random.Int( 1, HT - HP );
sprite.emitter().burst( ElmoParticle.FACTORY, 5 );
if (Dungeon.visible[step] && Dungeon.hero.isAlive()) {
GLog.n( "DM-300 repairs itself!" );
}
}
int[] cells = {
step-1, step+1, step-Level.WIDTH, step+Level.WIDTH,
step-1-Level.WIDTH,
step-1+Level.WIDTH,
step+1-Level.WIDTH,
step+1+Level.WIDTH
};
int cell = cells[Random.Int( cells.length )];
if (Dungeon.visible[cell]) {
CellEmitter.get( cell ).start( Speck.factory( Speck.ROCK ), 0.07f, 10 );
Camera.main.shake( 3, 0.7f );
Sample.INSTANCE.play( Assets.SND_ROCKS );
if (Level.water[cell]) {
GameScene.ripple( cell );
} else if (Dungeon.level.map[cell] == Terrain.EMPTY) {
Level.set( cell, Terrain.EMPTY_DECO );
GameScene.updateMap( cell );
}
}
Char ch = Actor.findChar( cell );
if (ch != null && ch != this) {
Buff.prolong( ch, Paralysis.class, 2 );
}
}
示例15: connectChambers
private void connectChambers(Chamber a, Chamber b) {
int x = a.x;
int y = a.y;
while (x != b.x || y != b.y) {
int dx = (int) Math.signum(x - b.x);
int dy = (int) Math.signum(y - b.y);
if (isCellIs(x,y, Terrain.WALL) ) {
map[cell(x, y)] = Terrain.EMPTY;
}
if (dx != 0 && isCellIs(x-dx,y,Terrain.EMPTY)) {
x = x - dx;
continue;
}
if (dy != 0 && isCellIs(x,y-dy,Terrain.EMPTY)) {
y = y - dy;
continue;
}
switch (Random.Int(10)) {
case 0:
case 1:
case 2:
case 3:
if (dx != 0) {
if(cellValid(x-dx,y)) {
x -= dx;
}
}
break;
case 4:
case 5:
case 6:
case 7:
if (dy != 0) {
if(cellValid(x,y-dy)) {
y -= dy;
}
}
break;
case 8:
if (dx != 0) {
if(cellValid(x+dx,y)) {
x += dx;
}
}
break;
case 9:
if (dy != 0) {
if(cellValid(x,y+dy)) {
y += dy;
}
}
break;
}
}
}