v0.7.0: single darts can now be tipped
This commit is contained in:
+7
-4
@@ -126,7 +126,7 @@ public abstract class TippedDart extends Dart {
|
|||||||
|
|
||||||
Plant.Seed seed = (Plant.Seed) ingredients.get(1);
|
Plant.Seed seed = (Plant.Seed) ingredients.get(1);
|
||||||
|
|
||||||
if (ingredients.get(0).quantity() >= 2
|
if (ingredients.get(0).quantity() >= 1
|
||||||
&& seed.quantity() >= 1
|
&& seed.quantity() >= 1
|
||||||
&& types.containsKey(seed.getClass())){
|
&& types.containsKey(seed.getClass())){
|
||||||
return true;
|
return true;
|
||||||
@@ -144,11 +144,13 @@ public abstract class TippedDart extends Dart {
|
|||||||
public Item brew(ArrayList<Item> ingredients) {
|
public Item brew(ArrayList<Item> ingredients) {
|
||||||
if (!testIngredients(ingredients)) return null;
|
if (!testIngredients(ingredients)) return null;
|
||||||
|
|
||||||
ingredients.get(0).quantity(ingredients.get(0).quantity() - 2);
|
int produced = Math.min(2, ingredients.get(0).quantity());
|
||||||
|
|
||||||
|
ingredients.get(0).quantity(ingredients.get(0).quantity() - produced);
|
||||||
ingredients.get(1).quantity(ingredients.get(1).quantity() - 1);
|
ingredients.get(1).quantity(ingredients.get(1).quantity() - 1);
|
||||||
|
|
||||||
try{
|
try{
|
||||||
return types.get(ingredients.get(1).getClass()).newInstance().quantity(2);
|
return types.get(ingredients.get(1).getClass()).newInstance().quantity(produced);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
ShatteredPixelDungeon.reportException(e);
|
ShatteredPixelDungeon.reportException(e);
|
||||||
return null;
|
return null;
|
||||||
@@ -161,7 +163,8 @@ public abstract class TippedDart extends Dart {
|
|||||||
if (!testIngredients(ingredients)) return null;
|
if (!testIngredients(ingredients)) return null;
|
||||||
|
|
||||||
try{
|
try{
|
||||||
return types.get(ingredients.get(1).getClass()).newInstance().quantity(2);
|
int produced = Math.min(2, ingredients.get(0).quantity());
|
||||||
|
return types.get(ingredients.get(1).getClass()).newInstance().quantity( produced );
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
ShatteredPixelDungeon.reportException(e);
|
ShatteredPixelDungeon.reportException(e);
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user