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


Java FireImbue类代码示例

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


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

示例1: execute

import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FireImbue; //导入依赖的package包/类
@Override
public void execute( Hero hero, String action ) {

	if (action.equals( AC_EAT ) && potionAttrib == null) {

		GLog.w( Messages.get(this, "raw"));
		return;

	}

	super.execute(hero, action);

	if (action.equals( AC_EAT ) && potionAttrib != null){

		if (potionAttrib instanceof PotionOfFrost) {
			GLog.i(Messages.get(this, "ice_msg"));
			FrozenCarpaccio.effect(hero);
		} else if (potionAttrib instanceof PotionOfLiquidFlame){
			GLog.i(Messages.get(this, "fire_msg"));
			Buff.affect(hero, FireImbue.class).set(FireImbue.DURATION);
		} else if (potionAttrib instanceof PotionOfToxicGas) {
			GLog.i(Messages.get(this, "toxic_msg"));
			Buff.affect(hero, ToxicImbue.class).set(ToxicImbue.DURATION);
		} else if (potionAttrib instanceof PotionOfParalyticGas) {
			GLog.i(Messages.get(this, "para_msg"));
			Buff.affect(hero, EarthImbue.class, EarthImbue.DURATION);
		} else {
			potionAttrib.apply(hero);
		}

	}
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:33,代码来源:Blandfruit.java

示例2: attack

import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FireImbue; //导入依赖的package包/类
public boolean attack( Char enemy ) {

		if (enemy == null || !enemy.isAlive()) return false;
		
		boolean visibleFight = Dungeon.level.heroFOV[pos] || Dungeon.level.heroFOV[enemy.pos];
		
		if (hit( this, enemy, false )) {
			
			// FIXME
			int dr = this instanceof Hero && ((Hero)this).rangedWeapon != null && ((Hero)this).subClass ==
				HeroSubClass.SNIPER ? 0 : enemy.drRoll();
			
			int dmg;
			Preparation prep = buff(Preparation.class);
			if (prep != null){
				dmg = prep.damageRoll(this, enemy);
			} else {
				dmg = damageRoll();
			}
			int effectiveDamage = Math.max( dmg - dr, 0 );
			
			effectiveDamage = attackProc( enemy, effectiveDamage );
			effectiveDamage = enemy.defenseProc( this, effectiveDamage );

			if (visibleFight) {
				Sample.INSTANCE.play( Assets.SND_HIT, 1, 1, Random.Float( 0.8f, 1.25f ) );
			}

			// If the enemy is already dead, interrupt the attack.
			// This matters as defence procs can sometimes inflict self-damage, such as armor glyphs.
			if (!enemy.isAlive()){
				return true;
			}

			//TODO: consider revisiting this and shaking in more cases.
			float shake = 0f;
			if (enemy == Dungeon.hero)
				shake = effectiveDamage / (enemy.HT / 4);

			if (shake > 1f)
				Camera.main.shake( GameMath.gate( 1, shake, 5), 0.3f );

			enemy.damage( effectiveDamage, this );

			if (buff(FireImbue.class) != null)
				buff(FireImbue.class).proc(enemy);
			if (buff(EarthImbue.class) != null)
				buff(EarthImbue.class).proc(enemy);

			enemy.sprite.bloodBurstA( sprite.center(), effectiveDamage );
			enemy.sprite.flash();

			if (!enemy.isAlive() && visibleFight) {
				if (enemy == Dungeon.hero) {

					Dungeon.fail( getClass() );
					GLog.n( Messages.capitalize(Messages.get(Char.class, "kill", name)) );
					
				} else if (this == Dungeon.hero) {
					GLog.i( Messages.capitalize(Messages.get(Char.class, "defeat", enemy.name)) );
				}
			}
			
			return true;
			
		} else {
			
			if (visibleFight) {
				String defense = enemy.defenseVerb();
				enemy.sprite.showStatus( CharSprite.NEUTRAL, defense );
				
				Sample.INSTANCE.play(Assets.SND_MISS);
			}
			
			return false;
			
		}
	}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:79,代码来源:Char.java


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