V0.1.1: fixed a bug involving throwing blandfruit (need to test)

This commit is contained in:
Evan Debenham
2014-08-15 09:20:15 -04:00
parent ef59fd8536
commit 8c8ccf8db4
@@ -40,10 +40,10 @@ public class Blandfruit extends Food {
@Override @Override
public void execute( Hero hero, String action ) { public void execute( Hero hero, String action ) {
if (potionAttrib == null){
if (action.equals( AC_EAT )){ if (action.equals( AC_EAT )){
if (potionAttrib == null) {
detach(hero.belongings.backpack); detach(hero.belongings.backpack);
((Hunger) hero.buff(Hunger.class)).satisfy(energy); ((Hunger) hero.buff(Hunger.class)).satisfy(energy);
@@ -58,12 +58,7 @@ public class Blandfruit extends Food {
Statistics.foodEaten++; Statistics.foodEaten++;
Badges.validateFoodEaten(); Badges.validateFoodEaten();
} } else {
else super.execute(hero, action);
} else if (action.equals( AC_EAT )){
((Hunger) hero.buff(Hunger.class)).satisfy(Hunger.HUNGRY); ((Hunger) hero.buff(Hunger.class)).satisfy(Hunger.HUNGRY);
@@ -73,7 +68,7 @@ public class Blandfruit extends Food {
hero.busy(); hero.busy();
if (potionAttrib instanceof PotionOfFrost) { if (potionAttrib instanceof PotionOfFrost) {
GLog.i( "the Frostfruit takes a bit like Frozen Carpaccio." ); GLog.i("the Frostfruit tastes a bit like Frozen Carpaccio.");
switch (Random.Int(5)) { switch (Random.Int(5)) {
case 0: case 0:
GLog.i("You see your hands turn invisible!"); GLog.i("You see your hands turn invisible!");
@@ -120,19 +115,7 @@ public class Blandfruit extends Food {
case HUNTRESS: case HUNTRESS:
break; break;
} }
} else if (action.equals( AC_THROW )){
if (potionAttrib instanceof PotionOfLiquidFlame ||
potionAttrib instanceof PotionOfToxicGas ||
potionAttrib instanceof PotionOfParalyticGas ||
potionAttrib instanceof PotionOfFrost){
potionAttrib.execute(hero, action);
//detaches in Potion.cast, this is an awkward workaround due to throwing being on a different thread.
} else {
super.execute(hero, action);
} }
} else { } else {
super.execute(hero, action); super.execute(hero, action);
} }
@@ -224,10 +207,24 @@ public class Blandfruit extends Food {
public static final String NAME = "name"; public static final String NAME = "name";
@Override
public void cast( final Hero user, int dst ) {
if (potionAttrib instanceof PotionOfLiquidFlame ||
potionAttrib instanceof PotionOfToxicGas ||
potionAttrib instanceof PotionOfParalyticGas ||
potionAttrib instanceof PotionOfFrost) {
potionAttrib.cast(user, dst);
detach( user.belongings.backpack );
} else {
super.cast(user, dst);
}
}
@Override @Override
public void storeInBundle(Bundle bundle){ public void storeInBundle(Bundle bundle){
super.storeInBundle(bundle); super.storeInBundle(bundle);
bundle.put(NAME name); bundle.put( NAME, name );
} }
@Override @Override