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


Java Char.isAlive方法代码示例

本文整理汇总了Java中com.shatteredpixel.shatteredpixeldungeon.actors.Char.isAlive方法的典型用法代码示例。如果您正苦于以下问题:Java Char.isAlive方法的具体用法?Java Char.isAlive怎么用?Java Char.isAlive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.shatteredpixel.shatteredpixeldungeon.actors.Char的用法示例。


在下文中一共展示了Char.isAlive方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: die

import com.shatteredpixel.shatteredpixeldungeon.actors.Char; //导入方法依赖的package包/类
@Override
public void die( Object cause ) {
	
	super.die( cause );
	
	boolean heroKilled = false;
	for (int i=0; i < Level.NEIGHBOURS8.length; i++) {
		Char ch = findChar( pos + Level.NEIGHBOURS8[i] );
		if (ch != null && ch.isAlive()) {
			int damage = Math.max( 0,  damageRoll() - Random.IntRange( 0, ch.dr() / 2 ) );
			ch.damage( damage, this );
			if (ch == Dungeon.hero && !ch.isAlive()) {
				heroKilled = true;
			}
		}
	}
	
	if (Dungeon.visible[pos]) {
		Sample.INSTANCE.play( Assets.SND_BONES );
	}
	
	if (heroKilled) {
		Dungeon.fail( Utils.format( ResultDescriptions.MOB, Utils.indefinite( name ) ) );
		GLog.n( TXT_HERO_KILLED );
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:27,代码来源:Skeleton.java

示例2: proc

import com.shatteredpixel.shatteredpixeldungeon.actors.Char; //导入方法依赖的package包/类
@Override
public boolean proc( Weapon weapon, Char attacker, Char defender, int damage ) {
	// lvl 0 - 8%
	// lvl 1 ~ 9%
	// lvl 2 ~ 10%
	int level = Math.max( 0, weapon.level );
	
	if (Random.Int( level + 100 ) >= 92) {
		
		defender.damage( defender.HP, this );
		defender.sprite.emitter().burst( ShadowParticle.UP, 5 );
		
		if (!defender.isAlive() && attacker instanceof Hero) {
			Badges.validateGrimWeapon();
		}
		
		return true;
		
	} else {
		
		return false;
		
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:25,代码来源:Death.java

示例3: onZap

import com.shatteredpixel.shatteredpixeldungeon.actors.Char; //导入方法依赖的package包/类
@Override
protected void onZap( int cell ) {
			
	Char ch = Actor.findChar( cell );
	if (ch != null) {	
		
		int level = level();
		
		ch.damage( Random.Int( 1, 6 + level * 2 ), this );
		
		ch.sprite.burst( 0xFF99CCFF, level / 2 + 2 );
		
		if (ch == curUser && !ch.isAlive()) {
			Dungeon.fail( Utils.format( ResultDescriptions.ITEM, name ) );
			GLog.n( "You killed yourself with your own Wand of Magic Missile..." );
		}
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:19,代码来源:WandOfMagicMissile.java

示例4: attack

import com.shatteredpixel.shatteredpixeldungeon.actors.Char; //导入方法依赖的package包/类
@Override
public boolean attack( Char enemy ) {
	
	if (!Level.adjacent( pos, enemy.pos )) {
		spend( attackDelay() );
		
		if (hit( this, enemy, true )) {
			
			int dmg =  damageRoll();
			enemy.damage( dmg, this );
			
			enemy.sprite.bloodBurstA( sprite.center(), dmg );
			enemy.sprite.flash();
			
			if (!enemy.isAlive() && enemy == Dungeon.hero) {
				Dungeon.fail( Utils.format( ResultDescriptions.UNIQUE, name ) );
				GLog.n( TXT_KILL, name );
			}
			return true;
			
		} else {
			
			enemy.sprite.showStatus( CharSprite.NEUTRAL,  enemy.defenseVerb() );
			return false;
		}
	} else {
		return super.attack( enemy );
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:30,代码来源:Yog.java

示例5: attack

import com.shatteredpixel.shatteredpixeldungeon.actors.Char; //导入方法依赖的package包/类
@Override
public boolean attack( Char enemy ) {
	
	for (int i=1; i < Ballistica.distance; i++) {
		
		int pos = Ballistica.trace[i];
		
		Char ch = Actor.findChar( pos );
		if (ch == null) {
			continue;
		}
		
		if (hit( this, ch, true )) {
			ch.damage( Random.NormalIntRange( 14, 20 ), this );
			
			if (Dungeon.visible[pos]) {
				ch.sprite.flash();
				CellEmitter.center( pos ).burst( PurpleParticle.BURST, Random.IntRange( 1, 2 ) );
			}
			
			if (!ch.isAlive() && ch == Dungeon.hero) {
				Dungeon.fail( Utils.format( ResultDescriptions.MOB, Utils.indefinite( name ) ) );
				GLog.n( TXT_DEATHGAZE_KILLED, name );
			}
		} else {
			ch.sprite.showStatus( CharSprite.NEUTRAL,  ch.defenseVerb() );
		}
	}
	
	return true;
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:32,代码来源:Eye.java

示例6: target

import com.shatteredpixel.shatteredpixeldungeon.actors.Char; //导入方法依赖的package包/类
public void target( Char ch ) {
	if (ch != null && ch.isAlive()) {
		target = ch;
	} else {
		target = null;
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:8,代码来源:HealthIndicator.java

示例7: trigger

import com.shatteredpixel.shatteredpixeldungeon.actors.Char; //导入方法依赖的package包/类
public static void trigger( int pos, Char ch ) {
	
	if (ch != null) {
		ch.damage( Math.max( 1, Random.Int( ch.HP / 3, 2 * ch.HP / 3 ) ), LIGHTNING );
		if (ch == Dungeon.hero) {
			
			Camera.main.shake( 2, 0.3f );
			
			if (!ch.isAlive()) {
				Dungeon.fail( Utils.format( ResultDescriptions.TRAP, name ) );
				GLog.n( "You were killed by a discharge of a lightning trap..." );
			} else {
				((Hero)ch).belongings.charge( false );
			}
		}
		
		int[] points = new int[2];
		
		points[0] = pos - Level.WIDTH;
		points[1] = pos + Level.WIDTH;
		ch.sprite.parent.add( new Lightning( points, 2, null ) );
		
		points[0] = pos - 1;
		points[1] = pos + 1;
		ch.sprite.parent.add( new Lightning( points, 2, null ) );
	}
	
	CellEmitter.center( pos ).burst( SparkParticle.FACTORY, Random.IntRange( 3, 4 ) );
	
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:31,代码来源:LightningTrap.java

示例8: checkOwner

import com.shatteredpixel.shatteredpixeldungeon.actors.Char; //导入方法依赖的package包/类
public boolean checkOwner( Char owner ) {
	if (!owner.isAlive() && owner instanceof Hero) {
		
		((Hero)owner).killerGlyph = this;
		Badges.validateDeathFromGlyph();
		return true;
		
	} else {
		return false;
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:12,代码来源:Armor.java

示例9: onZap

import com.shatteredpixel.shatteredpixeldungeon.actors.Char; //导入方法依赖的package包/类
@Override
protected void onZap( int cell ) {

	int level = level();
	
	for (int i=1; i < Ballistica.distance - 1; i++) {
		int c = Ballistica.trace[i];
		if (Level.flamable[c]) {
			GameScene.add( Blob.seed( c, 1, Fire.class ) );
		}
	}
	
	GameScene.add( Blob.seed( cell, 1, Fire.class ) );
				
	Char ch = Actor.findChar( cell );
	if (ch != null) {	
		
		ch.damage( Random.Int( 1, 8 + level * level ), this );
		Buff.affect( ch, Burning.class ).reignite( ch );
		
		ch.sprite.emitter().burst( FlameParticle.FACTORY, 5 );
		
		if (ch == curUser && !ch.isAlive()) {
			Dungeon.fail( Utils.format( ResultDescriptions.ITEM, name ) );
			GLog.n( "You killed yourself with your own Wand of Firebolt..." );
		}
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:29,代码来源:WandOfFirebolt.java

示例10: doAttack

import com.shatteredpixel.shatteredpixeldungeon.actors.Char; //导入方法依赖的package包/类
@Override
protected boolean doAttack( Char enemy ) {

	if (Level.distance( pos, enemy.pos ) <= 1) {
		
		return super.doAttack( enemy );
		
	} else {
		
		boolean visible = Level.fieldOfView[pos] || Level.fieldOfView[enemy.pos]; 
		if (visible) {
			((ShamanSprite)sprite).zap( enemy.pos );
		}
		
		spend( TIME_TO_ZAP );
		
		if (hit( this, enemy, true )) {
			int dmg = Random.Int( 2, 12 );
			if (Level.water[enemy.pos] && !enemy.flying) {
				dmg *= 1.5f;
			}
			enemy.damage( dmg, LightningTrap.LIGHTNING );
			
			enemy.sprite.centerEmitter().burst( SparkParticle.FACTORY, 3 );
			enemy.sprite.flash();
			
			if (enemy == Dungeon.hero) {
				
				Camera.main.shake( 2, 0.3f );
				
				if (!enemy.isAlive()) {
					Dungeon.fail( Utils.format( ResultDescriptions.MOB, Utils.indefinite( name ) ) );
					GLog.n( TXT_LIGHTNING_KILLED, name );
				}
			}
		} else {
			enemy.sprite.showStatus( CharSprite.NEUTRAL,  enemy.defenseVerb() );
		}
		
		return !visible;
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:43,代码来源:Shaman.java

示例11: proc

import com.shatteredpixel.shatteredpixeldungeon.actors.Char; //导入方法依赖的package包/类
@Override
public boolean proc( Weapon weapon, Char attacker, Char defender, int damage ) {
	
	int level = Math.max( 0, weapon.level );
	
	int maxDamage = (int)(damage * Math.pow( 2, -1d / (level + 1) ));
	if (maxDamage >= 1) {
		
		int p = attacker.pos;
		int[] neighbours = {
			p+1, p-1, p+Level.WIDTH, p-Level.WIDTH, 
			p+1+Level.WIDTH, p+1-Level.WIDTH, p-1+Level.WIDTH, p-1-Level.WIDTH};
		
		for (int n : neighbours) {
			Char ch = Actor.findChar( n );
			if (ch != null && ch != defender && ch.isAlive()) {
				
				int dr = Random.IntRange( 0, ch.dr() );
				int dmg = Random.Int( 1, maxDamage );
				int effectiveDamage = Math.max( dmg - dr, 0 );
				
				ch.damage( effectiveDamage, this );
				
				ch.sprite.bloodBurstA( attacker.sprite.center(), effectiveDamage );
				ch.sprite.flash();
				
			}
		}
		
		return true;
		
	} else {
	
		return false;
		
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:38,代码来源:Swing.java

示例12: onZap

import com.shatteredpixel.shatteredpixeldungeon.actors.Char; //导入方法依赖的package包/类
@Override
protected void onZap( int cell ) {
	
	Sample.INSTANCE.play( Assets.SND_ROCKS );
	
	int level = level();
	
	Ballistica.distance = Math.min( Ballistica.distance, 8 + level );
	
	int size = 1 + level / 3;
	PathFinder.buildDistanceMap( cell, BArray.not( Level.solid, null ), size );
	
	for (int i=0; i < Level.LENGTH; i++) {
		
		int d = PathFinder.distance[i];
		
		if (d < Integer.MAX_VALUE) {
			
			Char ch = Actor.findChar( i ); 
			if (ch != null) {
				
				ch.sprite.flash();
				
				ch.damage( Random.Int( 2, 6 + (size - d) * 2 ), this );
				
				if (ch.isAlive() && Random.Int( 2 + d ) == 0) {
					Buff.prolong( ch, Paralysis.class, Random.IntRange( 2, 6 ) );
				}
			}

			CellEmitter.get( i ).start( Speck.factory( Speck.ROCK ), 0.07f, 3 + (size - d) );
			Camera.main.shake( 3, 0.07f * (3 + (size - d)) );
		}
	}
	
	if (!curUser.isAlive()) {
		Dungeon.fail( Utils.format( ResultDescriptions.ITEM, name ) );
		GLog.n( "You killed yourself with your own Wand of Avalanche..." );
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:41,代码来源:WandOfAvalanche.java


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