v0.7.0: implemented more food-based alchemy
This commit is contained in:
parent
9b42908273
commit
eece33925e
Binary file not shown.
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 17 KiB |
|
@ -26,6 +26,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.Artifact;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.HornOfPlenty;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.Feast;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
|
@ -61,7 +62,7 @@ public class Hunger extends Buff implements Hero.Doom {
|
|||
@Override
|
||||
public boolean act() {
|
||||
|
||||
if (Dungeon.level.locked){
|
||||
if (Dungeon.level.locked || target.buff(Feast.WellFed.class) == null){
|
||||
spend(STEP);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,8 @@ package com.shatteredpixel.shatteredpixeldungeon.items;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.bombs.Bomb;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.Blandfruit;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.Feast;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.StewedMeat;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.elixirs.ElixirOfDragonsBlood;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.elixirs.ElixirOfEarthenPower;
|
||||
|
@ -130,7 +132,8 @@ public abstract class Recipe {
|
|||
//*******
|
||||
|
||||
private static Recipe[] oneIngredientRecipes = new Recipe[]{
|
||||
new Scroll.ScrollToStone()
|
||||
new Scroll.ScrollToStone(),
|
||||
new StewedMeat.oneMeat()
|
||||
};
|
||||
|
||||
private static Recipe[] twoIngredientRecipes = new Recipe[]{
|
||||
|
@ -138,14 +141,17 @@ public abstract class Recipe {
|
|||
new TippedDart.TipDart(),
|
||||
new ElixirOfDragonsBlood.Recipe(),
|
||||
new ElixirOfEarthenPower.Recipe(),
|
||||
new ElixirOfToxicEssence.Recipe()
|
||||
new ElixirOfToxicEssence.Recipe(),
|
||||
new StewedMeat.twoMeat()
|
||||
};
|
||||
|
||||
private static Recipe[] threeIngredientRecipes = new Recipe[]{
|
||||
new Potion.SeedToPotion(),
|
||||
new ExoticPotion.PotionToExotic(),
|
||||
new ExoticScroll.ScrollToExotic(),
|
||||
new Bomb.EnhanceBomb()
|
||||
new Bomb.EnhanceBomb(),
|
||||
new StewedMeat.threeMeat(),
|
||||
new Feast.Recipe()
|
||||
};
|
||||
|
||||
public static Recipe findRecipe(ArrayList<Item> ingredients){
|
||||
|
|
|
@ -25,16 +25,12 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Recharging;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.SpellSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.Blandfruit;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.Food;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
|
@ -87,28 +83,12 @@ public class HornOfPlenty extends Artifact {
|
|||
if (!isEquipped(hero)) GLog.i( Messages.get(Artifact.class, "need_to_equip") );
|
||||
else if (charge == 0) GLog.i( Messages.get(this, "no_food") );
|
||||
else {
|
||||
//consume as many
|
||||
//consume as much food as it takes to be full, to a minimum of 1
|
||||
int chargesToUse = Math.max( 1, hero.buff(Hunger.class).hunger() / (int)(Hunger.STARVING/10));
|
||||
if (chargesToUse > charge) chargesToUse = charge;
|
||||
hero.buff(Hunger.class).satisfy((Hunger.STARVING/10) * chargesToUse);
|
||||
|
||||
//if you get at least 80 food energy from the horn
|
||||
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:
|
||||
//1 charge
|
||||
Buff.affect( hero, Recharging.class, 4f );
|
||||
ScrollOfRecharging.charge(hero);
|
||||
break;
|
||||
case ROGUE:
|
||||
case HUNTRESS:
|
||||
break;
|
||||
}
|
||||
Food.foodProc( hero );
|
||||
|
||||
Statistics.foodEaten++;
|
||||
|
||||
|
|
|
@ -0,0 +1,104 @@
|
|||
/*
|
||||
* Pixel Dungeon
|
||||
* Copyright (C) 2012-2015 Oleg Dolya
|
||||
*
|
||||
* Shattered Pixel Dungeon
|
||||
* Copyright (C) 2014-2018 Evan Debenham
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package com.shatteredpixel.shatteredpixeldungeon.items.food;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FlavourBuff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Feast extends Food {
|
||||
|
||||
{
|
||||
image = ItemSpriteSheet.FEAST;
|
||||
energy = Hunger.STARVING*2f;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void satisfy(Hero hero) {
|
||||
super.satisfy( hero );
|
||||
|
||||
Buff.affect(hero, WellFed.class, Hunger.STARVING);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int price() {
|
||||
return 50 * quantity;
|
||||
}
|
||||
|
||||
//TODO visuals, is this the effect we want as well?
|
||||
public static class WellFed extends FlavourBuff {
|
||||
|
||||
}
|
||||
|
||||
public static class Recipe extends com.shatteredpixel.shatteredpixeldungeon.items.Recipe {
|
||||
|
||||
@Override
|
||||
public boolean testIngredients(ArrayList<Item> ingredients) {
|
||||
boolean pasty = false;
|
||||
boolean ration = false;
|
||||
boolean meat = false;
|
||||
|
||||
for (Item ingredient : ingredients){
|
||||
if (ingredient.quantity() > 0) {
|
||||
if (ingredient instanceof Pasty) {
|
||||
pasty = true;
|
||||
} else if (ingredient.getClass() == Food.class) {
|
||||
ration = true;
|
||||
} else if (ingredient instanceof MysteryMeat
|
||||
|| ingredient instanceof StewedMeat
|
||||
|| ingredient instanceof ChargrilledMeat
|
||||
|| ingredient instanceof FrozenCarpaccio) {
|
||||
meat = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return pasty && ration && meat;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int cost(ArrayList<Item> ingredients) {
|
||||
return 8;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item brew(ArrayList<Item> ingredients) {
|
||||
if (!testIngredients(ingredients)) return null;
|
||||
|
||||
for (Item ingredient : ingredients){
|
||||
ingredient.quantity(ingredient.quantity() - 1);
|
||||
}
|
||||
|
||||
return sampleOutput(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item sampleOutput(ArrayList<Item> ingredients) {
|
||||
return new Feast();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -71,10 +71,30 @@ public class Food extends Item {
|
|||
|
||||
detach( hero.belongings.backpack );
|
||||
|
||||
(hero.buff( Hunger.class )).satisfy( energy );
|
||||
satisfy(hero);
|
||||
GLog.i( message );
|
||||
|
||||
switch (hero.heroClass) {
|
||||
foodProc( hero );
|
||||
|
||||
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();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected void satisfy( Hero hero ){
|
||||
(hero.buff( Hunger.class )).satisfy( energy );
|
||||
}
|
||||
|
||||
public static void foodProc( Hero hero ){
|
||||
switch (hero.heroClass) {
|
||||
case WARRIOR:
|
||||
if (hero.HP < hero.HT) {
|
||||
hero.HP = Math.min( hero.HP + 5, hero.HT );
|
||||
|
@ -89,18 +109,6 @@ public class Food extends Item {
|
|||
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();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,15 +47,11 @@ public class FrozenCarpaccio extends Food {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void execute( Hero hero, String action ) {
|
||||
|
||||
super.execute( hero, action );
|
||||
|
||||
if (action.equals( AC_EAT )) {
|
||||
effect(hero);
|
||||
}
|
||||
protected void satisfy(Hero hero) {
|
||||
super.satisfy(hero);
|
||||
effect(hero);
|
||||
}
|
||||
|
||||
|
||||
public int price() {
|
||||
return 10 * quantity;
|
||||
}
|
||||
|
|
|
@ -42,13 +42,9 @@ public class MysteryMeat extends Food {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void execute( Hero hero, String action ) {
|
||||
|
||||
super.execute( hero, action );
|
||||
|
||||
if (action.equals( AC_EAT )) {
|
||||
effect(hero);
|
||||
}
|
||||
protected void satisfy(Hero hero) {
|
||||
super.satisfy(hero);
|
||||
effect(hero);
|
||||
}
|
||||
|
||||
public int price() {
|
||||
|
|
|
@ -98,23 +98,21 @@ public class Pasty extends Food {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void execute(Hero hero, String action) {
|
||||
super.execute(hero, action);
|
||||
|
||||
if (action.equals(AC_EAT)){
|
||||
switch(holiday){
|
||||
case NONE:
|
||||
break; //do nothing extra
|
||||
case HWEEN:
|
||||
//heals for 10% max hp
|
||||
hero.HP = Math.min(hero.HP + hero.HT/10, hero.HT);
|
||||
hero.sprite.emitter().burst( Speck.factory( Speck.HEALING ), 1 );
|
||||
break;
|
||||
case XMAS:
|
||||
Buff.affect( hero, Recharging.class, 2f ); //half of a charge
|
||||
ScrollOfRecharging.charge( hero );
|
||||
break;
|
||||
}
|
||||
protected void satisfy(Hero hero) {
|
||||
super.satisfy(hero);
|
||||
|
||||
switch(holiday){
|
||||
case NONE:
|
||||
break; //do nothing extra
|
||||
case HWEEN:
|
||||
//heals for 10% max hp
|
||||
hero.HP = Math.min(hero.HP + hero.HT/10, hero.HT);
|
||||
hero.sprite.emitter().burst( Speck.factory( Speck.HEALING ), 1 );
|
||||
break;
|
||||
case XMAS:
|
||||
Buff.affect( hero, Recharging.class, 2f ); //half of a charge
|
||||
ScrollOfRecharging.charge( hero );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* Pixel Dungeon
|
||||
* Copyright (C) 2012-2015 Oleg Dolya
|
||||
*
|
||||
* Shattered Pixel Dungeon
|
||||
* Copyright (C) 2014-2018 Evan Debenham
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package com.shatteredpixel.shatteredpixeldungeon.items.food;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Recipe;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
|
||||
public class StewedMeat extends Food {
|
||||
|
||||
{
|
||||
image = ItemSpriteSheet.STEWED;
|
||||
energy = Hunger.HUNGRY/2f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int price() {
|
||||
return 8 * quantity;
|
||||
}
|
||||
|
||||
public static class oneMeat extends Recipe.SimpleRecipe{
|
||||
{
|
||||
inputs = new Class[]{MysteryMeat.class};
|
||||
inQuantity = new int[]{1};
|
||||
|
||||
cost = 2;
|
||||
|
||||
output = StewedMeat.class;
|
||||
outQuantity = 1;
|
||||
}
|
||||
}
|
||||
|
||||
public static class twoMeat extends Recipe.SimpleRecipe{
|
||||
{
|
||||
inputs = new Class[]{MysteryMeat.class};
|
||||
inQuantity = new int[]{2};
|
||||
|
||||
cost = 3;
|
||||
|
||||
output = StewedMeat.class;
|
||||
outQuantity = 2;
|
||||
}
|
||||
}
|
||||
|
||||
//red meat
|
||||
//blue meat
|
||||
|
||||
public static class threeMeat extends Recipe.SimpleRecipe{
|
||||
{
|
||||
inputs = new Class[]{MysteryMeat.class};
|
||||
inQuantity = new int[]{3};
|
||||
|
||||
cost = 4;
|
||||
|
||||
output = StewedMeat.class;
|
||||
outQuantity = 3;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -528,23 +528,27 @@ public class ItemSpriteSheet {
|
|||
private static final int FOOD = xy(1, 28); //16 slots
|
||||
public static final int MEAT = FOOD+0;
|
||||
public static final int STEAK = FOOD+1;
|
||||
public static final int OVERPRICED = FOOD+2;
|
||||
public static final int CARPACCIO = FOOD+3;
|
||||
public static final int RATION = FOOD+4;
|
||||
public static final int PASTY = FOOD+5;
|
||||
public static final int PUMPKIN_PIE = FOOD+6;
|
||||
public static final int CANDY_CANE = FOOD+7;
|
||||
public static final int BLANDFRUIT = FOOD+8;
|
||||
public static final int BLAND_CHUNKS= FOOD+9;
|
||||
public static final int STEWED = FOOD+2;
|
||||
public static final int OVERPRICED = FOOD+3;
|
||||
public static final int CARPACCIO = FOOD+4;
|
||||
public static final int RATION = FOOD+5;
|
||||
public static final int PASTY = FOOD+6;
|
||||
public static final int PUMPKIN_PIE = FOOD+7;
|
||||
public static final int CANDY_CANE = FOOD+8;
|
||||
public static final int FEAST = FOOD+9;
|
||||
public static final int BLANDFRUIT = FOOD+10;
|
||||
public static final int BLAND_CHUNKS= FOOD+11;
|
||||
static{
|
||||
assignItemRect(MEAT, 15, 11);
|
||||
assignItemRect(STEAK, 15, 11);
|
||||
assignItemRect(STEWED, 15, 11);
|
||||
assignItemRect(OVERPRICED, 14, 11);
|
||||
assignItemRect(CARPACCIO, 15, 11);
|
||||
assignItemRect(RATION, 16, 12);
|
||||
assignItemRect(PASTY, 16, 11);
|
||||
assignItemRect(PUMPKIN_PIE, 16, 12);
|
||||
assignItemRect(CANDY_CANE, 13, 16);
|
||||
assignItemRect(FEAST, 16, 11);
|
||||
assignItemRect(BLANDFRUIT, 9, 12);
|
||||
assignItemRect(BLAND_CHUNKS,14, 6);
|
||||
}
|
||||
|
|
|
@ -409,6 +409,9 @@ items.food.blandfruit$chunks.desc=The blandfruit has exploded on impact, leaving
|
|||
items.food.chargrilledmeat.name=chargrilled meat
|
||||
items.food.chargrilledmeat.desc=It looks like a decent steak.
|
||||
|
||||
items.food.feast.name=feast
|
||||
items.food.feast.desc=TODO
|
||||
|
||||
items.food.food.name=ration of food
|
||||
items.food.food.ac_eat=EAT
|
||||
items.food.food.eat_msg=That food tasted delicious!
|
||||
|
@ -429,17 +432,20 @@ items.food.mysterymeat.not_well=You are not feeling well.
|
|||
items.food.mysterymeat.stuffed=You are stuffed.
|
||||
items.food.mysterymeat.desc=Eat at your own risk!
|
||||
|
||||
items.food.pasty.pasty=pasty
|
||||
items.food.pasty.pie=pumpkin pie
|
||||
items.food.pasty.cane=candy cane
|
||||
items.food.pasty.pasty_desc=This is authentic Cornish pasty with traditional filling of beef and potato.
|
||||
items.food.pasty.pie_desc=A great big slice of pumpkin pie! Its sweet and spicy flavor will fill you up and give you a tiny bit of healing.\n\nHappy Halloween!
|
||||
items.food.pasty.cane_desc=A huge sugary sweet candy cane! It's big enough to fill you up, and the sugar might give your wands a tiny bit of extra charge too.\n\nHappy Holidays!
|
||||
|
||||
items.food.smallration.name=small food ration
|
||||
items.food.smallration.eat_msg=That food tasted ok.
|
||||
items.food.smallration.desc=It looks exactly like a standard ration of food but smaller.
|
||||
|
||||
items.food.pasty.pasty=pasty
|
||||
items.food.pasty.pie=pumpkin pie
|
||||
items.food.pasty.cane=candy cane
|
||||
|
||||
items.food.pasty.pasty_desc=This is authentic Cornish pasty with traditional filling of beef and potato.
|
||||
items.food.pasty.pie_desc=A great big slice of pumpkin pie! Its sweet and spicy flavor will fill you up and give you a tiny bit of healing.\n\nHappy Halloween!
|
||||
items.food.pasty.cane_desc=A huge sugary sweet candy cane! It's big enough to fill you up, and the sugar might give your wands a tiny bit of extra charge too.\n\nHappy Holidays!
|
||||
items.food.stewedmeat.name=stewed meat
|
||||
items.food.stewedmeat.eat_msg=That food tasted ok.
|
||||
items.food.stewedmeat.desc=TODO
|
||||
|
||||
|
||||
|
||||
|
@ -810,9 +816,6 @@ items.scrolls.exotic.scrollofantimagic.desc=The incantation on this scroll will
|
|||
items.scrolls.exotic.scrollofconfusion.name=scroll of confusion
|
||||
items.scrolls.exotic.scrollofconfusion.desc=When read aloud, this scroll will unleash confusing magic on all targets in sight, blinding and disorienting them.
|
||||
|
||||
items.scrolls.exotic.scrollofdistortion.name=scroll of distortion
|
||||
items.scrolls.exotic.scrollofdistortion.desc=This scroll contains powerful magic capable of warping reality.
|
||||
|
||||
items.scrolls.exotic.scrollofdivination.name=scroll of divination
|
||||
items.scrolls.exotic.scrollofdivination.nothing_left=There is nothing left to identify!
|
||||
items.scrolls.exotic.scrollofdivination.desc=This scroll will permanently identify four random item types: potion colors, scroll runes, and ring gems. The items identified won't necessary be ones you're carrying.
|
||||
|
|
Loading…
Reference in New Issue
Block a user