本文整理汇总了Java中com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica.trace方法的典型用法代码示例。如果您正苦于以下问题:Java Ballistica.trace方法的具体用法?Java Ballistica.trace怎么用?Java Ballistica.trace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica
的用法示例。
在下文中一共展示了Ballistica.trace方法的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;
}
}
示例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;
}
示例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;
}
示例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);
}
});
}
}
示例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();
}
示例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..." );
}
}
}
示例7: fx
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; //导入方法依赖的package包/类
@Override
protected void fx( int cell, Callback callback ) {
cell = Ballistica.trace[Math.min( Ballistica.distance, distance() ) - 1];
curUser.sprite.parent.add( new DeathRay( curUser.sprite.center(), DungeonTilemap.tileCenterToWorld( cell ) ) );
callback.call();
}
示例8: 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);
}
}
示例9: 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;
}