v0.7.1: improved how trans/recycle handle exotics, stones, elixirs/brews
This commit is contained in:
parent
63a5f57b01
commit
24e311dc58
|
@ -29,9 +29,12 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.Artifact;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.brews.Brew;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.elixirs.Elixir;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic.ExoticPotion;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ExoticScroll;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.stones.Runestone;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff;
|
||||
|
@ -53,9 +56,14 @@ public class ScrollOfTransmutation extends InventoryScroll {
|
|||
}
|
||||
|
||||
public static boolean canTransmute(Item item){
|
||||
return item instanceof MagesStaff || item instanceof MeleeWeapon || item instanceof Potion
|
||||
|| item instanceof Scroll || item instanceof Ring || item instanceof Wand
|
||||
|| item instanceof Plant.Seed || item instanceof Artifact;
|
||||
return item instanceof MeleeWeapon ||
|
||||
(item instanceof Potion && !(item instanceof Elixir || item instanceof Brew)) ||
|
||||
item instanceof Scroll ||
|
||||
item instanceof Ring ||
|
||||
item instanceof Wand ||
|
||||
item instanceof Plant.Seed ||
|
||||
item instanceof Runestone ||
|
||||
item instanceof Artifact;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -77,6 +85,8 @@ public class ScrollOfTransmutation extends InventoryScroll {
|
|||
result = changeWand( (Wand)item );
|
||||
} else if (item instanceof Plant.Seed) {
|
||||
result = changeSeed((Plant.Seed) item);
|
||||
} else if (item instanceof Runestone) {
|
||||
result = changeStone((Runestone) item);
|
||||
} else if (item instanceof Artifact) {
|
||||
result = changeArtifact( (Artifact)item );
|
||||
} else {
|
||||
|
@ -219,6 +229,17 @@ public class ScrollOfTransmutation extends InventoryScroll {
|
|||
return n;
|
||||
}
|
||||
|
||||
private Runestone changeStone( Runestone r ) {
|
||||
|
||||
Runestone n;
|
||||
|
||||
do {
|
||||
n = (Runestone) Generator.random( Generator.Category.STONE );
|
||||
} while (n.getClass() == r.getClass());
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
private Scroll changeScroll( Scroll s ) {
|
||||
try {
|
||||
if (s instanceof ExoticScroll) {
|
||||
|
|
|
@ -21,11 +21,16 @@
|
|||
|
||||
package com.shatteredpixel.shatteredpixeldungeon.items.spells;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.brews.Brew;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.elixirs.Elixir;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic.ExoticPotion;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTransmutation;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ExoticScroll;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ScrollOfDivination;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.stones.Runestone;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
|
@ -47,8 +52,24 @@ public class Recycle extends InventorySpell {
|
|||
do {
|
||||
if (item instanceof Potion) {
|
||||
result = Generator.random(Generator.Category.POTION);
|
||||
if (item instanceof ExoticPotion){
|
||||
try {
|
||||
result = ExoticPotion.regToExo.get(result.getClass()).newInstance();
|
||||
} catch ( Exception e ){
|
||||
ShatteredPixelDungeon.reportException(e);
|
||||
result = item;
|
||||
}
|
||||
}
|
||||
} else if (item instanceof Scroll) {
|
||||
result = Generator.random(Generator.Category.SCROLL);
|
||||
if (item instanceof ExoticScroll){
|
||||
try {
|
||||
result = ExoticScroll.regToExo.get(result.getClass()).newInstance();
|
||||
} catch ( Exception e ){
|
||||
ShatteredPixelDungeon.reportException(e);
|
||||
result = item;
|
||||
}
|
||||
}
|
||||
} else if (item instanceof Plant.Seed) {
|
||||
result = Generator.random(Generator.Category.SEED);
|
||||
} else {
|
||||
|
@ -63,7 +84,7 @@ public class Recycle extends InventorySpell {
|
|||
}
|
||||
|
||||
public static boolean isRecyclable(Item item){
|
||||
return item instanceof Potion ||
|
||||
return (item instanceof Potion && !(item instanceof Elixir || item instanceof Brew)) ||
|
||||
item instanceof Scroll ||
|
||||
item instanceof Plant.Seed ||
|
||||
item instanceof Runestone;
|
||||
|
|
Loading…
Reference in New Issue
Block a user