diff --git a/core/src/main/assets/statue.png b/core/src/main/assets/statue.png index 3b2bdb834..d33e1e848 100644 Binary files a/core/src/main/assets/statue.png and b/core/src/main/assets/statue.png differ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/ArmoredStatue.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/ArmoredStatue.java new file mode 100644 index 000000000..d67ea29d0 --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/ArmoredStatue.java @@ -0,0 +1,110 @@ +/* + * 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.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.items.Generator; +import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; +import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; +import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite; +import com.shatteredpixel.shatteredpixeldungeon.sprites.StatueSprite; +import com.watabou.utils.Bundle; +import com.watabou.utils.Random; + +public class ArmoredStatue extends Statue { + + { + spriteClass = StatueSprite.class; + } + + protected Armor armor; + + public ArmoredStatue(){ + super(); + + do { + armor = Generator.randomArmor(); + } while (armor.cursed); + armor.inscribe(Armor.Glyph.random()); + + //double HP + HP = HT = 30 + Dungeon.depth * 10; + } + + private static final String ARMOR = "armor"; + + @Override + public void storeInBundle( Bundle bundle ) { + super.storeInBundle( bundle ); + bundle.put( ARMOR, armor ); + } + + @Override + public void restoreFromBundle( Bundle bundle ) { + super.restoreFromBundle( bundle ); + armor = (Armor)bundle.get( ARMOR ); + } + + @Override + public int drRoll() { + return super.drRoll() + Random.NormalIntRange( armor.DRMin(), armor.DRMax()); + } + + @Override + public int defenseProc(Char enemy, int damage) { + return armor.proc(enemy, this, damage); + } + + @Override + public CharSprite sprite() { + CharSprite sprite = super.sprite(); + ((StatueSprite)sprite).setArmor(armor.tier); + return sprite; + } + + @Override + public float speed() { + return armor.speedFactor(this, super.speed()); + } + + @Override + public float stealth() { + return armor.stealthFactor(this, super.stealth()); + } + + @Override + public int defenseSkill(Char enemy) { + return Math.round(armor.evasionFactor(this, super.defenseSkill(enemy))); + } + + @Override + public boolean isImmune(Class effect) { + return super.isImmune(effect); + } + + @Override + public String description() { + return Messages.get(this, "desc", weapon.name(), armor.name()); + } + +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Statue.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Statue.java index 017231de1..6c3f8a243 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Statue.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Statue.java @@ -160,5 +160,13 @@ public class Statue extends Mob { { resistances.add(Grim.class); } + + public static Statue random(){ + if (Random.Int(10) == 0){ + return new ArmoredStatue(); + } else { + return new Statue(); + } + } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/StatueRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/StatueRoom.java index 7eeb91660..7c2663e8a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/StatueRoom.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/StatueRoom.java @@ -67,7 +67,7 @@ public class StatueRoom extends SpecialRoom { } - Statue statue = new Statue(); + Statue statue = Statue.random(); statue.pos = cx + cy * level.width(); level.mobs.add( statue ); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/DistortionTrap.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/DistortionTrap.java index 8e53ed129..c63ce67d4 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/DistortionTrap.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/DistortionTrap.java @@ -124,7 +124,7 @@ public class DistortionTrap extends Trap{ Mimic.spawnAt(point, new ArrayList<>()); continue; //mimics spawn themselves, no need to do more case 3: - mob = new Statue(); + mob = Statue.random(); break; } break; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/StatueSprite.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/StatueSprite.java index 555a8d5a7..57505b055 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/StatueSprite.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/StatueSprite.java @@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.sprites; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.watabou.noosa.TextureFilm; +import com.watabou.utils.GameMath; public class StatueSprite extends MobSprite { @@ -47,7 +48,23 @@ public class StatueSprite extends MobSprite { play( idle ); } - + + private static int[] tierFrames = {0, 21, 32, 43, 54, 63}; + + public void setArmor( int tier ){ + int c = tierFrames[(int)GameMath.gate(0, tier, 5)]; + + TextureFilm frames = new TextureFilm( texture, 12, 15 ); + + idle.frames( frames, 0+c, 0+c, 0+c, 0+c, 0+c, 1+c, 1+c ); + run.frames( frames, 2+c, 3+c, 4+c, 5+c, 6+c, 7+c ); + attack.frames( frames, 8+c, 9+c, 10+c ); + //death animation is always armorless + + play( idle, true ); + + } + @Override public int blood() { return 0xFFcdcdb7; 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 a14ee9bd8..787d75ed3 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 @@ -448,6 +448,9 @@ actors.mobs.acidic.desc=These huge arachnid-like demonic creatures avoid close c actors.mobs.albino.name=albino rat actors.mobs.albino.desc=This is a rare breed of marsupial rat, with pure white fur and jagged teeth. +actors.mobs.armoredstatue.name=armored statue +actors.mobs.armoredstatue.desc=You would think that it's just another one of this dungeon's inanimate statues, but its red glowing eyes give it away.\n\nIt seems to be in great condition because of the armor it's wearing, it might be very hard to kill.\n\nWhile the statue itself is made of stone, the _%1$s_ and _%2$s_ it's wielding look real. + actors.mobs.bandit.name=crazy bandit actors.mobs.bat.name=vampire bat @@ -618,7 +621,7 @@ actors.mobs.spinner.desc=These greenish furry cave spiders try to avoid direct c actors.mobs.statue.name=animated statue actors.mobs.statue.def_verb=blocked -actors.mobs.statue.desc=You would think that it's just another one of this dungeon's ugly statues, but its red glowing eyes give it away.\n\nWhile the statue itself is made of stone, the _%s,_ it's wielding, looks real. +actors.mobs.statue.desc=You would think that it's just another one of this dungeon's inanimate statues, but its red glowing eyes give it away.\n\nWhile the statue itself is made of stone, the _%s,_ it's wielding looks real. actors.mobs.succubus.name=succubus actors.mobs.succubus.desc=Succubi are shapeshifting demons that manipulate the minds of their prey. This one has taken the form of a pale gothic humanoid, perhaps to attract dwarven warlocks?\n\nWhen they attack, succubi may charm their target, making them unable to directly attack until the charm wears off. When succubi attack a charmed enemy, they will steal their life essence.