• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java Hunger类的典型用法和代码示例

java 1次浏览

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

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

示例1: actDescend

点赞 3

import com.watabou.pixeldungeon.actors.buffs.Hunger; //导入依赖的package包/类
private boolean actDescend( HeroAction.Descend action ) {
	int stairs = action.dst;
	if (pos == stairs && pos == Dungeon.level.exit) {
		
		curAction = null;
		
		Hunger hunger = buff( Hunger.class );
		if (hunger != null && !hunger.isStarving()) {
			hunger.satisfy( -Hunger.STARVING / 10 );
		}
		
		InterlevelScene.mode = InterlevelScene.Mode.DESCEND;
		Game.switchScene( InterlevelScene.class );
		
		return false;
		
	} else if (getCloser( stairs )) {
		
		return true;
		
	} else {
		ready();
		return false;
	}
}
 

开发者ID:kurtyu,
项目名称:PixelDungeonTC,
代码行数:26,
代码来源:Hero.java

示例2: proc

点赞 3

import com.watabou.pixeldungeon.actors.buffs.Hunger; //导入依赖的package包/类
@Override
public int proc( Armor armor, Char attacker, Char defender, int damage) {

	int level = Math.max( 0, armor.effectiveLevel() );
	if (Random.Int( level / 2 + 5 ) >= 4) {
		
		int healing = Math.min( defender.HT - defender.HP, Random.Int( 1, defender.HT / 5 ) );
		if (healing > 0) {
			
			Hunger hunger = defender.buff( Hunger.class );
			
			if (hunger != null && !hunger.isStarving()) {
				
				hunger.satisfy( -Hunger.STARVING / 10 );
				BuffIndicator.refreshHero();
				
				defender.HP += healing;
				defender.sprite.emitter().burst( Speck.factory( Speck.HEALING ), 1 );
				defender.sprite.showStatus( CharSprite.POSITIVE, Integer.toString( healing ) );
			}
		}

	}
	
	return damage;
}
 

开发者ID:kurtyu,
项目名称:PixelDungeonTC,
代码行数:27,
代码来源:Metabolism.java

示例3: proc

点赞 3

import com.watabou.pixeldungeon.actors.buffs.Hunger; //导入依赖的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 + 5 ) >= 4) {
		
		int healing = Math.min( defender.HT - defender.HP, Random.Int( 1, defender.HT / 5 ) );
		if (healing > 0) {
			
			Hunger hunger = defender.buff( Hunger.class );
			
			if (hunger != null && !hunger.isStarving()) {
				
				hunger.satisfy( -Hunger.STARVING / 10 );
				BuffIndicator.refreshHero();
				
				defender.HP += healing;
				defender.sprite.emitter().burst( Speck.factory( Speck.HEALING ), 1 );
				defender.sprite.showStatus( CharSprite.POSITIVE, Integer.toString( healing ) );
			}
		}

	}
	
	return damage;
}
 

开发者ID:skynet67,
项目名称:pixel-dungeon-rebirth,
代码行数:27,
代码来源:Metabolism.java

示例4: doHeal

点赞 3

import com.watabou.pixeldungeon.actors.buffs.Hunger; //导入依赖的package包/类
private void doHeal(HealerNPC priest, Collection<? extends Char> patients, int healingCost) {
	hide();
	Dungeon.gold(Dungeon.gold() - healingCost);
	for(Char patient: patients) {
		PotionOfHealing.heal(patient, 1.0f);
		if(patient instanceof Hero) {
			patient.buff(Hunger.class).satisfy(Hunger.STARVING);
		}

		if(patient instanceof Mob) {
			if(((Mob) patient).getMobClassName().equals("Brute")) {
				Badges.validateGnollUnlocked();
			}
		}
	}

	priest.say(Game.getVar(R.string.HealerNPC_Message2));
}
 

开发者ID:NYRDS,
项目名称:pixel-dungeon-remix,
代码行数:19,
代码来源:WndPriest.java

示例5: damage

点赞 3

import com.watabou.pixeldungeon.actors.buffs.Hunger; //导入依赖的package包/类
@Override
public void damage(int dmg, Object src) {
	restoreHealth = false;
	super.damage(dmg, src);

	checkIfFurious();
	interrupt();

	if (belongings.armor instanceof SpiderArmor) {
		//Armor proc
		if (Random.Int(100) < 50) {
			GameScene.add(Blob.seed(getPos(), Random.Int(5, 7), Web.class));
		}
	}

	for (Item item : belongings) {
		if (item instanceof IChaosItem && item.isEquipped(this)) {
			if (!(src instanceof Hunger)) {
				((IChaosItem) item).ownerTakesDamage(dmg);
			}
		}
	}
}
 

