本文整理汇总了Java中com.shatteredpixel.shatteredpixeldungeon.levels.Level.passable方法的典型用法代码示例。如果您正苦于以下问题:Java Level.passable方法的具体用法?Java Level.passable怎么用?Java Level.passable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.shatteredpixel.shatteredpixeldungeon.levels.Level
的用法示例。
在下文中一共展示了Level.passable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: defenseProc
import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
@Override
public int defenseProc( Char enemy, int damage ) {
ArrayList<Integer> spawnPoints = new ArrayList<Integer>();
for (int i=0; i < Level.NEIGHBOURS8.length; i++) {
int p = pos + Level.NEIGHBOURS8[i];
if (Actor.findChar( p ) == null && (Level.passable[p] || Level.avoid[p])) {
spawnPoints.add( p );
}
}
if (spawnPoints.size() > 0) {
Larva larva = new Larva();
larva.pos = Random.element( spawnPoints );
GameScene.add( larva );
Actor.addDelayed( new Pushing( larva, pos, larva.pos ), -1 );
}
return super.defenseProc(enemy, damage);
}
示例2: spawnAt
import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
public static Wraith spawnAt( int pos ) {
if (Level.passable[pos] && Actor.findChar( pos ) == null) {
Wraith w = new Wraith();
w.adjustStats( Dungeon.depth );
w.pos = pos;
w.state = w.HUNTING;
GameScene.add( w, SPAWN_DELAY );
w.sprite.alpha( 0 );
w.sprite.parent.add( new AlphaTweener( w.sprite, 1, 0.5f ) );
w.sprite.emitter().burst( ShadowParticle.CURSE, 5 );
return w;
} else {
return null;
}
}
示例3: proc
import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
@Override
public int proc( Armor armor, Char attacker, Char defender, int damage ) {
if (Dungeon.bossLevel()) {
return damage;
}
int nTries = (armor.level < 0 ? 1 : armor.level + 1) * 5;
for (int i=0; i < nTries; i++) {
int pos = Random.Int( Level.LENGTH );
if (Dungeon.visible[pos] && Level.passable[pos] && Actor.findChar( pos ) == null) {
WandOfBlink.appear( defender, pos );
Dungeon.level.press( pos, defender );
Dungeon.observe();
break;
}
}
return damage;
}
示例4: move
import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
public void move( int step ) {
if (buff( Vertigo.class ) != null) {
ArrayList<Integer> candidates = new ArrayList<Integer>();
for (int dir : Level.NEIGHBOURS8) {
int p = pos + dir;
if ((Level.passable[p] || Level.avoid[p]) && Actor.findChar( p ) == null) {
candidates.add( p );
}
}
step = Random.element( candidates );
}
if (Dungeon.level.map[pos] == Terrain.OPEN_DOOR) {
Door.leave( pos );
}
pos = step;
if (flying && Dungeon.level.map[pos] == Terrain.DOOR) {
Door.enter( pos );
}
if (this != Dungeon.hero) {
sprite.visible = Dungeon.visible[pos];
}
}
示例5: damageRoll
import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
@Override
public int damageRoll() {
if (pumpedUp > 0) {
pumpedUp = 0;
for (int i = 0; i < Level.NEIGHBOURS9DIST2.length; i++) {
int j = pos + Level.NEIGHBOURS9DIST2[i];
if (j >= 0 && j <= 1023 && Level.passable[j])
CellEmitter.get(j).burst(ElmoParticle.FACTORY, 10);
}
Sample.INSTANCE.play( Assets.SND_BURNING );
return Random.NormalIntRange( 5, 30 );
} else {
return Random.NormalIntRange( 2, 12 );
}
}
示例6: spawnFists
import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
public void spawnFists() {
RottingFist fist1 = new RottingFist();
BurningFist fist2 = new BurningFist();
do {
fist1.pos = pos + Level.NEIGHBOURS8[Random.Int( 8 )];
fist2.pos = pos + Level.NEIGHBOURS8[Random.Int( 8 )];
} while (!Level.passable[fist1.pos] || !Level.passable[fist2.pos] || fist1.pos == fist2.pos);
GameScene.add( fist1 );
GameScene.add( fist2 );
}
示例7: defenseProc
import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
@Override
public int defenseProc( Char enemy, int damage ) {
if (HP >= damage + 2) {
ArrayList<Integer> candidates = new ArrayList<Integer>();
boolean[] passable = Level.passable;
int[] neighbours = {pos + 1, pos - 1, pos + Level.WIDTH, pos - Level.WIDTH};
for (int n : neighbours) {
if (passable[n] && Actor.findChar( n ) == null) {
candidates.add( n );
}
}
if (candidates.size() > 0) {
Swarm clone = split();
clone.HP = (HP - damage) / 2;
clone.pos = Random.element( candidates );
clone.state = clone.HUNTING;
if (Dungeon.level.map[clone.pos] == Terrain.DOOR) {
Door.enter( clone.pos );
}
GameScene.add( clone, SPLIT_DELAY );
Actor.addDelayed( new Pushing( clone, pos, clone.pos ), -1 );
HP -= clone.HP;
}
}
return damage;
}
示例8: jump
import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
private void jump() {
timeToJump = JUMP_DELAY;
for (int i=0; i < 4; i++) {
int trapPos;
do {
trapPos = Random.Int( Level.LENGTH );
} while (!Level.fieldOfView[trapPos] || !Level.passable[trapPos]);
if (Dungeon.level.map[trapPos] == Terrain.INACTIVE_TRAP) {
Level.set( trapPos, Terrain.POISON_TRAP );
GameScene.updateMap( trapPos );
ScrollOfMagicMapping.discover( trapPos );
}
}
int newPos;
do {
newPos = Random.Int( Level.LENGTH );
} while (
!Level.fieldOfView[newPos] ||
!Level.passable[newPos] ||
Level.adjacent( newPos, enemy.pos ) ||
Actor.findChar( newPos ) != null);
sprite.move( pos, newPos );
move( newPos );
if (Dungeon.visible[newPos]) {
CellEmitter.get( newPos ).burst( Speck.factory( Speck.WOOL ), 6 );
Sample.INSTANCE.play( Assets.SND_PUFF );
}
spend( 1 / speed() );
}
示例9: throwItem
import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
protected void throwItem() {
Heap heap = Dungeon.level.heaps.get( pos );
if (heap != null) {
int n;
do {
n = pos + Level.NEIGHBOURS8[Random.Int( 8 )];
} while (!Level.passable[n] && !Level.avoid[n]);
Dungeon.level.drop( heap.pickUp(), n ).sprite.drop( pos );
}
}
示例10: spawnAround
import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
public static void spawnAround( int pos ) {
for (int n : Level.NEIGHBOURS4) {
int cell = pos + n;
if (Level.passable[cell] && Actor.findChar( cell ) == null) {
spawnAt( cell );
}
}
}
示例11: onSelect
import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
@Override
public void onSelect( Integer target ) {
if (target != null) {
if (!Level.fieldOfView[target] ||
!(Level.passable[target] || Level.avoid[target]) ||
Actor.findChar( target ) != null) {
GLog.w( TXT_FOV );
return;
}
curUser.HP -= (curUser.HP / 3);
for (Mob mob : Dungeon.level.mobs) {
if (Level.fieldOfView[mob.pos]) {
Buff.prolong( mob, Blindness.class, 2 );
mob.state = mob.WANDERING;
mob.sprite.emitter().burst( Speck.factory( Speck.LIGHT ), 4 );
}
}
WandOfBlink.appear( curUser, target );
CellEmitter.get( target ).burst( Speck.factory( Speck.WOOL ), 10 );
Sample.INSTANCE.play( Assets.SND_PUFF );
Dungeon.level.press( target, curUser );
Dungeon.observe();
curUser.spendAndNext( Actor.TICK );
}
}
示例12: proc
import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
@Override
public int proc( Armor armor, Char attacker, Char defender, int damage) {
int level = Math.max( 0, armor.level );
if (Random.Int( level / 2 + 6 ) >= 5) {
ArrayList<Integer> respawnPoints = new ArrayList<Integer>();
for (int i=0; i < Level.NEIGHBOURS8.length; i++) {
int p = defender.pos + Level.NEIGHBOURS8[i];
if (Actor.findChar( p ) == null && (Level.passable[p] || Level.avoid[p])) {
respawnPoints.add( p );
}
}
if (respawnPoints.size() > 0) {
MirrorImage mob = new MirrorImage();
mob.duplicate( (Hero)defender );
GameScene.add( mob );
WandOfBlink.appear( mob, Random.element( respawnPoints ) );
defender.damage( Random.IntRange( 1, defender.HT / 6 ), /*attacker*/ this );
checkOwner( defender );
}
}
return damage;
}
示例13: proc
import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
@Override
public int proc( Armor armor, Char attacker, Char defender, int damage) {
int level = Math.max( 0, armor.level );
if (Level.adjacent( attacker.pos, defender.pos ) && Random.Int( level + 5) >= 4) {
for (int i=0; i < Level.NEIGHBOURS8.length; i++) {
int ofs = Level.NEIGHBOURS8[i];
if (attacker.pos - defender.pos == ofs) {
int newPos = attacker.pos + ofs;
if ((Level.passable[newPos] || Level.avoid[newPos]) && Actor.findChar( newPos ) == null) {
Actor.addDelayed( new Pushing( attacker, attacker.pos, newPos ), -1 );
attacker.pos = newPos;
// FIXME
if (attacker instanceof Mob) {
Dungeon.level.mobPress( (Mob)attacker );
} else {
Dungeon.level.press( newPos, attacker );
}
}
break;
}
}
}
return damage;
}
示例14: doRead
import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
@Override
protected void doRead() {
ArrayList<Integer> respawnPoints = new ArrayList<Integer>();
for (int i=0; i < Level.NEIGHBOURS8.length; i++) {
int p = curUser.pos + Level.NEIGHBOURS8[i];
if (Actor.findChar( p ) == null && (Level.passable[p] || Level.avoid[p])) {
respawnPoints.add( p );
}
}
int nImages = NIMAGES;
while (nImages > 0 && respawnPoints.size() > 0) {
int index = Random.index( respawnPoints );
MirrorImage mob = new MirrorImage();
mob.duplicate( curUser );
GameScene.add( mob );
WandOfBlink.appear( mob, respawnPoints.get( index ) );
respawnPoints.remove( index );
nImages--;
}
if (nImages < NIMAGES) {
setKnown();
}
Sample.INSTANCE.play( Assets.SND_READ );
Invisibility.dispel();
curUser.spendAndNext( TIME_TO_READ );
}
示例15: cast
import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
public static int cast( int from, int to, boolean magic, boolean hitChars ) {
int w = Level.WIDTH;
int x0 = from % w;
int x1 = to % w;
int y0 = from / w;
int y1 = to / w;
int dx = x1 - x0;
int dy = y1 - y0;
int stepX = dx > 0 ? +1 : -1;
int stepY = dy > 0 ? +1 : -1;
dx = Math.abs( dx );
dy = Math.abs( dy );
int stepA;
int stepB;
int dA;
int dB;
if (dx > dy) {
stepA = stepX;
stepB = stepY * w;
dA = dx;
dB = dy;
} else {
stepA = stepY * w;
stepB = stepX;
dA = dy;
dB = dx;
}
distance = 1;
trace[0] = from;
int cell = from;
int err = dA / 2;
while (cell != to || magic) {
cell += stepA;
err += dB;
if (err >= dA) {
err = err - dA;
cell = cell + stepB;
}
trace[distance++] = cell;
if (!Level.passable[cell] && !Level.avoid[cell]) {
return trace[--distance - 1];
}
if (Level.losBlocking[cell] || (hitChars && Actor.findChar( cell ) != null)) {
return cell;
}
}
trace[distance++] = cell;
return to;
}