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


Java Armor类代码示例

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


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

示例1: restoreFromBundle

import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; //导入依赖的package包/类
public void restoreFromBundle( Bundle bundle ) {
	
	backpack.clear();
	backpack.restoreFromBundle( bundle );
	
	weapon = (KindOfWeapon)bundle.get( WEAPON );
	if (weapon != null) {
		weapon.activate( owner );
	}
	
	armor = (Armor)bundle.get( ARMOR );
	
	misc1 = (KindofMisc)bundle.get(MISC1);
	if (misc1 != null) {
		misc1.activate( owner );
	}
	
	misc2 = (KindofMisc)bundle.get(MISC2);
	if (misc2 != null) {
		misc2.activate( owner );
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:23,代码来源:Belongings.java

示例2: defenseProc

import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; //导入依赖的package包/类
@Override
public int defenseProc( Char enemy, int damage ) {
	
	CapeOfThorns.Thorns thorns = buff( CapeOfThorns.Thorns.class );
	if (thorns != null) {
		damage = thorns.proc(damage, enemy);
	}
	
	Earthroot.Armor armor = buff( Earthroot.Armor.class );
	if (armor != null) {
		damage = armor.absorb( damage );
	}

       Sungrass.Health health = buff( Sungrass.Health.class );
       if (health != null) {
           health.absorb( damage );
       }
	
	if (belongings.armor != null) {
		damage = belongings.armor.proc( enemy, this, damage );
	}
	
	return damage;
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:25,代码来源:Hero.java

示例3: restoreFromBundle

import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; //导入依赖的package包/类
public static void restoreFromBundle( Bundle bundle ) {
	
	Bundle node = bundle.getBundle( NODE );

	if (!node.isNull() && (spawned = node.getBoolean( SPAWNED ))) {

              type = node.getInt(TYPE);
              given	= node.getBoolean( GIVEN );
              processed = node.getBoolean( PROCESSED );

		depth	= node.getInt( DEPTH );
		
		weapon	= (Weapon)node.get( WEAPON );
		armor	= (Armor)node.get( ARMOR );
	} else {
		reset();
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:19,代码来源:Ghost.java

示例4: proc

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

示例5: proc

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

	if (damage == 0) {
		return 0;
	}
	
	int level = Math.max( 0, armor.level );
	
	if (Random.Int( level + 7 ) >= 6) {
		
		DeferedDamage debuff = defender.buff( DeferedDamage.class );
		if (debuff == null) {
			debuff = new DeferedDamage();
			debuff.attachTo( defender );
		}
		debuff.prolong( damage );
		
		defender.sprite.showStatus( CharSprite.WARNING, "deferred %d", damage );
		
		return 0;
		
	} else {
		return damage;
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:27,代码来源:Viscosity.java

示例6: proc

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

示例7: defenseProc

import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; //导入依赖的package包/类
@Override
public int defenseProc( Char enemy, int damage ) {
	
	Earthroot.Armor armor = buff( Earthroot.Armor.class );
	if (armor != null) {
		damage = armor.absorb( damage );
	}

	Sungrass.Health health = buff( Sungrass.Health.class );
	if (health != null) {
		health.absorb( damage );
	}
	
	if (belongings.armor != null) {
		damage = belongings.armor.proc( enemy, this, damage );
	}
	
	return damage;
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:20,代码来源:Hero.java

示例8: createLoot

import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; //导入依赖的package包/类
@Override
protected Item createLoot() {
	//first see if we drop armor, overall chance is 1/8
	if (Random.Int(2) == 0){
		Armor loot;
		do{
			loot = Generator.randomArmor();
			//50% chance of re-rolling tier 4 or 5 items
		} while (loot.tier >= 4 && Random.Int(2) == 0);
		loot.level(0);
		return loot;
	//otherwise, we may drop a health potion. overall chance is 7/(8 * (7 + potions dropped))
	//with 0 potions dropped that simplifies to 1/8
	} else {
		if (Random.Int(7 + Dungeon.LimitedDrops.GUARD_HP.count) < 7){
			Dungeon.LimitedDrops.GUARD_HP.drop();
			return new PotionOfHealing();
		}
	}

	return null;
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:23,代码来源:Guard.java

示例9: restoreFromBundle

import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; //导入依赖的package包/类
public static void restoreFromBundle( Bundle bundle ) {
	
	Bundle node = bundle.getBundle( NODE );

	if (!node.isNull() && (spawned = node.getBoolean( SPAWNED ))) {

		type = node.getInt(TYPE);
		given	= node.getBoolean( GIVEN );
		processed = node.getBoolean( PROCESSED );

		depth	= node.getInt( DEPTH );
		
		weapon	= (Weapon)node.get( WEAPON );
		armor	= (Armor)node.get( ARMOR );
	} else {
		reset();
	}
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:19,代码来源:Ghost.java

示例10: curse

import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; //导入依赖的package包/类
private static void curse(Item item){
	item.cursed = item.cursedKnown = true;

	if (item instanceof Weapon){
		Weapon w = (Weapon) item;
		if (w.enchantment == null){
			w.enchantment = Weapon.Enchantment.randomCurse();
		}
	}
	if (item instanceof Armor){
		Armor a = (Armor) item;
		if (a.glyph == null){
			a.glyph = Armor.Glyph.randomCurse();
		}
	}
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:17,代码来源:CursingTrap.java

示例11: inscribe

import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; //导入依赖的package包/类
private void inscribe( Armor armor ) {

		if (!armor.isIdentified() ){
			GLog.w( Messages.get(this, "identify"));
			return;
		} else if (armor.cursed || armor.hasCurseGlyph()){
			GLog.w( Messages.get(this, "cursed"));
			return;
		}
		
		detach(curUser.belongings.backpack);

		GLog.w( Messages.get(this, "inscribed"));

		armor.inscribe();
		
		curUser.sprite.operate(curUser.pos);
		curUser.sprite.centerEmitter().start(PurpleParticle.BURST, 0.05f, 10);
		Enchanting.show(curUser, armor);
		Sample.INSTANCE.play(Assets.SND_BURNING);
		
		curUser.spend(TIME_TO_INSCRIBE);
		curUser.busy();
	}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:25,代码来源:Stylus.java

示例12: proc

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

	if (damage == 0) {
		return 0;
	}
	
	int level = Math.max( 0, armor.level() );
	
	if (Random.Int( level + 6 ) >= 5) {
		
		DeferedDamage debuff = defender.buff( DeferedDamage.class );
		if (debuff == null) {
			debuff = new DeferedDamage();
			debuff.attachTo( defender );
		}
		debuff.prolong( damage );
		
		defender.sprite.showStatus( CharSprite.WARNING, Messages.get(this, "deferred", damage) );
		
		return 0;
		
	} else {
		return damage;
	}
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:27,代码来源:Viscosity.java

示例13: proc

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

	if (Random.Int( 8 ) == 0) {

		if (Dungeon.level.adjacent( attacker.pos, defender.pos )) {
			Buff.prolong(attacker, Frost.class, Frost.duration(attacker) * Random.Float(0.5f, 1f));
			CellEmitter.get(attacker.pos).start(SnowParticle.FACTORY, 0.2f, 6);
		}
		
		Buff.affect( defender, Burning.class ).reignite( defender );
		defender.sprite.emitter().burst( FlameParticle.FACTORY, 5 );

	}
	
	return damage;
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:18,代码来源:AntiEntropy.java

示例14: onSelect

import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; //导入依赖的package包/类
@Override
public void onSelect( Item item ) {
	if (item != null && item instanceof Armor) {
		Armor armor = (Armor)item;
		if (!armor.levelKnown){
			GLog.w(Messages.get(BrokenSeal.class, "unknown_armor"));
		} else if (armor.cursed || armor.level() < 0){
			GLog.w(Messages.get(BrokenSeal.class, "degraded_armor"));
		} else {
			GLog.p(Messages.get(BrokenSeal.class, "affix"));
			Dungeon.hero.sprite.operate(Dungeon.hero.pos);
			Sample.INSTANCE.play(Assets.SND_UNLOCK);
			armor.affixSeal((BrokenSeal)curItem);
			curItem.detach(Dungeon.hero.belongings.backpack);
			Badges.validateTutorial();
		}
	}
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:19,代码来源:BrokenSeal.java

示例15: proc

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

	int level = Math.max( 0, armor.level );
	
	if (Random.Int( level / 2 + 6 ) >= 5) {
		
		ArrayList<Integer> respawnPoints = new ArrayList<Integer>();
		
		for (int i=0; i < Level.NEIGHBOURS8.length; i++) {
			int p = defender.pos + Level.NEIGHBOURS8[i];
			if (Actor.findChar( p ) == null && (Level.passable[p] || Level.avoid[p])) {
				respawnPoints.add( p );
			}
		}
		
		if (respawnPoints.size() > 0) {
			MirrorImage mob = new MirrorImage();
			mob.duplicate( (Hero)defender );
			GameScene.add( mob );
			WandOfBlink.appear( mob, Random.element( respawnPoints ) );
			
			defender.damage( Random.IntRange( 1, defender.HT / 6 ), /*attacker*/ this );
			checkOwner( defender );
		}
		
	}
	
	return damage;
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:31,代码来源:Multiplicity.java


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