开发者ID:NYRDS,
项目名称:pixel-dungeon-remix,
代码行数:24,
代码来源:Hero.java

示例6: proc

点赞 3

import com.watabou.pixeldungeon.actors.buffs.Hunger; //导入依赖的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 + 5 ) >= 4) {
		
		int healing = Math.min( defender.ht() - defender.hp(), Random.Int( 1, defender.ht() / 5 ) );

		if (healing > 0) {
			
			Hunger hunger = defender.buff( Hunger.class );

			if (hunger != null && !hunger.isStarving()) {

				hunger.satisfy(-Hunger.STARVING / 10);
				BuffIndicator.refreshHero();
			}
				defender.hp(defender.hp() + healing);
				defender.getSprite().emitter().burst( Speck.factory( Speck.HEALING ), 1 );
				defender.getSprite().showStatus( CharSprite.POSITIVE, Integer.toString( healing ) );
		}

	}
	
	return damage;
}
 

开发者ID:NYRDS,
项目名称:pixel-dungeon-remix,
代码行数:27,
代码来源:Metabolism.java

示例7: actAscend

点赞 2

import com.watabou.pixeldungeon.actors.buffs.Hunger; //导入依赖的package包/类
private boolean actAscend( HeroAction.Ascend action ) {
	int stairs = action.dst;
	if (pos == stairs && pos == Dungeon.level.entrance) {
		
		if (Dungeon.depth == 1) {
			
			if (belongings.getItem( Amulet.class ) == null) {
				GameScene.show( new WndMessage( TXT_LEAVE ) );
				ready();
			} else {
				Dungeon.win( ResultDescriptions.WIN );
				Dungeon.deleteGame( Dungeon.hero.heroClass, true );
				Game.switchScene( SurfaceScene.class );
			}
			
		} else {
			
			curAction = null;
			
			Hunger hunger = buff( Hunger.class );
			if (hunger != null && !hunger.isStarving()) {
				hunger.satisfy( -Hunger.STARVING / 10 );
			}
			
			InterlevelScene.mode = InterlevelScene.Mode.ASCEND;
			Game.switchScene( InterlevelScene.class );
		}
		
		return false;
		
	} else if (getCloser( stairs )) {
		
		return true;
		
	} else {
		ready();
		return false;
	}
}
 

开发者ID:kurtyu,
项目名称:PixelDungeonTC,
代码行数:40,
代码来源:Hero.java

示例8: restoreFromBundle

点赞 2

import com.watabou.pixeldungeon.actors.buffs.Hunger; //导入依赖的package包/类
@Override
public void restoreFromBundle(Bundle bundle) {

	super.restoreFromBundle(bundle);

	setPos(bundle.getInt(POS));
	hp(bundle.getInt(TAG_HP));
	ht(bundle.getInt(TAG_HT));

	boolean hungerAttached = false;
	boolean hungerBugSend = false;

	for (Buff b : bundle.getCollection(BUFFS, Buff.class)) {
		if (b != null) {
			if (b instanceof Hunger) {
				if (!hungerAttached) {
					hungerAttached = true;
				} else {
					if (!hungerBugSend) {
						EventCollector.logEvent(EventCollector.BUG, "hunger count");
						hungerBugSend = true;
						continue;
					}
				}
			}
			b.attachTo(this);
		}
	}

	readCharData();
}
 

开发者ID:NYRDS,
项目名称:pixel-dungeon-remix,
代码行数:32,
代码来源:Char.java

示例9: live

点赞 2

import com.watabou.pixeldungeon.actors.buffs.Hunger; //导入依赖的package包/类
private void live() {
	if (buff(Regeneration.class) == null) {
		Buff.affect(this, Regeneration.class);
	}
	if (buff(Hunger.class) == null) {
		Buff.affect(this, Hunger.class);
	}
}
 

开发者ID:NYRDS,
项目名称:pixel-dungeon-remix,
代码行数:9,
代码来源:Hero.java

示例10: affectHero

点赞 2

import com.watabou.pixeldungeon.actors.buffs.Hunger; //导入依赖的package包/类
@Override
protected boolean affectHero( Hero hero ) {
	
	Sample.INSTANCE.play( Assets.SND_DRINK );
	
	PotionOfHealing.heal( hero );
	hero.belongings.uncurseEquipped();
	((Hunger)hero.buff( Hunger.class )).satisfy( Hunger.STARVING );
	
	CellEmitter.get( pos ).start( ShaftParticle.FACTORY, 0.2f, 3 );

	Dungeon.hero.interrupt();

	GLog.p( TXT_PROCCED );
	
	Journal.remove( Feature.WELL_OF_HEALTH );
	
	return true;
}
 

