v0.6.1: changes to the horn of plenty:
- now has 10 levels internally instead of 30 - gains levels more consistently based on food value - charge speed slightly nerfed
This commit is contained in:
parent
a68dc6dbc2
commit
e21e378b94
|
@ -52,16 +52,16 @@ public class HornOfPlenty extends Artifact {
|
|||
{
|
||||
image = ItemSpriteSheet.ARTIFACT_HORN1;
|
||||
|
||||
levelCap = 30;
|
||||
levelCap = 10;
|
||||
|
||||
charge = 0;
|
||||
partialCharge = 0;
|
||||
chargeCap = 10 + visiblyUpgraded();
|
||||
chargeCap = 10 + level();
|
||||
|
||||
defaultAction = AC_EAT;
|
||||
}
|
||||
|
||||
private static final float TIME_TO_EAT = 3f;
|
||||
|
||||
private int storedFoodEnergy = 0;
|
||||
|
||||
public static final String AC_EAT = "EAT";
|
||||
public static final String AC_STORE = "STORE";
|
||||
|
@ -73,7 +73,7 @@ public class HornOfPlenty extends Artifact {
|
|||
ArrayList<String> actions = super.actions( hero );
|
||||
if (isEquipped( hero ) && charge > 0)
|
||||
actions.add(AC_EAT);
|
||||
if (isEquipped( hero ) && level() < 30 && !cursed)
|
||||
if (isEquipped( hero ) && level() < levelCap && !cursed)
|
||||
actions.add(AC_STORE);
|
||||
return actions;
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ public class HornOfPlenty extends Artifact {
|
|||
Sample.INSTANCE.play(Assets.SND_EAT);
|
||||
GLog.i( Messages.get(this, "eat") );
|
||||
|
||||
hero.spend(TIME_TO_EAT);
|
||||
hero.spend(Food.TIME_TO_EAT);
|
||||
|
||||
Badges.validateFoodEaten();
|
||||
|
||||
|
@ -163,19 +163,58 @@ public class HornOfPlenty extends Artifact {
|
|||
@Override
|
||||
public void level(int value) {
|
||||
super.level(value);
|
||||
chargeCap = 10 + visiblyUpgraded();
|
||||
chargeCap = 10 + level();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item upgrade() {
|
||||
super.upgrade();
|
||||
chargeCap = 10 + visiblyUpgraded();
|
||||
chargeCap = 10 + level();
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public void gainFoodValue( Food food ){
|
||||
if (level() >= 10) return;
|
||||
|
||||
storedFoodEnergy += food.energy;
|
||||
if (storedFoodEnergy >= Hunger.HUNGRY){
|
||||
int upgrades = storedFoodEnergy / (int)Hunger.HUNGRY;
|
||||
upgrades = Math.min(upgrades, 10 - level());
|
||||
upgrade(upgrades);
|
||||
storedFoodEnergy -= upgrades * Hunger.HUNGRY;
|
||||
if (level() == 10){
|
||||
storedFoodEnergy = 0;
|
||||
GLog.p( Messages.get(this, "maxlevel") );
|
||||
} else {
|
||||
GLog.p( Messages.get(this, "levelup") );
|
||||
}
|
||||
} else {
|
||||
GLog.i( Messages.get(this, "feed") );
|
||||
}
|
||||
}
|
||||
|
||||
private static final String STORED = "stored";
|
||||
|
||||
@Override
|
||||
public void storeInBundle(Bundle bundle) {
|
||||
super.storeInBundle(bundle);
|
||||
bundle.put( STORED, storedFoodEnergy );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreFromBundle(Bundle bundle) {
|
||||
super.restoreFromBundle(bundle);
|
||||
|
||||
if (bundle.contains(STORED)){
|
||||
storedFoodEnergy = bundle.getInt(STORED);
|
||||
|
||||
//logic for pre-0.6.1 saves
|
||||
} else {
|
||||
//keep partial levels
|
||||
storedFoodEnergy = (int)(level()%3 * Hunger.HUNGRY/3);
|
||||
level(level()/3);
|
||||
}
|
||||
|
||||
if (charge >= 15) image = ItemSpriteSheet.ARTIFACT_HORN4;
|
||||
else if (charge >= 10) image = ItemSpriteSheet.ARTIFACT_HORN3;
|
||||
else if (charge >= 5) image = ItemSpriteSheet.ARTIFACT_HORN2;
|
||||
|
@ -186,10 +225,10 @@ public class HornOfPlenty extends Artifact {
|
|||
public void gainCharge(float levelPortion) {
|
||||
if (charge < chargeCap) {
|
||||
|
||||
//generates 0.25x max hunger value every hero level, +0.035x max value per horn level
|
||||
//to a max of 1.3x max hunger value per hero level
|
||||
//This means that a standard ration will be recovered in ~7.15 hero levels
|
||||
partialCharge += Hunger.STARVING * levelPortion * (0.25f + (0.035f*level()));
|
||||
//generates 0.2x max hunger value every hero level, +0.1x max value per horn level
|
||||
//to a max of 1.2x max hunger value per hero level
|
||||
//This means that a standard ration will be recovered in 6.67 hero levels
|
||||
partialCharge += Hunger.STARVING * levelPortion * (0.2f + (0.1f*level()));
|
||||
|
||||
//charge is in increments of 1/10 max hunger value.
|
||||
while (partialCharge >= Hunger.STARVING/10) {
|
||||
|
@ -224,14 +263,9 @@ public class HornOfPlenty extends Artifact {
|
|||
Hero hero = Dungeon.hero;
|
||||
hero.sprite.operate( hero.pos );
|
||||
hero.busy();
|
||||
hero.spend( TIME_TO_EAT );
|
||||
hero.spend( Food.TIME_TO_EAT );
|
||||
|
||||
curItem.upgrade(((Food)item).hornValue);
|
||||
if (curItem.level() >= 30){
|
||||
curItem.level(30);
|
||||
GLog.p( Messages.get(HornOfPlenty.class, "maxlevel") );
|
||||
} else
|
||||
GLog.p( Messages.get(HornOfPlenty.class, "levelup") );
|
||||
((HornOfPlenty)curItem).gainFoodValue(((Food)item));
|
||||
item.detach(hero.belongings.backpack);
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,6 @@ public class Blandfruit extends Food {
|
|||
|
||||
//only applies when blandfruit is cooked
|
||||
energy = Hunger.STARVING;
|
||||
hornValue = 6;
|
||||
|
||||
bones = true;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@ public class ChargrilledMeat extends Food {
|
|||
{
|
||||
image = ItemSpriteSheet.STEAK;
|
||||
energy = Hunger.HUNGRY/2f;
|
||||
hornValue = 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -41,14 +41,12 @@ import java.util.ArrayList;
|
|||
|
||||
public class Food extends Item {
|
||||
|
||||
private static final float TIME_TO_EAT = 3f;
|
||||
public static final float TIME_TO_EAT = 3f;
|
||||
|
||||
public static final String AC_EAT = "EAT";
|
||||
|
||||
public float energy = Hunger.HUNGRY;
|
||||
public String message = Messages.get(this, "eat_msg");
|
||||
|
||||
public int hornValue = 3;
|
||||
|
||||
{
|
||||
stackable = true;
|
||||
|
|
|
@ -44,7 +44,6 @@ public class FrozenCarpaccio extends Food {
|
|||
{
|
||||
image = ItemSpriteSheet.CARPACCIO;
|
||||
energy = Hunger.HUNGRY/2f;
|
||||
hornValue = 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -39,7 +39,6 @@ public class MysteryMeat extends Food {
|
|||
{
|
||||
image = ItemSpriteSheet.MEAT;
|
||||
energy = Hunger.HUNGRY/2f;
|
||||
hornValue = 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -88,7 +88,6 @@ public class Pasty extends Food {
|
|||
}
|
||||
|
||||
energy = Hunger.STARVING;
|
||||
hornValue = 5;
|
||||
|
||||
bones = true;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@ public class SmallRation extends Food {
|
|||
{
|
||||
image = ItemSpriteSheet.OVERPRICED;
|
||||
energy = Hunger.HUNGRY/2f;
|
||||
hornValue = 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -212,6 +212,7 @@ items.artifacts.hornofplenty.full=Your horn is full of food!
|
|||
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 over time when equipped.
|
||||
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.
|
||||
|
|
Loading…
Reference in New Issue
Block a user