v0.2.2a: tweaked level and hero gen logic for certain challenges
This commit is contained in:
parent
80819f1c7a
commit
dfda4a53c2
|
@ -19,6 +19,7 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.hero;
|
|||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Challenges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.TomeOfMastery;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClothArmor;
|
||||
|
@ -110,7 +111,10 @@ public enum HeroClass {
|
|||
}
|
||||
|
||||
private static void initCommon( Hero hero ) {
|
||||
if (!Dungeon.isChallenged(Challenges.NO_ARMOR))
|
||||
(hero.belongings.armor = new ClothArmor()).identify();
|
||||
|
||||
if (!Dungeon.isChallenged(Challenges.NO_FOOD))
|
||||
new Food().identify().collect();
|
||||
}
|
||||
|
||||
|
|
|
@ -17,20 +17,6 @@
|
|||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.levels;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.Blandfruit;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfMight;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfWealth;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfWeaponUpgrade;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.plants.BlandfruitBush;
|
||||
import com.watabou.noosa.Scene;
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Challenges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
|
@ -51,30 +37,44 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Bestiary;
|
|||
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.Gold;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Stylus;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.Blandfruit;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.Food;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfMight;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfWealth;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfWeaponUpgrade;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.features.Chasm;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.features.Door;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.features.HighGrass;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.*;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.mechanics.ShadowCaster;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.plants.BlandfruitBush;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
import com.watabou.noosa.Scene;
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
import com.watabou.utils.Bundlable;
|
||||
import com.watabou.utils.Bundle;
|
||||
import com.watabou.utils.Random;
|
||||
import com.watabou.utils.SparseArray;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
public abstract class Level implements Bundlable {
|
||||
|
||||
public static enum Feeling {
|
||||
|
@ -447,6 +447,7 @@ public abstract class Level implements Bundlable {
|
|||
}
|
||||
}
|
||||
|
||||
//TODO: this results in lots of empty rooms that could otherwise have a prize, should rework, also fix typo.
|
||||
public Item itemToSpanAsPrize() {
|
||||
if (Random.Int( itemsToSpawn.size() + 1 ) > 0) {
|
||||
Item item = Random.element( itemsToSpawn );
|
||||
|
@ -555,14 +556,13 @@ public abstract class Level implements Bundlable {
|
|||
|
||||
public Heap drop( Item item, int cell ) {
|
||||
|
||||
if (Dungeon.isChallenged( Challenges.NO_FOOD ) && item instanceof Food) {
|
||||
item = new Gold( item.price() );
|
||||
} else
|
||||
if (Dungeon.isChallenged( Challenges.NO_ARMOR ) && item instanceof Armor) {
|
||||
item = new Gold( item.price() );
|
||||
} else
|
||||
if (Dungeon.isChallenged( Challenges.NO_HEALING ) && item instanceof PotionOfHealing) {
|
||||
item = new Gold( item.price() );
|
||||
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))) {
|
||||
|
||||
return new Heap();
|
||||
|
||||
}
|
||||
|
||||
if ((map[cell] == Terrain.ALCHEMY) && (item instanceof BlandfruitBush.Seed || !(item instanceof Plant.Seed ||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
package com.shatteredpixel.shatteredpixeldungeon.levels;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Bones;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Challenges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
|
@ -139,6 +140,14 @@ public abstract class RegularLevel extends Level {
|
|||
if (Dungeon.bossLevel( Dungeon.depth + 1 )) {
|
||||
specials.remove( Room.Type.WEAK_FLOOR );
|
||||
}
|
||||
if (Dungeon.isChallenged( Challenges.NO_ARMOR )){
|
||||
//no sense in giving an armor reward room on a run with no armor.
|
||||
specials.remove( Room.Type.CRYPT );
|
||||
}
|
||||
if (Dungeon.isChallenged( Challenges.NO_HERBALISM )){
|
||||
//sorry warden, no lucky sungrass or blandfruit seeds for you!
|
||||
specials.remove( Room.Type.GARDEN );
|
||||
}
|
||||
assignRoomType();
|
||||
|
||||
paint();
|
||||
|
|
|
@ -17,12 +17,14 @@
|
|||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.levels.painters;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Challenges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Foliage;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Room;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Sungrass;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.plants.BlandfruitBush;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Sungrass;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
public class GardenPainter extends Painter {
|
||||
|
@ -35,16 +37,19 @@ public class GardenPainter extends Painter {
|
|||
|
||||
room.entrance().set( Room.Door.Type.REGULAR );
|
||||
|
||||
int bushes = Random.Int( 3 );
|
||||
if (Dungeon.isChallenged(Challenges.NO_FOOD)) {
|
||||
if (Random.Int(2) == 0){
|
||||
level.plant(new Sungrass.Seed(), room.random());
|
||||
}
|
||||
} else {
|
||||
int bushes = Random.Int(3);
|
||||
if (bushes == 0) {
|
||||
level.plant(new Sungrass.Seed(), room.random());
|
||||
} else if (bushes == 1) {
|
||||
level.plant(new BlandfruitBush.Seed(), room.random() );
|
||||
} else {
|
||||
bushes = Random.Int( 5 );
|
||||
if (bushes == 0){
|
||||
level.plant(new BlandfruitBush.Seed(), room.random());
|
||||
} else if (Random.Int(5) == 0) {
|
||||
level.plant(new Sungrass.Seed(), room.random());
|
||||
level.plant(new BlandfruitBush.Seed(), room.random() );
|
||||
level.plant(new BlandfruitBush.Seed(), room.random());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user