diff --git a/assets/rot_heart.png b/assets/rot_heart.png new file mode 100644 index 000000000..1fdbfb814 Binary files /dev/null and b/assets/rot_heart.png differ diff --git a/assets/rot_lasher.png b/assets/rot_lasher.png new file mode 100644 index 000000000..0a58e6f9c Binary files /dev/null and b/assets/rot_lasher.png differ diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/Assets.java b/src/com/shatteredpixel/shatteredpixeldungeon/Assets.java index 16d950620..bd5299fd2 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/Assets.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/Assets.java @@ -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"; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/RotHeart.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/RotHeart.java new file mode 100644 index 000000000..88d518006 --- /dev/null +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/RotHeart.java @@ -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 + */ +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> IMMUNITIES = new HashSet>(); + static { + IMMUNITIES.add( ToxicGas.class ); + } + + @Override + public HashSet> immunities() { + return IMMUNITIES; + } + +} diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/RotLasher.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/RotLasher.java new file mode 100644 index 000000000..699e01315 --- /dev/null +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/RotLasher.java @@ -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 + */ +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> IMMUNITIES = new HashSet>(); + static { + IMMUNITIES.add( ToxicGas.class ); + } + + @Override + public HashSet> immunities() { + return IMMUNITIES; + } + +} diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/Room.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/Room.java index 3b2849d3e..5097b640f 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/Room.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/Room.java @@ -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; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/RotGardenPainter.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/RotGardenPainter.java new file mode 100644 index 000000000..345cde063 --- /dev/null +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/RotGardenPainter.java @@ -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 + */ +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 ); + } + } +} diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/RotHeartSprite.java b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/RotHeartSprite.java new file mode 100644 index 000000000..2a69fb382 --- /dev/null +++ b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/RotHeartSprite.java @@ -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 + */ +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 ); + } +} diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/sprites/RotLasherSprite.java b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/RotLasherSprite.java new file mode 100644 index 000000000..0817867ff --- /dev/null +++ b/src/com/shatteredpixel/shatteredpixeldungeon/sprites/RotLasherSprite.java @@ -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 + */ +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 ); + } +}