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


Java BArray类代码示例

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


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

示例1: findPath

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

示例2: flee

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

示例3: shatter

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

示例4: canAttack

import com.shatteredpixel.shatteredpixeldungeon.utils.BArray; //导入依赖的package包/类
public boolean canAttack(Char enemy){
	if (enemy == null || pos == enemy.pos)
		return false;

	//can always attack adjacent enemies
	if (Dungeon.level.adjacent(pos, enemy.pos))
		return true;

	KindOfWeapon wep = Dungeon.hero.belongings.weapon;

	if (wep != null && Dungeon.level.distance( pos, enemy.pos ) <= wep.reachFactor(this)){

		boolean[] passable = BArray.not(Dungeon.level.solid, null);
		for (Mob m : Dungeon.level.mobs)
			passable[m.pos] = false;

		PathFinder.buildDistanceMap(enemy.pos, passable, wep.reachFactor(this));

		return PathFinder.distance[pos] <= wep.reachFactor(this);

	} else {
		return false;
	}
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:25,代码来源:Hero.java

示例5: damageRoll

import com.shatteredpixel.shatteredpixeldungeon.utils.BArray; //导入依赖的package包/类
@Override
public int damageRoll() {
	int min = 1;
	int max = (HP*2 <= HT) ? 15 : 10;
	if (pumpedUp > 0) {
		pumpedUp = 0;
		PathFinder.buildDistanceMap( pos, BArray.not( Dungeon.level.solid, null ), 2 );
		for (int i = 0; i < PathFinder.distance.length; i++) {
			if (PathFinder.distance[i] < Integer.MAX_VALUE)
				CellEmitter.get(i).burst(ElmoParticle.FACTORY, 10);
		}
		Sample.INSTANCE.play( Assets.SND_BURNING );
		return Random.NormalIntRange( min*3, max*3 );
	} else {
		return Random.NormalIntRange( min, max );
	}
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:18,代码来源:Goo.java

示例6: findPath

import com.shatteredpixel.shatteredpixeldungeon.utils.BArray; //导入依赖的package包/类
public static PathFinder.Path findPath(Char ch, int from, int to, boolean pass[], boolean[] visible ) {

		setupPassable();
		if (ch.flying || ch.buff( Amok.class ) != null) {
			BArray.or( pass, Dungeon.level.avoid, passable );
		} else {
			System.arraycopy( pass, 0, passable, 0, Dungeon.level.length() );
		}

		for (Char c : Actor.chars()) {
			if (visible[c.pos]) {
				passable[c.pos] = false;
			}
		}

		return PathFinder.find( from, to, passable );

	}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:19,代码来源:Dungeon.java

示例7: findStep

import com.shatteredpixel.shatteredpixeldungeon.utils.BArray; //导入依赖的package包/类
public static int findStep(Char ch, int from, int to, boolean pass[], boolean[] visible ) {

		if (Dungeon.level.adjacent( from, to )) {
			return Actor.findChar( to ) == null && (pass[to] || Dungeon.level.avoid[to]) ? to : -1;
		}

		setupPassable();
		if (ch.flying || ch.buff( Amok.class ) != null) {
			BArray.or( pass, Dungeon.level.avoid, passable );
		} else {
			System.arraycopy( pass, 0, passable, 0, Dungeon.level.length() );
		}
		
		for (Char c : Actor.chars()) {
			if (visible[c.pos]) {
				passable[c.pos] = false;
			}
		}
		
		return PathFinder.getStep( from, to, passable );

	}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:23,代码来源:Dungeon.java

示例8: flee

import com.shatteredpixel.shatteredpixeldungeon.utils.BArray; //导入依赖的package包/类
public static int flee( Char ch, int cur, int from, boolean pass[], boolean[] visible ) {

		setupPassable();
		if (ch.flying) {
			BArray.or( pass, Dungeon.level.avoid, passable );
		} else {
			System.arraycopy( pass, 0, passable, 0, Dungeon.level.length() );
		}
		
		for (Char c : Actor.chars()) {
			if (visible[c.pos]) {
				passable[c.pos] = false;
			}
		}
		passable[cur] = true;
		
		return PathFinder.getStepBack( cur, from, passable );
		
	}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:20,代码来源:Dungeon.java

示例9: autoAim

import com.shatteredpixel.shatteredpixeldungeon.utils.BArray; //导入依赖的package包/类
public static int autoAim(Char target, Item item){

		//first try to directly target
		if (item.throwPos(Dungeon.hero, target.pos) == target.pos) {
			return target.pos;
		}

		//Otherwise pick nearby tiles to try and 'angle' the shot, auto-aim basically.
		PathFinder.buildDistanceMap( target.pos, BArray.not( new boolean[Dungeon.level.length()], null ), 2 );
		for (int i = 0; i < PathFinder.distance.length; i++) {
			if (PathFinder.distance[i] < Integer.MAX_VALUE
					&& item.throwPos(Dungeon.hero, i) == target.pos)
				return i;
		}

		//couldn't find a cell, give up.
		return -1;
	}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:19,代码来源:QuickSlotButton.java

示例10: castShadow

import com.shatteredpixel.shatteredpixeldungeon.utils.BArray; //导入依赖的package包/类
public static void castShadow( int x, int y, boolean[] fieldOfView, int distance ) {

		BArray.setFalse(fieldOfView);

		fieldOfView[y * Dungeon.level.width() + x] = true;

		boolean[] losBlocking = Dungeon.level.losBlocking;
		Obstacles obs = new Obstacles();

		scanSector( distance, fieldOfView, losBlocking, obs, x, y, +1, +1, 0, 0 );
		scanSector( distance, fieldOfView, losBlocking, obs, x, y, -1, +1, 0, 0 );
		scanSector( distance, fieldOfView, losBlocking, obs, x, y, +1, -1, 0, 0 );
		scanSector( distance, fieldOfView, losBlocking, obs, x, y, -1, -1, 0, 0 );
		scanSector( distance, fieldOfView, losBlocking, obs, x, y, 0, 0, +1, +1 );
		scanSector( distance, fieldOfView, losBlocking, obs, x, y, 0, 0, -1, +1 );
		scanSector( distance, fieldOfView, losBlocking, obs, x, y, 0, 0, +1, -1 );
		scanSector( distance, fieldOfView, losBlocking, obs, x, y, 0, 0, -1, -1 );

	}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:20,代码来源:ShadowCaster.java

示例11: changeMap

import com.shatteredpixel.shatteredpixeldungeon.utils.BArray; //导入依赖的package包/类
private void changeMap(int[] map){
	this.map = map.clone();
	buildFlagMaps();
	cleanWalls();

	exit = entrance = 0;
	for (int i = 0; i < length(); i ++)
		if (map[i] == Terrain.ENTRANCE)
			entrance = i;
		else if (map[i] == Terrain.EXIT)
			exit = i;

	BArray.setFalse(visited);
	BArray.setFalse(mapped);
	
	for (Blob blob: blobs.values()){
		blob.fullyClear();
	}
	addVisuals(); //this also resets existing visuals
	resetTraps();


	GameScene.resetMap();
	Dungeon.observe();
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:26,代码来源:PrisonBossLevel.java

示例12: teleportToLocation

import com.shatteredpixel.shatteredpixeldungeon.utils.BArray; //导入依赖的package包/类
public static void teleportToLocation(Hero hero, int pos){
	PathFinder.buildDistanceMap(pos, BArray.or(Dungeon.level.passable, Dungeon.level.avoid, null));
	if (PathFinder.distance[hero.pos] == Integer.MAX_VALUE
			|| (!Dungeon.level.passable[pos] && !Dungeon.level.avoid[pos])
			|| Actor.findChar(pos) != null){
		GLog.w( Messages.get(ScrollOfTeleportation.class, "cant_reach") );
		return;
	}
	
	appear( hero, pos );
	Dungeon.level.press( pos, hero );
	Dungeon.observe();
	GameScene.updateFog();
	
	GLog.i( Messages.get(ScrollOfTeleportation.class, "tele") );
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:17,代码来源:ScrollOfTeleportation.java

示例13: onSelect

import com.shatteredpixel.shatteredpixeldungeon.utils.BArray; //导入依赖的package包/类
@Override
public void onSelect(Integer target) {
	if (target != null && (Dungeon.level.visited[target] || Dungeon.level.mapped[target])){

		//chains cannot be used to go where it is impossible to walk to
		PathFinder.buildDistanceMap(target, BArray.or(Dungeon.level.passable, Dungeon.level.avoid, null));
		if (PathFinder.distance[curUser.pos] == Integer.MAX_VALUE){
			GLog.w( Messages.get(EtherealChains.class, "cant_reach") );
			return;
		}
		
		final Ballistica chain = new Ballistica(curUser.pos, target, Ballistica.STOP_TARGET);
		
		if (Actor.findChar( chain.collisionPos ) != null){
			chainEnemy( chain, curUser, Actor.findChar( chain.collisionPos ));
		} else {
			chainLocation( chain, curUser );
		}

	}

}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:23,代码来源:EtherealChains.java

示例14: arc

import com.shatteredpixel.shatteredpixeldungeon.utils.BArray; //导入依赖的package包/类
private void arc( Char ch ) {
	
	affected.add( ch );

	int dist;
	if (Dungeon.level.water[ch.pos] && !ch.flying)
		dist = 2;
	else
		dist = 1;

		PathFinder.buildDistanceMap( ch.pos, BArray.not( Dungeon.level.solid, null ), dist );
		for (int i = 0; i < PathFinder.distance.length; i++) {
			if (PathFinder.distance[i] < Integer.MAX_VALUE){
				Char n = Actor.findChar( i );
				if (n == Dungeon.hero && PathFinder.distance[i] > 1)
					//the hero is only zapped if they are adjacent
					continue;
				else if (n != null && !affected.contains( n )) {
					arcs.add(new Lightning.Arc(ch.sprite.center(), n.sprite.center()));
					arc(n);
				}
			}
	}
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:25,代码来源:WandOfLightning.java

示例15: activate

import com.shatteredpixel.shatteredpixeldungeon.utils.BArray; //导入依赖的package包/类
@Override
public void activate( Char ch ) {
	super.activate( ch );
	
	PathFinder.buildDistanceMap( pos, BArray.not( Level.losBlocking, null ), 1 );
	
	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 );
		}
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:16,代码来源:Icecap.java


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