From afed14d0ed5f939c05ffc648df2812830f1867ec Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Tue, 6 Mar 2018 20:14:34 -0500 Subject: [PATCH] v0.6.4: significantly improved challenges --- .../shatteredpixeldungeon/Challenges.java | 75 +++++++++++++++++++ .../shatteredpixeldungeon/Dungeon.java | 9 ++- .../actors/blobs/WaterOfTransmutation.java | 13 ++-- .../actors/buffs/Hunger.java | 4 +- .../actors/hero/HeroClass.java | 27 ++++--- .../actors/mobs/Mimic.java | 34 ++++++--- .../actors/mobs/Mob.java | 10 ++- .../actors/mobs/Statue.java | 6 +- .../shatteredpixeldungeon/items/Torch.java | 9 ++- .../items/food/Blandfruit.java | 8 ++ .../items/wands/WandOfPrismaticLight.java | 10 ++- .../levels/CavesBossLevel.java | 4 +- .../levels/CavesLevel.java | 6 +- .../levels/HallsBossLevel.java | 2 +- .../levels/HallsLevel.java | 4 +- .../levels/LastLevel.java | 3 - .../shatteredpixeldungeon/levels/Level.java | 31 ++++---- .../levels/RegularLevel.java | 3 + .../levels/painters/RegularPainter.java | 10 +++ .../levels/rooms/secret/SecretMazeRoom.java | 3 +- .../levels/rooms/special/ArmoryRoom.java | 2 +- .../levels/rooms/special/CryptRoom.java | 8 +- .../levels/rooms/special/PitRoom.java | 26 ++++--- .../levels/rooms/special/PoolRoom.java | 3 +- .../levels/rooms/special/SpecialRoom.java | 11 --- .../levels/rooms/special/TrapsRoom.java | 3 +- .../levels/rooms/special/VaultRoom.java | 8 +- .../mechanics/ShadowCaster.java | 5 +- 28 files changed, 237 insertions(+), 100 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Challenges.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Challenges.java index 718cf0294..6920455e7 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Challenges.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Challenges.java @@ -21,6 +21,25 @@ 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; +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 { public static final int NO_FOOD = 1; @@ -47,4 +66,60 @@ public class Challenges { NO_FOOD, NO_ARMOR, NO_HEALING, NO_HERBALISM, SWARM_INTELLIGENCE, DARKNESS, NO_SCROLLS }; + 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)) { + return true; + } else if (item instanceof Stylus){ + return true; + } + } + + if (Dungeon.isChallenged(NO_HEALING)){ + if (item instanceof PotionOfHealing){ + return true; + } else if (item instanceof Blandfruit + && ((Blandfruit) item).potionAttrib instanceof PotionOfHealing){ + return true; + } + } + + if (Dungeon.isChallenged(NO_HERBALISM)){ + if (item instanceof Plant.Seed) { + 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; + } + } + } + + return false; + + } + } \ No newline at end of file diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java index 093acb217..0010af528 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java @@ -411,8 +411,13 @@ public class Dungeon { } public static boolean souNeeded() { - //3 SOU each floor set - int souLeftThisSet = 3 - (LimitedDrops.UPGRADE_SCROLLS.count - (depth / 5) * 3); + int souLeftThisSet; + //3 SOU each floor set, 2 on no_scrolls challenge + if (isChallenged(Challenges.NO_SCROLLS)){ + souLeftThisSet = 2 - (LimitedDrops.UPGRADE_SCROLLS.count - (depth / 5) * 2); + } else { + souLeftThisSet = 3 - (LimitedDrops.UPGRADE_SCROLLS.count - (depth / 5) * 3); + } if (souLeftThisSet <= 0) return false; int floorThisSet = (depth % 5); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WaterOfTransmutation.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WaterOfTransmutation.java index 9e8e02efa..8909da975 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WaterOfTransmutation.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WaterOfTransmutation.java @@ -21,6 +21,7 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.blobs; +import com.shatteredpixel.shatteredpixeldungeon.Challenges; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.effects.BlobEmitter; @@ -105,7 +106,7 @@ public class WaterOfTransmutation extends WellWater { Wand n; do { n = (Wand)Generator.random(Category.WAND); - } while (n.getClass() == wandClass); + } while (Challenges.isItemBlocked(n) || n.getClass() == wandClass); n.level(0); staff.imbueWand(n, null); } @@ -120,12 +121,12 @@ public class WaterOfTransmutation extends WellWater { do { try { - n = (Weapon)c.classes[Random.chances(c.probs)].newInstance(); + n = (MeleeWeapon)c.classes[Random.chances(c.probs)].newInstance(); } catch (Exception e) { ShatteredPixelDungeon.reportException(e); return null; } - } while (!(n instanceof MeleeWeapon) || n.getClass() == w.getClass()); + } while (Challenges.isItemBlocked(n) || n.getClass() == w.getClass()); int level = w.level(); if (level > 0) { @@ -148,7 +149,7 @@ public class WaterOfTransmutation extends WellWater { Ring n; do { n = (Ring)Generator.random( Category.RING ); - } while (n.getClass() == r.getClass()); + } while (Challenges.isItemBlocked(n) || n.getClass() == r.getClass()); n.level(0); @@ -169,7 +170,7 @@ public class WaterOfTransmutation extends WellWater { private Artifact changeArtifact( Artifact a ) { Artifact n = Generator.randomArtifact(); - if (n != null){ + if (n != null && !Challenges.isItemBlocked(n)){ n.cursedKnown = a.cursedKnown; n.cursed = a.cursed; n.levelKnown = a.levelKnown; @@ -184,7 +185,7 @@ public class WaterOfTransmutation extends WellWater { Wand n; do { n = (Wand)Generator.random( Category.WAND ); - } while (n.getClass() == w.getClass()); + } while ( Challenges.isItemBlocked(n) || n.getClass() == w.getClass()); n.level( 0 ); n.upgrade( w.level() ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Hunger.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Hunger.java index 4bae44e4b..1f497217f 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Hunger.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Hunger.java @@ -22,7 +22,6 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.buffs; import com.shatteredpixel.shatteredpixeldungeon.Badges; -import com.shatteredpixel.shatteredpixeldungeon.Challenges; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.Artifact; @@ -126,8 +125,7 @@ public class Hunger extends Buff implements Hero.Doom { GLog.n( Messages.get(this, "cursedhorn") ); } - if (!Dungeon.isChallenged(Challenges.NO_FOOD)) - reduceHunger( energy ); + reduceHunger( energy ); } //directly interacts with hunger, no checks. diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/HeroClass.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/HeroClass.java index 706fdb134..1be925693 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/HeroClass.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/HeroClass.java @@ -26,9 +26,11 @@ import com.shatteredpixel.shatteredpixeldungeon.Badges; import com.shatteredpixel.shatteredpixeldungeon.Challenges; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.items.BrokenSeal; +import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClothArmor; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.CloakOfShadows; 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.PotionOfMindVision; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicMapping; @@ -84,11 +86,16 @@ public enum HeroClass { } private static void initCommon( Hero hero ) { - if (!Dungeon.isChallenged(Challenges.NO_ARMOR)) - (hero.belongings.armor = new ClothArmor()).identify(); + Item i = new ClothArmor().identify(); + if (!Challenges.isItemBlocked(i)) hero.belongings.armor = (ClothArmor)i; + + i = new Food(); + if (!Challenges.isItemBlocked(i)) i.collect(); + + if (Dungeon.isChallenged(Challenges.NO_FOOD)){ + new SmallRation().collect(); + } - if (!Dungeon.isChallenged(Challenges.NO_FOOD)) - new Food().identify().collect(); } public Badges.Badge masteryBadge() { @@ -109,18 +116,16 @@ public enum HeroClass { (hero.belongings.weapon = new WornShortsword()).identify(); ThrowingStone stones = new ThrowingStone(); stones.identify().quantity(3).collect(); + Dungeon.quickslot.setSlot(0, stones); - if ( Badges.isUnlocked(Badges.Badge.TUTORIAL_WARRIOR) ){ - if (!Dungeon.isChallenged(Challenges.NO_ARMOR)) + if (hero.belongings.armor != null){ + if ( Badges.isUnlocked(Badges.Badge.TUTORIAL_WARRIOR) ){ hero.belongings.armor.affixSeal(new BrokenSeal()); - Dungeon.quickslot.setSlot(0, stones); - } else { - if (!Dungeon.isChallenged(Challenges.NO_ARMOR)) { + } else { BrokenSeal seal = new BrokenSeal(); seal.collect(); - Dungeon.quickslot.setSlot(0, seal); + Dungeon.quickslot.setSlot(1, seal); } - Dungeon.quickslot.setSlot(1, stones); } new PotionOfHealing().identify(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mimic.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mimic.java index 8aad4c52c..7b7d5dfd8 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mimic.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mimic.java @@ -22,6 +22,7 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.mobs; import com.shatteredpixel.shatteredpixeldungeon.Assets; +import com.shatteredpixel.shatteredpixeldungeon.Challenges; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; @@ -149,18 +150,27 @@ public class Mimic extends Mob { } //generate an extra reward for killing the mimic - switch(Random.Int(5)){ - case 0: - m.items.add(new Gold().random()); break; - case 1: - m.items.add(Generator.randomMissile()); break; - case 2: - m.items.add(Generator.randomArmor().identify()); break; - case 3: - m.items.add(Generator.randomWeapon().identify()); break; - case 4: - m.items.add(Generator.random(Generator.Category.RING).identify()); break; - } + Item reward = null; + do { + switch (Random.Int(5)) { + case 0: + reward = new Gold().random(); + break; + case 1: + reward = Generator.randomMissile(); + break; + case 2: + reward = Generator.randomArmor(); + break; + case 3: + reward = Generator.randomWeapon(); + break; + case 4: + reward = Generator.random(Generator.Category.RING); + break; + } + } while (reward == null || !Challenges.isItemBlocked(reward)); + m.items.add(reward); return m; } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java index 23c1b738c..5110e4eb0 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java @@ -666,7 +666,7 @@ public abstract class Mob extends Char { if (Dungeon.isChallenged( Challenges.SWARM_INTELLIGENCE )) { for (Mob mob : Dungeon.level.mobs) { - if (mob != Mob.this) { + if (Dungeon.level.distance(pos, mob.pos) <= 8 && mob.state != mob.HUNTING) { mob.beckon( target ); } } @@ -700,6 +700,14 @@ public abstract class Mob extends Char { state = HUNTING; target = enemy.pos; + if (Dungeon.isChallenged( Challenges.SWARM_INTELLIGENCE )) { + for (Mob mob : Dungeon.level.mobs) { + if (Dungeon.level.distance(pos, mob.pos) <= 8 && mob.state != mob.HUNTING) { + mob.beckon( target ); + } + } + } + } else { enemySeen = false; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Statue.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Statue.java index 7c3e51e85..af6b99b9c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Statue.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Statue.java @@ -23,13 +23,11 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.mobs; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; -import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ToxicGas; -import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Poison; import com.shatteredpixel.shatteredpixeldungeon.items.Generator; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon.Enchantment; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Grim; -import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Vampiric; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon; import com.shatteredpixel.shatteredpixeldungeon.journal.Notes; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.sprites.StatueSprite; @@ -53,7 +51,7 @@ public class Statue extends Mob { super(); do { - weapon = Generator.randomWeapon(); + weapon = (MeleeWeapon) Generator.random(Generator.Category.WEAPON); } while (weapon.cursed); weapon.enchant( Enchantment.random() ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Torch.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Torch.java index 4524f36da..5c9ae78bd 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Torch.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Torch.java @@ -21,6 +21,8 @@ package com.shatteredpixel.shatteredpixeldungeon.items; +import com.shatteredpixel.shatteredpixeldungeon.Challenges; +import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Light; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; @@ -64,7 +66,12 @@ public class Torch extends Item { hero.sprite.operate( hero.pos ); detach( hero.belongings.backpack ); - Buff.affect( hero, Light.class, Light.DURATION ); + + if (Dungeon.isChallenged(Challenges.DARKNESS)){ + Buff.affect(hero, Light.class, 2*Light.DURATION/3f); + } else { + Buff.affect(hero, Light.class, Light.DURATION); + } Emitter emitter = hero.sprite.centerEmitter(); emitter.start( FlameParticle.FACTORY, 0.2f, 3 ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/food/Blandfruit.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/food/Blandfruit.java index 43b38b1ff..4c9fbd69e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/food/Blandfruit.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/food/Blandfruit.java @@ -21,6 +21,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.food; +import com.shatteredpixel.shatteredpixeldungeon.Challenges; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; @@ -46,6 +47,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfToxicGas; import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.plants.Plant.Seed; +import com.shatteredpixel.shatteredpixeldungeon.plants.Sungrass; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; @@ -259,6 +261,12 @@ public class Blandfruit extends Food { if (fruit.quantity() >= 1 && fruit.potionAttrib == null && seed.quantity() >= 1){ + + if (Dungeon.isChallenged(Challenges.NO_HEALING) + && seed instanceof Sungrass.Seed){ + return false; + } + return true; } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfPrismaticLight.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfPrismaticLight.java index 65dafecae..a2a313d88 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfPrismaticLight.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfPrismaticLight.java @@ -22,6 +22,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.wands; import com.shatteredpixel.shatteredpixeldungeon.Assets; +import com.shatteredpixel.shatteredpixeldungeon.Challenges; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; @@ -72,8 +73,13 @@ public class WandOfPrismaticLight extends DamageWand { } affectMap(beam); - if (Dungeon.level.viewDistance < 6) - Buff.prolong( curUser, Light.class, 10f+level()*5); + if (Dungeon.level.viewDistance < 6 ){ + if (Dungeon.isChallenged(Challenges.DARKNESS)){ + Buff.prolong( curUser, Light.class, 2f + level()); + } else { + Buff.prolong( curUser, Light.class, 10f+level()*5); + } + } } private void affectTarget(Char ch){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/CavesBossLevel.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/CavesBossLevel.java index fc2f2bf84..2f3bbbeba 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/CavesBossLevel.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/CavesBossLevel.java @@ -52,8 +52,8 @@ public class CavesBossLevel extends Level { { color1 = 0x534f3e; color2 = 0xb9d661; - - viewDistance = 6; + + viewDistance = Math.min(6, viewDistance); } private static final int WIDTH = 32; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/CavesLevel.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/CavesLevel.java index 472ced65d..943f90102 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/CavesLevel.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/CavesLevel.java @@ -29,6 +29,7 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room; import com.shatteredpixel.shatteredpixeldungeon.levels.traps.BurningTrap; import com.shatteredpixel.shatteredpixeldungeon.levels.traps.ConfusionTrap; +import com.shatteredpixel.shatteredpixeldungeon.levels.traps.CorrosionTrap; import com.shatteredpixel.shatteredpixeldungeon.levels.traps.ExplosiveTrap; import com.shatteredpixel.shatteredpixeldungeon.levels.traps.FrostTrap; import com.shatteredpixel.shatteredpixeldungeon.levels.traps.GrippingTrap; @@ -38,7 +39,6 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.traps.PoisonDartTrap; import com.shatteredpixel.shatteredpixeldungeon.levels.traps.RockfallTrap; import com.shatteredpixel.shatteredpixeldungeon.levels.traps.StormTrap; import com.shatteredpixel.shatteredpixeldungeon.levels.traps.SummoningTrap; -import com.shatteredpixel.shatteredpixeldungeon.levels.traps.CorrosionTrap; import com.shatteredpixel.shatteredpixeldungeon.levels.traps.WarpingTrap; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap; @@ -55,8 +55,8 @@ public class CavesLevel extends RegularLevel { { color1 = 0x534f3e; color2 = 0xb9d661; - - viewDistance = 6; + + viewDistance = Math.min(6, viewDistance); } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/HallsBossLevel.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/HallsBossLevel.java index 2e342f423..347626947 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/HallsBossLevel.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/HallsBossLevel.java @@ -47,7 +47,7 @@ public class HallsBossLevel extends Level { color1 = 0x801500; color2 = 0xa68521; - viewDistance = 4; + viewDistance = Math.min(4, viewDistance); } private static final int WIDTH = 32; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/HallsLevel.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/HallsLevel.java index 83d6a6394..195c7871c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/HallsLevel.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/HallsLevel.java @@ -27,6 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Torch; import com.shatteredpixel.shatteredpixeldungeon.levels.painters.HallsPainter; import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; import com.shatteredpixel.shatteredpixeldungeon.levels.traps.BlazingTrap; +import com.shatteredpixel.shatteredpixeldungeon.levels.traps.CorrosionTrap; import com.shatteredpixel.shatteredpixeldungeon.levels.traps.CursingTrap; import com.shatteredpixel.shatteredpixeldungeon.levels.traps.DisarmingTrap; import com.shatteredpixel.shatteredpixeldungeon.levels.traps.DisintegrationTrap; @@ -40,7 +41,6 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.traps.PitfallTrap; import com.shatteredpixel.shatteredpixeldungeon.levels.traps.RockfallTrap; import com.shatteredpixel.shatteredpixeldungeon.levels.traps.StormTrap; import com.shatteredpixel.shatteredpixeldungeon.levels.traps.SummoningTrap; -import com.shatteredpixel.shatteredpixeldungeon.levels.traps.CorrosionTrap; import com.shatteredpixel.shatteredpixeldungeon.levels.traps.WarpingTrap; import com.shatteredpixel.shatteredpixeldungeon.levels.traps.WeakeningTrap; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; @@ -56,7 +56,7 @@ public class HallsLevel extends RegularLevel { { - viewDistance = Math.max( 26 - Dungeon.depth, 1 ); + viewDistance = Math.min( 26 - Dungeon.depth, viewDistance ); color1 = 0x801500; color2 = 0xa68521; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/LastLevel.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/LastLevel.java index 13e6886d0..b96d9ed68 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/LastLevel.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/LastLevel.java @@ -39,8 +39,6 @@ public class LastLevel extends Level { { color1 = 0x801500; color2 = 0xa68521; - - viewDistance = 8; } private int pedestal; @@ -109,7 +107,6 @@ public class LastLevel extends Level { } feeling = Feeling.NONE; - viewDistance = 8; return true; } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java index 7e292eb20..805a5916f 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java @@ -41,22 +41,15 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; import com.shatteredpixel.shatteredpixeldungeon.effects.particles.FlowParticle; import com.shatteredpixel.shatteredpixeldungeon.effects.particles.WindParticle; -import com.shatteredpixel.shatteredpixeldungeon.items.Dewdrop; import com.shatteredpixel.shatteredpixeldungeon.items.Generator; import com.shatteredpixel.shatteredpixeldungeon.items.Heap; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.Stylus; import com.shatteredpixel.shatteredpixeldungeon.items.Torch; -import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass; -import com.shatteredpixel.shatteredpixeldungeon.items.bags.ScrollHolder; -import com.shatteredpixel.shatteredpixeldungeon.items.bags.SeedPouch; -import com.shatteredpixel.shatteredpixeldungeon.items.food.Food; -import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing; +import com.shatteredpixel.shatteredpixeldungeon.items.food.SmallRation; import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength; -import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll; -import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicalInfusion; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade; import com.shatteredpixel.shatteredpixeldungeon.levels.features.Chasm; import com.shatteredpixel.shatteredpixeldungeon.levels.features.Door; @@ -66,7 +59,6 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.MassGraveRo import com.shatteredpixel.shatteredpixeldungeon.levels.traps.Trap; import com.shatteredpixel.shatteredpixeldungeon.mechanics.ShadowCaster; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; -import com.shatteredpixel.shatteredpixeldungeon.plants.BlandfruitBush; import com.shatteredpixel.shatteredpixeldungeon.plants.Plant; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; @@ -113,7 +105,7 @@ public abstract class Level implements Bundlable { public boolean[] mapped; public boolean[] discoverable; - public int viewDistance = Dungeon.isChallenged( Challenges.DARKNESS ) ? 4 : 8; + public int viewDistance = Dungeon.isChallenged( Challenges.DARKNESS ) ? 2 : 8; public boolean[] heroFOV; @@ -172,7 +164,16 @@ public abstract class Level implements Bundlable { Random.seed( Dungeon.seedCurDepth() ); if (!(Dungeon.bossLevel() || Dungeon.depth == 21) /*final shop floor*/) { - addItemToSpawn( Generator.random( Generator.Category.FOOD ) ); + + if (Dungeon.isChallenged(Challenges.NO_FOOD)){ + addItemToSpawn( new SmallRation() ); + } else { + addItemToSpawn(Generator.random(Generator.Category.FOOD)); + } + + if (Dungeon.isChallenged(Challenges.DARKNESS)){ + addItemToSpawn( new Torch() ); + } if (Dungeon.posNeeded()) { addItemToSpawn( new PotionOfStrength() ); @@ -650,13 +651,7 @@ public abstract class Level implements Bundlable { public Heap drop( Item item, int cell ) { - //This messy if statement deals will items which should not drop in challenges primarily. - if ((Dungeon.isChallenged( Challenges.NO_FOOD ) && (item instanceof Food || item instanceof BlandfruitBush.Seed)) || - (Dungeon.isChallenged( Challenges.NO_ARMOR ) && item instanceof Armor) || - (Dungeon.isChallenged( Challenges.NO_HEALING ) && item instanceof PotionOfHealing) || - (Dungeon.isChallenged( Challenges.NO_HERBALISM ) && (item instanceof Plant.Seed || item instanceof Dewdrop || item instanceof SeedPouch)) || - (Dungeon.isChallenged( Challenges.NO_SCROLLS ) && ((item instanceof Scroll && !(item instanceof ScrollOfUpgrade || item instanceof ScrollOfMagicalInfusion)) || item instanceof ScrollHolder)) || - item == null) { + if (item == null || Challenges.isItemBlocked(item)){ //create a dummy heap, give it a dummy sprite, don't add it to the game, and return it. //effectively nullifies whatever the logic calling this wants to do, including dropping items. diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java index 59a000412..391935ec4 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java @@ -324,6 +324,9 @@ public abstract class RegularLevel extends Level { } Item toDrop = Generator.random(); + + if (toDrop == null) continue; + if ((toDrop instanceof Artifact && Random.Int(2) == 0) || (toDrop.isUpgradable() && Random.Int(4 - toDrop.level()) == 0)){ Heap dropped = drop( toDrop, cell ); 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 d350fdaf0..832fbb870 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,6 +21,7 @@ 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; @@ -326,6 +327,15 @@ 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/levels/rooms/secret/SecretMazeRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/secret/SecretMazeRoom.java index f6e3e3a86..f957cba8c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/secret/SecretMazeRoom.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/secret/SecretMazeRoom.java @@ -21,6 +21,7 @@ package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.secret; +import com.shatteredpixel.shatteredpixeldungeon.Challenges; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.items.Generator; import com.shatteredpixel.shatteredpixeldungeon.items.Heap; @@ -101,7 +102,7 @@ public class SecretMazeRoom extends SecretRoom { } else { prize = Generator.randomArmor((Dungeon.depth / 5) + 1); } - } while (prize.cursed); + } while (prize.cursed || Challenges.isItemBlocked(prize)); //33% chance for an extra update. if (Random.Int(3) == 0){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/ArmoryRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/ArmoryRoom.java index 3c436e721..dc0da4e2b 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/ArmoryRoom.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/ArmoryRoom.java @@ -75,7 +75,7 @@ public class ArmoryRoom extends SpecialRoom { return Generator.randomWeapon(); case 2: return Generator.randomArmor(); - default: + case 3: default: return Generator.randomMissile(); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/CryptRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/CryptRoom.java index 7f191be4c..118f5e288 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/CryptRoom.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/CryptRoom.java @@ -21,8 +21,10 @@ package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special; +import com.shatteredpixel.shatteredpixeldungeon.Challenges; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.items.Generator; +import com.shatteredpixel.shatteredpixeldungeon.items.Gold; import com.shatteredpixel.shatteredpixeldungeon.items.Heap; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; @@ -70,9 +72,13 @@ public class CryptRoom extends SpecialRoom { } private static Item prize( Level level ) { - + //1 floor set higher than normal Armor prize = Generator.randomArmor( (Dungeon.depth / 5) + 1); + + if (Challenges.isItemBlocked(prize)){ + return new Gold().random(); + } //if it isn't already cursed, give it a free upgrade if (!prize.cursed){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/PitRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/PitRoom.java index d079e3279..4c0123b4c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/PitRoom.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/PitRoom.java @@ -21,6 +21,7 @@ package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special; +import com.shatteredpixel.shatteredpixeldungeon.Challenges; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.items.Generator; import com.shatteredpixel.shatteredpixeldungeon.items.Heap; @@ -60,17 +61,20 @@ public class PitRoom extends SpecialRoom { } level.drop( new IronKey( Dungeon.depth ), remains ).type = Heap.Type.SKELETON; - int loot = Random.Int( 3 ); - if (loot == 0) { - level.drop( Generator.random( Generator.Category.RING ), remains ); - } else if (loot == 1) { - level.drop( Generator.random( Generator.Category.ARTIFACT ), remains ); - } else { - level.drop( Generator.random( Random.oneOf( - Generator.Category.WEAPON, - Generator.Category.ARMOR - ) ), remains ); - } + Item mainLoot = null; + do { + switch (Random.Int(3)){ + case 0: + mainLoot = Generator.random(Generator.Category.RING); + case 1: + mainLoot = Generator.random(Generator.Category.ARTIFACT); + case 2: + mainLoot = Generator.random(Random.oneOf( + Generator.Category.WEAPON, + Generator.Category.ARMOR)); + } + } while ( mainLoot == null || !Challenges.isItemBlocked(mainLoot)); + level.drop(mainLoot, remains); int n = Random.IntRange( 1, 2 ); for (int i=0; i < n; i++) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/PoolRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/PoolRoom.java index 179ff60fd..d96b5704a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/PoolRoom.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/PoolRoom.java @@ -21,6 +21,7 @@ package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special; +import com.shatteredpixel.shatteredpixeldungeon.Challenges; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Piranha; import com.shatteredpixel.shatteredpixeldungeon.items.Generator; @@ -101,7 +102,7 @@ public class PoolRoom extends SpecialRoom { } else { prize = Generator.randomArmor((Dungeon.depth / 5) + 1); } - } while (prize.cursed); + } while (prize.cursed || Challenges.isItemBlocked(prize)); //33% chance for an extra update. if (Random.Int(3) == 0){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/SpecialRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/SpecialRoom.java index ea9adaf72..6c48624c8 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/SpecialRoom.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/SpecialRoom.java @@ -21,7 +21,6 @@ package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special; -import com.shatteredpixel.shatteredpixeldungeon.Challenges; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.WaterOfTransmutation; @@ -74,16 +73,6 @@ public class SpecialRoom extends Room { public static void initForRun() { runSpecials = (ArrayList>)ALL_SPEC.clone(); - //remove special rooms disallowed by challenges - if (Dungeon.isChallenged( Challenges.NO_ARMOR )){ - //no sense in giving an armor reward room on a run with no armor. - runSpecials.remove( CryptRoom.class ); - } - if (Dungeon.isChallenged( Challenges.NO_HERBALISM )){ - //Would be a bit mean to spawn these with no plants in them - runSpecials.remove( GardenRoom.class ); - } - pitNeededDepth = -1; guaranteedWellDepth = Random.IntRange( 6, 14 ); Random.shuffle(runSpecials); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/TrapsRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/TrapsRoom.java index ae13f7b86..eb2407894 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/TrapsRoom.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/TrapsRoom.java @@ -21,6 +21,7 @@ package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special; +import com.shatteredpixel.shatteredpixeldungeon.Challenges; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.items.Generator; @@ -132,7 +133,7 @@ public class TrapsRoom extends SpecialRoom { } else { prize = Generator.randomArmor((Dungeon.depth / 5) + 1); } - } while (prize.cursed); + } while (prize.cursed || Challenges.isItemBlocked(prize)); //33% chance for an extra update. if (Random.Int(3) == 0){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/VaultRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/VaultRoom.java index 1f320385f..0f3e0e276 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/VaultRoom.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/VaultRoom.java @@ -21,6 +21,7 @@ package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special; +import com.shatteredpixel.shatteredpixeldungeon.Challenges; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.items.Generator; import com.shatteredpixel.shatteredpixeldungeon.items.Heap; @@ -62,7 +63,12 @@ public class VaultRoom extends SpecialRoom { } private Item prize( Level level ) { - return Generator.random( prizeClasses.remove(0) ); + Generator.Category cat = prizeClasses.remove(0); + Item prize = null; + do { + prize = Generator.random(cat); + } while (prize == null || Challenges.isItemBlocked(prize)); + return prize; } private ArrayList prizeClasses = new ArrayList<>( diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/mechanics/ShadowCaster.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/mechanics/ShadowCaster.java index 62d6f836c..0d566f75d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/mechanics/ShadowCaster.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/mechanics/ShadowCaster.java @@ -37,7 +37,10 @@ public final class ShadowCaster { for (int i=1; i <= MAX_DISTANCE; i++) { rounding[i] = new int[i+1]; for (int j=1; j <= i; j++) { - rounding[i][j] = (int)Math.min( j, Math.round( i * Math.cos( Math.asin( j / (i + 0.5) )))); + //testing the middle of a cell, so we use i + 0.5 + rounding[i][j] = (int)Math.min( + j, + Math.round( (i + 0.5) * Math.cos( Math.asin( j / (i + 0.5) )))); } } }