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


Java Level.adjacent方法代码示例

本文整理汇总了Java中com.shatteredpixel.shatteredpixeldungeon.levels.Level.adjacent方法的典型用法代码示例。如果您正苦于以下问题:Java Level.adjacent方法的具体用法?Java Level.adjacent怎么用?Java Level.adjacent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.shatteredpixel.shatteredpixeldungeon.levels.Level的用法示例。


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

示例1: attack

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
@Override
public void attack( int cell ) {
	if (!Level.adjacent( cell, ch.pos )) {
		
		((MissileSprite)parent.recycle( MissileSprite.class )).
			reset( ch.pos, cell, new Shuriken(), new Callback() {			
				@Override
				public void call() {
					ch.onAttackComplete();
				}
			} );
		
		play( cast );
		turnTo( ch.pos , cell );
		
	} else {
		
		super.attack( cell );
		
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:22,代码来源:TenguSprite.java

示例2: actBuy

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
private boolean actBuy( HeroAction.Buy action ) {
	int dst = action.dst;
	if (pos == dst || Level.adjacent( pos, dst )) {

		ready();
		
		Heap heap = Dungeon.level.heaps.get( dst );
		if (heap != null && heap.type == Type.FOR_SALE && heap.size() == 1) {
			GameScene.show( new WndTradeItem( heap, true ) );
		}

           return false;

	} else if (getCloser( dst )) {

           return true;

	} else {
		ready();
           return false;
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:23,代码来源:Hero.java

示例3: doAttack

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
protected boolean doAttack( Char enemy ) {

		if (Level.adjacent( pos, enemy.pos )) {
			
			return super.doAttack( enemy );
			
		} else {
			
			boolean visible = Level.fieldOfView[pos] || Level.fieldOfView[enemy.pos]; 
			if (visible) {
				((WarlockSprite)sprite).zap( enemy.pos );
			} else {
				zap();
			}
			
			return !visible;
		}
	}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:19,代码来源:Warlock.java

示例4: findPath

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
public static int findPath( Char ch, int from, int to, boolean pass[], boolean[] visible ) {
	
	if (Level.adjacent( from, to )) {
		return Actor.findChar( to ) == null && (pass[to] || Level.avoid[to]) ? to : -1;
	}
	
	if (ch.flying || ch.buff( Amok.class ) != null) {
		BArray.or( pass, Level.avoid, passable );
	} else {
		System.arraycopy( pass, 0, passable, 0, Level.LENGTH );
	}
	
	for (Actor actor : Actor.all()) {
		if (actor instanceof Char) {
			int pos = ((Char)actor).pos;
			if (visible[pos]) {
				passable[pos] = false;
			}
		}
	}
	
	return PathFinder.getStep( from, to, passable );
	
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:25,代码来源:Dungeon.java

示例5: 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 + 7 ) >= 6) {
		
		int dmg = Random.IntRange( 1, damage );
		attacker.damage( dmg, LightningTrap.LIGHTNING );
		dmg = Random.IntRange( 1, dmg );
		defender.damage( dmg, LightningTrap.LIGHTNING );
		
		checkOwner( defender );
		if (defender == Dungeon.hero) {
			Camera.main.shake( 2, 0.3f );
		}
		
		int[] points = {attacker.pos, defender.pos};
		attacker.sprite.parent.add( new Lightning( points, 2, null ) );

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

示例6: attack

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
@Override
public void attack( int cell ) {
	if (!Level.adjacent( cell, ch.pos )) {
		
		cellToAttack = cell;
		turnTo( ch.pos , cell );
		play( zap );	
		
	} else {
		
		super.attack( cell );
		
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:15,代码来源:ScorpioSprite.java

示例7: 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;
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:33,代码来源:Bounce.java

示例8: attack

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
@Override
public boolean attack( Char enemy ) {
	
	if (!Level.adjacent( pos, enemy.pos )) {
		spend( attackDelay() );
		
		if (hit( this, enemy, true )) {
			
			int dmg =  damageRoll();
			enemy.damage( dmg, this );
			
			enemy.sprite.bloodBurstA( sprite.center(), dmg );
			enemy.sprite.flash();
			
			if (!enemy.isAlive() && enemy == Dungeon.hero) {
				Dungeon.fail( Utils.format( ResultDescriptions.UNIQUE, name ) );
				GLog.n( TXT_KILL, name );
			}
			return true;
			
		} else {
			
			enemy.sprite.showStatus( CharSprite.NEUTRAL,  enemy.defenseVerb() );
			return false;
		}
	} else {
		return super.attack( enemy );
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:30,代码来源:Yog.java

示例9: doAttack

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
@Override
protected boolean doAttack( Char enemy ) {
	timeToJump--;
	if (timeToJump <= 0 && Level.adjacent( pos, enemy.pos )) {
		jump();
		return true;
	} else {
		return super.doAttack( enemy );
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:11,代码来源:Tengu.java

示例10: 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() );
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:36,代码来源:Tengu.java

示例11: canAttack

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
@Override
protected boolean canAttack( Char enemy ) {
    if (!Level.adjacent(pos, enemy.pos) && Ballistica.cast( pos, enemy.pos, false, true ) == enemy.pos){
        combo++;
        return true;
    } else {
        return false;
    }
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:10,代码来源:Ghost.java

示例12: getCloser

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
@Override
protected boolean getCloser( int target ) {
    combo = 0; //if he's moving, he isn't attacking, reset combo.
    if (Level.adjacent(pos, enemy.pos)) {
        return getFurther( target );
    } else {
        return super.getCloser( target );
    }
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:10,代码来源:Ghost.java

示例13: checkEnemies

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
private void checkEnemies() {
	
	int heroPos = Dungeon.hero.pos;
	candidates.clear();
	int v = Dungeon.hero.visibleEnemies();
	for (int i=0; i < v; i++) {
		Mob mob = Dungeon.hero.visibleEnemy( i );
		if (Level.adjacent( heroPos, mob.pos )) {
			candidates.add( mob );
		}
	}
	
	if (!candidates.contains( lastTarget )) {
		if (candidates.isEmpty()) {
			lastTarget = null;
		} else {
			active = true;
			lastTarget = Random.element( candidates );
			updateImage();				
			flash();
		}
	} else {
		if (!bg.visible) {
			active = true;
			flash();
		}
	}
	
	visible( lastTarget != null );
	enable( bg.visible );
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:32,代码来源:AttackIndicator.java

示例14: 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 + 6 ) >= 5) {
		
		Buff.prolong( attacker, Frost.class, Frost.duration( attacker ) * Random.Float( 1f, 1.5f ));
		CellEmitter.get( attacker.pos ).start( SnowParticle.FACTORY, 0.2f, 6 );
		
		Buff.affect( defender, Burning.class ).reignite( defender );
		defender.sprite.emitter().burst( FlameParticle.FACTORY, 5 );

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

示例15: actInteract

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
private boolean actInteract( HeroAction.Interact action ) {
	
	NPC npc = action.npc;

	if (Level.adjacent( pos, npc.pos )) {
		
		ready();
		sprite.turnTo( pos, npc.pos );
		npc.interact();
           return false;
		
	} else {
		
		if (Level.fieldOfView[npc.pos] && getCloser( npc.pos )) {

               return true;

		} else {
			ready();
               return false;
		}
		
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:25,代码来源:Hero.java


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