diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Challenges.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Challenges.java index 6920455e7..9c85391be 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Challenges.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Challenges.java @@ -23,7 +23,6 @@ package com.shatteredpixel.shatteredpixeldungeon; import com.shatteredpixel.shatteredpixeldungeon.items.Dewdrop; import com.shatteredpixel.shatteredpixeldungeon.items.Item; -import com.shatteredpixel.shatteredpixeldungeon.items.Stylus; import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClothArmor; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.HornOfPlenty; @@ -31,17 +30,10 @@ 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; -import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll; -import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicalInfusion; -import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRemoveCurse; -import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade; -import com.shatteredpixel.shatteredpixeldungeon.items.stones.Runestone; -import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfEnchantment; -import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfRegrowth; -import com.shatteredpixel.shatteredpixeldungeon.plants.Plant; public class Challenges { + //Some of these internal IDs are outdated and don't represent what these challenges do public static final int NO_FOOD = 1; public static final int NO_ARMOR = 2; public static final int NO_HEALING = 4; @@ -78,8 +70,6 @@ public class Challenges { if (Dungeon.isChallenged(NO_ARMOR)){ if (item instanceof Armor && !(item instanceof ClothArmor)) { return true; - } else if (item instanceof Stylus){ - return true; } } @@ -93,28 +83,8 @@ public class Challenges { } if (Dungeon.isChallenged(NO_HERBALISM)){ - if (item instanceof Plant.Seed) { + if (item instanceof Dewdrop) { return true; - } else if (item instanceof Dewdrop){ - return true; - } else if (item instanceof Blandfruit){ - return true; - } else if (item instanceof WandOfRegrowth){ - return true; - } - } - - if (Dungeon.isChallenged(NO_SCROLLS)){ - if (item instanceof Scroll){ - if (!(item instanceof ScrollOfUpgrade - || item instanceof ScrollOfRemoveCurse - || item instanceof ScrollOfMagicalInfusion)){ - return true; - } - } else if (item instanceof Runestone){ - if (!(item instanceof StoneOfEnchantment)){ - return true; - } } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java index 50bb8bfb4..a76544a49 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java @@ -419,9 +419,9 @@ public class Dungeon { public static boolean souNeeded() { int souLeftThisSet; - //3 SOU each floor set, 2 on no_scrolls challenge + //3 SOU each floor set, 1.5 (rounded) on forbidden runes challenge if (isChallenged(Challenges.NO_SCROLLS)){ - souLeftThisSet = 2 - (LimitedDrops.UPGRADE_SCROLLS.count - (depth / 5) * 2); + souLeftThisSet = Math.round(1.5f - (LimitedDrops.UPGRADE_SCROLLS.count - (depth / 5) * 1.5f)); } else { souLeftThisSet = 3 - (LimitedDrops.UPGRADE_SCROLLS.count - (depth / 5) * 3); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Wandmaker.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Wandmaker.java index 086d1bfd9..32664e985 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Wandmaker.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Wandmaker.java @@ -21,7 +21,6 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs; -import com.shatteredpixel.shatteredpixeldungeon.Challenges; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; @@ -282,8 +281,7 @@ public class Wandmaker extends NPC { if (!spawned && (type != 0 || (Dungeon.depth > 6 && Random.Int( 10 - Dungeon.depth ) == 0))) { // decide between 1,2, or 3 for quest type. - // but if the no herbalism challenge is enabled, only pick 1 or 2, no rotberry. - if (type == 0) type = Random.Int(Dungeon.isChallenged(Challenges.NO_HERBALISM) ? 2 : 3)+1; + if (type == 0) type = Random.Int(3)+1; switch (type){ case 1: default: diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/HighGrass.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/HighGrass.java index 60a3c4ee4..5df4d0ce6 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/HighGrass.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/HighGrass.java @@ -21,7 +21,6 @@ package com.shatteredpixel.shatteredpixeldungeon.levels.features; -import com.shatteredpixel.shatteredpixeldungeon.Challenges; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Barkskin; @@ -47,40 +46,38 @@ public class HighGrass { Level.set( pos, Terrain.GRASS ); GameScene.updateMap( pos ); + + int naturalismLevel = 0; - if (!Dungeon.isChallenged( Challenges.NO_HERBALISM )) { - int naturalismLevel = 0; - - if (ch != null) { - SandalsOfNature.Naturalism naturalism = ch.buff( SandalsOfNature.Naturalism.class ); - if (naturalism != null) { - if (!naturalism.isCursed()) { - naturalismLevel = naturalism.itemLevel() + 1; - naturalism.charge(); - } else { - naturalismLevel = -1; - } + if (ch != null) { + SandalsOfNature.Naturalism naturalism = ch.buff( SandalsOfNature.Naturalism.class ); + if (naturalism != null) { + if (!naturalism.isCursed()) { + naturalismLevel = naturalism.itemLevel() + 1; + naturalism.charge(); + } else { + naturalismLevel = -1; } } + } - if (naturalismLevel >= 0) { - // Seed, scales from 1/16 to 1/4 - if (Random.Int(16 - ((int) (naturalismLevel * 3))) == 0) { - Item seed = Generator.random(Generator.Category.SEED); + if (naturalismLevel >= 0) { + // Seed, scales from 1/16 to 1/4 + if (Random.Int(16 - ((int) (naturalismLevel * 3))) == 0) { + Item seed = Generator.random(Generator.Category.SEED); - if (seed instanceof BlandfruitBush.Seed) { - if (Random.Int(3) - Dungeon.LimitedDrops.BLANDFRUIT_SEED.count >= 0) { - level.drop(seed, pos).sprite.drop(); - Dungeon.LimitedDrops.BLANDFRUIT_SEED.count++; - } - } else + if (seed instanceof BlandfruitBush.Seed) { + if (Random.Int(3) - Dungeon.LimitedDrops.BLANDFRUIT_SEED.count >= 0) { level.drop(seed, pos).sprite.drop(); - } + Dungeon.LimitedDrops.BLANDFRUIT_SEED.count++; + } + } else + level.drop(seed, pos).sprite.drop(); + } - // Dew, scales from 1/6 to 1/3 - if (Random.Int(24 - naturalismLevel*3) <= 3) { - level.drop(new Dewdrop(), pos).sprite.drop(); - } + // Dew, scales from 1/6 to 1/3 + if (Random.Int(24 - naturalismLevel*3) <= 3) { + level.drop(new Dewdrop(), pos).sprite.drop(); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/painters/RegularPainter.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/painters/RegularPainter.java index 832fbb870..d350fdaf0 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/painters/RegularPainter.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/painters/RegularPainter.java @@ -21,7 +21,6 @@ package com.shatteredpixel.shatteredpixeldungeon.levels.painters; -import com.shatteredpixel.shatteredpixeldungeon.Challenges; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.levels.Level; @@ -327,15 +326,6 @@ public abstract class RegularPainter extends Painter { } l.map[i] = (Random.Float() < count / 12f) ? Terrain.HIGH_GRASS : Terrain.GRASS; } - - //forces all grass to short under no herbalism challenge - if (Dungeon.isChallenged(Challenges.NO_HERBALISM)){ - for (int i = 0; i < l.map.length; i++){ - if (l.map[i] == Terrain.HIGH_GRASS){ - l.map[i] = Terrain.GRASS; - } - } - } } protected void paintTraps( Level l, ArrayList rooms ) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Plant.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Plant.java index 3792cf1b4..0a04bffba 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Plant.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Plant.java @@ -22,6 +22,7 @@ package com.shatteredpixel.shatteredpixeldungeon.plants; import com.shatteredpixel.shatteredpixeldungeon.Assets; +import com.shatteredpixel.shatteredpixeldungeon.Challenges; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; @@ -144,7 +145,8 @@ public abstract class Plant implements Bundlable { protected void onThrow( int cell ) { if (Dungeon.level.map[cell] == Terrain.ALCHEMY || Dungeon.level.pit[cell] - || Dungeon.level.traps.get(cell) != null) { + || Dungeon.level.traps.get(cell) != null + || Dungeon.isChallenged(Challenges.NO_HERBALISM)) { super.onThrow( cell ); } else { Dungeon.level.plant( this, cell ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndChallenges.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndChallenges.java index 7f822f6ed..11e18eb06 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndChallenges.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndChallenges.java @@ -23,9 +23,12 @@ package com.shatteredpixel.shatteredpixeldungeon.windows; import com.shatteredpixel.shatteredpixeldungeon.Challenges; import com.shatteredpixel.shatteredpixeldungeon.SPDSettings; +import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; import com.shatteredpixel.shatteredpixeldungeon.ui.CheckBox; +import com.shatteredpixel.shatteredpixeldungeon.ui.IconButton; +import com.shatteredpixel.shatteredpixeldungeon.ui.Icons; import com.shatteredpixel.shatteredpixeldungeon.ui.Window; import com.watabou.noosa.RenderedText; @@ -33,7 +36,7 @@ import java.util.ArrayList; public class WndChallenges extends Window { - private static final int WIDTH = 108; + private static final int WIDTH = 120; private static final int TTL_HEIGHT = 12; private static final int BTN_HEIGHT = 18; private static final int GAP = 1; @@ -59,18 +62,33 @@ public class WndChallenges extends Window { float pos = TTL_HEIGHT; for (int i=0; i < Challenges.NAME_IDS.length; i++) { - CheckBox cb = new CheckBox( Messages.get(Challenges.class, Challenges.NAME_IDS[i]) ); + final String challenge = Challenges.NAME_IDS[i]; + + CheckBox cb = new CheckBox( Messages.get(Challenges.class, challenge) ); cb.checked( (checked & Challenges.MASKS[i]) != 0 ); cb.active = editable; if (i > 0) { pos += GAP; } - cb.setRect( 0, pos, WIDTH, BTN_HEIGHT ); - pos = cb.bottom(); + cb.setRect( 0, pos, WIDTH-16, BTN_HEIGHT ); add( cb ); boxes.add( cb ); + + IconButton info = new IconButton(Icons.get(Icons.INFO)){ + @Override + protected void onClick() { + super.onClick(); + ShatteredPixelDungeon.scene().add( + new WndMessage(Messages.get(Challenges.class, challenge+"_desc")) + ); + } + }; + info.setRect(cb.right(), pos, 16, BTN_HEIGHT); + add(info); + + pos = cb.bottom(); } resize( WIDTH, (int)pos ); diff --git a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/misc/misc.properties b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/misc/misc.properties index 08d7ff532..3761e7e06 100644 --- a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/misc/misc.properties +++ b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/misc/misc.properties @@ -66,11 +66,18 @@ badges$badge.happy_end=Happy end badges$badge.champion=Challenge won 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_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 +challenges.no_healing_desc=Without healing potions, you'll need to rely on alternate healing sources to survive\n\n- Potions of healing are removed challenges.no_herbalism=Barren land +challenges.no_herbalism_desc=There seems to be no clean water left in this accursed dungeon...\n\n- Dew drops are removed\n- Plants are removed\n- Seeds still appear, but will not take root challenges.swarm_intelligence=Swarm intelligence +challenges.swarm_intelligence_desc=Watch out, the dungeon monsters are getting smarter!\n\n- When an enemy notices you, nearby enemies are drawn to that location challenges.darkness=Into darkness +challenges.darkness_desc=It is a dungeon after all!\n\n- Regular visible distance dramatically reduced\n- A torch appears on each floor\n- Light buff lasts for less time challenges.no_scrolls=Forbidden runes +challenges.no_scrolls_desc=A certain rune is harder to find. Unfortunately, it's always the most useful one.\n\n- Half of the dungeon's upgrades scrolls are removed rankings$record.something=Killed by Something