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


Java Ballistica类代码示例

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


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

	if (beamCooldown == 0) {
		Ballistica aim = new Ballistica(pos, enemy.pos, Ballistica.STOP_TERRAIN);

		if (enemy.invisible == 0 && !isCharmedBy(enemy) && fieldOfView[enemy.pos] && aim.subPath(1, aim.dist).contains(enemy.pos)){
			beam = aim;
			beamTarget = aim.collisionPos;
			return true;
		} else
			//if the beam is charged, it has to attack, will aim at previous location of target.
			return beamCharged;
	} else
		return super.canAttack(enemy);
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:17,代码来源:Eye.java

示例3: doAttack

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

	if (beamCooldown > 0) {
		return super.doAttack(enemy);
	} else if (!beamCharged){
		((EyeSprite)sprite).charge( enemy.pos );
		spend( attackDelay()*2f );
		beamCharged = true;
		return true;
	} else {

		spend( attackDelay() );
		
		beam = new Ballistica(pos, beamTarget, Ballistica.STOP_TERRAIN);
		if (Dungeon.level.heroFOV[pos] || Dungeon.level.heroFOV[beam.collisionPos] ) {
			sprite.zap( beam.collisionPos );
			return false;
		} else {
			deathGaze();
			return true;
		}
	}

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

示例4: onSelect

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

示例5: cursedZap

import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; //导入依赖的package包/类
public static void cursedZap(final Wand wand, final Hero user, final Ballistica bolt){
	switch (Random.chances(new float[]{COMMON_CHANCE, UNCOMMON_CHANCE, RARE_CHANCE, VERY_RARE_CHANCE})){
		case 0:
		default:
			commonEffect(wand, user, bolt);
			break;
		case 1:
			uncommonEffect(wand, user, bolt);
			break;
		case 2:
			rareEffect(wand, user, bolt);
			break;
		case 3:
			veryRareEffect(wand, user, bolt);
			break;
	}
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:18,代码来源:CursedWand.java

示例6: onZap

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

	//lightning deals less damage per-target, the more targets that are hit.
	float multipler = 0.4f + (0.6f/affected.size());
	//if the main target is in water, all affected take full damage
	if (Dungeon.level.water[bolt.collisionPos]) multipler = 1f;

	int min = 5 + level();
	int max = 10 + 5*level();

	for (Char ch : affected){
		processSoulMark(ch, chargesPerCast());
		ch.damage(Math.round(damageRoll() * multipler), this);

		if (ch == Dungeon.hero) Camera.main.shake( 2, 0.3f );
		ch.sprite.centerEmitter().burst( SparkParticle.FACTORY, 3 );
		ch.sprite.flash();
	}

	if (!curUser.isAlive()) {
		Dungeon.fail( getClass() );
		GLog.n(Messages.get(this, "ondeath"));
	}
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:26,代码来源:WandOfLightning.java

示例7: fx

import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; //导入依赖的package包/类
@Override
protected void fx( Ballistica bolt, Callback callback ) {

	affected.clear();
	arcs.clear();

	int cell = bolt.collisionPos;

	Char ch = Actor.findChar( cell );
	if (ch != null) {
		arcs.add( new Lightning.Arc(curUser.sprite.center(), ch.sprite.center()));
		arc(ch);
	} else {
		arcs.add( new Lightning.Arc(curUser.sprite.center(), DungeonTilemap.raisedTileCenterToWorld(bolt.collisionPos)));
		CellEmitter.center( cell ).burst( SparkParticle.FACTORY, 3 );
	}

	//don't want to wait for the effect before processing damage.
	curUser.sprite.parent.addToFront( new Lightning( arcs, null ) );
	callback.call();
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:22,代码来源:WandOfLightning.java

示例8: onZap

import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; //导入依赖的package包/类
@Override
protected void onZap(Ballistica bolt) {
	Blob venomGas = Blob.seed(bolt.collisionPos, 50 + 10 * level(), VenomGas.class);
	((VenomGas)venomGas).setStrength(level()+1);
	GameScene.add(venomGas);

	for (int i : PathFinder.NEIGHBOURS9) {
		Char ch = Actor.findChar(bolt.collisionPos + i);
		if (ch != null) {
			processSoulMark(ch, chargesPerCast());
		}
	}
	
	if (Actor.findChar(bolt.collisionPos) == null){
		Dungeon.level.press(bolt.collisionPos, null);
	}
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:18,代码来源:WandOfVenom.java

示例9: canAttack

import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; //导入依赖的package包/类
@Override
protected boolean canAttack( Char enemy ) {
    if (!Level.adjacent(pos, enemy.pos) && Ballistica.cast( pos, enemy.pos, false, true ) == enemy.pos){
        combo++;
        return true;
    } else {
        return false;
    }
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:10,代码来源:Ghost.java

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

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

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

示例13: cast

import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; //导入依赖的package包/类
public void cast( final Hero user, int dst ) {
	
	final int cell = Ballistica.cast( user.pos, dst, false, true );
	user.sprite.zap( cell );
	user.busy();
	
	Char enemy = Actor.findChar( cell );
	QuickSlotButton.target(enemy);
	
	float delay = TIME_TO_THROW;
	if (this instanceof MissileWeapon) {

		// FIXME
		delay *= ((MissileWeapon)this).speedFactor( user );
		if (enemy != null && enemy.buff( SnipersMark.class ) != null) {
			delay *= 0.5f;
		}
	}
	final float finalDelay = delay;
	
	((MissileSprite)user.sprite.parent.recycle( MissileSprite.class )).
		reset( user.pos, cell, this, new Callback() {			
			@Override
			public void call() {
				Item.this.detach( user.belongings.backpack ).onThrow( cell );
				user.spendAndNext( finalDelay );
			}
		} );
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:30,代码来源:Item.java

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

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


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