v3.2.0: liquid metal and arcane resin can now be made without full ID
This commit is contained in:
@@ -153,7 +153,7 @@ public class ArcaneResin extends Item {
|
||||
public boolean testIngredients(ArrayList<Item> ingredients) {
|
||||
return ingredients.size() == 1
|
||||
&& ingredients.get(0) instanceof Wand
|
||||
&& ingredients.get(0).isIdentified()
|
||||
&& ingredients.get(0).cursedKnown
|
||||
&& !ingredients.get(0).cursed;
|
||||
}
|
||||
|
||||
@@ -165,8 +165,12 @@ public class ArcaneResin extends Item {
|
||||
@Override
|
||||
public Item brew(ArrayList<Item> ingredients) {
|
||||
Item result = sampleOutput(ingredients);
|
||||
Wand w = (Wand)ingredients.get(0);
|
||||
|
||||
ingredients.get(0).quantity(0);
|
||||
if (!w.levelKnown){
|
||||
result.quantity(resinQuantity(w));
|
||||
}
|
||||
w.quantity(0);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -174,15 +178,22 @@ public class ArcaneResin extends Item {
|
||||
@Override
|
||||
public Item sampleOutput(ArrayList<Item> ingredients) {
|
||||
Wand w = (Wand)ingredients.get(0);
|
||||
int level = w.level() - w.resinBonus;
|
||||
|
||||
Item output = new ArcaneResin().quantity(2*(level+1));
|
||||
if (w.levelKnown){
|
||||
return new ArcaneResin().quantity(resinQuantity(w));
|
||||
} else {
|
||||
return new ArcaneResin();
|
||||
}
|
||||
}
|
||||
|
||||
private int resinQuantity(Wand w){
|
||||
int level = w.level() - w.resinBonus;
|
||||
int quantity = 2*(level+1);
|
||||
|
||||
if (Dungeon.hero.heroClass != HeroClass.MAGE && Dungeon.hero.hasTalent(Talent.WAND_PRESERVATION)){
|
||||
output.quantity(output.quantity() + Dungeon.hero.pointsInTalent(Talent.WAND_PRESERVATION));
|
||||
quantity += Dungeon.hero.pointsInTalent(Talent.WAND_PRESERVATION);
|
||||
}
|
||||
|
||||
return output;
|
||||
return quantity;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -129,9 +129,7 @@ public class LiquidMetal extends Item {
|
||||
return item instanceof MissileWeapon && !(item instanceof Dart);
|
||||
}
|
||||
|
||||
//TODO this needs to fix broken thrown weapons too
|
||||
// should also only apply to IDed thrown weapons?
|
||||
// TODO maybe thrown weps and wands can just be known uncursed in order to make recipe?
|
||||
//TODO should we let this fix broken weapons too?
|
||||
|
||||
@Override
|
||||
public void onSelect( Item item ) {
|
||||
@@ -178,7 +176,7 @@ public class LiquidMetal extends Item {
|
||||
public boolean testIngredients(ArrayList<Item> ingredients) {
|
||||
return ingredients.size() == 1
|
||||
&& ingredients.get(0) instanceof MissileWeapon
|
||||
&& ingredients.get(0).isIdentified()
|
||||
&& ingredients.get(0).cursedKnown
|
||||
&& !ingredients.get(0).cursed;
|
||||
}
|
||||
|
||||
@@ -190,27 +188,34 @@ public class LiquidMetal extends Item {
|
||||
@Override
|
||||
public Item brew(ArrayList<Item> ingredients) {
|
||||
Item result = sampleOutput(ingredients);
|
||||
MissileWeapon m = (MissileWeapon) ingredients.get(0);
|
||||
if (!m.levelKnown){
|
||||
result.quantity(metalQuantity(m));
|
||||
}
|
||||
|
||||
MissileWeapon w = (MissileWeapon) ingredients.get(0);
|
||||
w.quantity(0);
|
||||
Buff.affect(Dungeon.hero, MissileWeapon.UpgradedSetTracker.class).levelThresholds.put(w.setID, Integer.MAX_VALUE);
|
||||
m.quantity(0);
|
||||
Buff.affect(Dungeon.hero, MissileWeapon.UpgradedSetTracker.class).levelThresholds.put(m.setID, Integer.MAX_VALUE);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item sampleOutput(ArrayList<Item> ingredients) {
|
||||
int metalQuantity = 0;
|
||||
MissileWeapon m = (MissileWeapon) ingredients.get(0);
|
||||
|
||||
for (Item i : ingredients){
|
||||
MissileWeapon m = (MissileWeapon) i;
|
||||
if (m.levelKnown){
|
||||
return new LiquidMetal().quantity(metalQuantity(m));
|
||||
} else {
|
||||
return new LiquidMetal();
|
||||
}
|
||||
}
|
||||
|
||||
private int metalQuantity(MissileWeapon m){
|
||||
//TODO a smaller quantity set (if one ever exists) should produce more metal per thrown wep?
|
||||
float quantity = m.quantity()-1;
|
||||
quantity += 0.25f + 0.0075f*m.durabilityLeft();
|
||||
quantity *= Math.pow(2, Math.min(3, m.level()));
|
||||
metalQuantity += Math.round((5*(m.tier+1))*quantity);
|
||||
}
|
||||
|
||||
return new LiquidMetal().quantity(metalQuantity);
|
||||
return Math.round((5*(m.tier+1))*quantity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -257,10 +257,10 @@ public abstract class Recipe {
|
||||
public static boolean usableInRecipe(Item item){
|
||||
//only upgradeable thrown weapons and wands allowed among equipment items
|
||||
if (item instanceof EquipableItem){
|
||||
return item.isIdentified() && !item.cursed &&
|
||||
return item.cursedKnown && !item.cursed &&
|
||||
item instanceof MissileWeapon && item.isUpgradable();
|
||||
} else if (item instanceof Wand) {
|
||||
return item.isIdentified() && !item.cursed;
|
||||
return item.cursedKnown && !item.cursed;
|
||||
} else {
|
||||
//other items can be unidentified, but not cursed
|
||||
return !item.cursed;
|
||||
|
||||
Reference in New Issue
Block a user