v0.3.4: externalized food strings

This commit is contained in:
Evan Debenham
2016-01-01 22:07:20 -05:00
committed by Evan Debenham
parent c1aca208b4
commit 861fa34420
9 changed files with 102 additions and 231 deletions
@@ -33,6 +33,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Vertigo;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Weakness;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.utils.Random;
@@ -51,18 +52,26 @@ public class FrozenCarpaccio extends Food {
super.execute( hero, action );
if (action.equals( AC_EAT )) {
switch (Random.Int( 5 )) {
effect(hero);
}
}
public int price() {
return 10 * quantity;
}
public static void effect(Hero hero){
switch (Random.Int( 5 )) {
case 0:
GLog.i( "You see your hands turn invisible!" );
GLog.i( Messages.get(FrozenCarpaccio.class, "invis") );
Buff.affect( hero, Invisibility.class, Invisibility.DURATION );
break;
case 1:
GLog.i( "You feel your skin harden!" );
GLog.i( Messages.get(FrozenCarpaccio.class, "hard") );
Buff.affect( hero, Barkskin.class ).level( hero.HT / 4 );
break;
case 2:
GLog.i( "Refreshing!" );
GLog.i( Messages.get(FrozenCarpaccio.class, "refresh") );
Buff.detach( hero, Poison.class );
Buff.detach( hero, Cripple.class );
Buff.detach( hero, Weakness.class );
@@ -72,27 +81,15 @@ public class FrozenCarpaccio extends Food {
Buff.detach( hero, Vertigo.class);
break;
case 3:
GLog.i( "You feel better!" );
GLog.i( Messages.get(FrozenCarpaccio.class, "better") );
if (hero.HP < hero.HT) {
hero.HP = Math.min( hero.HP + hero.HT / 4, hero.HT );
hero.sprite.emitter().burst( Speck.factory( Speck.HEALING ), 1 );
}
break;
}
}
}
@Override
public String info() {
return
"It's a piece of frozen raw meat. The only way to eat it is " +
"by cutting thin slices of it. And this way it's suprisingly good.";
}
public int price() {
return 10 * quantity;
};
public static Food cook( MysteryMeat ingredient ) {
FrozenCarpaccio result = new FrozenCarpaccio();
result.quantity = ingredient.quantity();