diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java index 9d41e863e..eea6e5236 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java @@ -835,7 +835,7 @@ public abstract class Mob extends Char { if (!(this instanceof Wraith) && soulMarked && Random.Float() < (0.4f*Dungeon.hero.pointsInTalent(Talent.NECROMANCERS_MINIONS)/3f)){ - Wraith w = Wraith.spawnAt(pos, false); + Wraith w = Wraith.spawnAt(pos, Wraith.class); if (w != null) { Buff.affect(w, Corruption.class); if (Dungeon.level.heroFOV[pos]) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/SpectralNecromancer.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/SpectralNecromancer.java index 700799616..0361d9d86 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/SpectralNecromancer.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/SpectralNecromancer.java @@ -151,7 +151,7 @@ public class SpectralNecromancer extends Necromancer { summoning = firstSummon = false; - Wraith wraith = Wraith.spawnAt(summoningPos, false); + Wraith wraith = Wraith.spawnAt(summoningPos, Wraith.class); wraith.adjustStats(0); Dungeon.level.occupyCell( wraith ); ((SpectralNecromancerSprite)sprite).finishSummoning(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Wraith.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Wraith.java index 9d82b6e90..5a33749ce 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Wraith.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Wraith.java @@ -32,6 +32,7 @@ import com.watabou.noosa.tweeners.AlphaTweener; import com.watabou.utils.Bundle; import com.watabou.utils.PathFinder; import com.watabou.utils.Random; +import com.watabou.utils.Reflection; public class Wraith extends Mob { @@ -93,21 +94,34 @@ public class Wraith extends Mob { state = WANDERING; return true; } - - public static void spawnAround( int pos, boolean allowExotic ) { - for (int n : PathFinder.NEIGHBOURS4) { - spawnAt( pos + n, allowExotic ); - } + + public static void spawnAround( int pos ) { + spawnAround( pos, null ); } - public static Wraith spawnAt( int pos, boolean allowExotic ) { + public static void spawnAround( int pos, Class wraithClass ) { + for (int n : PathFinder.NEIGHBOURS4) { + spawnAt( pos + n, wraithClass ); + } + } + + public static Wraith spawnAt( int pos ) { + return spawnAt( pos, null ); + } + + public static Wraith spawnAt( int pos, Class wraithClass ) { if ((!Dungeon.level.solid[pos] || Dungeon.level.passable[pos]) && Actor.findChar( pos ) == null) { Wraith w; - if (allowExotic && Random.Int(100) == 0){ - w = new TormentedSpirit(); + //if no wraith type is specified, 1/100 chance for exotic, otherwise normal + if (wraithClass == null){ + if (Random.Int(100) == 0){ + w = new TormentedSpirit(); + } else { + w = new Wraith(); + } } else { - w = new Wraith(); + w = Reflection.newInstance(wraithClass); } w.adjustStats( Dungeon.scalingDepth() ); w.pos = pos; @@ -123,7 +137,7 @@ public class Wraith extends Mob { } else { w.sprite.emitter().burst(ShadowParticle.CURSE, 5); } - + return w; } else { return null; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java index e244738dc..a888fb63f 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java @@ -84,7 +84,7 @@ public class Heap implements Bundlable { public void open( Hero hero ) { switch (type) { case TOMB: - Wraith.spawnAround( hero.pos, true ); + Wraith.spawnAround( hero.pos ); break; case REMAINS: case SKELETON: @@ -94,7 +94,7 @@ public class Heap implements Bundlable { } if (haunted){ - if (Wraith.spawnAt( pos, true ) == null) { + if (Wraith.spawnAt( pos ) == null) { hero.sprite.emitter().burst( ShadowParticle.CURSE, 6 ); hero.damage( hero.HP / 2, this ); if (!hero.isAlive()){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java index eb4ce9f87..aba9af54e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java @@ -438,7 +438,7 @@ public class DriedRose extends Artifact { } if (spawnPoints.size() > 0) { - Wraith.spawnAt(Random.element(spawnPoints), false); + Wraith.spawnAt(Random.element(spawnPoints), Wraith.class); Sample.INSTANCE.play(Assets.Sounds.CURSED); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/quest/CorpseDust.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/quest/CorpseDust.java index 1a446f19f..ffc7dfbce 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/quest/CorpseDust.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/quest/CorpseDust.java @@ -105,7 +105,7 @@ public class CorpseDust extends Item { spawnPower++; int wraiths = 1; //we include the wraith we're trying to spawn for (Mob mob : Dungeon.level.mobs){ - if (mob instanceof Wraith){ + if (mob instanceof DustWraith){ wraiths++; } } @@ -130,7 +130,7 @@ public class CorpseDust extends Item { } } if (!candidates.isEmpty()){ - Wraith.spawnAt(Random.element(candidates), false); + Wraith.spawnAt(Random.element(candidates), DustWraith.class); Sample.INSTANCE.play(Assets.Sounds.CURSED); spawnPower -= powerNeeded; } @@ -143,7 +143,7 @@ public class CorpseDust extends Item { public void dispel(){ detach(); for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])){ - if (mob instanceof Wraith){ + if (mob instanceof DustWraith){ mob.die(null); } } @@ -177,4 +177,6 @@ public class CorpseDust extends Item { } } + public static class DustWraith extends Wraith{}; + } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfCorruption.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfCorruption.java index 7faae4889..935a59417 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfCorruption.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfCorruption.java @@ -89,11 +89,11 @@ public class WandOfCorruption extends Wand { private static final float MINOR_DEBUFF_WEAKEN = 1/4f; private static final HashMap, Float> MINOR_DEBUFFS = new HashMap<>(); static{ - MINOR_DEBUFFS.put(Weakness.class, 2f); - MINOR_DEBUFFS.put(Vulnerable.class, 2f); - MINOR_DEBUFFS.put(Cripple.class, 1f); - MINOR_DEBUFFS.put(Blindness.class, 1f); - MINOR_DEBUFFS.put(Terror.class, 1f); + MINOR_DEBUFFS.put(Weakness.class, 0f); + MINOR_DEBUFFS.put(Vulnerable.class, 0f); + MINOR_DEBUFFS.put(Cripple.class, 0f); + MINOR_DEBUFFS.put(Blindness.class, 0f); + MINOR_DEBUFFS.put(Terror.class, 0f); MINOR_DEBUFFS.put(Chill.class, 0f); MINOR_DEBUFFS.put(Ooze.class, 0f); @@ -109,9 +109,9 @@ public class WandOfCorruption extends Wand { private static final HashMap, Float> MAJOR_DEBUFFS = new HashMap<>(); static{ MAJOR_DEBUFFS.put(Amok.class, 3f); - MAJOR_DEBUFFS.put(Slow.class, 2f); - MAJOR_DEBUFFS.put(Hex.class, 2f); - MAJOR_DEBUFFS.put(Paralysis.class, 1f); + MAJOR_DEBUFFS.put(Slow.class, 0f); + MAJOR_DEBUFFS.put(Hex.class, 0f); + MAJOR_DEBUFFS.put(Paralysis.class, 0f); MAJOR_DEBUFFS.put(Daze.class, 0f); MAJOR_DEBUFFS.put(Dread.class, 0f); 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 56ec4f642..ad3ba6c7c 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 @@ -116,7 +116,7 @@ public class DistortionTrap extends Trap{ case 2: switch (2){ case 0: default: - Wraith.spawnAt(point, true); + Wraith.spawnAt(point); continue; //wraiths spawn themselves, no need to do more case 1: //yes it's intended that these are likely to die right away