當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。