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


Java MissileWeapon类代码示例

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


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

示例1: acuracyFactor

import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon; //导入依赖的package包/类
@Override
public float acuracyFactor( Hero hero ) {
	
	int encumbrance = STR - hero.STR();

       float ACU = this.ACU;
	
	if (this instanceof MissileWeapon) {
		switch (hero.heroClass) {
		case WARRIOR:
			encumbrance += 3;
			break;
		case HUNTRESS:
			encumbrance -= 2;
			break;
		default:
		}
           int bonus = 0;
           for (Buff buff : hero.buffs(RingOfSharpshooting.Aim.class)) {
               bonus += ((RingOfSharpshooting.Aim)buff).level;
           }
           ACU *= (float)(Math.pow(1.1, bonus));
	}

       return encumbrance > 0 ? (float)(ACU / Math.pow( 1.5, encumbrance )) : ACU;
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:27,代码来源:Weapon.java

示例2: speedFactor

import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon; //导入依赖的package包/类
@Override
public float speedFactor( Hero hero ) {

	int encumrance = STR - hero.STR();
	if (this instanceof MissileWeapon && hero.heroClass == HeroClass.HUNTRESS) {
		encumrance -= 2;
	}

       float DLY = this.DLY * (imbue == Imbue.LIGHT ? 0.667f : (imbue == Imbue.HEAVY ? 1.667f : 1.0f));

       int bonus = 0;
       for (Buff buff : hero.buffs(RingOfFuror.Furor.class)) {
           bonus += ((RingOfFuror.Furor)buff).level;
       }

       DLY = (float)(0.25 + (DLY - 0.25)*Math.pow(0.8, bonus));

       return
               (encumrance > 0 ? (float)(DLY * Math.pow( 1.2, encumrance )) : DLY);
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:21,代码来源:Weapon.java

示例3: paint

import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon; //导入依赖的package包/类
@Override
public void paint(Level level) {
	super.paint(level);
	
	Painter.fill(level, this, Terrain.WALL);
	Painter.fill(level, this, 1, Terrain.EMPTY_SP);
	
	Painter.set(level, center(), Terrain.STATUE_SP);
	
	for (int i = 0; i < 4; i++){
		int itemPos;
		do{
			itemPos = level.pointToCell(random());
		} while ( level.map[itemPos] != Terrain.EMPTY_SP
				|| level.heaps.get(itemPos) != null);
		
		Item item;
		do{
			item = Generator.randomWeapon();
		} while (!(item instanceof MissileWeapon));
		
		level.drop(item, itemPos);
	}
	
	entrance().set(Door.Type.HIDDEN);
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:27,代码来源:SecretArtilleryRoom.java

示例4: accuracyFactor

import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon; //导入依赖的package包/类
@Override
public float accuracyFactor( Char owner ) {
	
	int encumbrance = 0;
	
	if( owner instanceof Hero ){
		encumbrance = STRReq() - ((Hero)owner).STR();
	}

	if (hasEnchant(Wayward.class))
		encumbrance = Math.max(3, encumbrance+3);

	float ACC = this.ACC;
	
	if (this instanceof MissileWeapon) {
		ACC *= RingOfSharpshooting.accuracyMultiplier( owner );
	}

	return encumbrance > 0 ? (float)(ACC / Math.pow( 1.5, encumbrance )) : ACC;
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:21,代码来源:Weapon.java

示例5: speedFactor

import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon; //导入依赖的package包/类
@Override
public float speedFactor( Char owner ) {

	int encumbrance = 0;
	if (owner instanceof Hero) {
		encumbrance = STRReq() - ((Hero)owner).STR();
		if (this instanceof MissileWeapon && ((Hero)owner).heroClass == HeroClass.HUNTRESS) {
			encumbrance -= 2;
		}
	}

	float DLY = imbue.delayFactor(this.DLY);

	DLY = RingOfFuror.modifyAttackDelay(DLY, owner);

	return (encumbrance > 0 ? (float)(DLY * Math.pow( 1.2, encumbrance )) : DLY);
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:18,代码来源:Weapon.java

示例6: damageRoll

import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon; //导入依赖的package包/类
@Override
public int damageRoll( Char owner ) {
	
	int damage = super.damageRoll( owner );
	
	if (owner instanceof Hero &&
			(this instanceof MeleeWeapon
			|| (this instanceof MissileWeapon && ((Hero)owner).heroClass == HeroClass.HUNTRESS))) {
		int exStr = ((Hero)owner).STR() - STRReq();
		if (exStr > 0) {
			damage += Random.IntRange( 0, exStr );
		}
	}
	
	return imbue.damageFactor(damage);
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:17,代码来源:Weapon.java

示例7: shoot

import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon; //导入依赖的package包/类
public boolean shoot( Char enemy, MissileWeapon wep ) {

        rangedWeapon = wep;
        boolean result = attack( enemy );
        Invisibility.dispel();
        rangedWeapon = null;

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

示例8: cast

import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon; //导入依赖的package包/类
public void cast( final Hero user, int dst ) {
	
	final int cell = Ballistica.cast( user.pos, dst, false, true );
	user.sprite.zap( cell );
	user.busy();
	
	Char enemy = Actor.findChar( cell );
	QuickSlotButton.target(enemy);
	
	float delay = TIME_TO_THROW;
	if (this instanceof MissileWeapon) {

		// FIXME
		delay *= ((MissileWeapon)this).speedFactor( user );
		if (enemy != null && enemy.buff( SnipersMark.class ) != null) {
			delay *= 0.5f;
		}
	}
	final float finalDelay = delay;
	
	((MissileSprite)user.sprite.parent.recycle( MissileSprite.class )).
		reset( user.pos, cell, this, new Callback() {			
			@Override
			public void call() {
				Item.this.detach( user.belongings.backpack ).onThrow( cell );
				user.spendAndNext( finalDelay );
			}
		} );
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:30,代码来源:Item.java

示例9: shoot

import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon; //导入依赖的package包/类
public boolean shoot( Char enemy, MissileWeapon wep ) {

		rangedWeapon = wep;
		boolean result = attack( enemy );
		Invisibility.dispel();
		rangedWeapon = null;

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

示例10: stick

import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon; //导入依赖的package包/类
public void stick(MissileWeapon projectile){
	for (Item item : items){
		if (item.isSimilar(projectile)){
			item.quantity(item.quantity() + projectile.quantity());
			return;
		}
	}
	items.add(projectile);
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:10,代码来源:PinCushion.java

示例11: restoreFromBundle

import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon; //导入依赖的package包/类
@Override
public void restoreFromBundle(Bundle bundle) {
	items = new ArrayList<MissileWeapon>((Collection<MissileWeapon>)((Collection<?>)bundle.getCollection( ITEMS )));
	super.restoreFromBundle( bundle );
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:6,代码来源:PinCushion.java

示例12: paint

import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon; //导入依赖的package包/类
@Override
public void paint(Level level) {
	super.paint(level);
	
	Painter.fill(level, this, Terrain.WALL);
	Painter.fill(level, this, 1, Terrain.EMPTY);
	
	//true = space, false = wall
	boolean[][] maze = Maze.generate(this);
	boolean[] passable = new boolean[width()*height()];
	
	Painter.fill(level, this, 1, Terrain.EMPTY);
	for (int x = 0; x < maze.length; x++) {
		for (int y = 0; y < maze[0].length; y++) {
			if (maze[x][y] == Maze.FILLED) {
				Painter.fill(level, x + left, y + top, 1, 1, Terrain.WALL);
			}
			passable[x + width()*y] = maze[x][y] == Maze.EMPTY;
		}
	}
	
	PathFinder.setMapSize(width(), height());
	Point entrance = entrance();
	int entrancePos = (entrance.x - left) + width()*(entrance.y - top);
	
	PathFinder.buildDistanceMap( entrancePos, passable );
	
	int bestDist = 0;
	Point bestDistP = new Point();
	for (int i = 0; i < PathFinder.distance.length; i++){
		if (PathFinder.distance[i] != Integer.MAX_VALUE
				&& PathFinder.distance[i] > bestDist){
			bestDist = PathFinder.distance[i];
			bestDistP.x = (i % width()) + left;
			bestDistP.y = (i / width()) + top;
		}
	}
	
	Item prize;
	//1 floor set higher in probability, never cursed
	do {
		if (Random.Int(2) == 0) {
			prize = Generator.randomWeapon((Dungeon.depth / 5) + 1);
		} else {
			prize = Generator.randomArmor((Dungeon.depth / 5) + 1);
		}
	} while (prize.cursed || prize instanceof MissileWeapon);
	
	//33% chance for an extra update.
	if (Random.Int(3) == 0){
		prize.upgrade();
	}
	
	level.drop(prize, level.pointToCell(bestDistP)).type = Heap.Type.CHEST;
	
	PathFinder.setMapSize(level.width(), level.height());
	
	entrance().set(Door.Type.HIDDEN);
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:60,代码来源:SecretMazeRoom.java

示例13: cast

import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon; //导入依赖的package包/类
public void cast( final Hero user, int dst ) {
	
	final int cell = throwPos( user, dst );
	user.sprite.zap( cell );
	user.busy();

	Sample.INSTANCE.play( Assets.SND_MISS, 0.6f, 0.6f, 1.5f );

	Char enemy = Actor.findChar( cell );
	QuickSlotButton.target(enemy);

	// FIXME!!!
	float delay = TIME_TO_THROW;
	if (this instanceof MissileWeapon) {
		delay *= ((MissileWeapon)this).speedFactor( user );
		if (enemy != null) {
			SnipersMark mark = user.buff( SnipersMark.class );
			if (mark != null) {
				if (mark.object == enemy.id()) {
					delay *= 0.5f;
				}
				user.remove( mark );
			}
		}
	}
	final float finalDelay = delay;

	if (enemy != null) {
		((MissileSprite) user.sprite.parent.recycle(MissileSprite.class)).
				reset(user.sprite,
						enemy.sprite,
						this,
						new Callback() {
					@Override
					public void call() {
						Item.this.detach(user.belongings.backpack).onThrow(cell);
						user.spendAndNext(finalDelay);
					}
				});
	} else {
		((MissileSprite) user.sprite.parent.recycle(MissileSprite.class)).
				reset(user.sprite,
						cell,
						this,
						new Callback() {
					@Override
					public void call() {
						Item.this.detach(user.belongings.backpack).onThrow(cell);
						user.spendAndNext(finalDelay);
					}
				});
	}
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:54,代码来源:Item.java


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