diff --git a/android/src/main/assets/slime.png b/android/src/main/assets/slime.png new file mode 100644 index 000000000..44268548f Binary files /dev/null and b/android/src/main/assets/slime.png differ diff --git a/android/src/main/assets/snake.png b/android/src/main/assets/snake.png new file mode 100644 index 000000000..d5287b246 Binary files /dev/null and b/android/src/main/assets/snake.png differ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Assets.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Assets.java index ce75a3664..bfa280187 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Assets.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Assets.java @@ -99,6 +99,8 @@ public class Assets { public static final String GUARD = "guard.png"; public static final String WARDS = "wards.png"; public static final String GUARDIAN = "guardian.png"; + public static final String SLIME = "slime.png"; + public static final String SNAKE = "snake.png"; public static final String ITEMS = "items.png"; public static final String TERRAIN_FEATURES = "terrain_features.png"; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bestiary.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bestiary.java index d768a6d15..469ac0384 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bestiary.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bestiary.java @@ -42,25 +42,28 @@ public class Bestiary { // Sewers case 1: default: - //10x rat - return new ArrayList>(Arrays.asList( - Rat.class, Rat.class, Rat.class, Rat.class, Rat.class, - Rat.class, Rat.class, Rat.class, Rat.class, Rat.class)); + //6x rat, 2x snake + return new ArrayList<>(Arrays.asList( + Rat.class, Rat.class, Rat.class, Rat.class, + Snake.class, Snake.class)); case 2: - //3x rat, 3x gnoll - return new ArrayList<>(Arrays.asList(Rat.class, Rat.class, Rat.class, - Gnoll.class, Gnoll.class, Gnoll.class)); - case 3: - //2x rat, 4x gnoll, 1x crab, 1x swarm + //2x rat, 1x snake, 2x gnoll return new ArrayList<>(Arrays.asList(Rat.class, Rat.class, - Gnoll.class, Gnoll.class, Gnoll.class, Gnoll.class, - Crab.class, Swarm.class)); - case 4: case 5: - //1x rat, 2x gnoll, 3x crab, 1x swarm + Snake.class, + Gnoll.class, Gnoll.class)); + case 3: + //1x rat, 1x snake, 3x gnoll, 1x swarm, 1x crab return new ArrayList<>(Arrays.asList(Rat.class, - Gnoll.class, Gnoll.class, - Crab.class, Crab.class, Crab.class, - Swarm.class)); + Snake.class, + Gnoll.class, Gnoll.class, Gnoll.class, + Swarm.class, + Crab.class)); + case 4: case 5: + //1x gnoll, 1x swarm, 2x crab, 2x slime + return new ArrayList<>(Arrays.asList(Gnoll.class, + Swarm.class, + Crab.class, Crab.class, + Slime.class, Slime.class)); // Prison case 6: @@ -173,8 +176,7 @@ public class Bestiary { default: return; case 4: - if (Random.Float() < 0.01f) rotation.add(Skeleton.class); - if (Random.Float() < 0.01f) rotation.add(Thief.class); + if (Random.Float() < 0.025f) rotation.add(Thief.class); return; // Prison diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Slime.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Slime.java new file mode 100644 index 000000000..5d148792f --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Slime.java @@ -0,0 +1,92 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2019 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.ShatteredPixelDungeon; +import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; +import com.shatteredpixel.shatteredpixeldungeon.items.Generator; +import com.shatteredpixel.shatteredpixeldungeon.items.Item; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon; +import com.shatteredpixel.shatteredpixeldungeon.sprites.SlimeSprite; +import com.watabou.utils.Random; + +public class Slime extends Mob { + + { + spriteClass = SlimeSprite.class; + + HP = HT = 25; + defenseSkill = 5; + + EXP = 4; + maxLvl = 9; + + lootChance = 0.1f; + } + + @Override + public int damageRoll() { + return Random.NormalIntRange( 4, 5 ); + } + + @Override + public int attackSkill( Char target ) { + return 12; + } + + @Override + public boolean act() { + + if (Dungeon.level.water[pos] && HP < HT) { + sprite.emitter().burst( Speck.factory( Speck.HEALING ), 1 ); + HP++; + } + + return super.act(); + } + + @Override + public void damage(int dmg, Object src) { + super.damage(Math.min(dmg, 6), src); + } + + @Override + public int defenseProc(Char enemy, int damage) { + return super.defenseProc(enemy, Math.min(damage, 6)); + } + + @Override + protected Item createLoot() { + try { + Generator.Category c = Generator.Category.WEP_T2; + MeleeWeapon w = (MeleeWeapon)c.classes[Random.chances(c.probs)].newInstance(); + w.random(); + w.level(0); + return w; + } catch (Exception e) { + ShatteredPixelDungeon.reportException(e); + return null; + } + } +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Snake.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Snake.java new file mode 100644 index 000000000..65e9941c5 --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Snake.java @@ -0,0 +1,52 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2019 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.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.sprites.SnakeSprite; +import com.watabou.utils.Random; + +public class Snake extends Mob { + + { + spriteClass = SnakeSprite.class; + + HP = HT = 6; + defenseSkill = 20; + + EXP = 2; + maxLvl = 7; + + //TODO loot? + } + + @Override + public int damageRoll() { + return Random.NormalIntRange( 1, 5 ); + } + + @Override + public int attackSkill( Char target ) { + return 10; + } + +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java index 189072d60..ed2dfb5d5 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java @@ -180,8 +180,8 @@ public abstract class RegularLevel extends Level { @Override protected void createMobs() { - //on floor 1, 10 rats are created so the player can get level 2. - int mobsToSpawn = Dungeon.depth == 1 ? 10 : nMobs(); + //on floor 1, 8 pre-set mobs are created so the player can get level 2. + int mobsToSpawn = Dungeon.depth == 1 ? 8 : nMobs(); ArrayList stdRooms = new ArrayList<>(); for (Room room : rooms) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/SlimeSprite.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/SlimeSprite.java new file mode 100644 index 000000000..93b79136f --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/SlimeSprite.java @@ -0,0 +1,52 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2019 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; + +//TODO currently just a recolor of goo +public class SlimeSprite extends MobSprite { + + public SlimeSprite() { + super(); + + texture( Assets.SLIME ); + + TextureFilm frames = new TextureFilm( texture, 20, 14 ); + + idle = new Animation( 10, true ); + idle.frames( frames, 2, 1, 0, 0, 1 ); + + run = new Animation( 15, true ); + run.frames( frames, 3, 2, 1, 2 ); + + attack = new Animation( 10, false ); + attack.frames( frames, 8, 9, 10 ); + + die = new Animation( 10, false ); + die.frames( frames, 5, 6, 7 ); + + play(idle); + } + +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/SnakeSprite.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/SnakeSprite.java new file mode 100644 index 000000000..479dcb96a --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/SnakeSprite.java @@ -0,0 +1,52 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2019 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; + +//TODO placeholder graphics atm +public class SnakeSprite extends MobSprite { + + public SnakeSprite() { + super(); + + texture( Assets.SNAKE ); + + TextureFilm frames = new TextureFilm( texture, 12, 12 ); + + idle = new Animation( 10, true ); + idle.frames( frames, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1 ); + + run = new Animation( 10, true ); + run.frames( frames, 3, 4 ); + + attack = new Animation( 15, false ); + attack.frames( frames, 5, 6, 7, 7, 0 ); + + die = new Animation( 10, false ); + die.frames( frames, 8, 9, 10 ); + + play(idle); + } + +} diff --git a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/actors/actors.properties b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/actors/actors.properties index bfa085573..256179375 100644 --- a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/actors/actors.properties +++ b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/actors/actors.properties @@ -557,6 +557,12 @@ actors.mobs.skeleton.explo_kill=You were killed by the explosion of bones... actors.mobs.skeleton.def_verb=blocked actors.mobs.skeleton.desc=Skeletons are composed of corpses bones from unlucky adventurers and inhabitants of the dungeon, animated by emanations of evil magic from the depths below. After they have been damaged enough, they disintegrate in an explosion of bones. +actors.mobs.slime.name=slime +actors.mobs.slime.desc=TODO + +actors.mobs.snake.name=sewer snake +actors.mobs.snake.desc=TODO + actors.mobs.spinner.name=cave spinner actors.mobs.spinner.desc=These greenish furry cave spiders try to avoid direct combat, preferring to wait in the distance while their victim, entangled in the spinner's excreted cobweb, slowly dies from their poisonous bite.