v1.1.0: exotic potions and scrolls now require energy to create

This commit is contained in:
Evan Debenham 2021-11-14 17:02:00 -05:00
parent 97fd800b92
commit a4db11c8eb
5 changed files with 27 additions and 57 deletions

View File

@ -171,6 +171,8 @@ public abstract class Recipe {
private static Recipe[] oneIngredientRecipes = new Recipe[]{
new AlchemistsToolkit.upgradeKit(),
new ExoticPotion.PotionToExotic(),
new ExoticScroll.ScrollToExotic(),
new Scroll.ScrollToStone(),
new ArcaneResin.Recipe(),
new StewedMeat.oneMeat()
@ -208,8 +210,8 @@ public abstract class Recipe {
private static Recipe[] threeIngredientRecipes = new Recipe[]{
new Potion.SeedToPotion(),
new ExoticPotion.PotionToExotic(),
new ExoticScroll.ScrollToExotic(),
//new ExoticPotion.PotionToExotic(),
//new ExoticScroll.ScrollToExotic(),
new StewedMeat.threeMeat(),
new MeatPie.Recipe()
};

View File

@ -128,50 +128,33 @@ public class ExoticPotion extends Potion {
}
public static class PotionToExotic extends Recipe{
@Override
public boolean testIngredients(ArrayList<Item> ingredients) {
int s = 0;
Potion p = null;
for (Item i : ingredients){
if (i instanceof Plant.Seed){
s++;
} else if (regToExo.containsKey(i.getClass())) {
p = (Potion)i;
}
if (ingredients.size() == 1 && regToExo.containsKey(ingredients.get(0).getClass())){
return true;
}
return p != null && s == 2;
return false;
}
@Override
public int cost(ArrayList<Item> ingredients) {
return 0;
return 4;
}
@Override
public Item brew(ArrayList<Item> ingredients) {
Item result = null;
for (Item i : ingredients){
i.quantity(i.quantity()-1);
if (regToExo.containsKey(i.getClass())) {
result = Reflection.newInstance(regToExo.get(i.getClass()));
}
}
return result;
return Reflection.newInstance(regToExo.get(ingredients.get(0).getClass()));
}
@Override
public Item sampleOutput(ArrayList<Item> ingredients) {
for (Item i : ingredients){
if (regToExo.containsKey(i.getClass())) {
return Reflection.newInstance(regToExo.get(i.getClass()));
}
}
return null;
return Reflection.newInstance(regToExo.get(ingredients.get(0).getClass()));
}
}
}

View File

@ -123,47 +123,30 @@ public abstract class ExoticScroll extends Scroll {
@Override
public boolean testIngredients(ArrayList<Item> ingredients) {
int r = 0;
Scroll s = null;
for (Item i : ingredients){
if (i instanceof Runestone){
r++;
} else if (regToExo.containsKey(i.getClass())) {
s = (Scroll)i;
}
if (ingredients.size() == 1 && regToExo.containsKey(ingredients.get(0).getClass())){
return true;
}
return s != null && r == 2;
return false;
}
@Override
public int cost(ArrayList<Item> ingredients) {
return 0;
return 6;
}
@Override
public Item brew(ArrayList<Item> ingredients) {
Item result = null;
for (Item i : ingredients){
i.quantity(i.quantity()-1);
if (regToExo.containsKey(i.getClass())) {
result = Reflection.newInstance(regToExo.get(i.getClass()));
}
}
return result;
return Reflection.newInstance(regToExo.get(ingredients.get(0).getClass()));
}
@Override
public Item sampleOutput(ArrayList<Item> ingredients) {
for (Item i : ingredients){
if (regToExo.containsKey(i.getClass())) {
return Reflection.newInstance(regToExo.get(i.getClass()));
}
}
return null;
return Reflection.newInstance(regToExo.get(ingredients.get(0).getClass()));
}
}
}

View File

@ -563,6 +563,8 @@ public class AlchemyScene extends PixelScene {
bubbleEmitter.start(Speck.factory( Speck.BUBBLE ), 0.01f, 100 );
sparkEmitter.burst(SparkParticle.FACTORY, 20);
Sample.INSTANCE.play( Assets.Sounds.LIGHTNING );
updateState();
}
public static class ItemButton extends Component {

View File

@ -332,7 +332,7 @@ public class QuickRecipe extends Component {
r = new ExoticPotion.PotionToExotic();
for (Class<?> cls : Generator.Category.POTION.classes){
Potion pot = (Potion) Reflection.newInstance(cls);
ArrayList<Item> in = new ArrayList<>(Arrays.asList(pot, new Plant.Seed.PlaceHolder().quantity(2)));
ArrayList<Item> in = new ArrayList<>(Arrays.asList(pot));
result.add(new QuickRecipe( r, in, r.sampleOutput(in)));
}
return result;
@ -340,7 +340,7 @@ public class QuickRecipe extends Component {
r = new ExoticScroll.ScrollToExotic();
for (Class<?> cls : Generator.Category.SCROLL.classes){
Scroll scroll = (Scroll) Reflection.newInstance(cls);
ArrayList<Item> in = new ArrayList<>(Arrays.asList(scroll, new Runestone.PlaceHolder().quantity(2)));
ArrayList<Item> in = new ArrayList<>(Arrays.asList(scroll));
result.add(new QuickRecipe( r, in, r.sampleOutput(in)));
}
return result;