From 23cb08406a8ab9b45188abbebd207787b4e5d627 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sat, 10 Oct 2015 19:52:48 -0400 Subject: [PATCH] v0.3.2: added in a painter for the rot garden with some basic sprites --- assets/rot_heart.png | Bin 0 -> 487 bytes assets/rot_lasher.png | Bin 0 -> 276 bytes .../shatteredpixeldungeon/Assets.java | 2 + .../actors/mobs/RotHeart.java | 113 ++++++++++++++++++ .../actors/mobs/RotLasher.java | 104 ++++++++++++++++ .../shatteredpixeldungeon/levels/Room.java | 2 +- .../levels/painters/RotGardenPainter.java | 73 +++++++++++ .../sprites/RotHeartSprite.java | 50 ++++++++ .../sprites/RotLasherSprite.java | 49 ++++++++ 9 files changed, 392 insertions(+), 1 deletion(-) create mode 100644 assets/rot_heart.png create mode 100644 assets/rot_lasher.png create mode 100644 src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/RotHeart.java create mode 100644 src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/RotLasher.java create mode 100644 src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/RotGardenPainter.java create mode 100644 src/com/shatteredpixel/shatteredpixeldungeon/sprites/RotHeartSprite.java create mode 100644 src/com/shatteredpixel/shatteredpixeldungeon/sprites/RotLasherSprite.java diff --git a/assets/rot_heart.png b/assets/rot_heart.png new file mode 100644 index 0000000000000000000000000000000000000000..1fdbfb8140a74398300d82863500fd1f1fb2a431 GIT binary patch literal 487 zcmeAS@N?(olHy`uVBq!ia0vp^4L~fw!3HGnMU-~{DYhhUcNd2LAh=-f^2tCE&H|6f zVg?3oVGw3ym^DWND9B#o>FdgVpNoq_lB>S_ts+oJHZvrm#5q4VH#M&W$Yo$~E=o-- zNlj5G&n(GMaQE~LNYP7WXJBCT_H=O!$+-7+hGSNoEf#2C-e%5;avjgBuz&8T?qd??$R0 zo54_O^wBio*VP*JmIlq`ml86jM{)gWWQh5^|FOAC!1|5L{wXtVG2OqKqlep`sYhGH zL9On6r~S<29veoxd0WGMr&lE>Fs`{)e9Gj_9nSA*0m~MyyHG!rRl;&t;ucLK6V^7rFdgVpNor8Sdc;I`w5`XLQfaRkc@k8XL@rr81S$PSD%@8 zKH2Mz#*P(}(l>ICTE@*Ik`R6P{ + */ +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 ); + } +}