v1.1.0: added a snack option to horn of plenty & reduced total charges

This commit is contained in:
Evan Debenham 2021-11-14 15:23:14 -05:00
parent c1f3f5ca8f
commit 97fd800b92
2 changed files with 29 additions and 18 deletions

View File

@ -315,6 +315,7 @@ items.artifacts.etherealchains.desc_equipped=The chains rest around your side, s
items.artifacts.etherealchains$chainsrecharge.levelup=Your chains grow stronger!
items.artifacts.hornofplenty.name=horn of plenty
items.artifacts.hornofplenty.ac_snack=SNACK
items.artifacts.hornofplenty.ac_eat=EAT
items.artifacts.hornofplenty.ac_store=STORE
items.artifacts.hornofplenty.eat=You eat from the horn.
@ -325,7 +326,7 @@ items.artifacts.hornofplenty.reject=Your horn rejects the uncooked blandfruit.
items.artifacts.hornofplenty.maxlevel=Your horn has consumed all the food it can!
items.artifacts.hornofplenty.levelup=The horn consumes your food offering and grows in strength!
items.artifacts.hornofplenty.feed=The horn consumes your food offering.
items.artifacts.hornofplenty.desc=This horn can't be blown into, but instead seems to fill up with food as you adventure and gain experience.
items.artifacts.hornofplenty.desc=This horn can't be blown into, but instead seems to fill up with food as you adventure and gain experience. You can consume each charge individually as a snack, or eat until you're full.
items.artifacts.hornofplenty.desc_hint=Perhaps there is a way to increase the horn's power by giving it food energy.
items.artifacts.hornofplenty.desc_cursed=The cursed horn has bound itself to your side, it seems to be eager to take food rather than produce it.

View File

@ -57,23 +57,27 @@ public class HornOfPlenty extends Artifact {
charge = 0;
partialCharge = 0;
chargeCap = 10 + level();
chargeCap = 5 + level()/2;
defaultAction = AC_EAT;
defaultAction = AC_SNACK;
}
private int storedFoodEnergy = 0;
public static final String AC_SNACK = "SNACK";
public static final String AC_EAT = "EAT";
public static final String AC_STORE = "STORE";
@Override
public ArrayList<String> actions( Hero hero ) {
ArrayList<String> actions = super.actions( hero );
if (isEquipped( hero ) && charge > 0)
if (isEquipped( hero ) && charge > 0) {
actions.add(AC_SNACK);
actions.add(AC_EAT);
if (isEquipped( hero ) && level() < levelCap && !cursed)
}
if (isEquipped( hero ) && level() < levelCap && !cursed) {
actions.add(AC_STORE);
}
return actions;
}
@ -82,13 +86,13 @@ public class HornOfPlenty extends Artifact {
super.execute(hero, action);
if (action.equals(AC_EAT)){
if (action.equals(AC_EAT) || action.equals(AC_SNACK)){
if (!isEquipped(hero)) GLog.i( Messages.get(Artifact.class, "need_to_equip") );
else if (charge == 0) GLog.i( Messages.get(this, "no_food") );
else {
//consume as much food as it takes to be full, to a minimum of 1
int satietyPerCharge = (int) (Hunger.STARVING/10f);
int satietyPerCharge = (int) (Hunger.STARVING/5f);
if (Dungeon.isChallenged(Challenges.NO_FOOD)){
satietyPerCharge /= 3;
}
@ -96,6 +100,12 @@ public class HornOfPlenty extends Artifact {
Hunger hunger = Buff.affect(Dungeon.hero, Hunger.class);
int chargesToUse = Math.max( 1, hunger.hunger() / satietyPerCharge);
if (chargesToUse > charge) chargesToUse = charge;
//always use 1 charge if snacking
if (action.equals(AC_SNACK)){
chargesToUse = 1;
}
hunger.satisfy(satietyPerCharge * chargesToUse);
Statistics.foodEaten++;
@ -186,13 +196,13 @@ public class HornOfPlenty extends Artifact {
@Override
public void level(int value) {
super.level(value);
chargeCap = 10 + level();
chargeCap = 5 + level()/2;
}
@Override
public Item upgrade() {
super.upgrade();
chargeCap = 10 + level();
chargeCap = 5 + level()/2;
return this;
}
@ -229,9 +239,9 @@ public class HornOfPlenty extends Artifact {
super.restoreFromBundle(bundle);
storedFoodEnergy = bundle.getInt(STORED);
if (charge >= 15) image = ItemSpriteSheet.ARTIFACT_HORN4;
else if (charge >= 10) image = ItemSpriteSheet.ARTIFACT_HORN3;
else if (charge >= 5) image = ItemSpriteSheet.ARTIFACT_HORN2;
if (charge >= 8) image = ItemSpriteSheet.ARTIFACT_HORN4;
else if (charge >= 5) image = ItemSpriteSheet.ARTIFACT_HORN3;
else if (charge >= 2) image = ItemSpriteSheet.ARTIFACT_HORN2;
}
public class hornRecharge extends ArtifactBuff{
@ -248,15 +258,15 @@ public class HornOfPlenty extends Artifact {
chargeGain *= RingOfEnergy.artifactChargeMultiplier(target);
partialCharge += chargeGain;
//charge is in increments of 1/10 max hunger value.
while (partialCharge >= Hunger.STARVING/10) {
//charge is in increments of 1/5 max hunger value.
while (partialCharge >= Hunger.STARVING/5) {
charge++;
partialCharge -= Hunger.STARVING/10;
partialCharge -= Hunger.STARVING/5;
int oldImage = image;
if (charge >= 15) image = ItemSpriteSheet.ARTIFACT_HORN4;
else if (charge >= 10) image = ItemSpriteSheet.ARTIFACT_HORN3;
else if (charge >= 5) image = ItemSpriteSheet.ARTIFACT_HORN2;
if (charge >= 8) image = ItemSpriteSheet.ARTIFACT_HORN4;
else if (charge >= 5) image = ItemSpriteSheet.ARTIFACT_HORN3;
else if (charge >= 2) image = ItemSpriteSheet.ARTIFACT_HORN2;
else image = ItemSpriteSheet.ARTIFACT_HORN1;
updateQuickslot();