本文整理汇总了Java中com.shatteredpixel.shatteredpixeldungeon.levels.Level.fieldOfView方法的典型用法代码示例。如果您正苦于以下问题:Java Level.fieldOfView方法的具体用法?Java Level.fieldOfView怎么用?Java Level.fieldOfView使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.shatteredpixel.shatteredpixeldungeon.levels.Level
的用法示例。
在下文中一共展示了Level.fieldOfView方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkVisibleMobs
import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
private void checkVisibleMobs() {
ArrayList<Mob> visible = new ArrayList<Mob>();
boolean newMob = false;
for (Mob m : Dungeon.level.mobs) {
if (Level.fieldOfView[ m.pos ] && m.hostile) {
visible.add( m );
if (!visibleEnemies.contains( m )) {
newMob = true;
}
}
}
if (newMob) {
interrupt();
restoreHealth = false;
}
visibleEnemies = visible;
}
示例2: 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;
}
}
示例3: act
import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
@Override
protected boolean act() {
if (!Level.water[pos]) {
die( null );
return true;
} else {
//this causes pirahna to move away when a door is closed on them.
Dungeon.level.updateFieldOfView( this );
enemy = chooseEnemy();
if (state == this.HUNTING && !(enemy.isAlive() && Level.fieldOfView[enemy.pos] && enemy.invisible <= 0)){
state = this.WANDERING;
int oldPos = pos;
int i = 0;
do {
i++;
target = Dungeon.level.randomDestination();
if (i == 100) return true;
} while (!getCloser(target));
moveSprite( oldPos, pos );
return true;
}
return super.act();
}
}
示例4: doSpecial
import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
@Override
public void doSpecial() {
for (Mob mob : Dungeon.level.mobs) {
if (Level.fieldOfView[mob.pos]) {
Buff.affect( mob, Burning.class ).reignite( mob );
Buff.prolong( mob, Roots.class, 3 );
}
}
curUser.HP -= (curUser.HP / 3);
curUser.spend( Actor.TICK );
curUser.sprite.operate( curUser.pos );
curUser.busy();
curUser.sprite.centerEmitter().start( ElmoParticle.FACTORY, 0.15f, 4 );
Sample.INSTANCE.play( Assets.SND_READ );
}
示例5: doRead
import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
@Override
protected void doRead() {
for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) {
mob.beckon( curUser.pos );
if (Level.fieldOfView[mob.pos]) {
Buff.prolong(mob, Amok.class, 5f);
}
}
GLog.w( "The scroll emits an enraging roar that echoes throughout the dungeon!" );
setKnown();
curUser.sprite.centerEmitter().start( Speck.factory( Speck.SCREAM ), 0.3f, 3 );
Sample.INSTANCE.play( Assets.SND_CHALLENGE );
Invisibility.dispel();
curUser.spendAndNext( TIME_TO_READ );
}
示例6: doRead
import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
@Override
protected void doRead() {
curUser.sprite.centerEmitter().start( Speck.factory( Speck.NOTE ), 0.3f, 5 );
Sample.INSTANCE.play( Assets.SND_LULLABY );
Invisibility.dispel();
for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) {
if (Level.fieldOfView[mob.pos]) {
Buff.affect( mob, Drowsy.class );
mob.sprite.centerEmitter().start( Speck.factory( Speck.NOTE ), 0.3f, 5 );
}
}
Buff.affect( curUser, Drowsy.class );
GLog.i( "The scroll utters a soothing melody. You feel very sleepy." );
setKnown();
curUser.spendAndNext( TIME_TO_READ );
}
示例7: getCloser
import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
@Override
protected boolean getCloser( int target ) {
if (Level.fieldOfView[target] && Level.distance( pos, target ) > 2 && delay <= 0) {
blink( target );
spend( -1 / speed() );
return true;
} else {
delay--;
return super.getCloser( target );
}
}
示例8: getCloser
import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
@Override
protected boolean getCloser( int target ) {
if (Level.fieldOfView[target]) {
jump();
return true;
} else {
return super.getCloser( target );
}
}
示例9: 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() );
}
示例10: chooseEnemy
import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
protected Char chooseEnemy() {
if (enemy == DUMMY || !enemy.isAlive()) {
HashSet<Mob> enemies = new HashSet<Mob>();
for (Mob mob:Dungeon.level.mobs) {
if (mob.hostile && Level.fieldOfView[mob.pos]) {
enemies.add( mob );
}
}
enemy = enemies.size() > 0 ? Random.element( enemies ) : DUMMY;
}
return enemy;
}
示例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: doSpecial
import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
@Override
public void doSpecial() {
Item proto = new Shuriken();
for (Mob mob : Dungeon.level.mobs) {
if (Level.fieldOfView[mob.pos]) {
Callback callback = new Callback() {
@Override
public void call() {
curUser.attack( targets.get( this ) );
targets.remove( this );
if (targets.isEmpty()) {
curUser.spendAndNext( curUser.attackDelay() );
}
}
};
((MissileSprite)curUser.sprite.parent.recycle( MissileSprite.class )).
reset( curUser.pos, mob.pos, proto, callback );
targets.put( callback, mob );
}
}
if (targets.size() == 0) {
GLog.w( TXT_NO_ENEMIES );
return;
}
curUser.HP -= (curUser.HP / 3);
curUser.sprite.zap( curUser.pos );
curUser.busy();
}
示例13: doRead
import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
@Override
protected void doRead() {
GameScene.flash( 0xFFFFFF );
Sample.INSTANCE.play( Assets.SND_BLAST );
Invisibility.dispel();
for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) {
if (Level.fieldOfView[mob.pos]) {
mob.damage(mob.HT, this );
}
}
curUser.damage(Random.IntRange(curUser.HT/4, curUser.HT/2), this);
Buff.prolong( curUser, Paralysis.class, Random.Int( 4, 6 ) );
Buff.prolong( curUser, Blindness.class, Random.Int( 6, 9 ) );
Dungeon.observe();
setKnown();
curUser.spendAndNext( TIME_TO_READ );
if (!curUser.isAlive()) {
Dungeon.fail( Utils.format(ResultDescriptions.ITEM, name ));
GLog.n("The Psionic Blast tears your mind apart...");
}
}
示例14: doRead
import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
@Override
protected void doRead() {
new Flare( 5, 32 ).color( 0xFF0000, true ).show( curUser.sprite, 2f );
Sample.INSTANCE.play( Assets.SND_READ );
Invisibility.dispel();
int count = 0;
Mob affected = null;
for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) {
if (Level.fieldOfView[mob.pos]) {
Terror terror = Buff.affect( mob, Terror.class, Terror.DURATION );
terror.source = curUser;
count++;
affected = mob;
}
}
switch (count) {
case 0:
GLog.i( "The scroll emits a brilliant flash of red light" );
break;
case 1:
GLog.i( "The scroll emits a brilliant flash of red light and the " + affected.name + " flees!" );
break;
default:
GLog.i( "The scroll emits a brilliant flash of red light and the monsters flee!" );
}
setKnown();
curUser.spendAndNext( TIME_TO_READ );
}
示例15: chooseEnemy
import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入方法依赖的package包/类
@Override
protected Char chooseEnemy() {
if (enemy == DUMMY || !enemy.isAlive() || state == WANDERING) {
HashSet<Mob> enemies = new HashSet<Mob>();
for (Mob mob : Dungeon.level.mobs) {
if (mob.hostile && Level.fieldOfView[mob.pos] && mob.state != mob.PASSIVE) {
enemies.add(mob);
}
}
enemy = enemies.size() > 0 ? Random.element( enemies ) : DUMMY;
}
return enemy;
}