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


Java Char类代码示例

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


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

示例1: upgrade

import com.shatteredpixel.shatteredpixeldungeon.actors.Char; //导入依赖的package包/类
@Override
public Item upgrade() {
	
	super.upgrade();
	
	if (buff != null) {
		
		Char owner = buff.target;
		buff.detach();
		if ((buff = buff()) != null) {
			buff.attachTo( owner );
		}
	}
	
	return this;
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:17,代码来源:Ring.java

示例2: proc

import com.shatteredpixel.shatteredpixeldungeon.actors.Char; //导入依赖的package包/类
@Override
public int proc( Armor armor, Char attacker, Char defender, int damage ) {

	if (Dungeon.bossLevel()) {
		return damage;
	}
	
	int nTries = (armor.level < 0 ? 1 : armor.level + 1) * 5;
	for (int i=0; i < nTries; i++) {
		int pos = Random.Int( Level.LENGTH );
		if (Dungeon.visible[pos] && Level.passable[pos] && Actor.findChar( pos ) == null) {
			
			WandOfBlink.appear( defender, pos );
			Dungeon.level.press( pos, defender );
			Dungeon.observe();

			break;
		}
	}
	
	return damage;
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:23,代码来源:Displacement.java

示例3: evolve

import com.shatteredpixel.shatteredpixeldungeon.actors.Char; //导入依赖的package包/类
@Override
protected void evolve() {
	
	for (int i=0; i < LENGTH; i++) {
		
		int offv = cur[i] > 0 ? cur[i] - 1 : 0;
		off[i] = offv;
		
		if (offv > 0) {
			
			volume += offv;
			
			Char ch = Actor.findChar( i );
			if (ch != null) {
				Buff.prolong( ch, Roots.class, TICK );
			}
		}
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:20,代码来源:Web.java

示例4: proc

import com.shatteredpixel.shatteredpixeldungeon.actors.Char; //导入依赖的package包/类
@Override
public boolean proc( Weapon weapon, Char attacker, Char defender, int damage ) {
	// lvl 0 - 13%
	// lvl 1 - 22%
	// lvl 2 - 30%
	int level = Math.max( 0, weapon.level );
	
	if (Random.Int( level + 8 ) >= 7) {
		
		Buff.prolong( defender, com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis.class,
			Random.Float( 1, 1.5f + level ) );
		
		return true;
	} else {
		return false;
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:18,代码来源:Paralysis.java

示例5: flee

import com.shatteredpixel.shatteredpixeldungeon.actors.Char; //导入依赖的package包/类
public static int flee( Char ch, int cur, int from, boolean pass[], boolean[] visible ) {
	
	if (ch.flying) {
		BArray.or( pass, Level.avoid, passable );
	} else {
		System.arraycopy( pass, 0, passable, 0, Level.LENGTH );
	}
	
	for (Actor actor : Actor.all()) {
		if (actor instanceof Char) {
			int pos = ((Char)actor).pos;
			if (visible[pos]) {
				passable[pos] = false;
			}
		}
	}
	passable[cur] = true;
	
	return PathFinder.getStepBack( cur, from, passable );
	
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:22,代码来源:Dungeon.java

示例6: proc

import com.shatteredpixel.shatteredpixeldungeon.actors.Char; //导入依赖的package包/类
@Override
public boolean proc( Weapon weapon, Char attacker, Char defender, int damage ) {
	// lvl 0 - 20%
	// lvl 1 - 33%
	// lvl 2 - 43%
	int level = Math.max( 0, weapon.level );
	
	if (Random.Int( level + 5 ) >= 4) {

           if (defender == Dungeon.hero) {
               Buff.affect( defender, Vertigo.class, Vertigo.duration(defender) );
           } else {
               Buff.affect( defender, Terror.class, Terror.DURATION ).source = attacker;
           }
		
		return true;
	} else {
		return false;
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:21,代码来源:Horror.java

示例7: 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

示例8: proc

import com.shatteredpixel.shatteredpixeldungeon.actors.Char; //导入依赖的package包/类
public int proc( Char attacker, Char defender, int damage ) {
	
	if (glyph != null) {
		damage = glyph.proc( this, attacker, defender, damage );
	}
	
	if (!levelKnown) {
		if (--hitsToKnow <= 0) {
			levelKnown = true;
			GLog.w( TXT_IDENTIFY, name(), toString() );
			Badges.validateItemLevelAquired( this );
		}
	}
	
	return damage;
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:17,代码来源:Armor.java

示例9: proc

import com.shatteredpixel.shatteredpixeldungeon.actors.Char; //导入依赖的package包/类
@Override
public boolean proc( Weapon weapon, Char attacker, Char defender, int damage ) {
	// lvl 0 - 33%
	// lvl 1 - 50%
	// lvl 2 - 60%
	int level = Math.max( 0, weapon.level );
	
	if (Random.Int( level + 3 ) >= 2) {
		
		if (Random.Int( 2 ) == 0) {
			Buff.affect( defender, Burning.class ).reignite( defender );
		}
		defender.damage( Random.Int( 1, level + 2 ), this );
		
		defender.sprite.emitter().burst( FlameParticle.FACTORY, level + 1 );
		
		return true;
		
	} else {
		
		return false;
		
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:25,代码来源:Fire.java

示例10: findPath

import com.shatteredpixel.shatteredpixeldungeon.actors.Char; //导入依赖的package包/类
public static int findPath( Char ch, int from, int to, boolean pass[], boolean[] visible ) {
	
	if (Level.adjacent( from, to )) {
		return Actor.findChar( to ) == null && (pass[to] || Level.avoid[to]) ? to : -1;
	}
	
	if (ch.flying || ch.buff( Amok.class ) != null) {
		BArray.or( pass, Level.avoid, passable );
	} else {
		System.arraycopy( pass, 0, passable, 0, Level.LENGTH );
	}
	
	for (Actor actor : Actor.all()) {
		if (actor instanceof Char) {
			int pos = ((Char)actor).pos;
			if (visible[pos]) {
				passable[pos] = false;
			}
		}
	}
	
	return PathFinder.getStep( from, to, passable );
	
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:25,代码来源:Dungeon.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 );
	
	// lvl 0 - 33%
	// lvl 1 - 43%
	// lvl 2 - 50%
	int maxValue = damage * (level + 2) / (level + 6);
	int effValue = Math.min( Random.IntRange( 0, maxValue ), attacker.HT - attacker.HP );
	
	if (effValue > 0) {
	
		attacker.HP += effValue;
		attacker.sprite.emitter().start( Speck.factory( Speck.HEALING ), 0.4f, 1 );
		attacker.sprite.showStatus( CharSprite.POSITIVE, Integer.toString( effValue ) );
		
		return true;
		
	} else {
		return false;
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:24,代码来源:Leech.java

示例12: proc

import com.shatteredpixel.shatteredpixeldungeon.actors.Char; //导入依赖的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 + 7 ) >= 6) {
		
		int dmg = Random.IntRange( 1, damage );
		attacker.damage( dmg, LightningTrap.LIGHTNING );
		dmg = Random.IntRange( 1, dmg );
		defender.damage( dmg, LightningTrap.LIGHTNING );
		
		checkOwner( defender );
		if (defender == Dungeon.hero) {
			Camera.main.shake( 2, 0.3f );
		}
		
		int[] points = {attacker.pos, defender.pos};
		attacker.sprite.parent.add( new Lightning( points, 2, null ) );

	}
	
	return damage;
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:25,代码来源:Potential.java

示例13: proc

import com.shatteredpixel.shatteredpixeldungeon.actors.Char; //导入依赖的package包/类
@Override
public void proc( Char attacker, Char defender, int damage ) {
	
	super.proc( attacker, defender, damage );
	
	Hero hero = (Hero)attacker;
       if (hero.rangedWeapon == null && stackable) {
           if (quantity == 1) {
               doUnequip( hero, false, false );
		} else {
			detach( null );
		}
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:15,代码来源:MissileWeapon.java

示例14: link

import com.shatteredpixel.shatteredpixeldungeon.actors.Char; //导入依赖的package包/类
@Override
public void link( Char ch ) {
	super.link( ch );
	
	if (shield == null) {
		parent.add( shield = new Shield() );
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:9,代码来源:WandmakerSprite.java

示例15: evolve

import com.shatteredpixel.shatteredpixeldungeon.actors.Char; //导入依赖的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


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