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


Java KindOfWeapon类代码示例

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


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

示例1: restoreFromBundle

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

import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon; //导入依赖的package包/类
@Override
public int damageRoll() {
       KindOfWeapon wep = rangedWeapon != null ? rangedWeapon : belongings.weapon;
	int dmg;
       int bonus = 0;
       for (Buff buff : buffs( RingOfForce.Force.class )) {
           bonus += ((RingOfForce.Force)buff).level;
       }

	if (wep != null) {
		dmg = wep.damageRoll( this ) + bonus;
	} else {
		int str = STR() - 8;
		dmg = bonus == 0 ?
				str > 1 ? Random.NormalIntRange( 1, str ) : 1
				: bonus > 0 ?
						str > 0 ? Random.NormalIntRange( str/2+bonus, (int)(str*0.5f*bonus) + str*2 ) : 1
						: 0;
	}
	if (dmg < 0) dmg = 0;
	return buff( Fury.class ) != null ? (int)(dmg * 1.5f) : dmg;
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:23,代码来源:Hero.java

示例3: attackDelay

import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon; //导入依赖的package包/类
public float attackDelay() {
       KindOfWeapon wep = rangedWeapon != null ? rangedWeapon : belongings.weapon;
	if (wep != null) {
		
		return wep.speedFactor( this );
					
	} else {
           //Normally putting furor speed on unarmed attacks would be unnecessary
           //But there's going to be that one guy who gets a furor+force ring combo
           //This is for that one guy, you shall get your fists of fury!
           int bonus = 0;
           for (Buff buff : buffs(RingOfFuror.Furor.class)) {
               bonus += ((RingOfFuror.Furor)buff).level;
           }
		return (float)(0.25 + (1 - 0.25)*Math.pow(0.8, bonus));
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:18,代码来源:Hero.java

示例4: damageRoll

import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon; //导入依赖的package包/类
@Override
public int damageRoll() {
	KindOfWeapon wep = rangedWeapon != null ? rangedWeapon : belongings.weapon;
	int dmg;

	if (wep != null) {
		dmg = wep.damageRoll( this ) + RingOfForce.armedDamageBonus(this);
	} else {
		dmg = RingOfForce.damageRoll(this);
	}
	if (dmg < 0) dmg = 0;
	if (subClass == HeroSubClass.BERSERKER){
		berserk = Buff.affect(this, Berserk.class);
		dmg = berserk.damageFactor(dmg);
	}
	return buff( Fury.class ) != null ? (int)(dmg * 1.5f) : dmg;
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:18,代码来源:Hero.java

示例5: canAttack

import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon; //导入依赖的package包/类
public boolean canAttack(Char enemy){
	if (enemy == null || pos == enemy.pos)
		return false;

	//can always attack adjacent enemies
	if (Dungeon.level.adjacent(pos, enemy.pos))
		return true;

	KindOfWeapon wep = Dungeon.hero.belongings.weapon;

	if (wep != null && Dungeon.level.distance( pos, enemy.pos ) <= wep.reachFactor(this)){

		boolean[] passable = BArray.not(Dungeon.level.solid, null);
		for (Mob m : Dungeon.level.mobs)
			passable[m.pos] = false;

		PathFinder.buildDistanceMap(enemy.pos, passable, wep.reachFactor(this));

		return PathFinder.distance[pos] <= wep.reachFactor(this);

	} else {
		return false;
	}
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:25,代码来源:Hero.java

示例6: attackProc

import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon; //导入依赖的package包/类
@Override
public int attackProc( Char enemy, int damage ) {
	KindOfWeapon wep = rangedWeapon != null ? rangedWeapon : belongings.weapon;

	if (wep != null) damage = wep.proc( this, enemy, damage );
		
	switch (subClass) {
	case SNIPER:
		if (rangedWeapon != null) {
			Buff.prolong( this, SnipersMark.class, attackDelay() * 1.1f ).object = enemy.id();
		}
		break;
	default:
	}

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

示例7: attackProc

import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon; //导入依赖的package包/类
@Override
public int attackProc( Char enemy, int damage ) {
	KindOfWeapon wep = rangedWeapon != null ? rangedWeapon : belongings.weapon;

	if (wep != null) damage = wep.proc( this, enemy, damage );
		
	switch (subClass) {
	case SNIPER:
		if (rangedWeapon != null) {
			Buff.prolong( this, SnipersMark.class, attackDelay() * 1.1f ).object = enemy.id();
		}
		break;
	default:
	}
	if (!resting || buff(MindVision.class) != null || buff(Awareness.class) != null) {
		Dungeon.observe();
	}
	
	return damage;
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon-gdx,代码行数:21,代码来源:Hero.java

示例8: attackSkill

import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon; //导入依赖的package包/类
@Override
public int attackSkill( Char target ) {
       float accuracy = 1;
       if (rangedWeapon != null && Level.distance( pos, target.pos ) == 1) {
           accuracy *= 0.5f;
       }

       KindOfWeapon wep = rangedWeapon != null ? rangedWeapon : belongings.weapon;
       if (wep != null) {
           return (int)(attackSkill * accuracy * wep.acuracyFactor( this ));
       } else {
           return (int)(attackSkill * accuracy);
       }
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:15,代码来源:Hero.java

示例9: attackProc

import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon; //导入依赖的package包/类
@Override
public int attackProc( Char enemy, int damage ) {
       KindOfWeapon wep = rangedWeapon != null ? rangedWeapon : belongings.weapon;

	if (wep != null)  wep.proc( this, enemy, damage );
		
	switch (subClass) {
	case GLADIATOR:
		if (wep instanceof MeleeWeapon || wep == null) {
			damage += Buff.affect( this, Combo.class ).hit( enemy, damage );
		}
		break;
	case BATTLEMAGE:
		if (wep instanceof Wand) {
			Wand wand = (Wand)wep;
			if (wand.curCharges < wand.maxCharges && damage > 0) {

				wand.curCharges++;
				if (Dungeon.quickslot.contains(wand)) {
					QuickSlotButton.refresh();
				}

				ScrollOfRecharging.charge( this );
			}
			damage += wand.curCharges;
		}
	case SNIPER:
		if (rangedWeapon != null) {
			Buff.prolong( enemy, SnipersMark.class, attackDelay() * 1.1f );
		}
		break;
	default:
	}

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

示例10: attackSkill

import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon; //导入依赖的package包/类
@Override
public int attackSkill( Char target ) {
	float accuracy = 1;
	if (rangedWeapon != null && Dungeon.level.distance( pos, target.pos ) == 1) {
		accuracy *= 0.5f;
	}

	KindOfWeapon wep = rangedWeapon != null ? rangedWeapon : belongings.weapon;
	if (wep != null) {
		return (int)(attackSkill * accuracy * wep.accuracyFactor( this ));
	} else {
		return (int)(attackSkill * accuracy);
	}
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:15,代码来源:Hero.java

示例11: attackDelay

import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon; //导入依赖的package包/类
public float attackDelay() {
	KindOfWeapon wep = rangedWeapon != null ? rangedWeapon : belongings.weapon;
	if (wep != null) {
		
		return wep.speedFactor( this );
					
	} else {
		//Normally putting furor speed on unarmed attacks would be unnecessary
		//But there's going to be that one guy who gets a furor+force ring combo
		//This is for that one guy, you shall get your fists of fury!
		return RingOfFuror.modifyAttackDelay(1f, this);
	}
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:14,代码来源:Hero.java

示例12: restoreFromBundle

import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon; //导入依赖的package包/类
public void restoreFromBundle( Bundle bundle ) {

		//moving keys to Notes, for pre-0.6.1 saves
		if (bundle.contains("ironKeys")) {
			int[] ironKeys = bundle.getIntArray( "ironKeys" );
			for (int i = 0; i < ironKeys.length; i++){
				if (ironKeys[i] > 0){
					Notes.add((Key) new IronKey(i).quantity(ironKeys[i]));
				}
			}
		}
		
		if (bundle.contains("specialKeys")) {
			int[] specialKeys = bundle.getIntArray( "specialKeys" );
			for (int i = 0; i < specialKeys.length; i++){
				if (specialKeys[i] > 0){
					if (i % 5 == 0){
						Notes.add((Key) new SkeletonKey(i).quantity(specialKeys[i]));
					} else {
						Notes.add((Key) new GoldenKey(i).quantity(specialKeys[i]));
					}
				}
			}
		}
		
		backpack.clear();
		backpack.restoreFromBundle( bundle );
		
		weapon = (KindOfWeapon) bundle.get(WEAPON);
		if (weapon != null) {
			weapon.activate(owner);
		}
		
		armor = (Armor)bundle.get( ARMOR );
		if (armor != null){
			armor.activate( owner );
		}
		
		misc1 = (KindofMisc)bundle.get(MISC1);
		if (misc1 != null) {
			misc1.activate( owner );
		}
		
		misc2 = (KindofMisc)bundle.get(MISC2);
		if (misc2 != null) {
			misc2.activate( owner );
		}
	}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:49,代码来源:Belongings.java

示例13: curse

import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon; //导入依赖的package包/类
public static void curse(Hero hero){
	//items the trap wants to curse because it will create a more negative effect
	ArrayList<Item> priorityCurse = new ArrayList<>();
	//items the trap can curse if nothing else is available.
	ArrayList<Item> canCurse = new ArrayList<>();

	KindOfWeapon weapon = hero.belongings.weapon;
	if (weapon instanceof Weapon && !weapon.cursed && !(weapon instanceof Boomerang)){
		if (((Weapon) weapon).enchantment == null)
			priorityCurse.add(weapon);
		else
			canCurse.add(weapon);
	}

	Armor armor = hero.belongings.armor;
	if (armor != null && !armor.cursed){
		if (armor.glyph == null)
			priorityCurse.add(armor);
		else
			canCurse.add(armor);
	}

	KindofMisc misc1 = hero.belongings.misc1;
	if (misc1 != null){
		canCurse.add(misc1);
	}

	KindofMisc misc2 = hero.belongings.misc2;
	if (misc2 != null){
		canCurse.add(misc2);
	}

	Collections.shuffle(priorityCurse);
	Collections.shuffle(canCurse);

	int numCurses = Random.Int(2) == 0 ? 1 : 2;

	for (int i = 0; i < numCurses; i++){
		if (!priorityCurse.isEmpty()){
			curse(priorityCurse.remove(0));
		} else if (!canCurse.isEmpty()){
			curse(canCurse.remove(0));
		}
	}

	EquipableItem.equipCursed(hero);
	GLog.n( Messages.get(CursingTrap.class, "curse") );
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:49,代码来源:CursingTrap.java


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