v2.4.0: added holiday pastys for pride, birthdays, and new years

This commit is contained in:
Evan Debenham
2024-02-01 13:26:57 -05:00
parent 425c90135d
commit 5b58aec93f
6 changed files with 102 additions and 33 deletions

View File

@@ -578,14 +578,22 @@ items.food.pasty.name=pasty
items.food.pasty.fish_name=steamed fish items.food.pasty.fish_name=steamed fish
items.food.pasty.amulet_name=amulet of yendor? items.food.pasty.amulet_name=amulet of yendor?
items.food.pasty.egg_name=easter egg items.food.pasty.egg_name=easter egg
items.food.pasty.rainbow_name=rainbow potion
items.food.pasty.shattered_name=green cake
items.food.pasty.pie_name=pumpkin pie items.food.pasty.pie_name=pumpkin pie
items.food.pasty.vanilla_name=blue cake
items.food.pasty.cane_name=candy cane items.food.pasty.cane_name=candy cane
items.food.pasty.sparkling_name=sparkling potion
items.food.pasty.desc=An authentic Cornish pasty with a traditional filling of beef and potato. Delicious! items.food.pasty.desc=An authentic Cornish pasty with a traditional filling of beef and potato. Delicious!
items.food.pasty.fish_desc=A whole steamed fish, magically preserved on a bed of greens. It's tradition to save some fish for later around this time of year, so you'll keep some leftovers instead of eating it all at once.\n\nHappy Lunar New Year! items.food.pasty.fish_desc=A whole steamed fish, magically preserved on a bed of greens. It's tradition to save some fish for later around this time of year, so you'll keep some leftovers instead of eating it all at once.\n\nHappy Lunar New Year!
items.food.pasty.amulet_desc=You've finally found it, the magical amulet of - wait a minute, this is just a foil-wrapped chocolate made to look like the amulet! It won't grant you limitless power, but at least it'll fill you up and give you a little artifact charge.\n\nApril Fools! items.food.pasty.amulet_desc=You've finally found it, the magical amulet of - wait a minute, this is just a foil-wrapped chocolate made to look like the amulet! It won't grant you limitless power, but at least it'll fill you up and give you a little artifact charge.\n\nApril Fools!
items.food.pasty.egg_desc=A great big chocolate egg, wrapped in colorful yellow foil. There's easily enough chocolate here to fill you up, and the sugar might give your artifacts a tiny bit of extra charge.\n\nHappy Easter! items.food.pasty.egg_desc=A great big chocolate egg, wrapped in colorful yellow foil. There's easily enough chocolate here to fill you up, and the sugar might give your artifacts a tiny bit of extra charge.\n\nHappy Easter!
items.food.pasty.rainbow_desc=This colorful potion is a kind of liquid food. In addition to satisfying your hunger, it has a little magic in it which will calm an adjacent non-boss enemy, making them temporarily hesitant to fight you.\n\nHappy Pride!
items.food.pasty.shattered_desc=This large slice of vanilla cake has colorful sprinkles and green frosting. The cake was made to celebrate years of experience, and will grant a small amount of that experience to you when eaten.\n\nShattered Pixel Dungeon was first released on August 5th 2014. Happy birthday Shattered Pixel Dungeon!
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.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.vanilla_desc=This large slice of vanilla cake has colorful sprinkles and blue frosting. The cake was made to celebrate years of experience, and will grant a small amount of that experience to you when eaten.\n\nThe original Pixel Dungeon was first released on December 4th 2012. Happy birthday Pixel Dungeon!
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! 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!
items.food.pasty.sparkling_desc=This sparkling potion is a kind of liquid food. It satisfies hunger and simulates sparkling wine, but isn't actually alcoholic. The warm feeling in your belly will grant a little bit of shielding.\n\nHappy New Year!
items.food.pasty$fishleftover.name=fish leftovers items.food.pasty$fishleftover.name=fish leftovers
items.food.pasty$fishleftover.eat_msg=That food tasted ok. items.food.pasty$fishleftover.eat_msg=That food tasted ok.
items.food.pasty$fishleftover.desc=Some surplus fish from your previous meal. You can eat it any time you like to restore a little hunger. items.food.pasty$fishleftover.desc=Some surplus fish from your previous meal. You can eat it any time you like to restore a little hunger.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -80,7 +80,7 @@ public class Food extends Item {
hero.sprite.operate( hero.pos ); hero.sprite.operate( hero.pos );
hero.busy(); hero.busy();
SpellSprite.show( hero, SpellSprite.FOOD ); SpellSprite.show( hero, SpellSprite.FOOD );
Sample.INSTANCE.play( Assets.Sounds.EAT ); eatSFX();
hero.spend( eatingTime() ); hero.spend( eatingTime() );
@@ -92,6 +92,10 @@ public class Food extends Item {
} }
} }
protected void eatSFX(){
Sample.INSTANCE.play( Assets.Sounds.EAT );
}
protected float eatingTime(){ protected float eatingTime(){
if (Dungeon.hero.hasTalent(Talent.IRON_STOMACH) if (Dungeon.hero.hasTalent(Talent.IRON_STOMACH)
|| Dungeon.hero.hasTalent(Talent.ENERGIZING_MEAL) || Dungeon.hero.hasTalent(Talent.ENERGIZING_MEAL)

View File

@@ -23,14 +23,22 @@ package com.shatteredpixel.shatteredpixeldungeon.items.food;
import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.ArtifactRecharge; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.ArtifactRecharge;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Barrier;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Charm;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.effects.FloatingText; import com.shatteredpixel.shatteredpixeldungeon.effects.FloatingText;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.RainbowParticle;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfExperience;
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.CharSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.ui.TargetHealthIndicator;
import com.shatteredpixel.shatteredpixeldungeon.utils.Holiday; import com.shatteredpixel.shatteredpixeldungeon.utils.Holiday;
import com.watabou.noosa.audio.Sample; import com.watabou.noosa.audio.Sample;
@@ -60,15 +68,38 @@ public class Pasty extends Food {
case EASTER: case EASTER:
image = ItemSpriteSheet.EASTER_EGG; image = ItemSpriteSheet.EASTER_EGG;
break; break;
case PRIDE:
image = ItemSpriteSheet.RAINBOW_POTION;
break;
case SHATTEREDPD_BIRTHDAY:
image = ItemSpriteSheet.SHATTERED_CAKE;
break;
case HALLOWEEN: case HALLOWEEN:
image = ItemSpriteSheet.PUMPKIN_PIE; image = ItemSpriteSheet.PUMPKIN_PIE;
break; break;
case PD_BIRTHDAY:
image = ItemSpriteSheet.VANILLA_CAKE;
break;
case WINTER_HOLIDAYS: case WINTER_HOLIDAYS:
image = ItemSpriteSheet.CANDY_CANE; image = ItemSpriteSheet.CANDY_CANE;
break; break;
case NEW_YEARS:
image = ItemSpriteSheet.SPARKLING_POTION;
break;
} }
} }
@Override
protected void eatSFX() {
switch(Holiday.getCurrentHoliday()){
case PRIDE:
case NEW_YEARS:
Sample.INSTANCE.play( Assets.Sounds.DRINK );
return;
}
super.eatSFX();
}
@Override @Override
protected void satisfy(Hero hero) { protected void satisfy(Hero hero) {
if (Holiday.getCurrentHoliday() == Holiday.LUNAR_NEW_YEAR){ if (Holiday.getCurrentHoliday() == Holiday.LUNAR_NEW_YEAR){
@@ -94,6 +125,33 @@ public class Pasty extends Food {
ArtifactRecharge.chargeArtifacts(hero, 2f); ArtifactRecharge.chargeArtifacts(hero, 2f);
ScrollOfRecharging.charge( hero ); ScrollOfRecharging.charge( hero );
break; break;
case PRIDE:
Char target = null;
//charms an adjacent non-boss enemy, prioritizing the one the hero is focusing on
for (Char ch : Actor.chars()){
if (!Char.hasProp(ch, Char.Property.BOSS)
&& !Char.hasProp(ch, Char.Property.MINIBOSS)
&& ch.alignment == Char.Alignment.ENEMY
&& Dungeon.level.adjacent(hero.pos, ch.pos)){
if (target == null || ch == TargetHealthIndicator.instance.target()){
target = ch;
}
}
}
if (target != null){
Buff.affect(target, Charm.class, 5f).object = hero.id();
}
hero.sprite.emitter().burst(RainbowParticle.BURST, 15);
break;
case SHATTEREDPD_BIRTHDAY:
case PD_BIRTHDAY:
//gives 10% of level in exp, min of 2
int expToGive = Math.max(2, hero.maxExp()/10);
hero.sprite.showStatusWithIcon(CharSprite.POSITIVE, Integer.toString(expToGive), FloatingText.EXPERIENCE);
hero.earnExp(expToGive, PotionOfExperience.class);
break;
case HALLOWEEN: case HALLOWEEN:
//heals for 5% max hp, min of 3 //heals for 5% max hp, min of 3
int toHeal = Math.max(3, hero.HT/20); int toHeal = Math.max(3, hero.HT/20);
@@ -104,6 +162,12 @@ public class Pasty extends Food {
hero.belongings.charge(0.5f); //2 turns worth hero.belongings.charge(0.5f); //2 turns worth
ScrollOfRecharging.charge( hero ); ScrollOfRecharging.charge( hero );
break; break;
case NEW_YEARS:
//shields for 10% of max hp, min of 5
int toShield = Math.max(5, hero.HT/10);
Buff.affect(hero, Barrier.class).setShield(toShield);
hero.sprite.showStatusWithIcon( CharSprite.POSITIVE, Integer.toString(toShield), FloatingText.SHIELDING );
break;
} }
} }
@@ -118,10 +182,18 @@ public class Pasty extends Food {
return Messages.get(this, "amulet_name"); return Messages.get(this, "amulet_name");
case EASTER: case EASTER:
return Messages.get(this, "egg_name"); return Messages.get(this, "egg_name");
case PRIDE:
return Messages.get(this, "rainbow_name");
case SHATTEREDPD_BIRTHDAY:
return Messages.get(this, "shattered_name");
case HALLOWEEN: case HALLOWEEN:
return Messages.get(this, "pie_name"); return Messages.get(this, "pie_name");
case PD_BIRTHDAY:
return Messages.get(this, "vanilla_name");
case WINTER_HOLIDAYS: case WINTER_HOLIDAYS:
return Messages.get(this, "cane_name"); return Messages.get(this, "cane_name");
case NEW_YEARS:
return Messages.get(this, "sparkling_name");
} }
} }
@@ -136,10 +208,18 @@ public class Pasty extends Food {
return Messages.get(this, "amulet_desc"); return Messages.get(this, "amulet_desc");
case EASTER: case EASTER:
return Messages.get(this, "egg_desc"); return Messages.get(this, "egg_desc");
case PRIDE:
return Messages.get(this, "rainbow_desc");
case SHATTEREDPD_BIRTHDAY:
return Messages.get(this, "shattered_desc");
case HALLOWEEN: case HALLOWEEN:
return Messages.get(this, "pie_desc"); return Messages.get(this, "pie_desc");
case PD_BIRTHDAY:
return Messages.get(this, "vanilla_desc");
case WINTER_HOLIDAYS: case WINTER_HOLIDAYS:
return Messages.get(this, "cane_desc"); return Messages.get(this, "cane_desc");
case NEW_YEARS:
return Messages.get(this, "sparkling_desc");
} }
} }

