v0.3.2: added in a painter for the rot garden with some basic sprites

This commit is contained in:
Evan Debenham 2015-10-10 19:52:48 -04:00
parent 2b8a65b529
commit 23cb08406a
9 changed files with 392 additions and 1 deletions

BIN
assets/rot_heart.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 487 B

BIN
assets/rot_lasher.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 B

View File

@ -90,6 +90,8 @@ public class Assets {
public static final String RATKING = "ratking.png";
public static final String BEE = "bee.png";
public static final String MIMIC = "mimic.png";
public static final String ROT_LASH = "rot_lasher.png";
public static final String ROT_HEART= "rot_heart.png";
public static final String ITEMS = "items.png";
public static final String PLANTS = "plants.png";

View File

@ -0,0 +1,113 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2015 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.actors.mobs;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ToxicGas;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Wandmaker;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.RotHeartSprite;
import java.util.HashSet;
public class RotHeart extends Mob {
{
name = "rot heart";
spriteClass = RotHeartSprite.class;
HP = HT = 80;
defenseSkill = 0;
loot = Wandmaker.Rotberry.Seed.class;
lootChance = 1f;
state = PASSIVE;
}
@Override
protected boolean act() {
if (Dungeon.level.map[pos] != Terrain.GRASS && Dungeon.level.map[pos] != Terrain.HIGH_GRASS){
destroy();
sprite.die();
return true;
} else {
return super.act();
}
}
@Override
public int defenseProc(Char enemy, int damage) {
GameScene.add(Blob.seed(pos, 20, ToxicGas.class));
return super.defenseProc(enemy, damage);
}
@Override
protected boolean getCloser(int target) {
return false;
}
@Override
public void destroy() {
super.destroy();
for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )){
if (mob instanceof RotLasher){
mob.die(null);
}
}
}
@Override
public int damageRoll() {
return 0;
}
@Override
public int attackSkill( Char target ) {
return 0;
}
@Override
public int dr() {
return 5;
}
@Override
public String description() {
return
"heart";
}
private static final HashSet<Class<?>> IMMUNITIES = new HashSet<Class<?>>();
static {
IMMUNITIES.add( ToxicGas.class );
}
@Override
public HashSet<Class<?>> immunities() {
return IMMUNITIES;
}
}

View File

@ -0,0 +1,104 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2015 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
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.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Cripple;
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.sprites.RotLasherSprite;
import com.watabou.utils.Random;
import java.util.HashSet;
public class RotLasher extends Mob {
{
name = "rot lasher";
spriteClass = RotLasherSprite.class;
HP = HT = 40;
defenseSkill = 4;
loot = Generator.Category.SEED;
lootChance = 1f;
state = WANDERING;
}
@Override
protected boolean act() {
if (Dungeon.level.map[pos] != Terrain.GRASS && Dungeon.level.map[pos] != Terrain.HIGH_GRASS){
destroy();
sprite.die();
return true;
} else {
HP = Math.min(HT, HP + 2);
return super.act();
}
}
@Override
public int attackProc(Char enemy, int damage) {
Buff.affect( enemy, Cripple.class, 2f );
return super.attackProc(enemy, damage);
}
@Override
protected boolean getCloser(int target) {
return false;
}
@Override
public int damageRoll() {
return Random.NormalIntRange(4, 12);
}
@Override
public int attackSkill( Char target ) {
return 15;
}
@Override
public int dr() {
return 8;
}
@Override
public String description() {
return
"lasher";
}
private static final HashSet<Class<?>> IMMUNITIES = new HashSet<Class<?>>();
static {
IMMUNITIES.add( ToxicGas.class );
}
@Override
public HashSet<Class<?>> immunities() {
return IMMUNITIES;
}
}

View File

@ -72,7 +72,7 @@ public class Room extends Rect implements Graph.Node, Bundlable {
//prison quests
MASS_GRAVE ( MassGravePainter.class ),
ROT_GARDEN ( StandardPainter.class ),
ROT_GARDEN ( RotGardenPainter.class ),
RITUAL_SITE ( RitualSitePainter.class );
private Method paint;

View File

@ -0,0 +1,73 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2015 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.levels.painters;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.RotHeart;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.RotLasher;
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.watabou.utils.Random;
public class RotGardenPainter extends Painter {
public static void paint( Level level, Room room ) {
Room.Door entrance = room.entrance();
entrance.set(Room.Door.Type.LOCKED);
level.addItemToSpawn(new IronKey(Dungeon.depth));
fill(level, room, Terrain.WALL);
fill(level, room, 1, Terrain.HIGH_GRASS);
int heartX = Random.IntRange(room.left+1, room.right-1);
int heartY = Random.IntRange(room.top+1, room.bottom-1);
if (entrance.x == room.left) {
heartX = room.right - 1;
} else if (entrance.x == room.right) {
heartX = room.left + 1;
} else if (entrance.y == room.top) {
heartY = room.bottom - 1;
} else if (entrance.y == room.bottom) {
heartY = room.top + 1;
}
RotHeart heart = 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;
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 );
}
}
}

View File

@ -0,0 +1,50 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2015 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.sprites;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.watabou.noosa.MovieClip;
import com.watabou.noosa.TextureFilm;
public class RotHeartSprite extends MobSprite {
public RotHeartSprite(){
super();
texture( Assets.ROT_HEART );
TextureFilm frames = new TextureFilm( texture, 16, 16 );
idle = new MovieClip.Animation( 8, true );
idle.frames( frames, 0);
run = new MovieClip.Animation( 12, true );
run.frames( frames, 0, 1 );
attack = new MovieClip.Animation( 12, false );
attack.frames( frames, 2, 3, 0, 1 );
die = new MovieClip.Animation( 12, false );
die.frames( frames, 4, 5, 6 );
play( idle );
}
}

View File

@ -0,0 +1,49 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2015 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.sprites;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.watabou.noosa.TextureFilm;
public class RotLasherSprite extends MobSprite {
public RotLasherSprite() {
super();
texture( Assets.ROT_LASH );
TextureFilm frames = new TextureFilm( texture, 12, 16 );
idle = new Animation( 8, true );
idle.frames( frames, 0, 1, 2, 3 );
run = new Animation( 12, true );
run.frames( frames, 0, 1 );
attack = new Animation( 12, false );
attack.frames( frames, 2, 3, 0, 1 );
die = new Animation( 12, false );
die.frames( frames, 4, 5, 6 );
play( idle );
}
}