当前位置: 首页>>代码示例>>Java>>正文


Java Actor.findChar方法代码示例

本文整理汇总了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();
		}
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:23,代码来源:IncendiaryDart.java

示例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();
           }
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:22,代码来源:MissileWeapon.java

示例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);
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:23,代码来源:Yog.java

示例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;
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:20,代码来源:Wraith.java

示例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 );
	}
	
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:24,代码来源:FlashingTrap.java

示例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);
				}
			}
		}
	}
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:22,代码来源:VenomGas.java

示例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;
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon-gdx,代码行数:26,代码来源:CorpseDust.java

示例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 );
		}
	}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:18,代码来源:Potion.java

示例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();
	}
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon-gdx,代码行数:17,代码来源:Fire.java

示例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);
				}
			}
		}
	}
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:27,代码来源:ToxicGas.java

示例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);
	}
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:22,代码来源:PitfallTrap.java

示例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 );
        }
    }
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:13,代码来源:StenchGas.java

示例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;
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:33,代码来源:Bounce.java

示例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);
                  }
              });
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:41,代码来源:WarriorArmor.java

示例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 ) );
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:31,代码来源:WandOfLightning.java


注:本文中的com.shatteredpixel.shatteredpixeldungeon.actors.Actor.findChar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。