本文整理汇总了Java中com.shatteredpixel.shatteredpixeldungeon.items.food.Blandfruit类的典型用法代码示例。如果您正苦于以下问题:Java Blandfruit类的具体用法?Java Blandfruit怎么用?Java Blandfruit使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Blandfruit类属于com.shatteredpixel.shatteredpixeldungeon.items.food包,在下文中一共展示了Blandfruit类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onSelect
import com.shatteredpixel.shatteredpixeldungeon.items.food.Blandfruit; //导入依赖的package包/类
@Override
public void onSelect( Item item ) {
if (item != null && item instanceof Food) {
if (item instanceof Blandfruit && ((Blandfruit) item).potionAttrib == null){
GLog.w("your horn rejects the unprepared blandfruit.");
} else {
Hero hero = Dungeon.hero;
hero.sprite.operate( hero.pos );
hero.busy();
hero.spend( TIME_TO_EAT );
curItem.upgrade(((Food)item).hornValue);
if (curItem.level >= 30){
curItem.level = 30;
GLog.p("your horn has consumed all the food it can!");
} else
GLog.p("the horn consumes your food offering and grows in strength!");
item.detach(hero.belongings.backpack);
}
}
}
示例2: updateState
import com.shatteredpixel.shatteredpixeldungeon.items.food.Blandfruit; //导入依赖的package包/类
private void updateState(){
//potion creation
if (filterInput(Plant.Seed.class).size() == 3){
output.item(new WndBag.Placeholder(ItemSpriteSheet.POTION_HOLDER));
output.visible = true;
btnCombine.enable(true);
//blandfruit cooking
} else if (filterInput(Blandfruit.class).size() == 1 && filterInput(Plant.Seed.class).size() == 1){
output.item(new WndBag.Placeholder(ItemSpriteSheet.SOMETHING));
output.visible = true;
btnCombine.enable(true);
} else {
btnCombine.enable(false);
output.visible = false;
}
}
示例3: onSelect
import com.shatteredpixel.shatteredpixeldungeon.items.food.Blandfruit; //导入依赖的package包/类
@Override
public void onSelect( Item item ) {
if (item != null && item instanceof Food) {
if (item instanceof Blandfruit && ((Blandfruit) item).potionAttrib == null){
GLog.w( Messages.get(HornOfPlenty.class, "reject") );
} else {
Hero hero = Dungeon.hero;
hero.sprite.operate( hero.pos );
hero.busy();
hero.spend( Food.TIME_TO_EAT );
((HornOfPlenty)curItem).gainFoodValue(((Food)item));
item.detach(hero.belongings.backpack);
}
}
}
示例4: operate
import com.shatteredpixel.shatteredpixeldungeon.items.food.Blandfruit; //导入依赖的package包/类
public static void operate( Hero hero, int pos ) {
AlchemyPot.hero = hero;
AlchemyPot.pos = pos;
Iterator<Item> items = hero.belongings.iterator();
foundFruit = false;
Heap heap = Dungeon.level.heaps.get( pos );
if (heap == null)
while (items.hasNext() && !foundFruit){
curItem = items.next();
if (curItem instanceof Blandfruit && ((Blandfruit) curItem).potionAttrib == null){
GameScene.show(
new WndOptions(TXT_POT, TXT_OPTIONS, TXT_FRUIT, TXT_POTION) {
@Override
protected void onSelect(int index) {
if (index == 0) {
curItem.cast( AlchemyPot.hero, AlchemyPot.pos );
} else
GameScene.selectItem(itemSelector, WndBag.Mode.SEED, TXT_SELECT_SEED);
}
}
);
foundFruit = true;
}
}
if (!foundFruit)
GameScene.selectItem(itemSelector, WndBag.Mode.SEED, TXT_SELECT_SEED);
}
示例5: activate
import com.shatteredpixel.shatteredpixeldungeon.items.food.Blandfruit; //导入依赖的package包/类
@Override
public void activate( Char ch ) {
super.activate( ch );
Dungeon.level.drop( new Blandfruit(), pos ).sprite.drop();
}
示例6: combine
import com.shatteredpixel.shatteredpixeldungeon.items.food.Blandfruit; //导入依赖的package包/类
private void combine(){
ArrayList<Plant.Seed> seeds = filterInput(Plant.Seed.class);
ArrayList<Blandfruit> fruits = filterInput(Blandfruit.class);
Item result = null;
//potion creation
if (seeds.size() == 3){
if (Random.Int( 3 ) == 0) {
result = Generator.random( Generator.Category.POTION );
} else {
Class<? extends Item> itemClass = Random.element(seeds).alchemyClass;
try {
result = itemClass.newInstance();
} catch (Exception e) {
ShatteredPixelDungeon.reportException(e);
result = Generator.random( Generator.Category.POTION );
}
}
while (result instanceof PotionOfHealing
&& Random.Int(10) < Dungeon.LimitedDrops.COOKING_HP.count) {
result = Generator.random(Generator.Category.POTION);
}
if (result instanceof PotionOfHealing) {
Dungeon.LimitedDrops.COOKING_HP.count++;
}
Statistics.potionsCooked++;
Badges.validatePotionsCooked();
//blandfruit cooking
} else if (fruits.size() == 1 && seeds.size() == 1) {
result = fruits.get(0);
((Blandfruit)result).cook(seeds.get(0));
}
if (result != null){
bubbleEmitter.start(Speck.factory( Speck.BUBBLE ), 0.2f, 10 );
smokeEmitter.burst(Speck.factory( Speck.WOOL ), 10 );
Sample.INSTANCE.play( Assets.SND_PUFF );
output.item(result);
if (!result.collect()){
Dungeon.level.drop(result, Dungeon.hero.pos);
}
for (int i = 0; i < inputs.length; i++){
inputs[i].slot.item(new WndBag.Placeholder(ItemSpriteSheet.SOMETHING));
inputs[i].item = null;
}
btnCombine.enable(false);
}
}
示例7: activate
import com.shatteredpixel.shatteredpixeldungeon.items.food.Blandfruit; //导入依赖的package包/类
@Override
public void activate() {
Dungeon.level.drop( new Blandfruit(), pos ).sprite.drop();
}