本文整理汇总了Java中com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica.PROJECTILE属性的典型用法代码示例。如果您正苦于以下问题:Java Ballistica.PROJECTILE属性的具体用法?Java Ballistica.PROJECTILE怎么用?Java Ballistica.PROJECTILE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica
的用法示例。
在下文中一共展示了Ballistica.PROJECTILE属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: blink
private void blink( int target ) {
Ballistica route = new Ballistica( pos, target, Ballistica.PROJECTILE);
int cell = route.collisionPos;
//can't occupy the same cell as another char, so move back one.
if (Actor.findChar( cell ) != null && cell != this.pos)
cell = route.path.get(route.dist-1);
if (Dungeon.level.avoid[ cell ]){
ArrayList<Integer> candidates = new ArrayList<>();
for (int n : PathFinder.NEIGHBOURS8) {
cell = route.collisionPos + n;
if (Dungeon.level.passable[cell] && Actor.findChar( cell ) == null) {
candidates.add( cell );
}
}
if (candidates.size() > 0)
cell = Random.element(candidates);
else {
delay = BLINK_DELAY;
return;
}
}
ScrollOfTeleportation.appear( this, cell );
delay = BLINK_DELAY;
}
示例2: onSelect
@Override
public void onSelect( Integer target ) {
if (target != null && target != curUser.pos) {
Ballistica route = new Ballistica(curUser.pos, target, Ballistica.PROJECTILE);
int cell = route.collisionPos;
//can't occupy the same cell as another char, so move back one.
if (Actor.findChar( cell ) != null && cell != curUser.pos)
cell = route.path.get(route.dist-1);
curUser.HP -= (curUser.HP / 3);
final int dest = cell;
curUser.busy();
curUser.sprite.jump(curUser.pos, cell, new Callback() {
@Override
public void call() {
curUser.move(dest);
Dungeon.level.press(dest, curUser);
Dungeon.observe();
GameScene.updateFog();
for (int i = 0; i < PathFinder.NEIGHBOURS8.length; i++) {
Char mob = Actor.findChar(curUser.pos + PathFinder.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);
}
});
}
}
示例3: canAttack
@Override
protected boolean canAttack( Char enemy ) {
Ballistica attack = new Ballistica( pos, enemy.pos, Ballistica.PROJECTILE);
return !Dungeon.level.adjacent(pos, enemy.pos) && attack.collisionPos == enemy.pos;
}
示例4: canAttack
@Override
protected boolean canAttack( Char enemy ) {
return new Ballistica( pos, enemy.pos, Ballistica.PROJECTILE).collisionPos == enemy.pos;
}
示例5: canAttack
@Override
protected boolean canAttack( Char enemy ) {
Ballistica attack = new Ballistica( pos, enemy.pos, Ballistica.PROJECTILE);
return !Dungeon.level.adjacent( pos, enemy.pos ) && attack.collisionPos == enemy.pos;
}
示例6: activate
@Override
public void activate() {
Char target = Actor.findChar(pos);
//find the closest char that can be aimed at
if (target == null){
for (Char ch : Actor.chars()){
Ballistica bolt = new Ballistica(pos, ch.pos, Ballistica.PROJECTILE);
if (bolt.collisionPos == ch.pos &&
(target == null || Dungeon.level.distNoDiag(pos, ch.pos) < Dungeon.level.distNoDiag(pos, target.pos))){
target = ch;
}
}
}
if (target != null) {
final Char finalTarget = target;
final PoisonDartTrap trap = this;
if (Dungeon.level.heroFOV[pos] || Dungeon.level.heroFOV[target.pos]) {
Actor.add(new Actor() {
{
//it's a visual effect, gets priority no matter what
actPriority = Integer.MIN_VALUE;
}
@Override
protected boolean act() {
final Actor toRemove = this;
((MissileSprite) ShatteredPixelDungeon.scene().recycle(MissileSprite.class)).
reset(pos, finalTarget.sprite, new Dart(), new Callback() {
@Override
public void call() {
int dmg = Random.NormalIntRange(1, 4) - finalTarget.drRoll();
finalTarget.damage(dmg, trap);
if (finalTarget == Dungeon.hero && !finalTarget.isAlive()){
Dungeon.fail( trap.getClass() );
}
Buff.affect( finalTarget, Poison.class )
.set( Poison.durationFactor( finalTarget ) * (4 + Dungeon.depth) );
Sample.INSTANCE.play(Assets.SND_HIT, 1, 1, Random.Float(0.8f, 1.25f));
finalTarget.sprite.bloodBurstA(finalTarget.sprite.center(), dmg);
finalTarget.sprite.flash();
Actor.remove(toRemove);
next();
}
});
return false;
}
});
} else {
finalTarget.damage(Random.NormalIntRange(1, 4) - finalTarget.drRoll(), trap);
Buff.affect( finalTarget, Poison.class )
.set( Poison.durationFactor( finalTarget ) * (4 + Dungeon.depth) );
}
}
}
示例7: activate
@Override
public void activate() {
Char target = Actor.findChar(pos);
//find the closest char that can be aimed at
if (target == null){
for (Char ch : Actor.chars()){
Ballistica bolt = new Ballistica(pos, ch.pos, Ballistica.PROJECTILE);
if (bolt.collisionPos == ch.pos &&
(target == null || Dungeon.level.distNoDiag(pos, ch.pos) < Dungeon.level.distNoDiag(pos, target.pos))){
target = ch;
}
}
}
if (target != null) {
final Char finalTarget = target;
final WornDartTrap trap = this;
if (Dungeon.level.heroFOV[pos] || Dungeon.level.heroFOV[target.pos]) {
Actor.add(new Actor() {
{
//it's a visual effect, gets priority no matter what
actPriority = Integer.MIN_VALUE;
}
@Override
protected boolean act() {
final Actor toRemove = this;
((MissileSprite) ShatteredPixelDungeon.scene().recycle(MissileSprite.class)).
reset(pos, finalTarget.sprite, new Dart(), new Callback() {
@Override
public void call() {
int dmg = Random.NormalIntRange(1, 4) - finalTarget.drRoll();
finalTarget.damage(dmg, trap);
if (finalTarget == Dungeon.hero && !finalTarget.isAlive()){
Dungeon.fail( trap.getClass() );
}
Sample.INSTANCE.play(Assets.SND_HIT, 1, 1, Random.Float(0.8f, 1.25f));
finalTarget.sprite.bloodBurstA(finalTarget.sprite.center(), dmg);
finalTarget.sprite.flash();
Actor.remove(toRemove);
next();
}
});
return false;
}
});
} else {
finalTarget.damage(Random.NormalIntRange(1, 4) - finalTarget.drRoll(), trap);
}
}
}
示例8: activate
@Override
public void activate() {
Char target = Actor.findChar(pos);
//find the closest char that can be aimed at
if (target == null){
for (Char ch : Actor.chars()){
Ballistica bolt = new Ballistica(pos, ch.pos, Ballistica.PROJECTILE);
if (bolt.collisionPos == ch.pos &&
(target == null || Dungeon.level.distNoDiag(pos, ch.pos) < Dungeon.level.distNoDiag(pos, target.pos))){
target = ch;
}
}
}
if (target != null){
final Char finalTarget = target;
final GrimTrap trap = this;
int damage;
//almost kill the player
if (finalTarget == Dungeon.hero && ((float)finalTarget.HP/finalTarget.HT) >= 0.9f){
damage = finalTarget.HP-1;
//kill 'em
} else {
damage = finalTarget.HP;
}
final int finalDmg = damage;
Actor.add(new Actor() {
{
//it's a visual effect, gets priority no matter what
actPriority = Integer.MIN_VALUE;
}
@Override
protected boolean act() {
final Actor toRemove = this;
((MagicMissile)finalTarget.sprite.parent.recycle(MagicMissile.class)).reset(
MagicMissile.SHADOW,
DungeonTilemap.tileCenterToWorld(pos),
finalTarget.sprite.center(),
new Callback() {
@Override
public void call() {
finalTarget.damage(finalDmg, trap);
if (finalTarget == Dungeon.hero) {
Sample.INSTANCE.play(Assets.SND_CURSED);
if (!finalTarget.isAlive()) {
Dungeon.fail( GrimTrap.class );
GLog.n( Messages.get(GrimTrap.class, "ondeath") );
}
} else {
Sample.INSTANCE.play(Assets.SND_BURNING);
}
finalTarget.sprite.emitter().burst(ShadowParticle.UP, 10);
Actor.remove(toRemove);
next();
}
});
return false;
}
});
} else {
CellEmitter.get(pos).burst(ShadowParticle.UP, 10);
Sample.INSTANCE.play(Assets.SND_BURNING);
}
}
示例9: throwPos
public int throwPos( Hero user, int dst){
return new Ballistica( user.pos, dst, Ballistica.PROJECTILE ).collisionPos;
}