v0.7.0: refactored seed to potion alchemy
This commit is contained in:
parent
9fc8ec2f0d
commit
0cccd06d44
|
@ -120,7 +120,7 @@ public abstract class Recipe {
|
|||
};
|
||||
|
||||
private static Recipe[] threeIngredientRecipes = new Recipe[]{
|
||||
new Potion.RandomPotion()
|
||||
new Potion.SeedToPotion()
|
||||
};
|
||||
|
||||
public static Recipe findRecipe(ArrayList<Item> ingredients){
|
||||
|
|
|
@ -131,7 +131,7 @@ public class Blandfruit extends Food {
|
|||
public Item cook(Seed seed){
|
||||
|
||||
try {
|
||||
return imbuePotion((Potion)seed.alchemyClass.newInstance());
|
||||
return imbuePotion(Potion.SeedToPotion.types.get(seed.getClass()).newInstance());
|
||||
} catch (Exception e) {
|
||||
ShatteredPixelDungeon.reportException(e);
|
||||
return null;
|
||||
|
|
|
@ -42,7 +42,18 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Recipe;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Blindweed;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Dreamfoil;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Earthroot;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Fadeleaf;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Firebloom;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Icecap;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Rotberry;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Sorrowmoss;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Starflower;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Stormvine;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Sungrass;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
|
@ -338,7 +349,22 @@ public class Potion extends Item {
|
|||
}
|
||||
|
||||
|
||||
public static class RandomPotion extends Recipe {
|
||||
public static class SeedToPotion extends Recipe {
|
||||
|
||||
public static HashMap<Class<?extends Plant.Seed>, Class<?extends Potion>> types = new HashMap<>();
|
||||
static {
|
||||
types.put(Blindweed.Seed.class, PotionOfInvisibility.class);
|
||||
types.put(Dreamfoil.Seed.class, PotionOfPurity.class);
|
||||
types.put(Earthroot.Seed.class, PotionOfParalyticGas.class);
|
||||
types.put(Fadeleaf.Seed.class, PotionOfMindVision.class);
|
||||
types.put(Firebloom.Seed.class, PotionOfLiquidFlame.class);
|
||||
types.put(Icecap.Seed.class, PotionOfFrost.class);
|
||||
types.put(Rotberry.Seed.class, PotionOfStrength.class);
|
||||
types.put(Sorrowmoss.Seed.class, PotionOfToxicGas.class);
|
||||
types.put(Starflower.Seed.class, PotionOfExperience.class);
|
||||
types.put(Stormvine.Seed.class, PotionOfLevitation.class);
|
||||
types.put(Sungrass.Seed.class, PotionOfHealing.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testIngredients(ArrayList<Item> ingredients) {
|
||||
|
@ -347,7 +373,9 @@ public class Potion extends Item {
|
|||
}
|
||||
|
||||
for (Item ingredient : ingredients){
|
||||
if (!(ingredient instanceof Plant.Seed && ingredient.quantity() >= 1)){
|
||||
if (!(ingredient instanceof Plant.Seed
|
||||
&& ingredient.quantity() >= 1
|
||||
&& types.containsKey(ingredient.getClass()))){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -367,15 +395,23 @@ public class Potion extends Item {
|
|||
ingredient.quantity(ingredient.quantity() - 1);
|
||||
}
|
||||
|
||||
ArrayList<Class<?extends Plant.Seed>> seeds = new ArrayList<>();
|
||||
for (Item i : ingredients) {
|
||||
if (!seeds.contains(i.getClass())) {
|
||||
seeds.add((Class<? extends Plant.Seed>) i.getClass());
|
||||
}
|
||||
}
|
||||
|
||||
Item result;
|
||||
|
||||
if (Random.Int( 3 ) == 0) {
|
||||
if ( (seeds.size() == 2 && Random.Int(4) == 0)
|
||||
|| (seeds.size() == 3 && Random.Int(2) == 0)) {
|
||||
|
||||
result = Generator.random( Generator.Category.POTION );
|
||||
|
||||
} else {
|
||||
|
||||
Class<? extends Item> itemClass = ((Plant.Seed)Random.element(ingredients)).alchemyClass;
|
||||
Class<? extends Potion> itemClass = types.get(Random.element(ingredients).getClass());
|
||||
try {
|
||||
result = itemClass.newInstance();
|
||||
} catch (Exception e) {
|
||||
|
@ -405,7 +441,7 @@ public class Potion extends Item {
|
|||
public Item sampleOutput(ArrayList<Item> ingredients) {
|
||||
return new WndBag.Placeholder(ItemSpriteSheet.POTION_HOLDER){
|
||||
{
|
||||
name = Messages.get(RandomPotion.class, "name");
|
||||
name = Messages.get(SeedToPotion.class, "name");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -41,7 +41,6 @@ public class BlandfruitBush extends Plant {
|
|||
image = ItemSpriteSheet.SEED_BLANDFRUIT;
|
||||
|
||||
plantClass = BlandfruitBush.class;
|
||||
alchemyClass = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Cripple;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfInvisibility;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
|
@ -64,7 +63,6 @@ public class Blindweed extends Plant {
|
|||
image = ItemSpriteSheet.SEED_BLINDWEED;
|
||||
|
||||
plantClass = Blindweed.class;
|
||||
alchemyClass = PotionOfInvisibility.class;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Vertigo;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Weakness;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfPurity;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
|
@ -70,7 +69,6 @@ public class Dreamfoil extends Plant {
|
|||
image = ItemSpriteSheet.SEED_DREAMFOIL;
|
||||
|
||||
plantClass = Dreamfoil.class;
|
||||
alchemyClass = PotionOfPurity.class;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -28,7 +28,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FlavourBuff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.EarthParticle;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfParalyticGas;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
|
@ -61,7 +60,6 @@ public class Earthroot extends Plant {
|
|||
image = ItemSpriteSheet.SEED_EARTHROOT;
|
||||
|
||||
plantClass = Earthroot.class;
|
||||
alchemyClass = PotionOfParalyticGas.class;
|
||||
|
||||
bones = true;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfMindVision;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
|
||||
|
@ -79,7 +78,6 @@ public class Fadeleaf extends Plant {
|
|||
image = ItemSpriteSheet.SEED_FADELEAF;
|
||||
|
||||
plantClass = Fadeleaf.class;
|
||||
alchemyClass = PotionOfMindVision.class;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.FlameParticle;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfLiquidFlame;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
|
||||
|
@ -51,7 +50,6 @@ public class Firebloom extends Plant {
|
|||
image = ItemSpriteSheet.SEED_FIREBLOOM;
|
||||
|
||||
plantClass = Firebloom.class;
|
||||
alchemyClass = PotionOfLiquidFlame.class;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ package com.shatteredpixel.shatteredpixeldungeon.plants;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Freezing;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfFrost;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
|
||||
import com.watabou.utils.PathFinder;
|
||||
|
@ -54,7 +53,6 @@ public class Icecap extends Plant {
|
|||
image = ItemSpriteSheet.SEED_ICECAP;
|
||||
|
||||
plantClass = Icecap.class;
|
||||
alchemyClass = PotionOfFrost.class;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -132,8 +132,6 @@ public abstract class Plant implements Bundlable {
|
|||
|
||||
protected Class<? extends Plant> plantClass;
|
||||
|
||||
public Class<? extends Item> alchemyClass;
|
||||
|
||||
@Override
|
||||
public ArrayList<String> actions( Hero hero ) {
|
||||
ArrayList<String> actions = super.actions( hero );
|
||||
|
|
|
@ -24,7 +24,6 @@ package com.shatteredpixel.shatteredpixeldungeon.plants;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.LeafParticle;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
|
||||
public class Rotberry extends Plant {
|
||||
|
@ -54,7 +53,6 @@ public class Rotberry extends Plant {
|
|||
image = ItemSpriteSheet.SEED_ROTBERRY;
|
||||
|
||||
plantClass = Rotberry.class;
|
||||
alchemyClass = PotionOfStrength.class;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Poison;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.PoisonParticle;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfToxicGas;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
|
||||
public class Sorrowmoss extends Plant {
|
||||
|
@ -55,7 +54,6 @@ public class Sorrowmoss extends Plant {
|
|||
image = ItemSpriteSheet.SEED_SORROWMOSS;
|
||||
|
||||
plantClass = Sorrowmoss.class;
|
||||
alchemyClass = PotionOfToxicGas.class;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Bless;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfExperience;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
|
@ -53,7 +52,6 @@ public class Starflower extends Plant {
|
|||
image = ItemSpriteSheet.SEED_STARFLOWER;
|
||||
|
||||
plantClass = Starflower.class;
|
||||
alchemyClass = PotionOfExperience.class;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Vertigo;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfLevitation;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
|
||||
public class Stormvine extends Plant {
|
||||
|
@ -48,7 +47,6 @@ public class Stormvine extends Plant {
|
|||
image = ItemSpriteSheet.SEED_STORMVINE;
|
||||
|
||||
plantClass = Stormvine.class;
|
||||
alchemyClass = PotionOfLevitation.class;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShaftParticle;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
|
@ -61,7 +60,6 @@ public class Sungrass extends Plant {
|
|||
image = ItemSpriteSheet.SEED_SUNGRASS;
|
||||
|
||||
plantClass = Sungrass.class;
|
||||
alchemyClass = PotionOfHealing.class;
|
||||
|
||||
bones = true;
|
||||
}
|
||||
|
|
|
@ -444,7 +444,7 @@ items.potions.potion.no=No, I changed my mind
|
|||
items.potions.potion.sure_drink=Are you sure you want to drink it? In most cases you should throw such potions at your enemies.
|
||||
items.potions.potion.sure_throw=Are you sure you want to throw it? In most cases it makes sense to drink it.
|
||||
items.potions.potion.shatter=The flask shatters and the liquid splashes harmlessly.
|
||||
items.potions.potion$randompotion.name=Random Potion
|
||||
items.potions.potion$seedtopotion.name=Random Potion
|
||||
|
||||
items.potions.potionofexperience.name=potion of experience
|
||||
items.potions.potionofexperience.desc=The storied experiences of multitudes of battles reduced to liquid form, this draught will instantly raise your experience level.
|
||||
|
|
Loading…
Reference in New Issue
Block a user