本文整理汇总了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 );
}
}
示例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;
}
示例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();
}
}
示例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;
}
示例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;
}
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
}
示例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();
}
}
}
示例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();
}
示例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;
}
}
示例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;
}
示例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();
}
}
}
示例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;
}