v0.6.4: significantly improved challenges

This commit is contained in:
Evan Debenham 2018-03-06 20:14:34 -05:00
parent 04f02a0aca
commit afed14d0ed
28 changed files with 237 additions and 100 deletions

View File

@ -21,6 +21,25 @@
package com.shatteredpixel.shatteredpixeldungeon; 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 class Challenges {
public static final int NO_FOOD = 1; 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 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;
}
} }

View File

@ -411,8 +411,13 @@ public class Dungeon {
} }
public static boolean souNeeded() { public static boolean souNeeded() {
//3 SOU each floor set int souLeftThisSet;
int souLeftThisSet = 3 - (LimitedDrops.UPGRADE_SCROLLS.count - (depth / 5) * 3); //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; if (souLeftThisSet <= 0) return false;
int floorThisSet = (depth % 5); int floorThisSet = (depth % 5);

View File

@ -21,6 +21,7 @@
package com.shatteredpixel.shatteredpixeldungeon.actors.blobs; package com.shatteredpixel.shatteredpixeldungeon.actors.blobs;
import com.shatteredpixel.shatteredpixeldungeon.Challenges;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.effects.BlobEmitter; import com.shatteredpixel.shatteredpixeldungeon.effects.BlobEmitter;
@ -105,7 +106,7 @@ public class WaterOfTransmutation extends WellWater {
Wand n; Wand n;
do { do {
n = (Wand)Generator.random(Category.WAND); n = (Wand)Generator.random(Category.WAND);
} while (n.getClass() == wandClass); } while (Challenges.isItemBlocked(n) || n.getClass() == wandClass);
n.level(0); n.level(0);
staff.imbueWand(n, null); staff.imbueWand(n, null);
} }
@ -120,12 +121,12 @@ public class WaterOfTransmutation extends WellWater {
do { do {
try { try {
n = (Weapon)c.classes[Random.chances(c.probs)].newInstance(); n = (MeleeWeapon)c.classes[Random.chances(c.probs)].newInstance();
} catch (Exception e) { } catch (Exception e) {
ShatteredPixelDungeon.reportException(e); ShatteredPixelDungeon.reportException(e);
return null; return null;
} }
} while (!(n instanceof MeleeWeapon) || n.getClass() == w.getClass()); } while (Challenges.isItemBlocked(n) || n.getClass() == w.getClass());
int level = w.level(); int level = w.level();
if (level > 0) { if (level > 0) {
@ -148,7 +149,7 @@ public class WaterOfTransmutation extends WellWater {
Ring n; Ring n;
do { do {
n = (Ring)Generator.random( Category.RING ); n = (Ring)Generator.random( Category.RING );
} while (n.getClass() == r.getClass()); } while (Challenges.isItemBlocked(n) || n.getClass() == r.getClass());
n.level(0); n.level(0);
@ -169,7 +170,7 @@ public class WaterOfTransmutation extends WellWater {
private Artifact changeArtifact( Artifact a ) { private Artifact changeArtifact( Artifact a ) {
Artifact n = Generator.randomArtifact(); Artifact n = Generator.randomArtifact();
if (n != null){ if (n != null && !Challenges.isItemBlocked(n)){
n.cursedKnown = a.cursedKnown; n.cursedKnown = a.cursedKnown;
n.cursed = a.cursed; n.cursed = a.cursed;
n.levelKnown = a.levelKnown; n.levelKnown = a.levelKnown;
@ -184,7 +185,7 @@ public class WaterOfTransmutation extends WellWater {
Wand n; Wand n;
do { do {
n = (Wand)Generator.random( Category.WAND ); n = (Wand)Generator.random( Category.WAND );
} while (n.getClass() == w.getClass()); } while ( Challenges.isItemBlocked(n) || n.getClass() == w.getClass());
n.level( 0 ); n.level( 0 );
n.upgrade( w.level() ); n.upgrade( w.level() );

View File

@ -22,7 +22,6 @@
package com.shatteredpixel.shatteredpixeldungeon.actors.buffs; package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
import com.shatteredpixel.shatteredpixeldungeon.Badges; import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Challenges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.Artifact; 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") ); GLog.n( Messages.get(this, "cursedhorn") );
} }
if (!Dungeon.isChallenged(Challenges.NO_FOOD)) reduceHunger( energy );
reduceHunger( energy );
} }
//directly interacts with hunger, no checks. //directly interacts with hunger, no checks.

View File

@ -26,9 +26,11 @@ import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Challenges; import com.shatteredpixel.shatteredpixeldungeon.Challenges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.items.BrokenSeal; import com.shatteredpixel.shatteredpixeldungeon.items.BrokenSeal;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClothArmor; import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClothArmor;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.CloakOfShadows; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.CloakOfShadows;
import com.shatteredpixel.shatteredpixeldungeon.items.food.Food; 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.PotionOfHealing;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfMindVision; import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfMindVision;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicMapping; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicMapping;
@ -84,11 +86,16 @@ public enum HeroClass {
} }
private static void initCommon( Hero hero ) { private static void initCommon( Hero hero ) {
if (!Dungeon.isChallenged(Challenges.NO_ARMOR)) Item i = new ClothArmor().identify();
(hero.belongings.armor = 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() { public Badges.Badge masteryBadge() {
@ -109,18 +116,16 @@ public enum HeroClass {
(hero.belongings.weapon = new WornShortsword()).identify(); (hero.belongings.weapon = new WornShortsword()).identify();
ThrowingStone stones = new ThrowingStone(); ThrowingStone stones = new ThrowingStone();
stones.identify().quantity(3).collect(); stones.identify().quantity(3).collect();
Dungeon.quickslot.setSlot(0, stones);
if ( Badges.isUnlocked(Badges.Badge.TUTORIAL_WARRIOR) ){ if (hero.belongings.armor != null){
if (!Dungeon.isChallenged(Challenges.NO_ARMOR)) if ( Badges.isUnlocked(Badges.Badge.TUTORIAL_WARRIOR) ){
hero.belongings.armor.affixSeal(new BrokenSeal()); hero.belongings.armor.affixSeal(new BrokenSeal());
Dungeon.quickslot.setSlot(0, stones); } else {
} else {
if (!Dungeon.isChallenged(Challenges.NO_ARMOR)) {
BrokenSeal seal = new BrokenSeal(); BrokenSeal seal = new BrokenSeal();
seal.collect(); seal.collect();
Dungeon.quickslot.setSlot(0, seal); Dungeon.quickslot.setSlot(1, seal);
} }
Dungeon.quickslot.setSlot(1, stones);
} }
new PotionOfHealing().identify(); new PotionOfHealing().identify();

View File

@ -22,6 +22,7 @@
package com.shatteredpixel.shatteredpixeldungeon.actors.mobs; package com.shatteredpixel.shatteredpixeldungeon.actors.mobs;
import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Challenges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
@ -149,18 +150,27 @@ public class Mimic extends Mob {
} }
//generate an extra reward for killing the mimic //generate an extra reward for killing the mimic
switch(Random.Int(5)){ Item reward = null;
case 0: do {
m.items.add(new Gold().random()); break; switch (Random.Int(5)) {
case 1: case 0:
m.items.add(Generator.randomMissile()); break; reward = new Gold().random();
case 2: break;
m.items.add(Generator.randomArmor().identify()); break; case 1:
case 3: reward = Generator.randomMissile();
m.items.add(Generator.randomWeapon().identify()); break; break;
case 4: case 2:
m.items.add(Generator.random(Generator.Category.RING).identify()); break; 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; return m;
} }

View File

@ -666,7 +666,7 @@ public abstract class Mob extends Char {
if (Dungeon.isChallenged( Challenges.SWARM_INTELLIGENCE )) { if (Dungeon.isChallenged( Challenges.SWARM_INTELLIGENCE )) {
for (Mob mob : Dungeon.level.mobs) { 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 ); mob.beckon( target );
} }
} }
@ -700,6 +700,14 @@ public abstract class Mob extends Char {
state = HUNTING; state = HUNTING;
target = enemy.pos; 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 { } else {
enemySeen = false; enemySeen = false;

View File

@ -23,13 +23,11 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.mobs;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char; 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.Generator;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon.Enchantment; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon.Enchantment;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Grim; 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.journal.Notes;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.StatueSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.StatueSprite;
@ -53,7 +51,7 @@ public class Statue extends Mob {
super(); super();
do { do {
weapon = Generator.randomWeapon(); weapon = (MeleeWeapon) Generator.random(Generator.Category.WEAPON);
} while (weapon.cursed); } while (weapon.cursed);
weapon.enchant( Enchantment.random() ); weapon.enchant( Enchantment.random() );

View File

@ -21,6 +21,8 @@
package com.shatteredpixel.shatteredpixeldungeon.items; 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.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Light; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Light;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
@ -64,7 +66,12 @@ public class Torch extends Item {
hero.sprite.operate( hero.pos ); hero.sprite.operate( hero.pos );
detach( hero.belongings.backpack ); 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 emitter = hero.sprite.centerEmitter();
emitter.start( FlameParticle.FACTORY, 0.2f, 3 ); emitter.start( FlameParticle.FACTORY, 0.2f, 3 );

View File

@ -21,6 +21,7 @@
package com.shatteredpixel.shatteredpixeldungeon.items.food; package com.shatteredpixel.shatteredpixeldungeon.items.food;
import com.shatteredpixel.shatteredpixeldungeon.Challenges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; 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.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant.Seed; import com.shatteredpixel.shatteredpixeldungeon.plants.Plant.Seed;
import com.shatteredpixel.shatteredpixeldungeon.plants.Sungrass;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
@ -259,6 +261,12 @@ public class Blandfruit extends Food {
if (fruit.quantity() >= 1 && fruit.potionAttrib == null if (fruit.quantity() >= 1 && fruit.potionAttrib == null
&& seed.quantity() >= 1){ && seed.quantity() >= 1){
if (Dungeon.isChallenged(Challenges.NO_HEALING)
&& seed instanceof Sungrass.Seed){
return false;
}
return true; return true;
} }

View File

@ -22,6 +22,7 @@
package com.shatteredpixel.shatteredpixeldungeon.items.wands; package com.shatteredpixel.shatteredpixeldungeon.items.wands;
import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Challenges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
@ -72,8 +73,13 @@ public class WandOfPrismaticLight extends DamageWand {
} }
affectMap(beam); affectMap(beam);
if (Dungeon.level.viewDistance < 6) if (Dungeon.level.viewDistance < 6 ){
Buff.prolong( curUser, Light.class, 10f+level()*5); 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){ private void affectTarget(Char ch){

View File

@ -53,7 +53,7 @@ public class CavesBossLevel extends Level {
color1 = 0x534f3e; color1 = 0x534f3e;
color2 = 0xb9d661; color2 = 0xb9d661;
viewDistance = 6; viewDistance = Math.min(6, viewDistance);
} }
private static final int WIDTH = 32; private static final int WIDTH = 32;

View File

@ -29,6 +29,7 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room; import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.BurningTrap; import com.shatteredpixel.shatteredpixeldungeon.levels.traps.BurningTrap;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.ConfusionTrap; 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.ExplosiveTrap;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.FrostTrap; import com.shatteredpixel.shatteredpixeldungeon.levels.traps.FrostTrap;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.GrippingTrap; 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.RockfallTrap;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.StormTrap; import com.shatteredpixel.shatteredpixeldungeon.levels.traps.StormTrap;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.SummoningTrap; 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.WarpingTrap;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap; import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap;
@ -56,7 +56,7 @@ public class CavesLevel extends RegularLevel {
color1 = 0x534f3e; color1 = 0x534f3e;
color2 = 0xb9d661; color2 = 0xb9d661;
viewDistance = 6; viewDistance = Math.min(6, viewDistance);
} }
@Override @Override

View File

@ -47,7 +47,7 @@ public class HallsBossLevel extends Level {
color1 = 0x801500; color1 = 0x801500;
color2 = 0xa68521; color2 = 0xa68521;
viewDistance = 4; viewDistance = Math.min(4, viewDistance);
} }
private static final int WIDTH = 32; private static final int WIDTH = 32;

View File

@ -27,6 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Torch;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.HallsPainter; import com.shatteredpixel.shatteredpixeldungeon.levels.painters.HallsPainter;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.BlazingTrap; 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.CursingTrap;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.DisarmingTrap; import com.shatteredpixel.shatteredpixeldungeon.levels.traps.DisarmingTrap;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.DisintegrationTrap; 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.RockfallTrap;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.StormTrap; import com.shatteredpixel.shatteredpixeldungeon.levels.traps.StormTrap;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.SummoningTrap; 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.WarpingTrap;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.WeakeningTrap; import com.shatteredpixel.shatteredpixeldungeon.levels.traps.WeakeningTrap;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; 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; color1 = 0x801500;
color2 = 0xa68521; color2 = 0xa68521;

View File

@ -39,8 +39,6 @@ public class LastLevel extends Level {
{ {
color1 = 0x801500; color1 = 0x801500;
color2 = 0xa68521; color2 = 0xa68521;
viewDistance = 8;
} }
private int pedestal; private int pedestal;
@ -109,7 +107,6 @@ public class LastLevel extends Level {
} }
feeling = Feeling.NONE; feeling = Feeling.NONE;
viewDistance = 8;
return true; return true;
} }

View File

@ -41,22 +41,15 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.FlowParticle; import com.shatteredpixel.shatteredpixeldungeon.effects.particles.FlowParticle;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.WindParticle; import com.shatteredpixel.shatteredpixeldungeon.effects.particles.WindParticle;
import com.shatteredpixel.shatteredpixeldungeon.items.Dewdrop;
import com.shatteredpixel.shatteredpixeldungeon.items.Generator; import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap; import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.Stylus; import com.shatteredpixel.shatteredpixeldungeon.items.Stylus;
import com.shatteredpixel.shatteredpixeldungeon.items.Torch; 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.DriedRose;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.ScrollHolder; import com.shatteredpixel.shatteredpixeldungeon.items.food.SmallRation;
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.potions.PotionOfStrength; 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.items.scrolls.ScrollOfUpgrade;
import com.shatteredpixel.shatteredpixeldungeon.levels.features.Chasm; import com.shatteredpixel.shatteredpixeldungeon.levels.features.Chasm;
import com.shatteredpixel.shatteredpixeldungeon.levels.features.Door; 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.levels.traps.Trap;
import com.shatteredpixel.shatteredpixeldungeon.mechanics.ShadowCaster; import com.shatteredpixel.shatteredpixeldungeon.mechanics.ShadowCaster;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.plants.BlandfruitBush;
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant; import com.shatteredpixel.shatteredpixeldungeon.plants.Plant;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
@ -113,7 +105,7 @@ public abstract class Level implements Bundlable {
public boolean[] mapped; public boolean[] mapped;
public boolean[] discoverable; public boolean[] discoverable;
public int viewDistance = Dungeon.isChallenged( Challenges.DARKNESS ) ? 4 : 8; public int viewDistance = Dungeon.isChallenged( Challenges.DARKNESS ) ? 2 : 8;
public boolean[] heroFOV; public boolean[] heroFOV;
@ -172,7 +164,16 @@ public abstract class Level implements Bundlable {
Random.seed( Dungeon.seedCurDepth() ); Random.seed( Dungeon.seedCurDepth() );
if (!(Dungeon.bossLevel() || Dungeon.depth == 21) /*final shop floor*/) { 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()) { if (Dungeon.posNeeded()) {
addItemToSpawn( new PotionOfStrength() ); addItemToSpawn( new PotionOfStrength() );
@ -650,13 +651,7 @@ public abstract class Level implements Bundlable {
public Heap drop( Item item, int cell ) { public Heap drop( Item item, int cell ) {
//This messy if statement deals will items which should not drop in challenges primarily. if (item == null || Challenges.isItemBlocked(item)){
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) {
//create a dummy heap, give it a dummy sprite, don't add it to the game, and return it. //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. //effectively nullifies whatever the logic calling this wants to do, including dropping items.

View File

@ -324,6 +324,9 @@ public abstract class RegularLevel extends Level {
} }
Item toDrop = Generator.random(); Item toDrop = Generator.random();
if (toDrop == null) continue;
if ((toDrop instanceof Artifact && Random.Int(2) == 0) || if ((toDrop instanceof Artifact && Random.Int(2) == 0) ||
(toDrop.isUpgradable() && Random.Int(4 - toDrop.level()) == 0)){ (toDrop.isUpgradable() && Random.Int(4 - toDrop.level()) == 0)){
Heap dropped = drop( toDrop, cell ); Heap dropped = drop( toDrop, cell );

View File

@ -21,6 +21,7 @@
package com.shatteredpixel.shatteredpixeldungeon.levels.painters; package com.shatteredpixel.shatteredpixeldungeon.levels.painters;
import com.shatteredpixel.shatteredpixeldungeon.Challenges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level; 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; 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<Room> rooms ) { protected void paintTraps( Level l, ArrayList<Room> rooms ) {

View File

@ -21,6 +21,7 @@
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.secret; package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.secret;
import com.shatteredpixel.shatteredpixeldungeon.Challenges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.items.Generator; import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap; import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
@ -101,7 +102,7 @@ public class SecretMazeRoom extends SecretRoom {
} else { } else {
prize = Generator.randomArmor((Dungeon.depth / 5) + 1); prize = Generator.randomArmor((Dungeon.depth / 5) + 1);
} }
} while (prize.cursed); } while (prize.cursed || Challenges.isItemBlocked(prize));
//33% chance for an extra update. //33% chance for an extra update.
if (Random.Int(3) == 0){ if (Random.Int(3) == 0){

View File

@ -75,7 +75,7 @@ public class ArmoryRoom extends SpecialRoom {
return Generator.randomWeapon(); return Generator.randomWeapon();
case 2: case 2:
return Generator.randomArmor(); return Generator.randomArmor();
default: case 3: default:
return Generator.randomMissile(); return Generator.randomMissile();
} }
} }

View File

@ -21,8 +21,10 @@
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special; package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special;
import com.shatteredpixel.shatteredpixeldungeon.Challenges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.items.Generator; import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
import com.shatteredpixel.shatteredpixeldungeon.items.Gold;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap; import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
@ -74,6 +76,10 @@ public class CryptRoom extends SpecialRoom {
//1 floor set higher than normal //1 floor set higher than normal
Armor prize = Generator.randomArmor( (Dungeon.depth / 5) + 1); 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 it isn't already cursed, give it a free upgrade
if (!prize.cursed){ if (!prize.cursed){
prize.upgrade(); prize.upgrade();

View File

@ -21,6 +21,7 @@
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special; package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special;
import com.shatteredpixel.shatteredpixeldungeon.Challenges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.items.Generator; import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap; 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; level.drop( new IronKey( Dungeon.depth ), remains ).type = Heap.Type.SKELETON;
int loot = Random.Int( 3 ); Item mainLoot = null;
if (loot == 0) { do {
level.drop( Generator.random( Generator.Category.RING ), remains ); switch (Random.Int(3)){
} else if (loot == 1) { case 0:
level.drop( Generator.random( Generator.Category.ARTIFACT ), remains ); mainLoot = Generator.random(Generator.Category.RING);
} else { case 1:
level.drop( Generator.random( Random.oneOf( mainLoot = Generator.random(Generator.Category.ARTIFACT);
Generator.Category.WEAPON, case 2:
Generator.Category.ARMOR mainLoot = Generator.random(Random.oneOf(
) ), remains ); Generator.Category.WEAPON,
} Generator.Category.ARMOR));
}
} while ( mainLoot == null || !Challenges.isItemBlocked(mainLoot));
level.drop(mainLoot, remains);
int n = Random.IntRange( 1, 2 ); int n = Random.IntRange( 1, 2 );
for (int i=0; i < n; i++) { for (int i=0; i < n; i++) {

View File

@ -21,6 +21,7 @@
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special; package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special;
import com.shatteredpixel.shatteredpixeldungeon.Challenges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Piranha; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Piranha;
import com.shatteredpixel.shatteredpixeldungeon.items.Generator; import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
@ -101,7 +102,7 @@ public class PoolRoom extends SpecialRoom {
} else { } else {
prize = Generator.randomArmor((Dungeon.depth / 5) + 1); prize = Generator.randomArmor((Dungeon.depth / 5) + 1);
} }
} while (prize.cursed); } while (prize.cursed || Challenges.isItemBlocked(prize));
//33% chance for an extra update. //33% chance for an extra update.
if (Random.Int(3) == 0){ if (Random.Int(3) == 0){

View File

@ -21,7 +21,6 @@
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special; package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special;
import com.shatteredpixel.shatteredpixeldungeon.Challenges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.WaterOfTransmutation; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.WaterOfTransmutation;
@ -74,16 +73,6 @@ public class SpecialRoom extends Room {
public static void initForRun() { public static void initForRun() {
runSpecials = (ArrayList<Class<?extends Room>>)ALL_SPEC.clone(); runSpecials = (ArrayList<Class<?extends Room>>)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; pitNeededDepth = -1;
guaranteedWellDepth = Random.IntRange( 6, 14 ); guaranteedWellDepth = Random.IntRange( 6, 14 );
Random.shuffle(runSpecials); Random.shuffle(runSpecials);

View File

@ -21,6 +21,7 @@
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special; package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special;
import com.shatteredpixel.shatteredpixeldungeon.Challenges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.items.Generator; import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
@ -132,7 +133,7 @@ public class TrapsRoom extends SpecialRoom {
} else { } else {
prize = Generator.randomArmor((Dungeon.depth / 5) + 1); prize = Generator.randomArmor((Dungeon.depth / 5) + 1);
} }
} while (prize.cursed); } while (prize.cursed || Challenges.isItemBlocked(prize));
//33% chance for an extra update. //33% chance for an extra update.
if (Random.Int(3) == 0){ if (Random.Int(3) == 0){

View File

@ -21,6 +21,7 @@
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special; package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special;
import com.shatteredpixel.shatteredpixeldungeon.Challenges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.items.Generator; import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap; import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
@ -62,7 +63,12 @@ public class VaultRoom extends SpecialRoom {
} }
private Item prize( Level level ) { 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<Generator.Category> prizeClasses = new ArrayList<>( private ArrayList<Generator.Category> prizeClasses = new ArrayList<>(

View File

@ -37,7 +37,10 @@ public final class ShadowCaster {
for (int i=1; i <= MAX_DISTANCE; i++) { for (int i=1; i <= MAX_DISTANCE; i++) {
rounding[i] = new int[i+1]; rounding[i] = new int[i+1];
for (int j=1; j <= i; j++) { 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) ))));
} }
} }
} }