本文整理汇总了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 );
}
}
示例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;
}
}
示例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;
}
}
示例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 );
}
示例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;
}
示例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 );
}
}
示例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;
}
示例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 );
}
}
示例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 );
}
}
示例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() );
}
示例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;
}
}
示例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 );
}
}
示例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 );
}
示例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;
}
示例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;
}
}
}