diff --git a/core/src/main/assets/messages/items/items.properties b/core/src/main/assets/messages/items/items.properties index f992ae6d6..68d2496ca 100644 --- a/core/src/main/assets/messages/items/items.properties +++ b/core/src/main/assets/messages/items/items.properties @@ -574,12 +574,21 @@ items.food.mysterymeat$placeholder.name=meat items.food.phantommeat.name=phantom meat items.food.phantommeat.desc=A large glistening translucent steak, cut from a phantom piranha. This magical meat doesn't need to be cooked and grants a number of defensive benefits in addition to fully satiating you. When eaten it will grant invisibility, barkskin, some healing, and cures many harmful effects. -items.food.pasty.pasty=pasty -items.food.pasty.pie=pumpkin pie -items.food.pasty.cane=candy cane -items.food.pasty.pasty_desc=An authentic Cornish pasty with a traditional filling of beef and potato. Delicious! -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! +items.food.pasty.name=pasty +items.food.pasty.fish_name=steamed fish +items.food.pasty.amulet_name=amulet of yendor? +items.food.pasty.egg_name=easter egg +items.food.pasty.pie_name=pumpkin pie +items.food.pasty.cane_name=candy cane +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.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 foil. There's easily enough chocolate here to fill you up, and the suger might give your artifacts a tiny bit of extra charge.\n\nHappy Easter! +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! +items.food.pasty$fishleftover.name=fish leftovers +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.smallration.name=small food ration items.food.smallration.eat_msg=That food tasted ok. diff --git a/core/src/main/assets/sprites/items.png b/core/src/main/assets/sprites/items.png index 2a763756f..191a36512 100644 Binary files a/core/src/main/assets/sprites/items.png and b/core/src/main/assets/sprites/items.png differ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/ArtifactRecharge.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/ArtifactRecharge.java index 2265e3cae..7b01c3402 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/ArtifactRecharge.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/ArtifactRecharge.java @@ -124,4 +124,12 @@ public class ArtifactRecharge extends Buff { left = bundle.getFloat(LEFT); ignoreHornOfPlenty = bundle.getBoolean(IGNORE_HORN); } + + public static void chargeArtifacts( Hero hero, float turns ){ + for (Buff b : hero.buffs()){ + if (b instanceof Artifact.ArtifactBuff && !((Artifact.ArtifactBuff) b).isCursed()){ + if (!((Artifact.ArtifactBuff) b).isCursed()) ((Artifact.ArtifactBuff) b).charge(hero, turns); + } + } + } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/food/Pasty.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/food/Pasty.java index 5589bd4f3..092aea4bb 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/food/Pasty.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/food/Pasty.java @@ -21,15 +21,17 @@ package com.shatteredpixel.shatteredpixeldungeon.items.food; -import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; +import com.shatteredpixel.shatteredpixeldungeon.Assets; +import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.ArtifactRecharge; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger; -import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Recharging; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.utils.Holiday; +import com.watabou.noosa.audio.Sample; public class Pasty extends Food { @@ -48,6 +50,15 @@ public class Pasty extends Food { case NONE: image = ItemSpriteSheet.PASTY; break; + case LUNAR_NEW_YEAR: + image = ItemSpriteSheet.STEAMED_FISH; + break; + case APRIL_FOOLS: + image = ItemSpriteSheet.CHOC_AMULET; + break; + case EASTER: + image = ItemSpriteSheet.EASTER_EGG; + break; case HALLOWEEN: image = ItemSpriteSheet.PUMPKIN_PIE; break; @@ -59,18 +70,37 @@ public class Pasty extends Food { @Override protected void satisfy(Hero hero) { + if (Holiday.getCurrentHoliday() == Holiday.LUNAR_NEW_YEAR){ + //main item only clears 300 hunger on lunar new year... + energy = Hunger.HUNGRY; + } + super.satisfy(hero); switch(Holiday.getCurrentHoliday()){ default: break; //do nothing extra + case LUNAR_NEW_YEAR: + //...but it also awards an extra item that restores 150 hunger + FishLeftover left = new FishLeftover(); + if (!left.collect()){ + Dungeon.level.drop(left, hero.pos).sprite.drop(); + } + break; + case APRIL_FOOLS: + Sample.INSTANCE.play(Assets.Sounds.MIMIC); + case EASTER: + ArtifactRecharge.chargeArtifacts(hero, 2f); + ScrollOfRecharging.charge( hero ); + break; case HALLOWEEN: - //heals for 10% max hp - hero.HP = Math.min(hero.HP + hero.HT/10, hero.HT); + //heals for 5% max hp, min of 3 + int toHeal = Math.max(3, hero.HT/20); + hero.HP = Math.min(hero.HP + toHeal, hero.HT); hero.sprite.emitter().burst( Speck.factory( Speck.HEALING ), 1 ); break; case WINTER_HOLIDAYS: - Buff.affect( hero, Recharging.class, 2f ); //half of a charge + hero.belongings.charge(0.5f); //2 turns worth ScrollOfRecharging.charge( hero ); break; } @@ -80,11 +110,17 @@ public class Pasty extends Food { public String name() { switch(Holiday.getCurrentHoliday()){ case NONE: default: - return Messages.get(this, "pasty"); + return super.name(); + case LUNAR_NEW_YEAR: + return Messages.get(this, "fish_name"); + case APRIL_FOOLS: + return Messages.get(this, "amulet_name"); + case EASTER: + return Messages.get(this, "egg_name"); case HALLOWEEN: - return Messages.get(this, "pie"); + return Messages.get(this, "pie_name"); case WINTER_HOLIDAYS: - return Messages.get(this, "cane"); + return Messages.get(this, "cane_name"); } } @@ -92,7 +128,13 @@ public class Pasty extends Food { public String info() { switch(Holiday.getCurrentHoliday()){ case NONE: default: - return Messages.get(this, "pasty_desc"); + return super.info(); + case LUNAR_NEW_YEAR: + return Messages.get(this, "fish_desc"); + case APRIL_FOOLS: + return Messages.get(this, "amulet_desc"); + case EASTER: + return Messages.get(this, "egg_desc"); case HALLOWEEN: return Messages.get(this, "pie_desc"); case WINTER_HOLIDAYS: @@ -104,4 +146,17 @@ public class Pasty extends Food { public int value() { return 20 * quantity; } + + public static class FishLeftover extends Food { + + { + image = ItemSpriteSheet.FISH_LEFTOVER; + energy = Hunger.HUNGRY/2; + } + + @Override + public int value() { + return 10 * quantity; + } + } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/remains/CloakScrap.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/remains/CloakScrap.java index 364d40875..1229b5c0f 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/remains/CloakScrap.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/remains/CloakScrap.java @@ -22,9 +22,8 @@ package com.shatteredpixel.shatteredpixeldungeon.items.remains; import com.shatteredpixel.shatteredpixeldungeon.Assets; -import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.ArtifactRecharge; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; -import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.Artifact; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.watabou.noosa.audio.Sample; @@ -37,11 +36,7 @@ public class CloakScrap extends RemainsItem { @Override protected void doEffect(Hero hero) { - for (Buff b : hero.buffs()){ - if (b instanceof Artifact.ArtifactBuff){ - if (!((Artifact.ArtifactBuff) b).isCursed()) ((Artifact.ArtifactBuff) b).charge(hero, 4); - } - } + ArtifactRecharge.chargeArtifacts(hero, 4f); ScrollOfRecharging.charge(hero); Sample.INSTANCE.play( Assets.Sounds.CHARGEUP ); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/WildEnergy.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/WildEnergy.java index 6b56b87f0..ecc489017 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/WildEnergy.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/WildEnergy.java @@ -27,7 +27,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Recharging; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.effects.SpellSprite; -import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.Artifact; import com.shatteredpixel.shatteredpixeldungeon.items.quest.MetalShard; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ScrollOfMysticalEnergy; @@ -58,11 +57,7 @@ public class WildEnergy extends TargetedSpell { SpellSprite.show(hero, SpellSprite.CHARGE); hero.belongings.charge(1f); - for (Buff b : hero.buffs()){ - if (b instanceof Artifact.ArtifactBuff){ - if (!((Artifact.ArtifactBuff) b).isCursed()) ((Artifact.ArtifactBuff) b).charge(hero, 4); - } - } + ArtifactRecharge.chargeArtifacts(hero, 4f); Buff.affect(hero, Recharging.class, 8f); Buff.affect(hero, ArtifactRecharge.class).prolong( 8 ).ignoreHornOfPlenty = false; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MagesStaff.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MagesStaff.java index 8a0234e25..fd042ccb2 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MagesStaff.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MagesStaff.java @@ -25,6 +25,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Badges; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.ArtifactRecharge; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass; @@ -33,7 +34,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ElmoParticle; import com.shatteredpixel.shatteredpixeldungeon.items.ArcaneResin; import com.shatteredpixel.shatteredpixeldungeon.items.Item; -import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.Artifact; import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag; import com.shatteredpixel.shatteredpixeldungeon.items.bags.MagicalHolster; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging; @@ -168,11 +168,7 @@ public class MagesStaff extends MeleeWeapon { public int proc(Char attacker, Char defender, int damage) { if (attacker instanceof Hero && ((Hero) attacker).hasTalent(Talent.MYSTICAL_CHARGE)){ Hero hero = (Hero) attacker; - for (Buff b : hero.buffs()){ - if (b instanceof Artifact.ArtifactBuff && !((Artifact.ArtifactBuff) b).isCursed() ) { - ((Artifact.ArtifactBuff) b).charge(hero, hero.pointsInTalent(Talent.MYSTICAL_CHARGE)/2f); - } - } + ArtifactRecharge.chargeArtifacts(hero, hero.pointsInTalent(Talent.MYSTICAL_CHARGE)/2f); } Talent.EmpoweredStrikeTracker empoweredStrike = attacker.buff(Talent.EmpoweredStrikeTracker.class); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java index e1ea96d0c..e61ad4e7d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java @@ -651,13 +651,11 @@ public class ItemSpriteSheet { public static final int CARPACCIO = FOOD+4; public static final int RATION = FOOD+5; public static final int PASTY = FOOD+6; - public static final int PUMPKIN_PIE = FOOD+7; - public static final int CANDY_CANE = FOOD+8; - public static final int MEAT_PIE = FOOD+9; - public static final int BLANDFRUIT = FOOD+10; - public static final int BLAND_CHUNKS= FOOD+11; - public static final int BERRY = FOOD+12; - public static final int PHANTOM_MEAT= FOOD+13; + public static final int MEAT_PIE = FOOD+7; + public static final int BLANDFRUIT = FOOD+8; + public static final int BLAND_CHUNKS= FOOD+9; + public static final int BERRY = FOOD+10; + public static final int PHANTOM_MEAT= FOOD+11; static{ assignItemRect(MEAT, 15, 11); assignItemRect(STEAK, 15, 11); @@ -666,8 +664,6 @@ public class ItemSpriteSheet { assignItemRect(CARPACCIO, 15, 11); assignItemRect(RATION, 16, 12); assignItemRect(PASTY, 16, 11); - assignItemRect(PUMPKIN_PIE, 16, 12); - assignItemRect(CANDY_CANE, 13, 16); assignItemRect(MEAT_PIE, 16, 12); assignItemRect(BLANDFRUIT, 9, 12); assignItemRect(BLAND_CHUNKS,14, 6); @@ -675,7 +671,31 @@ public class ItemSpriteSheet { assignItemRect(PHANTOM_MEAT,15, 11); } - private static final int QUEST = xy(1, 29); //32 slots + private static final int HOLIDAY_FOOD = xy(1, 29); //16 slots + public static final int STEAMED_FISH = HOLIDAY_FOOD+0; + public static final int FISH_LEFTOVER = HOLIDAY_FOOD+1; + public static final int CHOC_AMULET = HOLIDAY_FOOD+2; + public static final int EASTER_EGG = HOLIDAY_FOOD+3; + public static final int RAINBOW_POTION = HOLIDAY_FOOD+4; + public static final int SHATTERED_CAKE = HOLIDAY_FOOD+5; + public static final int PUMPKIN_PIE = HOLIDAY_FOOD+6; + public static final int VANILLA_CAKE = HOLIDAY_FOOD+7; + public static final int CANDY_CANE = HOLIDAY_FOOD+8; + public static final int SPARKLING_POTION= HOLIDAY_FOOD+9; + static{ + assignItemRect(STEAMED_FISH, 15, 11); + assignItemRect(FISH_LEFTOVER, 15, 11); + assignItemRect(CHOC_AMULET, 16, 16); + assignItemRect(EASTER_EGG, 15, 11); + assignItemRect(RAINBOW_POTION, 12, 14); + assignItemRect(SHATTERED_CAKE, 15, 11); + assignItemRect(PUMPKIN_PIE, 16, 12); + assignItemRect(VANILLA_CAKE, 15, 11); + assignItemRect(CANDY_CANE, 13, 16); + assignItemRect(SPARKLING_POTION,12, 14); + } + + private static final int QUEST = xy(1, 30); //16 slots public static final int SKULL = QUEST+0; public static final int DUST = QUEST+1; public static final int CANDLE = QUEST+2;