v0.9.0: reworked the 'on diet' challenge, now makes food less effective

This commit is contained in:
Evan Debenham 2020-09-05 15:10:56 -04:00
parent dfbd43df11
commit 832df0324f
8 changed files with 26 additions and 45 deletions

View File

@ -70,7 +70,7 @@ badges$badge.unlock_rogue=Unlocked the Rogue
badges$badge.unlock_huntress=Unlocked the Huntress
challenges.no_food=On diet
challenges.no_food_desc=Food is scarce, so make every bite count!\n\n- Regular rations and pasties are replaced with small rations\n- Mystery meat and blandfruit are removed\n- Horn of Plenty is removed
challenges.no_food_desc=Food's already scarce, but you have to watch your portions as welL!\n\n- Food and the horn of plenty are one third as effective at satisfying hunger\n- Other sources of satiety are unaffected
challenges.no_armor=Faith is my armor
challenges.no_armor_desc=Take on the dungeon with nothing but some cloth to protect you!\n\n- All armor except starting cloth is removed
challenges.no_healing=Pharmacophobia

View File

@ -26,10 +26,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClassArmor;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClothArmor;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.HornOfPlenty;
import com.shatteredpixel.shatteredpixeldungeon.items.food.Blandfruit;
import com.shatteredpixel.shatteredpixeldungeon.items.food.Food;
import com.shatteredpixel.shatteredpixeldungeon.items.food.SmallRation;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing;
public class Challenges {
@ -60,13 +57,6 @@ public class Challenges {
};
public static boolean isItemBlocked( Item item ){
if (Dungeon.isChallenged(NO_FOOD)){
if (item instanceof Food && !(item instanceof SmallRation)) {
return true;
} else if (item instanceof HornOfPlenty){
return true;
}
}
if (Dungeon.isChallenged(NO_ARMOR)){
if (item instanceof Armor && !(item instanceof ClothArmor || item instanceof ClassArmor)) {

View File

@ -33,7 +33,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.bags.PotionBandolier;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.ScrollHolder;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.VelvetPouch;
import com.shatteredpixel.shatteredpixeldungeon.items.food.Food;
import com.shatteredpixel.shatteredpixeldungeon.items.food.SmallRation;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfInvisibility;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfLiquidFlame;
@ -103,10 +102,6 @@ public enum HeroClass {
i = new Food();
if (!Challenges.isItemBlocked(i)) i.collect();
if (Dungeon.isChallenged(Challenges.NO_FOOD)){
new SmallRation().collect();
}
new ScrollOfIdentify().identify();
}

View File

@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.artifacts;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Challenges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
@ -86,10 +87,15 @@ public class HornOfPlenty extends Artifact {
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);
if (Dungeon.isChallenged(Challenges.NO_FOOD)){
satietyPerCharge /= 3;
}
Hunger hunger = Buff.affect(Dungeon.hero, Hunger.class);
int chargesToUse = Math.max( 1, hunger.hunger() / (int)(Hunger.STARVING/10));
int chargesToUse = Math.max( 1, hunger.hunger() / satietyPerCharge);
if (chargesToUse > charge) chargesToUse = charge;
hunger.satisfy((Hunger.STARVING/10) * chargesToUse);
hunger.satisfy(satietyPerCharge * chargesToUse);
Food.foodProc( hero );

View File

@ -23,6 +23,8 @@ package com.shatteredpixel.shatteredpixeldungeon.items.food;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Challenges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger;
@ -90,7 +92,11 @@ public class Food extends Item {
}
protected void satisfy( Hero hero ){
Buff.affect(hero, Hunger.class).satisfy( energy );
if (Dungeon.isChallenged(Challenges.NO_FOOD)){
Buff.affect(hero, Hunger.class).satisfy(energy/3f);
} else {
Buff.affect(hero, Hunger.class).satisfy(energy);
}
}
public static void foodProc( Hero hero ){

View File

@ -56,7 +56,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Stylus;
import com.shatteredpixel.shatteredpixeldungeon.items.Torch;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TalismanOfForesight;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass;
import com.shatteredpixel.shatteredpixeldungeon.items.food.SmallRation;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfEnchantment;
@ -179,11 +178,7 @@ public abstract class Level implements Bundlable {
if (!(Dungeon.bossLevel())) {
if (Dungeon.isChallenged(Challenges.NO_FOOD)){
addItemToSpawn( new SmallRation() );
} else {
addItemToSpawn(Generator.random(Generator.Category.FOOD));
}
addItemToSpawn(Generator.random(Generator.Category.FOOD));
if (Dungeon.isChallenged(Challenges.DARKNESS)){
addItemToSpawn( new Torch() );

View File

@ -21,7 +21,6 @@
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.secret;
import com.shatteredpixel.shatteredpixeldungeon.Challenges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger;
import com.shatteredpixel.shatteredpixeldungeon.items.food.ChargrilledMeat;
@ -55,9 +54,7 @@ public class SecretLarderRoom extends SecretRoom {
Painter.fill(level, c.x-1, c.y-1, 3, 3, Terrain.WATER);
Painter.set(level, c, Terrain.GRASS);
if (!Dungeon.isChallenged(Challenges.NO_FOOD)) {
level.plant(new BlandfruitBush.Seed(), level.pointToCell(c));
}
level.plant(new BlandfruitBush.Seed(), level.pointToCell(c));
int extraFood = (int)(Hunger.STARVING - Hunger.HUNGRY) * (1 + Dungeon.depth / 5);

View File

@ -21,8 +21,6 @@
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special;
import com.shatteredpixel.shatteredpixeldungeon.Challenges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Foliage;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
@ -41,20 +39,14 @@ public class GardenRoom extends SpecialRoom {
entrance().set( Door.Type.REGULAR );
if (Dungeon.isChallenged(Challenges.NO_FOOD)) {
if (Random.Int(2) == 0){
level.plant(new Sungrass.Seed(), plantPos( level ));
}
} else {
int bushes = Random.Int(3);
if (bushes == 0) {
level.plant(new Sungrass.Seed(), plantPos( level ));
} else if (bushes == 1) {
level.plant(new BlandfruitBush.Seed(), plantPos( level ));
} else if (Random.Int(5) == 0) {
level.plant(new Sungrass.Seed(), plantPos( level ));
level.plant(new BlandfruitBush.Seed(), plantPos( level ));
}
int bushes = Random.Int(3);
if (bushes == 0) {
level.plant(new Sungrass.Seed(), plantPos( level ));
} else if (bushes == 1) {
level.plant(new BlandfruitBush.Seed(), plantPos( level ));
} else if (Random.Int(5) == 0) {
level.plant(new Sungrass.Seed(), plantPos( level ));
level.plant(new BlandfruitBush.Seed(), plantPos( level ));
}
Foliage light = (Foliage)level.blobs.get( Foliage.class );