From 97483b806232233fc23863c69d5c5cd72c05dbf8 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Thu, 22 Nov 2018 19:00:01 -0500 Subject: [PATCH] v0.7.1: adjusted wand of regrowth to work with furrowed grass Also removed now-unnecessary checks for blandfruit seeds --- .../actors/blobs/Regrowth.java | 3 ++- .../items/wands/WandOfRegrowth.java | 26 ++++++++----------- .../levels/features/HighGrass.java | 12 +-------- .../shatteredpixeldungeon/plants/Plant.java | 10 +------ 4 files changed, 15 insertions(+), 36 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Regrowth.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Regrowth.java index 2bde0a789..d7a2fca61 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Regrowth.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Regrowth.java @@ -49,7 +49,8 @@ public class Regrowth extends Blob { if (c == Terrain.EMPTY || c == Terrain.EMBERS || c == Terrain.EMPTY_DECO) { c1 = (cur[cell] > 9 && Actor.findChar( cell ) == null) ? Terrain.HIGH_GRASS : Terrain.GRASS; - } else if (c == Terrain.GRASS && cur[cell] > 9 && Dungeon.level.plants.get(cell) == null && Actor.findChar( cell ) == null ) { + } else if ((c == Terrain.GRASS || c == Terrain.FURROWED_GRASS) + && cur[cell] > 9 && Dungeon.level.plants.get(cell) == null && Actor.findChar( cell ) == null ) { c1 = Terrain.HIGH_GRASS; } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfRegrowth.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfRegrowth.java index c28ff7017..77684119d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfRegrowth.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfRegrowth.java @@ -35,7 +35,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff; import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; -import com.shatteredpixel.shatteredpixeldungeon.plants.BlandfruitBush; import com.shatteredpixel.shatteredpixeldungeon.plants.Plant; import com.shatteredpixel.shatteredpixeldungeon.plants.Starflower; import com.shatteredpixel.shatteredpixeldungeon.plants.Sungrass; @@ -117,10 +116,14 @@ public class WandOfRegrowth extends Wand { processSoulMark(ch, chargesPerCast()); } - if (Random.Int(50) < overLimit){ - GameScene.add( Blob.seed( i, 9, Regrowth.class ) ); + if (Random.Int(50) < overLimit) { + if (Dungeon.level.map[i] == Terrain.GRASS) { + Level.set( i, Terrain.FURROWED_GRASS ); + GameScene.updateMap( i ); + } + GameScene.add(Blob.seed(i, 9, Regrowth.class)); } else { - GameScene.add( Blob.seed( i, 10, Regrowth.class ) ); + GameScene.add(Blob.seed(i, 10, Regrowth.class)); } } @@ -139,7 +142,7 @@ public class WandOfRegrowth extends Wand { } private void spreadRegrowth(int cell, float strength){ - if (strength >= 0 && Dungeon.level.passable[cell] && !Dungeon.level.losBlocking[cell]){ + if (strength >= 0 && Dungeon.level.passable[cell]){ affectedCells.add(cell); if (strength >= 1.5f) { spreadRegrowth(cell + PathFinder.CIRCLE8[left(direction)], strength - 1.5f); @@ -148,7 +151,7 @@ public class WandOfRegrowth extends Wand { } else { visualCells.add(cell); } - } else if (!Dungeon.level.passable[cell] || Dungeon.level.losBlocking[cell]) + } else if (!Dungeon.level.passable[cell]) visualCells.add(cell); } @@ -158,14 +161,7 @@ public class WandOfRegrowth extends Wand { while(cells.hasNext() && Random.Float() <= numPlants){ Plant.Seed seed = (Plant.Seed) Generator.random(Generator.Category.SEED); - - if (seed instanceof BlandfruitBush.Seed) { - if (Random.Int(3) - Dungeon.LimitedDrops.BLANDFRUIT_SEED.count >= 0) { - floor.plant(seed, cells.next()); - Dungeon.LimitedDrops.BLANDFRUIT_SEED.count++; - } - } else - floor.plant(seed, cells.next()); + floor.plant(seed, cells.next()); numPlants --; } @@ -229,7 +225,7 @@ public class WandOfRegrowth extends Wand { float strength = maxDist; for (int c : bolt.subPath(1, dist)) { strength--; //as we start at dist 1, not 0. - if (!Dungeon.level.losBlocking[c]) { + if (Dungeon.level.passable[c]) { affectedCells.add(c); spreadRegrowth(c + PathFinder.CIRCLE8[left(direction)], strength - 1); spreadRegrowth(c + PathFinder.CIRCLE8[direction], strength - 1); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/HighGrass.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/HighGrass.java index 16d57e5ac..26a0a84fd 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/HighGrass.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/HighGrass.java @@ -32,12 +32,10 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter; import com.shatteredpixel.shatteredpixeldungeon.effects.particles.LeafParticle; import com.shatteredpixel.shatteredpixeldungeon.items.Dewdrop; import com.shatteredpixel.shatteredpixeldungeon.items.Generator; -import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Camouflage; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.SandalsOfNature; import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; -import com.shatteredpixel.shatteredpixeldungeon.plants.BlandfruitBush; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.watabou.utils.Random; @@ -84,15 +82,7 @@ public class HighGrass { if (naturalismLevel >= 0) { // Seed, scales from 1/20 to 1/4 if (Random.Int(20 - (naturalismLevel * 4)) == 0) { - Item seed = Generator.random(Generator.Category.SEED); - - if (seed instanceof BlandfruitBush.Seed) { - if (Random.Int(3) - Dungeon.LimitedDrops.BLANDFRUIT_SEED.count >= 0) { - level.drop(seed, pos).sprite.drop(); - Dungeon.LimitedDrops.BLANDFRUIT_SEED.count++; - } - } else - level.drop(seed, pos).sprite.drop(); + level.drop(Generator.random(Generator.Category.SEED), pos).sprite.drop(); } // Dew, scales from 1/6 to 1/3 diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Plant.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Plant.java index b3184f984..34dfd38d0 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Plant.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Plant.java @@ -88,15 +88,7 @@ public abstract class Plant implements Bundlable { } if (Random.Int( 5 - (naturalismLevel/2) ) == 0) { - Item seed = Generator.random(Generator.Category.SEED); - - if (seed instanceof BlandfruitBush.Seed) { - if (Random.Int(3) - Dungeon.LimitedDrops.BLANDFRUIT_SEED.count >= 0) { - Dungeon.level.drop(seed, pos).sprite.drop(); - Dungeon.LimitedDrops.BLANDFRUIT_SEED.count++; - } - } else - Dungeon.level.drop(seed, pos).sprite.drop(); + Dungeon.level.drop(Generator.random(Generator.Category.SEED), pos).sprite.drop(); } if (Random.Int( 5 - naturalismLevel ) == 0) { Dungeon.level.drop( new Dewdrop(), pos ).sprite.drop();