View File

@@ -687,11 +687,11 @@ public class ItemSpriteSheet {
assignItemRect(CHOC_AMULET, 16, 16); assignItemRect(CHOC_AMULET, 16, 16);
assignItemRect(EASTER_EGG, 12, 14); assignItemRect(EASTER_EGG, 12, 14);
assignItemRect(RAINBOW_POTION, 12, 14); assignItemRect(RAINBOW_POTION, 12, 14);
assignItemRect(SHATTERED_CAKE, 15, 11); assignItemRect(SHATTERED_CAKE, 14, 13);
assignItemRect(PUMPKIN_PIE, 16, 12); assignItemRect(PUMPKIN_PIE, 16, 12);
assignItemRect(VANILLA_CAKE, 15, 11); assignItemRect(VANILLA_CAKE, 14, 13);
assignItemRect(CANDY_CANE, 13, 16); assignItemRect(CANDY_CANE, 13, 16);
assignItemRect(SPARKLING_POTION,12, 14); assignItemRect(SPARKLING_POTION, 7, 16);
} }
private static final int QUEST = xy(1, 30); //16 slots private static final int QUEST = xy(1, 30); //16 slots

View File

@@ -28,7 +28,6 @@ public enum Holiday {
NONE, NONE,
//TODO many of these don't actually do anything atm
LUNAR_NEW_YEAR, //Varies, sometime in late Jan to Late Feb (7 days) LUNAR_NEW_YEAR, //Varies, sometime in late Jan to Late Feb (7 days)
APRIL_FOOLS, //April 1st, can override easter (1 day) APRIL_FOOLS, //April 1st, can override easter (1 day)
EASTER, //Varies, sometime in Late Mar to Late Apr (6-7 days) EASTER, //Varies, sometime in Late Mar to Late Apr (6-7 days)
@@ -62,32 +61,6 @@ public enum Holiday {
//requires a gregorian calendar //requires a gregorian calendar
public static Holiday getHolidayForDate(GregorianCalendar cal){ public static Holiday getHolidayForDate(GregorianCalendar cal){
//legacy holiday logic from late 2016 to early 2024
//only halloween and winter holidays, and they had longer dates determined by week of month
//TODO maybe remove this after early 2024 passes?
// Do we really care about historical accuracy for folks who turn their system date back?
if (cal.get(Calendar.YEAR) < 2024
|| (cal.get(Calendar.YEAR) == 2024 && cal.get(Calendar.DAY_OF_YEAR) <= 10)){
switch(cal.get(Calendar.MONTH)){
case Calendar.JANUARY:
if (cal.get(Calendar.WEEK_OF_MONTH) == 1)
return WINTER_HOLIDAYS;
break;
case Calendar.OCTOBER:
if (cal.get(Calendar.WEEK_OF_MONTH) >= 2)
return HALLOWEEN;
break;
case Calendar.NOVEMBER:
if (cal.get(Calendar.DAY_OF_MONTH) == 1)
return HALLOWEEN;
break;
case Calendar.DECEMBER:
if (cal.get(Calendar.WEEK_OF_MONTH) >= 3)
return WINTER_HOLIDAYS;
break;
}
}
//Lunar New Year //Lunar New Year
if (isLunarNewYear(cal.get(Calendar.YEAR), if (isLunarNewYear(cal.get(Calendar.YEAR),
cal.get(Calendar.DAY_OF_YEAR))){ cal.get(Calendar.DAY_OF_YEAR))){
@@ -151,8 +124,12 @@ public enum Holiday {
public static boolean isLunarNewYear(int year, int dayOfYear){ public static boolean isLunarNewYear(int year, int dayOfYear){
int lunarNewYearDayOfYear; int lunarNewYearDayOfYear;
switch (year){ switch (year){
//yes, I really did hardcode this all the way to 2100 //yes, I really did hardcode this all the way from 2020 to 2100
default: lunarNewYearDayOfYear = 31+5; break; //defaults to February 5th default: lunarNewYearDayOfYear = 31+5; break; //defaults to February 5th
case 2020: lunarNewYearDayOfYear = 25; break; //January 25th
case 2021: lunarNewYearDayOfYear = 31+12; break; //February 12th
case 2022: lunarNewYearDayOfYear = 31+1; break; //February 1st
case 2023: lunarNewYearDayOfYear = 22; break; //January 22nd
case 2024: lunarNewYearDayOfYear = 31+10; break; //February 10th case 2024: lunarNewYearDayOfYear = 31+10; break; //February 10th
case 2025: lunarNewYearDayOfYear = 29; break; //January 29th case 2025: lunarNewYearDayOfYear = 29; break; //January 29th
case 2026: lunarNewYearDayOfYear = 31+17; break; //February 17th case 2026: lunarNewYearDayOfYear = 31+17; break; //February 17th