當前位置: 首頁>>代碼示例>>Java>>正文


Java HornOfPlenty類代碼示例

本文整理匯總了Java中com.shatteredpixel.shatteredpixeldungeon.items.artifacts.HornOfPlenty的典型用法代碼示例。如果您正苦於以下問題:Java HornOfPlenty類的具體用法?Java HornOfPlenty怎麽用?Java HornOfPlenty使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


HornOfPlenty類屬於com.shatteredpixel.shatteredpixeldungeon.items.artifacts包,在下文中一共展示了HornOfPlenty類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: satisfy

import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.HornOfPlenty; //導入依賴的package包/類
public void satisfy( float energy ) {
	Artifact.ArtifactBuff buff = target.buff( HornOfPlenty.hornRecharge.class );
	if (buff != null && buff.isCursed()){
		energy = Math.round(energy*0.67f);
		GLog.n("The cursed horn steals some of the food energy as you eat.");
	}
	level -= energy;
	if (level < 0) {
		level = 0;
	} else if (level > STARVING) {
		level = STARVING;
	}
	
	BuffIndicator.refreshHero();
}
 
開發者ID:wolispace,項目名稱:soft-pixel-dungeon,代碼行數:16,代碼來源:Hunger.java

示例2: satisfy

import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.HornOfPlenty; //導入依賴的package包/類
public void satisfy( float energy ) {

		Artifact.ArtifactBuff buff = target.buff( HornOfPlenty.hornRecharge.class );
		if (buff != null && buff.isCursed()){
			energy *= 0.67f;
			GLog.n( Messages.get(this, "cursedhorn") );
		}

		if (!Dungeon.isChallenged(Challenges.NO_FOOD))
			reduceHunger( energy );
	}
 
開發者ID:00-Evan,項目名稱:shattered-pixel-dungeon,代碼行數:12,代碼來源:Hunger.java

示例3: earnExp

import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.HornOfPlenty; //導入依賴的package包/類
public void earnExp( int exp ) {
	
	this.exp += exp;
	float percent = exp/(float)maxExp();

	EtherealChains.chainsRecharge chains = buff(EtherealChains.chainsRecharge.class);
	if (chains != null) chains.gainExp(percent);

	HornOfPlenty.hornRecharge horn = buff(HornOfPlenty.hornRecharge.class);
	if (horn != null) horn.gainCharge(percent);

	if (subClass == HeroSubClass.BERSERKER){
		berserk = Buff.affect(this, Berserk.class);
		berserk.recover(percent);
	}
	
	boolean levelUp = false;
	while (this.exp >= maxExp()) {
		this.exp -= maxExp();
		if (lvl < MAX_LEVEL) {
			lvl++;
			levelUp = true;

			updateHT( true );
			attackSkill++;
			defenseSkill++;

		} else {
			Buff.prolong(this, Bless.class, 30f);
			this.exp = 0;

			GLog.p( Messages.get(this, "level_cap"));
			Sample.INSTANCE.play( Assets.SND_LEVELUP );
		}
		
	}
	
	if (levelUp) {
		
		GLog.p( Messages.get(this, "new_level"), lvl );
		sprite.showStatus( CharSprite.POSITIVE, Messages.get(Hero.class, "level_up") );
		Sample.INSTANCE.play( Assets.SND_LEVELUP );
		
		Badges.validateLevelReached();
	}
}
 
開發者ID:00-Evan,項目名稱:shattered-pixel-dungeon,代碼行數:47,代碼來源:Hero.java


注:本文中的com.shatteredpixel.shatteredpixeldungeon.items.artifacts.HornOfPlenty類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。