本文整理汇总了Java中com.shatteredpixel.shatteredpixeldungeon.actors.Actor.findChar方法的典型用法代码示例。如果您正苦于以下问题:Java Actor.findChar方法的具体用法?Java Actor.findChar怎么用?Java Actor.findChar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.shatteredpixel.shatteredpixeldungeon.actors.Actor
的用法示例。
在下文中一共展示了Actor.findChar方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onThrow
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入方法依赖的package包/类
@Override
protected void onThrow( int cell ) {
Char enemy = Actor.findChar( cell );
if (enemy == null || enemy == curUser) {
if (Level.flamable[cell]) {
GameScene.add( Blob.seed( cell, 4, Fire.class ) );
} else {
super.onThrow( cell );
}
} else {
if (!curUser.shoot( enemy, this )) {
Dungeon.level.drop( this, cell ).sprite.drop();
} else {
int bonus = 0;
for (Buff buff : curUser.buffs(RingOfSharpshooting.Aim.class)) {
bonus += ((RingOfSharpshooting.Aim)buff).level;
}
if (Random.Float() > Math.pow(0.7, bonus))
Dungeon.level.drop( this, cell ).sprite.drop();
}
}
}
示例2: onThrow
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入方法依赖的package包/类
@Override
protected void onThrow( int cell ) {
Char enemy = Actor.findChar( cell );
if (enemy == null || enemy == curUser) {
if (this instanceof Boomerang)
super.onThrow( cell );
else
miss( cell );
} else {
if (!curUser.shoot( enemy, this )) {
miss( cell );
} else if (!(this instanceof Boomerang)){
int bonus = 0;
for (Buff buff : curUser.buffs(RingOfSharpshooting.Aim.class)) {
bonus += ((RingOfSharpshooting.Aim)buff).level;
}
if (Random.Float() > Math.pow(0.7, bonus))
Dungeon.level.drop( this, cell ).sprite.drop();
}
}
}
示例3: defenseProc
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入方法依赖的package包/类
@Override
public int defenseProc( Char enemy, int damage ) {
ArrayList<Integer> spawnPoints = new ArrayList<Integer>();
for (int i=0; i < Level.NEIGHBOURS8.length; i++) {
int p = pos + Level.NEIGHBOURS8[i];
if (Actor.findChar( p ) == null && (Level.passable[p] || Level.avoid[p])) {
spawnPoints.add( p );
}
}
if (spawnPoints.size() > 0) {
Larva larva = new Larva();
larva.pos = Random.element( spawnPoints );
GameScene.add( larva );
Actor.addDelayed( new Pushing( larva, pos, larva.pos ), -1 );
}
return super.defenseProc(enemy, damage);
}
示例4: spawnAt
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入方法依赖的package包/类
public static Wraith spawnAt( int pos ) {
if (Level.passable[pos] && Actor.findChar( pos ) == null) {
Wraith w = new Wraith();
w.adjustStats( Dungeon.depth );
w.pos = pos;
w.state = w.HUNTING;
GameScene.add( w, SPAWN_DELAY );
w.sprite.alpha( 0 );
w.sprite.parent.add( new AlphaTweener( w.sprite, 1, 0.5f ) );
w.sprite.emitter().burst( ShadowParticle.CURSE, 5 );
return w;
} else {
return null;
}
}
示例5: activate
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入方法依赖的package包/类
@Override
public void activate() {
Char c = Actor.findChar( pos );
if (c != null) {
int damage = Math.max( 0, (4 + Dungeon.depth) - c.drRoll() );
Buff.affect( c, Bleeding.class ).set( damage );
Buff.prolong( c, Blindness.class, 10f );
Buff.prolong( c, Cripple.class, 20f );
if (c instanceof Mob) {
if (((Mob)c).state == ((Mob)c).HUNTING) ((Mob)c).state = ((Mob)c).WANDERING;
((Mob)c).beckon( Dungeon.level.randomDestination() );
}
}
if (Dungeon.level.heroFOV[pos]) {
GameScene.flash(0xFFFFFF);
Sample.INSTANCE.play( Assets.SND_BLAST );
}
}
示例6: evolve
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入方法依赖的package包/类
@Override
protected void evolve() {
super.evolve();
if (volume == 0){
strength = 0;
} else {
Char ch;
int cell;
for (int i = area.left; i < area.right; i++){
for (int j = area.top; j < area.bottom; j++){
cell = i + j*Dungeon.level.width();
if (cur[cell] > 0 && (ch = Actor.findChar( cell )) != null) {
if (!ch.immunities().contains(this.getClass()))
Buff.affect(ch, Venom.class).set(2f, strength);
}
}
}
}
}
示例7: act
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入方法依赖的package包/类
@Override
public boolean act() {
spawnPower++;
int wraiths = 1; //we include the wraith we're trying to spawn
for (Mob mob : Dungeon.level.mobs){
if (mob instanceof Wraith){
wraiths++;
}
}
int powerNeeded = Math.min(25, wraiths*wraiths);
if (powerNeeded <= spawnPower){
spawnPower -= powerNeeded;
int pos = 0;
do{
pos = Random.Int(Dungeon.level.length());
} while (!Dungeon.level.heroFOV[pos] || !Dungeon.level.passable[pos] || Actor.findChar( pos ) != null);
Wraith.spawnAt(pos);
Sample.INSTANCE.play(Assets.SND_CURSED);
}
spend(TICK);
return true;
}
示例8: splash
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入方法依赖的package包/类
protected void splash( int cell ) {
Fire fire = (Fire)Dungeon.level.blobs.get( Fire.class );
if (fire != null)
fire.clear( cell );
final int color = ItemSprite.pick( image, 8, 10 );
Char ch = Actor.findChar(cell);
if (ch != null) {
Buff.detach(ch, Burning.class);
Buff.detach(ch, Ooze.class);
Splash.at( ch.sprite.center(), color, 5 );
} else {
Splash.at( cell, color, 5 );
}
}
示例9: burn
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入方法依赖的package包/类
private void burn( int pos ) {
Char ch = Actor.findChar( pos );
if (ch != null && !ch.immunities().contains(this.getClass())) {
Buff.affect( ch, Burning.class ).reignite( ch );
}
Heap heap = Dungeon.level.heaps.get( pos );
if (heap != null) {
heap.burn();
}
Plant plant = Dungeon.level.plants.get( pos );
if (plant != null){
plant.wither();
}
}
示例10: evolve
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入方法依赖的package包/类
@Override
protected void evolve() {
super.evolve();
int levelDamage = 5 + Dungeon.depth * 5;
Char ch;
int cell;
for (int i = area.left; i < area.right; i++){
for (int j = area.top; j < area.bottom; j++){
cell = i + j*Dungeon.level.width();
if (cur[cell] > 0 && (ch = Actor.findChar( cell )) != null) {
if (!ch.immunities().contains(this.getClass())) {
int damage = (ch.HT + levelDamage) / 40;
if (Random.Int( 40 ) < (ch.HT + levelDamage) % 40) {
damage++;
}
ch.damage(damage, this);
}
}
}
}
}
示例11: activate
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入方法依赖的package包/类
@Override
public void activate() {
Heap heap = Dungeon.level.heaps.get( pos );
if (heap != null){
for (Item item : heap.items){
Dungeon.dropToChasm(item);
}
heap.sprite.kill();
GameScene.discard(heap);
Dungeon.level.heaps.remove( pos );
}
Char ch = Actor.findChar( pos );
if (ch == Dungeon.hero){
Chasm.heroFall( pos );
} else if (ch != null){
Chasm.mobFall((Mob)ch);
}
}
示例12: evolve
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入方法依赖的package包/类
@Override
protected void evolve() {
super.evolve();
Char ch;
for (int i=0; i < LENGTH; i++) {
if (cur[i] > 0 && (ch = Actor.findChar(i)) != null) {
if (!ch.immunities().contains(this.getClass()))
Buff.prolong( ch, Paralysis.class, Paralysis.duration( ch )/5 );
}
}
}
示例13: proc
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入方法依赖的package包/类
@Override
public int proc( Armor armor, Char attacker, Char defender, int damage) {
int level = Math.max( 0, armor.level );
if (Level.adjacent( attacker.pos, defender.pos ) && Random.Int( level + 5) >= 4) {
for (int i=0; i < Level.NEIGHBOURS8.length; i++) {
int ofs = Level.NEIGHBOURS8[i];
if (attacker.pos - defender.pos == ofs) {
int newPos = attacker.pos + ofs;
if ((Level.passable[newPos] || Level.avoid[newPos]) && Actor.findChar( newPos ) == null) {
Actor.addDelayed( new Pushing( attacker, attacker.pos, newPos ), -1 );
attacker.pos = newPos;
// FIXME
if (attacker instanceof Mob) {
Dungeon.level.mobPress( (Mob)attacker );
} else {
Dungeon.level.press( newPos, attacker );
}
}
break;
}
}
}
return damage;
}
示例14: onSelect
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入方法依赖的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);
}
});
}
}
示例15: hit
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; //导入方法依赖的package包/类
private void hit( Char ch, int damage ) {
if (damage < 1) {
return;
}
if (ch == Dungeon.hero) {
Camera.main.shake( 2, 0.3f );
}
affected.add( ch );
ch.damage( Level.water[ch.pos] && !ch.flying ? (int)(damage * 2) : damage, LightningTrap.LIGHTNING );
ch.sprite.centerEmitter().burst( SparkParticle.FACTORY, 3 );
ch.sprite.flash();
points[nPoints++] = ch.pos;
HashSet<Char> ns = new HashSet<Char>();
for (int i=0; i < Level.NEIGHBOURS8.length; i++) {
Char n = Actor.findChar( ch.pos + Level.NEIGHBOURS8[i] );
if (n != null && !affected.contains( n )) {
ns.add( n );
}
}
if (ns.size() > 0) {
hit( Random.element( ns ), Random.Int( damage / 2, damage ) );
}
}