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


Java Actor类代码示例

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


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

示例1: affect

import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入依赖的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

示例2: evolve

import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入依赖的package包/类
@Override
protected void evolve() {
	
	for (int i=0; i < LENGTH; i++) {
		
		int offv = cur[i] > 0 ? cur[i] - 1 : 0;
		off[i] = offv;
		
		if (offv > 0) {
			
			volume += offv;
			
			Char ch = Actor.findChar( i );
			if (ch != null) {
				Buff.prolong( ch, Roots.class, TICK );
			}
		}
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:20,代码来源:Web.java

示例3: evolve

import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入依赖的package包/类
@Override
   protected void evolve() {
       super.evolve();

       int levelDamage = 5 + Dungeon.depth * 5;

       Char ch;
       for (int i=0; i < LENGTH; i++) {
           if (cur[i] > 0 && (ch = Actor.findChar( i )) != null) {

               int damage = (ch.HT + levelDamage) / 40;
               if (Random.Int( 40 ) < (ch.HT + levelDamage) % 40) {
                   damage++;
               }
			
			ch.damage( damage, this );
		}
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:20,代码来源:ToxicGas.java

示例4: defenseProc

import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入依赖的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

示例5: spawn

import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入依赖的package包/类
public static void spawn( CityLevel level ) {
	if (!spawned && Dungeon.depth > 16 && Random.Int( 20 - Dungeon.depth ) == 0) {
		
		Imp npc = new Imp();
		do {
			npc.pos = level.randomRespawnCell();
		} while (npc.pos == -1 || level.heaps.get( npc.pos ) != null);
		level.mobs.add( npc );
		Actor.occupyCell( npc );
		
		spawned = true;	
		alternative = Random.Int( 2 ) == 0;
		
		given = false;
		
		do {
			reward = (Ring)Generator.random( Generator.Category.RING );
		} while (reward.cursed);
		reward.upgrade( 2 );
		reward.cursed = true;
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:23,代码来源:Imp.java

示例6: spawnAt

import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入依赖的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;
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:20,代码来源:Wraith.java

示例7: update

import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入依赖的package包/类
@Override
public synchronized void update() {
	if (Dungeon.hero == null) {
		return;
	}

	super.update();
	
	if (!freezeEmitters) water.offset( 0, -5 * Game.elapsed );
	
	Actor.process();
	
	if (Dungeon.hero.ready && !Dungeon.hero.paralysed) {
		log.newLine();
	}
	
	cellSelector.enabled = Dungeon.hero.ready;
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:19,代码来源:GameScene.java

示例8: findPath

import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入依赖的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

示例9: flee

import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入依赖的package包/类
public static int flee( Char ch, int cur, int from, boolean pass[], boolean[] visible ) {
	
	if (ch.flying) {
		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;
			}
		}
	}
	passable[cur] = true;
	
	return PathFinder.getStepBack( cur, from, passable );
	
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:22,代码来源:Dungeon.java

示例10: useTargeting

import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入依赖的package包/类
private void useTargeting() {
	
	targeting = lastTarget != null && lastTarget.isAlive() && Dungeon.visible[lastTarget.pos];
	
	if (targeting) {
		if (Actor.all().contains( lastTarget )) {
			lastTarget.sprite.parent.add( crossM );
			crossM.point( DungeonTilemap.tileToWorld( lastTarget.pos ) );
			crossB.x = PixelScene.align( x + (width - crossB.width) / 2 );
			crossB.y = PixelScene.align( y + (height - crossB.height) / 2 );
			crossB.visible = true;
		} else {
			lastTarget = null;
		}
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:17,代码来源:QuickSlotButton.java

示例11: randomRespawnCell

import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入依赖的package包/类
@Override
public int randomRespawnCell() {
	int count = 0;
	int cell = -1;
	
	while (true) {
		
		if (++count > 30) {
			return -1;
		}
		
		Room room = randomRoom( Room.Type.STANDARD, 10 );
		if (room == null) {
			continue;
		}
		
		cell = room.random();
		if (!Dungeon.visible[cell] && Actor.findChar( cell ) == null && Level.passable[cell]) {
			return cell;
		}
		
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:24,代码来源:RegularLevel.java

示例12: respawner

import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入依赖的package包/类
public Actor respawner() {
	return new Actor() {	
		@Override
		protected boolean act() {
			if (mobs.size() < nMobs()) {

				Mob mob = Bestiary.mutable( Dungeon.depth );
				mob.state = mob.WANDERING;
				mob.pos = randomRespawnCell();
				if (Dungeon.hero.isAlive() && mob.pos != -1) {
					GameScene.add( mob );
					if (Statistics.amuletObtained) {
						mob.beckon( Dungeon.hero.pos );
					}
				}
			}
			spend( Dungeon.level.feeling == Feeling.DARK || Statistics.amuletObtained ? TIME_TO_RESPAWN / 2 : TIME_TO_RESPAWN );
			return true;
		}
	};
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:22,代码来源:Level.java

示例13: proc

import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入依赖的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

示例14: doSpecial

import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入依赖的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 );
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:20,代码来源:MageArmor.java

示例15: onThrow

import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入依赖的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


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