diff --git a/assets/rot_heart.png b/assets/rot_heart.png index 1fdbfb814..653191c6e 100644 Binary files a/assets/rot_heart.png and b/assets/rot_heart.png differ diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Wandmaker.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Wandmaker.java index 60ee28983..5a7686b4d 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Wandmaker.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Wandmaker.java @@ -108,7 +108,6 @@ public class Wandmaker extends NPC { "If you can get that for me, I'll be happy to pay you with one of my finely crafted wands! " + "I brought two with me, so you can take whichever one you prefer."; - //TODO private static final String REMINDER_DUST = "Any luck with corpse dust, %s? Look for some barricades."; @@ -436,26 +435,6 @@ public class Wandmaker extends NPC { alchemyClass = PotionOfStrength.class; } - @Override - public boolean doPickUp( Hero hero ) { - if (super.doPickUp(hero)) { - - if (Dungeon.level != null) { - for (Mob mob : Dungeon.level.mobs) { - mob.beckon( Dungeon.hero.pos ); - } - - GLog.w( "The seed emits a roar that echoes throughout the dungeon!" ); - CellEmitter.center( Dungeon.hero.pos ).start( Speck.factory( Speck.SCREAM ), 0.3f, 3 ); - Sample.INSTANCE.play( Assets.SND_CHALLENGE ); - } - - return true; - } else { - return false; - } - } - @Override public String desc() { return TXT_DESC; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/RotGardenPainter.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/RotGardenPainter.java index 345cde063..afa8c2a4e 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/RotGardenPainter.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/RotGardenPainter.java @@ -21,6 +21,7 @@ package com.shatteredpixel.shatteredpixeldungeon.levels.painters; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.RotHeart; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.RotLasher; import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey; @@ -38,7 +39,7 @@ public class RotGardenPainter extends Painter { level.addItemToSpawn(new IronKey(Dungeon.depth)); fill(level, room, Terrain.WALL); - fill(level, room, 1, Terrain.HIGH_GRASS); + fill(level, room, 1, Terrain.GRASS); int heartX = Random.IntRange(room.left+1, room.right-1); @@ -54,20 +55,41 @@ public class RotGardenPainter extends Painter { heartY = room.top + 1; } - RotHeart heart = new RotHeart(); - heart.pos = heartX + heartY * Level.WIDTH; - level.mobs.add( heart ); + placePlant(level, heartX + heartY * Level.WIDTH, new RotHeart()); - int lashers = ((room.right-room.left-1)*(room.bottom-room.top-1))/5; + int lashers = ((room.right-room.left-1)*(room.bottom-room.top-1))/8; for (int i = 1; i <= lashers; i++){ int pos; do { pos = room.random(); - } while (level.map[pos] != Terrain.HIGH_GRASS || level.findMob(pos) != null); - RotLasher lasher = new RotLasher(); - lasher.pos = pos; - level.mobs.add( lasher ); + } while (!validPlantPos(level, pos)); + placePlant(level, pos, new RotLasher()); + } + } + + private static boolean validPlantPos(Level level, int pos){ + if (level.map[pos] != Terrain.GRASS){ + return false; + } + + for (int i : Level.NEIGHBOURS9){ + if (level.findMob(pos+i) != null){ + return false; + } + } + + return true; + } + + private static void placePlant(Level level, int pos, Mob plant){ + plant.pos = pos; + level.mobs.add( plant ); + + for(int i : Level.NEIGHBOURS8) { + if (level.map[pos + i] == Terrain.GRASS){ + set(level, pos + i, Terrain.HIGH_GRASS); + } } } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/RotHeartSprite.java b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/RotHeartSprite.java index 2a69fb382..8f7643a9e 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/RotHeartSprite.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/RotHeartSprite.java @@ -21,11 +21,16 @@ package com.shatteredpixel.shatteredpixeldungeon.sprites; import com.shatteredpixel.shatteredpixeldungeon.Assets; +import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.watabou.noosa.MovieClip; import com.watabou.noosa.TextureFilm; +import com.watabou.noosa.particles.Emitter; public class RotHeartSprite extends MobSprite { + private Emitter cloud; + public RotHeartSprite(){ super(); @@ -33,18 +38,47 @@ public class RotHeartSprite extends MobSprite { TextureFilm frames = new TextureFilm( texture, 16, 16 ); - idle = new MovieClip.Animation( 8, true ); + idle = new MovieClip.Animation( 1, true ); idle.frames( frames, 0); - run = new MovieClip.Animation( 12, true ); - run.frames( frames, 0, 1 ); + run = new MovieClip.Animation( 1, true ); + run.frames( frames, 0 ); - attack = new MovieClip.Animation( 12, false ); - attack.frames( frames, 2, 3, 0, 1 ); + attack = new MovieClip.Animation( 1, false ); + attack.frames( frames, 0 ); - die = new MovieClip.Animation( 12, false ); - die.frames( frames, 4, 5, 6 ); + die = new MovieClip.Animation( 8, false ); + die.frames( frames, 1, 2, 3, 4, 5, 6, 7, 7, 7 ); play( idle ); } + + @Override + public void link( Char ch ) { + super.link( ch ); + + if (cloud == null) { + cloud = emitter(); + cloud.pour( Speck.factory(Speck.TOXIC), 0.7f ); + } + } + + @Override + public void update() { + + super.update(); + + if (cloud != null) { + cloud.visible = visible; + } + } + + @Override + public void die() { + super.die(); + + if (cloud != null) { + cloud.on = false; + } + } }