本文整理汇总了Java中com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica.subPath方法的典型用法代码示例。如果您正苦于以下问题:Java Ballistica.subPath方法的具体用法?Java Ballistica.subPath怎么用?Java Ballistica.subPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica
的用法示例。
在下文中一共展示了Ballistica.subPath方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: affectMap
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; //导入方法依赖的package包/类
private void affectMap(Ballistica beam){
boolean noticed = false;
for (int c: beam.subPath(0, beam.dist)){
for (int n : PathFinder.NEIGHBOURS9){
int cell = c+n;
if (Dungeon.level.discoverable[cell])
Dungeon.level.mapped[cell] = true;
int terr = Dungeon.level.map[cell];
if ((Terrain.flags[terr] & Terrain.SECRET) != 0) {
Dungeon.level.discover( cell );
GameScene.discoverTile( cell, terr );
ScrollOfMagicMapping.discover(cell);
noticed = true;
}
}
CellEmitter.center(c).burst( RainbowParticle.BURST, Random.IntRange( 1, 2 ) );
}
if (noticed)
Sample.INSTANCE.play( Assets.SND_SECRET );
GameScene.updateFog();
}
示例2: chainEnemy
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; //导入方法依赖的package包/类
private void chainEnemy( Ballistica chain, final Hero hero, final Char enemy ){
if (enemy.properties().contains(Char.Property.IMMOVABLE)) {
GLog.w( Messages.get(this, "cant_pull") );
return;
}
int bestPos = -1;
for (int i : chain.subPath(1, chain.dist)){
//prefer to the earliest point on the path
if (!Dungeon.level.solid[i] && Actor.findChar(i) == null){
bestPos = i;
break;
}
}
if (bestPos == -1) {
GLog.i(Messages.get(this, "does_nothing"));
return;
}
final int pulledPos = bestPos;
int chargeUse = Dungeon.level.distance(enemy.pos, pulledPos);
if (chargeUse > charge) {
GLog.w( Messages.get(this, "no_charge") );
return;
} else {
charge -= chargeUse;
updateQuickslot();
}
hero.busy();
hero.sprite.parent.add(new Chains(hero.sprite.center(), enemy.sprite.center(), new Callback() {
public void call() {
Actor.add(new Pushing(enemy, enemy.pos, pulledPos, new Callback() {
public void call() {
Dungeon.level.press(pulledPos, enemy);
}
}));
enemy.pos = pulledPos;
Dungeon.observe();
GameScene.updateFog();
hero.spendAndNext(1f);
}
}));
}
示例3: fx
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; //导入方法依赖的package包/类
@Override
protected void fx( Ballistica bolt, Callback callback ) {
//need to perform flame spread logic here so we can determine what cells to put flames in.
affectedCells = new HashSet<>();
visualCells = new HashSet<>();
// 4/6/9 distance
int maxDist = (int)(4 * Math.pow(1.5,(chargesPerCast()-1)));
int dist = Math.min(bolt.dist, maxDist);
for (int i = 0; i < PathFinder.CIRCLE8.length; i++){
if (bolt.sourcePos+PathFinder.CIRCLE8[i] == bolt.path.get(1)){
direction = i;
break;
}
}
float strength = maxDist;
for (int c : bolt.subPath(1, dist)) {
strength--; //as we start at dist 1, not 0.
affectedCells.add(c);
if (strength > 1) {
spreadFlames(c + PathFinder.CIRCLE8[left(direction)], strength - 1);
spreadFlames(c + PathFinder.CIRCLE8[direction], strength - 1);
spreadFlames(c + PathFinder.CIRCLE8[right(direction)], strength - 1);
} else {
visualCells.add(c);
}
}
//going to call this one manually
visualCells.remove(bolt.path.get(dist));
for (int cell : visualCells){
//this way we only get the cells at the tip, much better performance.
((MagicMissile)curUser.sprite.parent.recycle( MagicMissile.class )).reset(
MagicMissile.FIRE_CONE,
curUser.sprite,
cell,
null
);
}
MagicMissile.boltFromChar( curUser.sprite.parent,
MagicMissile.FIRE_CONE,
curUser.sprite,
bolt.path.get(dist/2),
callback );
Sample.INSTANCE.play( Assets.SND_ZAP );
}
示例4: fx
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; //导入方法依赖的package包/类
protected void fx( Ballistica bolt, Callback callback ) {
affectedCells = new HashSet<>();
visualCells = new HashSet<>();
int maxDist = Math.round(1.2f + chargesPerCast()*.8f);
int dist = Math.min(bolt.dist, maxDist);
for (int i = 0; i < PathFinder.CIRCLE8.length; i++){
if (bolt.sourcePos+PathFinder.CIRCLE8[i] == bolt.path.get(1)){
direction = i;
break;
}
}
float strength = maxDist;
for (int c : bolt.subPath(1, dist)) {
strength--; //as we start at dist 1, not 0.
if (!Dungeon.level.losBlocking[c]) {
affectedCells.add(c);
spreadRegrowth(c + PathFinder.CIRCLE8[left(direction)], strength - 1);
spreadRegrowth(c + PathFinder.CIRCLE8[direction], strength - 1);
spreadRegrowth(c + PathFinder.CIRCLE8[right(direction)], strength - 1);
} else {
visualCells.add(c);
}
}
//going to call this one manually
visualCells.remove(bolt.path.get(dist));
for (int cell : visualCells){
//this way we only get the cells at the tip, much better performance.
((MagicMissile)curUser.sprite.parent.recycle( MagicMissile.class )).reset(
MagicMissile.FOLIAGE_CONE,
curUser.sprite,
cell,
null
);
}
MagicMissile.boltFromChar( curUser.sprite.parent,
MagicMissile.FOLIAGE_CONE,
curUser.sprite,
bolt.path.get(dist/2),
callback );
Sample.INSTANCE.play( Assets.SND_ZAP );
}