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


Java Ballistica.distance方法代码示例

本文整理汇总了Java中com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica.distance方法的典型用法代码示例。如果您正苦于以下问题:Java Ballistica.distance方法的具体用法?Java Ballistica.distance怎么用?Java Ballistica.distance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica的用法示例。


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

示例1: doAttack

import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; //导入方法依赖的package包/类
@Override
protected boolean doAttack( Char enemy ) {

	spend( attackDelay() );
	
	boolean rayVisible = false;
	
	for (int i=0; i < Ballistica.distance; i++) {
		if (Dungeon.visible[Ballistica.trace[i]]) {
			rayVisible = true;
		}
	}
	
	if (rayVisible) {
		sprite.attack( hitCell );
		return false;
	} else {
		attack( enemy );
		return true;
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:22,代码来源:Eye.java

示例2: canAttack

import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; //导入方法依赖的package包/类
@Override
protected boolean canAttack( Char enemy ) {
	
	hitCell = Ballistica.cast( pos, enemy.pos, true, false );
	
	for (int i=1; i < Ballistica.distance; i++) {
		if (Ballistica.trace[i] == enemy.pos) {
			return true;
		}
	}
	return false;
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:13,代码来源:Eye.java

示例3: attack

import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; //导入方法依赖的package包/类
@Override
public boolean attack( Char enemy ) {
	
	for (int i=1; i < Ballistica.distance; i++) {
		
		int pos = Ballistica.trace[i];
		
		Char ch = Actor.findChar( pos );
		if (ch == null) {
			continue;
		}
		
		if (hit( this, ch, true )) {
			ch.damage( Random.NormalIntRange( 14, 20 ), this );
			
			if (Dungeon.visible[pos]) {
				ch.sprite.flash();
				CellEmitter.center( pos ).burst( PurpleParticle.BURST, Random.IntRange( 1, 2 ) );
			}
			
			if (!ch.isAlive() && ch == Dungeon.hero) {
				Dungeon.fail( Utils.format( ResultDescriptions.MOB, Utils.indefinite( name ) ) );
				GLog.n( TXT_DEATHGAZE_KILLED, name );
			}
		} else {
			ch.sprite.showStatus( CharSprite.NEUTRAL,  ch.defenseVerb() );
		}
	}
	
	return true;
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:32,代码来源:Eye.java

示例4: onSelect

import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; //导入方法依赖的package包/类
@Override
public void onSelect( Integer target ) {
	if (target != null && target != curUser.pos) {
		
		int cell = Ballistica.cast( curUser.pos, target, false, true );
		if (Actor.findChar( cell ) != null && cell != curUser.pos) {
			cell = Ballistica.trace[Ballistica.distance - 2];
		}

              curUser.HP -= (curUser.HP / 3);
		if (curUser.subClass == HeroSubClass.BERSERKER && curUser.HP <= curUser.HT * Fury.LEVEL) {
			Buff.affect( curUser, Fury.class );
		}
		


              final int dest = cell;
              curUser.busy();
              ((HeroSprite)curUser.sprite).jump(curUser.pos, cell, new Callback() {
                  @Override
                  public void call() {
                      curUser.move(dest);
                      Dungeon.level.press(dest, curUser);
                      Dungeon.observe();

                      for (int i = 0; i < Level.NEIGHBOURS8.length; i++) {
                          Char mob = Actor.findChar(curUser.pos + Level.NEIGHBOURS8[i]);
                          if (mob != null && mob != curUser) {
                              Buff.prolong(mob, Paralysis.class, SHOCK_TIME);
                          }
                      }

                      CellEmitter.center(dest).burst(Speck.factory(Speck.DUST), 10);
                      Camera.main.shake(2, 0.5f);

                      curUser.spendAndNext(LEAP_TIME);
                  }
              });
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:41,代码来源:WarriorArmor.java

示例5: onZap

import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; //导入方法依赖的package包/类
@Override
protected void onZap( int cell ) {

	int level = level();
	
	if (Ballistica.distance > level + 4) {
		cell = Ballistica.trace[level + 3];
	} else if (Actor.findChar( cell ) != null && Ballistica.distance > 1) {
		cell = Ballistica.trace[Ballistica.distance - 2];
	}
	
	curUser.sprite.visible = true;
	appear( Dungeon.hero, cell );
	Dungeon.observe();
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:16,代码来源:WandOfBlink.java

示例6: onZap

import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; //导入方法依赖的package包/类
@Override
protected void onZap( int cell ) {

	int level = level();
	
	for (int i=1; i < Ballistica.distance - 1; i++) {
		int c = Ballistica.trace[i];
		if (Level.flamable[c]) {
			GameScene.add( Blob.seed( c, 1, Fire.class ) );
		}
	}
	
	GameScene.add( Blob.seed( cell, 1, Fire.class ) );
				
	Char ch = Actor.findChar( cell );
	if (ch != null) {	
		
		ch.damage( Random.Int( 1, 8 + level * level ), this );
		Buff.affect( ch, Burning.class ).reignite( ch );
		
		ch.sprite.emitter().burst( FlameParticle.FACTORY, 5 );
		
		if (ch == curUser && !ch.isAlive()) {
			Dungeon.fail( Utils.format( ResultDescriptions.ITEM, name ) );
			GLog.n( "You killed yourself with your own Wand of Firebolt..." );
		}
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:29,代码来源:WandOfFirebolt.java

示例7: onZap

import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; //导入方法依赖的package包/类
@Override
protected void onZap( int cell ) {
	
	int level = level();
	
	int n = level + 2;
	
	if (Actor.findChar( cell ) != null && Ballistica.distance > 2) {
		cell = Ballistica.trace[Ballistica.distance - 2];
	}
	
	boolean[] passable = BArray.or( Level.passable, Level.avoid, null );
	for (Actor actor : Actor.all()) {
		if (actor instanceof Char) {
			passable[((Char)actor).pos] = false;
		}
	}
	
	PathFinder.buildDistanceMap( cell, passable, n );
	int dist = 0;
	
	if (Actor.findChar( cell ) != null) {
		PathFinder.distance[cell] = Integer.MAX_VALUE;
		dist = 1;
	}
	
	float lifespan = level + 3;
	
sheepLabel:
	for (int i=0; i < n; i++) {
		do {
			for (int j=0; j < Level.LENGTH; j++) {
				if (PathFinder.distance[j] == dist) {
					
					Sheep sheep = new Sheep();
					sheep.lifespan = lifespan;
					sheep.pos = j;
					GameScene.add( sheep );
					Dungeon.level.mobPress( sheep );
					
					CellEmitter.get( j ).burst( Speck.factory( Speck.WOOL ), 4 );
					
					PathFinder.distance[j] = Integer.MAX_VALUE;
					
					continue sheepLabel;
				}
			}
			dist++;
		} while (dist < n);
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:52,代码来源:WandOfFlock.java

示例8: blink

import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; //导入方法依赖的package包/类
private void blink( int target ) {
	
	int cell = Ballistica.cast( pos, target, true, true );
	
	if (Actor.findChar( cell ) != null && Ballistica.distance > 1) {
		cell = Ballistica.trace[Ballistica.distance - 2];
	}
	
	WandOfBlink.appear( this, cell );
	
	delay = BLINK_DELAY;
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:13,代码来源:Succubus.java

示例9: onZap

import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; //导入方法依赖的package包/类
@Override
protected void onZap( int cell ) {
	
	Sample.INSTANCE.play( Assets.SND_ROCKS );
	
	int level = level();
	
	Ballistica.distance = Math.min( Ballistica.distance, 8 + level );
	
	int size = 1 + level / 3;
	PathFinder.buildDistanceMap( cell, BArray.not( Level.solid, null ), size );
	
	for (int i=0; i < Level.LENGTH; i++) {
		
		int d = PathFinder.distance[i];
		
		if (d < Integer.MAX_VALUE) {
			
			Char ch = Actor.findChar( i ); 
			if (ch != null) {
				
				ch.sprite.flash();
				
				ch.damage( Random.Int( 2, 6 + (size - d) * 2 ), this );
				
				if (ch.isAlive() && Random.Int( 2 + d ) == 0) {
					Buff.prolong( ch, Paralysis.class, Random.IntRange( 2, 6 ) );
				}
			}

			CellEmitter.get( i ).start( Speck.factory( Speck.ROCK ), 0.07f, 3 + (size - d) );
			Camera.main.shake( 3, 0.07f * (3 + (size - d)) );
		}
	}
	
	if (!curUser.isAlive()) {
		Dungeon.fail( Utils.format( ResultDescriptions.ITEM, name ) );
		GLog.n( "You killed yourself with your own Wand of Avalanche..." );
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:41,代码来源:WandOfAvalanche.java


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