v0.7.0: added a recipe for scrolls to runestones
This commit is contained in:
parent
876c1844c6
commit
6abfa988f2
|
@ -24,6 +24,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.Blandfruit;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.darts.TippedDart;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -111,7 +112,7 @@ public abstract class Recipe {
|
|||
//*******
|
||||
|
||||
private static Recipe[] oneIngredientRecipes = new Recipe[]{
|
||||
|
||||
new Scroll.ScrollToStone()
|
||||
};
|
||||
|
||||
private static Recipe[] twoIngredientRecipes = new Recipe[]{
|
||||
|
|
|
@ -22,11 +22,15 @@
|
|||
package com.shatteredpixel.shatteredpixeldungeon.items.scrolls;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Blindness;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.ItemStatusHandler;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Recipe;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.UnstableSpellbook;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.stones.Runestone;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfIntuition;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.HeroSprite;
|
||||
|
@ -226,4 +230,60 @@ public abstract class Scroll extends Item {
|
|||
public int price() {
|
||||
return 30 * quantity;
|
||||
}
|
||||
|
||||
public static class ScrollToStone extends Recipe {
|
||||
|
||||
private static HashMap<Class<?extends Scroll>, Class<?extends Runestone>> stones = new HashMap<>();
|
||||
private static HashMap<Class<?extends Scroll>, Integer> amnts = new HashMap<>();
|
||||
//TODO add more stones as they are implemented
|
||||
static {
|
||||
stones.put(ScrollOfIdentify.class, StoneOfIntuition.class);
|
||||
amnts.put(ScrollOfIdentify.class, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testIngredients(ArrayList<Item> ingredients) {
|
||||
if (ingredients.size() != 1
|
||||
|| !(ingredients.get(0) instanceof Scroll)
|
||||
|| !stones.containsKey(ingredients.get(0).getClass())){
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int cost(ArrayList<Item> ingredients) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item brew(ArrayList<Item> ingredients) {
|
||||
if (!testIngredients(ingredients)) return null;
|
||||
|
||||
Scroll s = (Scroll) ingredients.get(0);
|
||||
|
||||
s.quantity(s.quantity() - 1);
|
||||
|
||||
try{
|
||||
return stones.get(s.getClass()).newInstance().quantity(amnts.get(s.getClass()));
|
||||
} catch (Exception e) {
|
||||
ShatteredPixelDungeon.reportException(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item sampleOutput(ArrayList<Item> ingredients) {
|
||||
if (!testIngredients(ingredients)) return null;
|
||||
|
||||
try{
|
||||
Scroll s = (Scroll) ingredients.get(0);
|
||||
return stones.get(s.getClass()).newInstance().quantity(amnts.get(s.getClass()));
|
||||
} catch (Exception e) {
|
||||
ShatteredPixelDungeon.reportException(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.bags.MagicalHolster;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.items.bags.PotionBandolier;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.bags.ScrollHolder;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.bags.VelvetPouch;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.Blandfruit;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.Food;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
|
||||
|
@ -43,9 +42,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Boomerang;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.darts.Dart;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.plants.BlandfruitBush;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant.Seed;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
|
@ -399,7 +396,7 @@ public class WndBag extends WndTabbed {
|
|||
mode == Mode.SCROLL && (item instanceof Scroll) ||
|
||||
mode == Mode.UNIDED_POTION_OR_SCROLL && (!item.isIdentified() && (item instanceof Scroll || item instanceof Potion)) ||
|
||||
mode == Mode.EQUIPMENT && (item instanceof EquipableItem) ||
|
||||
mode == Mode.ALCHEMY && ((item instanceof Seed && !(item instanceof BlandfruitBush.Seed)) || (item instanceof Blandfruit && ((Blandfruit) item).potionAttrib == null) || (item.getClass() == Dart.class)) ||
|
||||
mode == Mode.ALCHEMY && (!(item instanceof EquipableItem) && item.isIdentified()) ||
|
||||
mode == Mode.ALL
|
||||
);
|
||||
//extra logic for cursed weapons or armor
|
||||
|
|
Loading…
Reference in New Issue
Block a user