v2.5.0: added a new trinket: salt cube

This commit is contained in:
Evan Debenham
2024-07-16 13:53:27 -04:00
parent 3877483191
commit c84e4852ee
8 changed files with 109 additions and 5 deletions

View File

@@ -1356,6 +1356,11 @@ items.trinkets.ratskull.desc=This macabre trinket isn't much larger than the sku
items.trinkets.ratskull.typical_stats_desc=Typically this trinket will make rare exotic enemies _%dx_ as likely to appear. The skull is only half as effective at attracting crystal mimics and armored statues, however.
items.trinkets.ratskull.stats_desc=At its current level this trinket will make rare exotic enemies _%dx_ as likely to appear. The skull is only half as effective at attracting crystal mimics and armored statues, however.
items.trinkets.saltcube.name=salt cube
items.trinkets.saltcube.desc=This large salt crystal was cut into an almost perfect cube shape, and it somehow managed to drain half the water from the alchemy pot instead of dissolving. It seems to be magically dehydrating and preserving the food you eat, extending the satiety you get, but also lessening your health restoration when not starving.
items.trinkets.saltcube.typical_stats_desc=Typically this trinket will increase the amount of time before you grow hungry by _%1$s%%_, but will also reduce your rate of health regeneration by _%2$s%%_.
items.trinkets.saltcube.stats_desc=At its current level this trinket will increase the amount of time before you grow hungry by _%1$s%%_, but will also reduce your rate of health regeneration by _%2$s%%_.
items.trinkets.thirteenleafclover.name=thirteen leaf clover
items.trinkets.thirteenleafclover.desc=Somehow stewing in the alchemy pot has caused this clover to grow a bunch of extra leaves! It's not really clear if this trinket is lucky or unlucky, perhaps this trinket will make your luck more chaotic?
items.trinkets.thirteenleafclover.typical_stats_desc=Normally when the hero deals damage, numbers closer to the average are more common. Typically this trinket has a _%d%%_ chance to invert this, making your attacks much more likely to deal the maximum or minimum damage instead.\n\nThis trinket costs relatively little energy to upgrade.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

@@ -26,6 +26,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.SPDSettings;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ScrollOfChallenge;
import com.shatteredpixel.shatteredpixeldungeon.items.trinkets.SaltCube;
import com.shatteredpixel.shatteredpixeldungeon.journal.Document;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
@@ -106,8 +107,14 @@ public class Hunger extends Buff implements Hero.Doom {
level = newLevel;
}
float hungerDelay = STEP;
if (target.buff(Shadows.class) != null){
hungerDelay *= 1.5f;
}
hungerDelay /= SaltCube.hungerGainMultiplier();
spend( target.buff( Shadows.class ) == null ? STEP : STEP * 1.5f );
spend( hungerDelay );
} else {

View File

@@ -25,6 +25,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.ChaliceOfBlood;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfEnergy;
import com.shatteredpixel.shatteredpixeldungeon.items.trinkets.SaltCube;
public class Regeneration extends Buff {
@@ -40,6 +41,12 @@ public class Regeneration extends Buff {
public boolean act() {
if (target.isAlive()) {
//cancel regenning entirely in thie case
if (SaltCube.healthRegenMultiplier() == 0){
spend(REGENERATION_DELAY);
return true;
}
if (target.HP < regencap() && !((Hero)target).isStarving()) {
if (regenOn()) {
target.HP += 1;
@@ -61,6 +68,7 @@ public class Regeneration extends Buff {
delay /= RingOfEnergy.artifactChargeMultiplier(target);
}
}
delay /= SaltCube.healthRegenMultiplier();
spend( delay );
} else {

View File

@@ -25,6 +25,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Challenges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.effects.FloatingText;
import com.shatteredpixel.shatteredpixeldungeon.items.trinkets.SaltCube;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
@@ -56,8 +57,9 @@ public class WellFed extends Buff {
((Hero) target).resting = false;
}
}
spend(TICK);
//salt cube does slow this buff down, but doesn't lessen the bonus health
spend(TICK / SaltCube.hungerGainMultiplier());
return true;
}

View File

@@ -115,6 +115,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.trinkets.MossyClump;
import com.shatteredpixel.shatteredpixeldungeon.items.trinkets.ParchmentScrap;
import com.shatteredpixel.shatteredpixeldungeon.items.trinkets.PetrifiedSeed;
import com.shatteredpixel.shatteredpixeldungeon.items.trinkets.RatSkull;
import com.shatteredpixel.shatteredpixeldungeon.items.trinkets.SaltCube;
import com.shatteredpixel.shatteredpixeldungeon.items.trinkets.ThirteenLeafClover;
import com.shatteredpixel.shatteredpixeldungeon.items.trinkets.TrapMechanism;
import com.shatteredpixel.shatteredpixeldungeon.items.trinkets.Trinket;
@@ -574,9 +575,10 @@ public class Generator {
TrapMechanism.class,
MimicTooth.class,
WondrousResin.class,
EyeOfNewt.class
EyeOfNewt.class,
SaltCube.class
};
TRINKET.defaultProbs = new float[]{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
TRINKET.defaultProbs = new float[]{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
TRINKET.probs = TRINKET.defaultProbs.clone();
for (Category cat : Category.values()){

View File

@@ -0,0 +1,78 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2024 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.trinkets;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class SaltCube extends Trinket {
{
image = ItemSpriteSheet.SALT_CUBE;
}
@Override
protected int upgradeEnergyCost() {
//5 -> 8(13) -> 10(23) -> 12(35)
return 6+2*level();
}
@Override
public String statsDesc() {
if (isIdentified()){
return Messages.get(this,
"stats_desc",
Messages.decimalFormat("#.##", 100*(1f-hungerGainMultiplier(buffedLvl()))),
Messages.decimalFormat("#.##", 100*(1f-healthRegenMultiplier(buffedLvl()))));
} else {
return Messages.get(this,
"typical_stats_desc",
Messages.decimalFormat("#.##", 100*(1f-hungerGainMultiplier(buffedLvl()))),
Messages.decimalFormat("#.##", 100*(1f-healthRegenMultiplier(buffedLvl()))));
}
}
public static float hungerGainMultiplier(){
return hungerGainMultiplier(trinketLevel(SaltCube.class));
}
public static float hungerGainMultiplier( int level ){
if (level == -1){
return 1;
} else {
return 1f - 0.125f*(level+1);
}
}
public static float healthRegenMultiplier(){
return healthRegenMultiplier(trinketLevel(SaltCube.class));
}
public static float healthRegenMultiplier( int level ){
if (level == -1){
return 1;
} else {
return 1f - 0.25f*(level+1);
}
}
}

View File

@@ -487,6 +487,7 @@ public class ItemSpriteSheet {
public static final int MIMIC_TOOTH = TRINKETS+8;
public static final int WONDROUS_RESIN = TRINKETS+9;
public static final int EYE_OF_NEWT = TRINKETS+10;
public static final int SALT_CUBE = TRINKETS+11;
static{
assignItemRect(RAT_SKULL, 16, 11);
assignItemRect(PARCHMENT_SCRAP, 10, 14);
@@ -499,6 +500,7 @@ public class ItemSpriteSheet {
assignItemRect(MIMIC_TOOTH, 8, 15);
assignItemRect(WONDROUS_RESIN, 12, 11);
assignItemRect(EYE_OF_NEWT, 12, 12);
assignItemRect(SALT_CUBE, 12, 13);
}
private static final int SCROLLS = xy(1, 19); //16 slots