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


Java Level类代码示例

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


Level类属于com.shatteredpixel.shatteredpixeldungeon.levels包,在下文中一共展示了Level类的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 CurareDart(), new Callback() {
                    @Override
                    public void call() {
                        ch.onAttackComplete();
                    }
                } );

        play( cast );
        turnTo( ch.pos , cell );

    } else {

        super.attack( cell );

    }
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:22,代码来源:GnollTricksterSprite.java

示例2: move

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入依赖的package包/类
public void move( int from, int to ) {
	play( run );
	
	motion = new PosTweener( this, worldToCamera( to ), MOVE_INTERVAL );
	motion.listener = this;
	parent.add( motion );

       isMoving = true;
	
	turnTo( from , to );
	
	if (visible && Level.water[from] && !ch.flying) {
		GameScene.ripple( from );
	}

       ch.onMotionComplete();
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:18,代码来源:CharSprite.java

示例3: affectCell

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入依赖的package包/类
public static void affectCell( int cell ) {
	
	Class<?>[] waters = {WaterOfHealth.class, WaterOfAwareness.class, WaterOfTransmutation.class};
	
	for (Class<?>waterClass : waters) {
		WellWater water = (WellWater)Dungeon.level.blobs.get( waterClass );
		if (water != null && 
			water.volume > 0 && 
			water.pos == cell && 
			water.affect()) {
			
			Level.set( cell, Terrain.EMPTY_WELL );
			GameScene.updateMap( cell );
			
			return;
		}
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:19,代码来源:WellWater.java

示例4: affect

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入依赖的package包/类
public static void affect( int cell, Fire fire ) {
	
	Char ch = Actor.findChar( cell ); 
	if (ch != null) {
           if (Level.water[ch.pos]){
               Buff.prolong(ch, Frost.class, Frost.duration(ch) * Random.Float(5f, 7.5f));
           } else {
               Buff.prolong(ch, Frost.class, Frost.duration(ch) * Random.Float(1.0f, 1.5f));
           }
	}
	
	if (fire != null) {
		fire.clear( cell );
	}
	
	Heap heap = Dungeon.level.heaps.get( cell );
	if (heap != null) {
		heap.freeze();
	}

	if (Dungeon.visible[cell]) {
		CellEmitter.get( cell ).start( SnowParticle.FACTORY, 0.2f, 6 );
	}
	
	
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:27,代码来源:Freezing.java

示例5: paint

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入依赖的package包/类
public static void paint( Level level, Room room ) {

		fill( level, room, Terrain.WALL );
		fill( level, room, 1, Terrain.EMPTY_SP );
		
		Room.Door entrance = room.entrance();
		entrance.set( Room.Door.Type.HIDDEN );
		int door = entrance.x + entrance.y * Level.WIDTH;
		
		for (int i=room.left + 1; i < room.right; i++) {
			addChest( level, (room.top + 1) * Level.WIDTH + i, door );
			addChest( level, (room.bottom - 1) * Level.WIDTH + i, door );
		}
		
		for (int i=room.top + 2; i < room.bottom - 1; i++) {
			addChest( level, i * Level.WIDTH + room.left + 1, door );
			addChest( level, i * Level.WIDTH + room.right - 1, door );
		}
		
		RatKing king = new RatKing();
		king.pos = room.random( 1 );
		level.mobs.add( king );
	}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:24,代码来源:RatKingPainter.java

示例6: 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

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

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

示例9: add

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入依赖的package包/类
@Override
public void add( Buff buff ) {
	if (buff instanceof Burning) {
		if (HP < HT) {
			HP++;
			sprite.emitter().burst( Speck.factory( Speck.HEALING ), 1 );
		}
	} else {
		if (buff instanceof Frost) {
               if (Level.water[this.pos])
                   damage( Random.NormalIntRange( HT / 2, HT ), buff );
               else
			    damage( Random.NormalIntRange( 1, HT * 2 / 3 ), buff );
		}
           if (isAlive())
		    super.add( buff );
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:19,代码来源:Elemental.java

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

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

示例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 (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

示例13: onThrow

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入依赖的package包/类
@Override
protected void onThrow( int cell ) {
	Char enemy = Actor.findChar( cell );
	if (enemy == null || enemy == curUser) {
		if (Level.flamable[cell]) {
			GameScene.add( Blob.seed( cell, 4, Fire.class ) );
		} else {
			super.onThrow( cell );
		}
	} else {
		if (!curUser.shoot( enemy, this )) {
			Dungeon.level.drop( this, cell ).sprite.drop();
           } else {
               int bonus = 0;
               for (Buff buff : curUser.buffs(RingOfSharpshooting.Aim.class)) {
                   bonus += ((RingOfSharpshooting.Aim)buff).level;
               }
               if (Random.Float() > Math.pow(0.7, bonus))
                   Dungeon.level.drop( this, cell ).sprite.drop();
		}
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:23,代码来源:IncendiaryDart.java

示例14: shatter

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入依赖的package包/类
@Override
protected void shatter( int cell ) {
	
	PathFinder.buildDistanceMap( cell, BArray.not( Level.losBlocking, null ), DISTANCE );
	
	Fire fire = (Fire)Dungeon.level.blobs.get( Fire.class );
	
	for (int i=0; i < Level.LENGTH; i++) {
		if (PathFinder.distance[i] < Integer.MAX_VALUE) {
			Freezing.affect( i, fire );
		}
	}
	
	splash( cell );
	Sample.INSTANCE.play( Assets.SND_SHATTER );
	
	setKnown();
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:19,代码来源:PotionOfFrost.java

示例15: attackProc

import com.shatteredpixel.shatteredpixeldungeon.levels.Level; //导入依赖的package包/类
@Override
public int attackProc( Char enemy, int damage ) {
    //The gnoll's attacks get more severe the more the player lets it hit them
    int effect = Random.Int(4)+combo;

    if (effect > 2) {

        if (effect >=6 && enemy.buff(Burning.class) == null){

            if (Level.flamable[enemy.pos])
                GameScene.add( Blob.seed( enemy.pos, 4, Fire.class ) );
            Buff.affect( enemy, Burning.class ).reignite( enemy );

        } else
            Buff.affect( enemy, Poison.class).set((effect-2) * Poison.durationFactor(enemy));

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


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