开发者ID:kurtyu,
项目名称:PixelDungeonTC,
代码行数:20,
代码来源:WaterOfHealth.java

示例11: live

点赞 2

import com.watabou.pixeldungeon.actors.buffs.Hunger; //导入依赖的package包/类
public void live() {
	Buff.affect( this, Regeneration.class );	
	Buff.affect( this, Hunger.class );
}
 

开发者ID:kurtyu,
项目名称:PixelDungeonTC,
代码行数:5,
代码来源:Hero.java

示例12: earnExp

点赞 2

import com.watabou.pixeldungeon.actors.buffs.Hunger; //导入依赖的package包/类
public void earnExp( int exp ) {
	
	this.exp += exp;
	
	boolean levelUp = false;
	while (this.exp >= maxExp()) {
		this.exp -= maxExp();
		lvl++;
		
		HT += 5;
		HP += 5;			
		attackSkill++;
		defenseSkill++;
		
		if (lvl < 10) {
			updateAwareness();
		}
		
		levelUp = true;
	}
	
	if (levelUp) {

		GLog.p(TXT_NEW_LEVEL, lvl);
		sprite.showStatus( CharSprite.POSITIVE, TXT_LEVEL_UP );
		Sample.INSTANCE.play( Assets.SND_LEVELUP );
		
		Badges.validateLevelReached();
	}
	
	if (subClass == HeroSubClass.WARLOCK) {
		
		int value = Math.min( HT - HP, 1 + (Dungeon.depth - 1) / 5 );
		if (value > 0) {
			HP += value;
			sprite.emitter().burst( Speck.factory( Speck.HEALING ), 1 );
		}
		
		((Hunger)buff( Hunger.class )).satisfy( 10 );
	}
}
 

开发者ID:kurtyu,
项目名称:PixelDungeonTC,
代码行数:42,
代码来源:Hero.java

示例13: isStarving

点赞 2

import com.watabou.pixeldungeon.actors.buffs.Hunger; //导入依赖的package包/类
public boolean isStarving() {
	return ((Hunger)buff( Hunger.class )).isStarving();
}
 

开发者ID:kurtyu,
项目名称:PixelDungeonTC,
代码行数:4,
代码来源:Hero.java

示例14: execute

点赞 2

import com.watabou.pixeldungeon.actors.buffs.Hunger; //导入依赖的package包/类
@Override
public void execute( Hero hero, String action ) {
	if (action.equals( AC_EAT )) {
		
		detach( hero.belongings.backpack );
		
		((Hunger)hero.buff( Hunger.class )).satisfy( energy );
		GLog.i( message );
		
		switch (hero.heroClass) {
		case WARRIOR:
			if (hero.HP < hero.HT) {
				hero.HP = Math.min( hero.HP + 5, hero.HT );
				hero.sprite.emitter().burst( Speck.factory( Speck.HEALING ), 1 );
			}
			break;
		case MAGE:
			hero.belongings.charge( false );
			ScrollOfRecharging.charge( hero );
			break;
		case ROGUE:
		case HUNTRESS:
			break;
		}
		
		hero.sprite.operate( hero.pos );
		hero.busy();
		SpellSprite.show( hero, SpellSprite.FOOD );
		Sample.INSTANCE.play( Assets.SND_EAT );
		
		hero.spend( TIME_TO_EAT );
		
		Statistics.foodEaten++;
		Badges.validateFoodEaten();
		
	} else {
	
		super.execute( hero, action );
		
	}
}
 

开发者ID:kurtyu,
项目名称:PixelDungeonTC,
代码行数:42,
代码来源:Food.java

示例15: execute

点赞 2

