v0.3.2: more implementation on rotberry quest (almost done)

This commit is contained in:
Evan Debenham 2015-10-21 03:03:15 -04:00
parent e54d686be4
commit 705a0f3966
4 changed files with 72 additions and 37 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 487 B

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -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! " + "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."; "I brought two with me, so you can take whichever one you prefer.";
//TODO
private static final String REMINDER_DUST = private static final String REMINDER_DUST =
"Any luck with corpse dust, %s? Look for some barricades."; "Any luck with corpse dust, %s? Look for some barricades.";
@ -436,26 +435,6 @@ public class Wandmaker extends NPC {
alchemyClass = PotionOfStrength.class; 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 @Override
public String desc() { public String desc() {
return TXT_DESC; return TXT_DESC;

View File

@ -21,6 +21,7 @@
package com.shatteredpixel.shatteredpixeldungeon.levels.painters; package com.shatteredpixel.shatteredpixeldungeon.levels.painters;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; 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.RotHeart;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.RotLasher; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.RotLasher;
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey; import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey;
@ -38,7 +39,7 @@ public class RotGardenPainter extends Painter {
level.addItemToSpawn(new IronKey(Dungeon.depth)); level.addItemToSpawn(new IronKey(Dungeon.depth));
fill(level, room, Terrain.WALL); 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); int heartX = Random.IntRange(room.left+1, room.right-1);
@ -54,20 +55,41 @@ public class RotGardenPainter extends Painter {
heartY = room.top + 1; heartY = room.top + 1;
} }
RotHeart heart = new RotHeart(); placePlant(level, heartX + heartY * Level.WIDTH, new RotHeart());
heart.pos = heartX + heartY * Level.WIDTH;
level.mobs.add( heart );
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++){ for (int i = 1; i <= lashers; i++){
int pos; int pos;
do { do {
pos = room.random(); pos = room.random();
} while (level.map[pos] != Terrain.HIGH_GRASS || level.findMob(pos) != null); } while (!validPlantPos(level, pos));
RotLasher lasher = new RotLasher(); placePlant(level, pos, new RotLasher());
lasher.pos = pos; }
level.mobs.add( lasher ); }
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);
}
} }
} }
} }

View File

@ -21,11 +21,16 @@
package com.shatteredpixel.shatteredpixeldungeon.sprites; package com.shatteredpixel.shatteredpixeldungeon.sprites;
import com.shatteredpixel.shatteredpixeldungeon.Assets; 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.MovieClip;
import com.watabou.noosa.TextureFilm; import com.watabou.noosa.TextureFilm;
import com.watabou.noosa.particles.Emitter;
public class RotHeartSprite extends MobSprite { public class RotHeartSprite extends MobSprite {
private Emitter cloud;
public RotHeartSprite(){ public RotHeartSprite(){
super(); super();
@ -33,18 +38,47 @@ public class RotHeartSprite extends MobSprite {
TextureFilm frames = new TextureFilm( texture, 16, 16 ); TextureFilm frames = new TextureFilm( texture, 16, 16 );
idle = new MovieClip.Animation( 8, true ); idle = new MovieClip.Animation( 1, true );
idle.frames( frames, 0); idle.frames( frames, 0);
run = new MovieClip.Animation( 12, true ); run = new MovieClip.Animation( 1, true );
run.frames( frames, 0, 1 ); run.frames( frames, 0 );
attack = new MovieClip.Animation( 12, false ); attack = new MovieClip.Animation( 1, false );
attack.frames( frames, 2, 3, 0, 1 ); attack.frames( frames, 0 );
die = new MovieClip.Animation( 12, false ); die = new MovieClip.Animation( 8, false );
die.frames( frames, 4, 5, 6 ); die.frames( frames, 1, 2, 3, 4, 5, 6, 7, 7, 7 );
play( idle ); 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;
}
}
} }