本文整理汇总了Java中com.shatteredpixel.shatteredpixeldungeon.actors.Actor.chars方法的典型用法代码示例。如果您正苦于以下问题:Java Actor.chars方法的具体用法?Java Actor.chars怎么用?Java Actor.chars使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.shatteredpixel.shatteredpixeldungeon.actors.Actor
的用法示例。
在下文中一共展示了Actor.chars方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: zoom
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入方法依赖的package包/类
private float zoom( float value ) {
value = GameMath.gate( PixelScene.minZoom, value, PixelScene.maxZoom );
ShatteredPixelDungeon.zoom((int) (value - PixelScene.defaultZoom));
camera.zoom( value );
//Resets character sprite positions with the new camera zoom
//This is important as characters are centered on a 16x16 tile, but may have any sprite size
//This can lead to none-whole coordinate, which need to be aligned with the zoom
for (Char c : Actor.chars()){
if (c.sprite != null && !c.sprite.isMoving){
c.sprite.point(c.sprite.worldToCamera(c.pos));
}
}
return value;
}
示例2: findPath
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入方法依赖的package包/类
public static PathFinder.Path findPath(Char ch, int from, int to, boolean pass[], boolean[] visible ) {
setupPassable();
if (ch.flying || ch.buff( Amok.class ) != null) {
BArray.or( pass, Dungeon.level.avoid, passable );
} else {
System.arraycopy( pass, 0, passable, 0, Dungeon.level.length() );
}
for (Char c : Actor.chars()) {
if (visible[c.pos]) {
passable[c.pos] = false;
}
}
return PathFinder.find( from, to, passable );
}
示例3: findStep
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入方法依赖的package包/类
public static int findStep(Char ch, int from, int to, boolean pass[], boolean[] visible ) {
if (Dungeon.level.adjacent( from, to )) {
return Actor.findChar( to ) == null && (pass[to] || Dungeon.level.avoid[to]) ? to : -1;
}
setupPassable();
if (ch.flying || ch.buff( Amok.class ) != null) {
BArray.or( pass, Dungeon.level.avoid, passable );
} else {
System.arraycopy( pass, 0, passable, 0, Dungeon.level.length() );
}
for (Char c : Actor.chars()) {
if (visible[c.pos]) {
passable[c.pos] = false;
}
}
return PathFinder.getStep( from, to, passable );
}
示例4: flee
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入方法依赖的package包/类
public static int flee( Char ch, int cur, int from, boolean pass[], boolean[] visible ) {
setupPassable();
if (ch.flying) {
BArray.or( pass, Dungeon.level.avoid, passable );
} else {
System.arraycopy( pass, 0, passable, 0, Dungeon.level.length() );
}
for (Char c : Actor.chars()) {
if (visible[c.pos]) {
passable[c.pos] = false;
}
}
passable[cur] = true;
return PathFinder.getStepBack( cur, from, passable );
}
示例5: summon
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入方法依赖的package包/类
private void summon() {
nextPedestal = !nextPedestal;
sprite.centerEmitter().start( Speck.factory( Speck.SCREAM ), 0.4f, 2 );
Sample.INSTANCE.play( Assets.SND_CHALLENGE );
boolean[] passable = Dungeon.level.passable.clone();
for (Char c : Actor.chars()) {
passable[c.pos] = false;
}
int undeadsToSummon = maxArmySize() - Undead.count;
PathFinder.buildDistanceMap( pos, passable, undeadsToSummon );
PathFinder.distance[pos] = Integer.MAX_VALUE;
int dist = 1;
undeadLabel:
for (int i=0; i < undeadsToSummon; i++) {
do {
for (int j=0; j < Dungeon.level.length(); j++) {
if (PathFinder.distance[j] == dist) {
Undead undead = new Undead();
undead.pos = j;
GameScene.add( undead );
ScrollOfTeleportation.appear( undead, j );
new Flare( 3, 32 ).color( 0x000000, false ).show( undead.sprite, 2f ) ;
PathFinder.distance[j] = Integer.MAX_VALUE;
continue undeadLabel;
}
}
dist++;
} while (dist < undeadsToSummon);
}
yell( Messages.get(this, "arise") );
}
示例6: activate
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入方法依赖的package包/类
@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
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入方法依赖的package包/类
@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
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入方法依赖的package包/类
@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);
}
}