v0.6.4: significantly improved challenges
This commit is contained in:
parent
04f02a0aca
commit
afed14d0ed
|
@ -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;
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -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);
|
||||
|
|
|
@ -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() );
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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() );
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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){
|
||||
|
|
|
@ -53,7 +53,7 @@ public class CavesBossLevel extends Level {
|
|||
color1 = 0x534f3e;
|
||||
color2 = 0xb9d661;
|
||||
|
||||
viewDistance = 6;
|
||||
viewDistance = Math.min(6, viewDistance);
|
||||
}
|
||||
|
||||
private static final int WIDTH = 32;
|
||||
|
|
|
@ -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;
|
||||
|
@ -56,7 +56,7 @@ public class CavesLevel extends RegularLevel {
|
|||
color1 = 0x534f3e;
|
||||
color2 = 0xb9d661;
|
||||
|
||||
viewDistance = 6;
|
||||
viewDistance = Math.min(6, viewDistance);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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<Room> rooms ) {
|
||||
|
|
|
@ -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){
|
||||
|
|
|
@ -75,7 +75,7 @@ public class ArmoryRoom extends SpecialRoom {
|
|||
return Generator.randomWeapon();
|
||||
case 2:
|
||||
return Generator.randomArmor();
|
||||
default:
|
||||
case 3: default:
|
||||
return Generator.randomMissile();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
@ -74,6 +76,10 @@ public class CryptRoom extends SpecialRoom {
|
|||
//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){
|
||||
prize.upgrade();
|
||||
|
|
|
@ -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++) {
|
||||
|
|
|
@ -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){
|
||||
|
|
|
@ -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<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;
|
||||
guaranteedWellDepth = Random.IntRange( 6, 14 );
|
||||
Random.shuffle(runSpecials);
|
||||
|
|
|
@ -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){
|
||||
|
|
|
@ -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<Generator.Category> prizeClasses = new ArrayList<>(
|
||||
|
|
|
@ -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) ))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user