import com.watabou.pixeldungeon.actors.buffs.Hunger; //导入依赖的package包/类
@Override
public void execute( final Hero hero, String action ) {
	
	if (action == AC_MINE) {
		
		if (Dungeon.depth < 11 || Dungeon.depth > 15) {
			GLog.w( TXT_NO_VEIN );
			return;
		}
		
		for (int i=0; i < Level.NEIGHBOURS8.length; i++) {
			
			final int pos = hero.pos + Level.NEIGHBOURS8[i];
			if (Dungeon.level.map[pos] == Terrain.WALL_DECO) {
			
				hero.spend( TIME_TO_MINE );
				hero.busy();
				
				hero.sprite.attack( pos, new Callback() {
					
					@Override
					public void call() {

						CellEmitter.center( pos ).burst( Speck.factory( Speck.STAR ), 7 );
						Sample.INSTANCE.play( Assets.SND_EVOKE );
						
						Level.set( pos, Terrain.WALL );
						GameScene.updateMap( pos );
						
						DarkGold gold = new DarkGold();
						if (gold.doPickUp( Dungeon.hero )) {
							GLog.i(Hero.TXT_YOU_NOW_HAVE, name());
						} else {
							Dungeon.level.drop( gold, hero.pos ).sprite.drop();
						}
						
						Hunger hunger = hero.buff( Hunger.class );
						if (hunger != null && !hunger.isStarving()) {
							hunger.satisfy( -Hunger.STARVING / 10 );
							BuffIndicator.refreshHero();
						}
						
						hero.onOperateComplete();
					}
				} );
				
				return;
			}
		}
		
		GLog.w( TXT_NO_VEIN );
		
	} else {
		
		super.execute( hero, action );
		
	}
}
 

开发者ID:kurtyu,
项目名称:PixelDungeonTC,
代码行数:59,
代码来源:Pickaxe.java

示例16: earnExp

点赞 2

import com.watabou.pixeldungeon.actors.buffs.Hunger; //导入依赖的package包/类
public void earnExp( int exp ) {
	
	this.exp += exp;
	
	boolean levelUp = false;
	while (this.exp >= maxExp()) {
		this.exp -= maxExp();
		lvl++;
		
		HT += 5;
		HP += 5;			
		attackSkill++;
		defenseSkill++;
		
		if (lvl < 10) {
			updateAwareness();
		}
		
		levelUp = true;
	}
	
	if (levelUp) {
		
		GLog.p( TXT_NEW_LEVEL, lvl );
		sprite.showStatus( CharSprite.POSITIVE, TXT_LEVEL_UP );
		Sample.INSTANCE.play( Assets.SND_LEVELUP );
		
		Badges.validateLevelReached();
	}
	
	if (subClass == HeroSubClass.WARLOCK) {
		
		int value = Math.min( HT - HP, 1 + (Dungeon.depth - 1) / 5 );
		if (value > 0) {
			HP += value;
			sprite.emitter().burst( Speck.factory( Speck.HEALING ), 1 );
		}
		
		((Hunger)buff( Hunger.class )).satisfy( 10 );
	}
}
 

开发者ID:HalcyonFish,
项目名称:OHSCompSciClubPixelDungeon,
代码行数:42,
代码来源:Hero.java

示例17: execute

点赞 2

import com.watabou.pixeldungeon.actors.buffs.Hunger; //导入依赖的package包/类
@Override
public void execute( final Hero hero, String action ) {
	
	if (action == AC_MINE) {
		
		if (Dungeon.depth < 11 || Dungeon.depth > 15) {
			GLog.w( TXT_NO_VEIN );
			return;
		}
		
		for (int i=0; i < Level.NEIGHBOURS8.length; i++) {
			
			final int pos = hero.pos + Level.NEIGHBOURS8[i];
			if (Dungeon.level.map[pos] == Terrain.WALL_DECO) {
			
				hero.spend( TIME_TO_MINE );
				hero.busy();
				
				hero.sprite.attack( pos, new Callback() {
					
					@Override
					public void call() {

						CellEmitter.center( pos ).burst( Speck.factory( Speck.STAR ), 7 );
						Sample.INSTANCE.play( Assets.SND_EVOKE );
						
						Level.set( pos, Terrain.WALL );
						GameScene.updateMap( pos );
						
						DarkGold gold = new DarkGold();
						if (gold.doPickUp( Dungeon.hero )) {
							GLog.i( Hero.TXT_YOU_NOW_HAVE, gold.name() );
						} else {
							Dungeon.level.drop( gold, hero.pos ).sprite.drop();
						}
						
						Hunger hunger = hero.buff( Hunger.class );
						if (hunger != null && !hunger.isStarving()) {
							hunger.satisfy( -Hunger.STARVING / 10 );
							BuffIndicator.refreshHero();
						}
						
						hero.onOperateComplete();
					}
				} );
				
				return;
			}
		}
		
		GLog.w( TXT_NO_VEIN );
		
	} else {
		
		super.execute( hero, action );
		
	}
}
 

开发者ID:HalcyonFish,
项目名称:OHSCompSciClubPixelDungeon,
代码行数:59,
代码来源:Pickaxe.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)