v0.4.3a: implemented a halloween treat

This commit is contained in:
Evan Debenham 2016-10-20 01:48:09 -04:00
parent 7651e4c557
commit e065d68f71
4 changed files with 37 additions and 15 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -24,6 +24,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Recharging; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Recharging;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
@ -37,7 +38,7 @@ public class Pasty extends Food {
private enum Holiday{ private enum Holiday{
NONE, NONE,
EASTER, //TBD EASTER, //TBD
HALLOWEEN,//TBD HWEEN,//2nd week of october though first day of november
XMAS //3rd week of december through first week of january XMAS //3rd week of december through first week of january
} }
@ -45,18 +46,25 @@ public class Pasty extends Food {
static{ static{
final Calendar calendar = Calendar.getInstance(); final Calendar calendar = Calendar.getInstance();
holiday = Holiday.NONE; switch(calendar.get(Calendar.MONTH)){
//we add 1 to turn it into standard calendar months (1-12 instead of 0-11) default:
switch(calendar.get(Calendar.MONTH)+1){ holiday = Holiday.NONE;
case 1:
if (calendar.get(Calendar.WEEK_OF_MONTH) == 1){
holiday = Holiday.XMAS;
}
break; break;
case 12: case Calendar.JANUARY:
if (calendar.get(Calendar.WEEK_OF_MONTH) >= 3){ if (calendar.get(Calendar.WEEK_OF_MONTH) == 1)
holiday = Holiday.XMAS;
break;
case Calendar.OCTOBER:
if (calendar.get(Calendar.WEEK_OF_MONTH) >= 2)
holiday = Holiday.HWEEN;
break;
case Calendar.NOVEMBER:
if (calendar.get(Calendar.DAY_OF_MONTH) == 1)
holiday = Holiday.HWEEN;
break;
case Calendar.DECEMBER:
if (calendar.get(Calendar.WEEK_OF_MONTH) >= 3)
holiday = Holiday.XMAS; holiday = Holiday.XMAS;
}
break; break;
} }
} }
@ -67,7 +75,11 @@ public class Pasty extends Food {
case NONE: case NONE:
name = Messages.get(this, "pasty"); name = Messages.get(this, "pasty");
image = ItemSpriteSheet.PASTY; image = ItemSpriteSheet.PASTY;
break; break;
case HWEEN:
name = Messages.get(this, "pie");
image = ItemSpriteSheet.PUMPKIN_PIE;
break;
case XMAS: case XMAS:
name = Messages.get(this, "cane"); name = Messages.get(this, "cane");
image = ItemSpriteSheet.CANDY_CANE; image = ItemSpriteSheet.CANDY_CANE;
@ -88,6 +100,11 @@ public class Pasty extends Food {
switch(holiday){ switch(holiday){
case NONE: default: case NONE: default:
break; //do nothing extra break; //do nothing extra
case HWEEN:
//heals for 10% max hp
hero.HP = Math.min(hero.HP + hero.HT/10, hero.HT);
hero.sprite.emitter().burst( Speck.factory( Speck.HEALING ), 1 );
break;
case XMAS: case XMAS:
Buff.affect( hero, Recharging.class, 2f ); //half of a charge Buff.affect( hero, Recharging.class, 2f ); //half of a charge
ScrollOfRecharging.charge( hero ); ScrollOfRecharging.charge( hero );
@ -101,6 +118,8 @@ public class Pasty extends Food {
switch(holiday){ switch(holiday){
case NONE: default: case NONE: default:
return Messages.get(this, "pasty_desc"); return Messages.get(this, "pasty_desc");
case HWEEN:
return Messages.get(this, "pie_desc");
case XMAS: case XMAS:
return Messages.get(this, "cane_desc"); return Messages.get(this, "cane_desc");
} }

View File

@ -241,7 +241,8 @@ public class ItemSpriteSheet {
public static final int BLANDFRUIT = FOOD+4; public static final int BLANDFRUIT = FOOD+4;
public static final int RATION = FOOD+5; public static final int RATION = FOOD+5;
public static final int PASTY = FOOD+6; public static final int PASTY = FOOD+6;
public static final int CANDY_CANE = FOOD+7; public static final int PUMPKIN_PIE = FOOD+7;
public static final int CANDY_CANE = FOOD+8;
private static final int QUEST = xy(1, 26); //32 slots private static final int QUEST = xy(1, 26); //32 slots
public static final int SKULL = QUEST+0; public static final int SKULL = QUEST+0;

View File

@ -368,10 +368,12 @@ items.food.overpricedration.eat_msg=That food tasted ok.
items.food.overpricedration.desc=It looks exactly like a standard ration of food but smaller. items.food.overpricedration.desc=It looks exactly like a standard ration of food but smaller.
items.food.pasty.pasty=pasty items.food.pasty.pasty=pasty
items.food.pasty.pie=pumpkin pie
items.food.pasty.cane=candy cane items.food.pasty.cane=candy cane
items.food.food.pasty_desc=This is authentic Cornish pasty with traditional filling of beef and potato. items.food.pasty.pasty_desc=This is authentic Cornish pasty with traditional filling of beef and potato.
items.food.food.cane_desc=A huge sugary sweet candy cane! It's big enough to fill you up, and the sugar might give your wands a tiny bit of extra charge too.\n\nHappy Holidays! items.food.pasty.pie_desc=A great big slice of pumpkin pie! Its sweet and spicy flavor will fill you up and give you a tiny bit of healing.\n\nHappy Halloween!
items.food.pasty.cane_desc=A huge sugary sweet candy cane! It's big enough to fill you up, and the sugar might give your wands a tiny bit of extra charge too.\n\nHappy Holidays!