v2.3.0: made wraith classes more flexible, and added one for corpse dust
This commit is contained in:
@@ -835,7 +835,7 @@ public abstract class Mob extends Char {
|
|||||||
if (!(this instanceof Wraith)
|
if (!(this instanceof Wraith)
|
||||||
&& soulMarked
|
&& soulMarked
|
||||||
&& Random.Float() < (0.4f*Dungeon.hero.pointsInTalent(Talent.NECROMANCERS_MINIONS)/3f)){
|
&& 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) {
|
if (w != null) {
|
||||||
Buff.affect(w, Corruption.class);
|
Buff.affect(w, Corruption.class);
|
||||||
if (Dungeon.level.heroFOV[pos]) {
|
if (Dungeon.level.heroFOV[pos]) {
|
||||||
|
|||||||
+1
-1
@@ -151,7 +151,7 @@ public class SpectralNecromancer extends Necromancer {
|
|||||||
|
|
||||||
summoning = firstSummon = false;
|
summoning = firstSummon = false;
|
||||||
|
|
||||||
Wraith wraith = Wraith.spawnAt(summoningPos, false);
|
Wraith wraith = Wraith.spawnAt(summoningPos, Wraith.class);
|
||||||
wraith.adjustStats(0);
|
wraith.adjustStats(0);
|
||||||
Dungeon.level.occupyCell( wraith );
|
Dungeon.level.occupyCell( wraith );
|
||||||
((SpectralNecromancerSprite)sprite).finishSummoning();
|
((SpectralNecromancerSprite)sprite).finishSummoning();
|
||||||
|
|||||||
+20
-6
@@ -32,6 +32,7 @@ import com.watabou.noosa.tweeners.AlphaTweener;
|
|||||||
import com.watabou.utils.Bundle;
|
import com.watabou.utils.Bundle;
|
||||||
import com.watabou.utils.PathFinder;
|
import com.watabou.utils.PathFinder;
|
||||||
import com.watabou.utils.Random;
|
import com.watabou.utils.Random;
|
||||||
|
import com.watabou.utils.Reflection;
|
||||||
|
|
||||||
public class Wraith extends Mob {
|
public class Wraith extends Mob {
|
||||||
|
|
||||||
@@ -94,20 +95,33 @@ public class Wraith extends Mob {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void spawnAround( int pos, boolean allowExotic ) {
|
public static void spawnAround( int pos ) {
|
||||||
|
spawnAround( pos, null );
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void spawnAround( int pos, Class<? extends Wraith> wraithClass ) {
|
||||||
for (int n : PathFinder.NEIGHBOURS4) {
|
for (int n : PathFinder.NEIGHBOURS4) {
|
||||||
spawnAt( pos + n, allowExotic );
|
spawnAt( pos + n, wraithClass );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Wraith spawnAt( int pos, boolean allowExotic ) {
|
public static Wraith spawnAt( int pos ) {
|
||||||
|
return spawnAt( pos, null );
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Wraith spawnAt( int pos, Class<? extends Wraith> wraithClass ) {
|
||||||
if ((!Dungeon.level.solid[pos] || Dungeon.level.passable[pos]) && Actor.findChar( pos ) == null) {
|
if ((!Dungeon.level.solid[pos] || Dungeon.level.passable[pos]) && Actor.findChar( pos ) == null) {
|
||||||
|
|
||||||
Wraith w;
|
Wraith w;
|
||||||
if (allowExotic && Random.Int(100) == 0){
|
//if no wraith type is specified, 1/100 chance for exotic, otherwise normal
|
||||||
w = new TormentedSpirit();
|
if (wraithClass == null){
|
||||||
|
if (Random.Int(100) == 0){
|
||||||
|
w = new TormentedSpirit();
|
||||||
|
} else {
|
||||||
|
w = new Wraith();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
w = new Wraith();
|
w = Reflection.newInstance(wraithClass);
|
||||||
}
|
}
|
||||||
w.adjustStats( Dungeon.scalingDepth() );
|
w.adjustStats( Dungeon.scalingDepth() );
|
||||||
w.pos = pos;
|
w.pos = pos;
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ public class Heap implements Bundlable {
|
|||||||
public void open( Hero hero ) {
|
public void open( Hero hero ) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case TOMB:
|
case TOMB:
|
||||||
Wraith.spawnAround( hero.pos, true );
|
Wraith.spawnAround( hero.pos );
|
||||||
break;
|
break;
|
||||||
case REMAINS:
|
case REMAINS:
|
||||||
case SKELETON:
|
case SKELETON:
|
||||||
@@ -94,7 +94,7 @@ public class Heap implements Bundlable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (haunted){
|
if (haunted){
|
||||||
if (Wraith.spawnAt( pos, true ) == null) {
|
if (Wraith.spawnAt( pos ) == null) {
|
||||||
hero.sprite.emitter().burst( ShadowParticle.CURSE, 6 );
|
hero.sprite.emitter().burst( ShadowParticle.CURSE, 6 );
|
||||||
hero.damage( hero.HP / 2, this );
|
hero.damage( hero.HP / 2, this );
|
||||||
if (!hero.isAlive()){
|
if (!hero.isAlive()){
|
||||||
|
|||||||
+1
-1
@@ -438,7 +438,7 @@ public class DriedRose extends Artifact {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (spawnPoints.size() > 0) {
|
if (spawnPoints.size() > 0) {
|
||||||
Wraith.spawnAt(Random.element(spawnPoints), false);
|
Wraith.spawnAt(Random.element(spawnPoints), Wraith.class);
|
||||||
Sample.INSTANCE.play(Assets.Sounds.CURSED);
|
Sample.INSTANCE.play(Assets.Sounds.CURSED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-3
@@ -105,7 +105,7 @@ public class CorpseDust extends Item {
|
|||||||
spawnPower++;
|
spawnPower++;
|
||||||
int wraiths = 1; //we include the wraith we're trying to spawn
|
int wraiths = 1; //we include the wraith we're trying to spawn
|
||||||
for (Mob mob : Dungeon.level.mobs){
|
for (Mob mob : Dungeon.level.mobs){
|
||||||
if (mob instanceof Wraith){
|
if (mob instanceof DustWraith){
|
||||||
wraiths++;
|
wraiths++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -130,7 +130,7 @@ public class CorpseDust extends Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!candidates.isEmpty()){
|
if (!candidates.isEmpty()){
|
||||||
Wraith.spawnAt(Random.element(candidates), false);
|
Wraith.spawnAt(Random.element(candidates), DustWraith.class);
|
||||||
Sample.INSTANCE.play(Assets.Sounds.CURSED);
|
Sample.INSTANCE.play(Assets.Sounds.CURSED);
|
||||||
spawnPower -= powerNeeded;
|
spawnPower -= powerNeeded;
|
||||||
}
|
}
|
||||||
@@ -143,7 +143,7 @@ public class CorpseDust extends Item {
|
|||||||
public void dispel(){
|
public void dispel(){
|
||||||
detach();
|
detach();
|
||||||
for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])){
|
for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])){
|
||||||
if (mob instanceof Wraith){
|
if (mob instanceof DustWraith){
|
||||||
mob.die(null);
|
mob.die(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -177,4 +177,6 @@ public class CorpseDust extends Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class DustWraith extends Wraith{};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-8
@@ -89,11 +89,11 @@ public class WandOfCorruption extends Wand {
|
|||||||
private static final float MINOR_DEBUFF_WEAKEN = 1/4f;
|
private static final float MINOR_DEBUFF_WEAKEN = 1/4f;
|
||||||
private static final HashMap<Class<? extends Buff>, Float> MINOR_DEBUFFS = new HashMap<>();
|
private static final HashMap<Class<? extends Buff>, Float> MINOR_DEBUFFS = new HashMap<>();
|
||||||
static{
|
static{
|
||||||
MINOR_DEBUFFS.put(Weakness.class, 2f);
|
MINOR_DEBUFFS.put(Weakness.class, 0f);
|
||||||
MINOR_DEBUFFS.put(Vulnerable.class, 2f);
|
MINOR_DEBUFFS.put(Vulnerable.class, 0f);
|
||||||
MINOR_DEBUFFS.put(Cripple.class, 1f);
|
MINOR_DEBUFFS.put(Cripple.class, 0f);
|
||||||
MINOR_DEBUFFS.put(Blindness.class, 1f);
|
MINOR_DEBUFFS.put(Blindness.class, 0f);
|
||||||
MINOR_DEBUFFS.put(Terror.class, 1f);
|
MINOR_DEBUFFS.put(Terror.class, 0f);
|
||||||
|
|
||||||
MINOR_DEBUFFS.put(Chill.class, 0f);
|
MINOR_DEBUFFS.put(Chill.class, 0f);
|
||||||
MINOR_DEBUFFS.put(Ooze.class, 0f);
|
MINOR_DEBUFFS.put(Ooze.class, 0f);
|
||||||
@@ -109,9 +109,9 @@ public class WandOfCorruption extends Wand {
|
|||||||
private static final HashMap<Class<? extends Buff>, Float> MAJOR_DEBUFFS = new HashMap<>();
|
private static final HashMap<Class<? extends Buff>, Float> MAJOR_DEBUFFS = new HashMap<>();
|
||||||
static{
|
static{
|
||||||
MAJOR_DEBUFFS.put(Amok.class, 3f);
|
MAJOR_DEBUFFS.put(Amok.class, 3f);
|
||||||
MAJOR_DEBUFFS.put(Slow.class, 2f);
|
MAJOR_DEBUFFS.put(Slow.class, 0f);
|
||||||
MAJOR_DEBUFFS.put(Hex.class, 2f);
|
MAJOR_DEBUFFS.put(Hex.class, 0f);
|
||||||
MAJOR_DEBUFFS.put(Paralysis.class, 1f);
|
MAJOR_DEBUFFS.put(Paralysis.class, 0f);
|
||||||
|
|
||||||
MAJOR_DEBUFFS.put(Daze.class, 0f);
|
MAJOR_DEBUFFS.put(Daze.class, 0f);
|
||||||
MAJOR_DEBUFFS.put(Dread.class, 0f);
|
MAJOR_DEBUFFS.put(Dread.class, 0f);
|
||||||
|
|||||||
+1
-1
@@ -116,7 +116,7 @@ public class DistortionTrap extends Trap{
|
|||||||
case 2:
|
case 2:
|
||||||
switch (2){
|
switch (2){
|
||||||
case 0: default:
|
case 0: default:
|
||||||
Wraith.spawnAt(point, true);
|
Wraith.spawnAt(point);
|
||||||
continue; //wraiths spawn themselves, no need to do more
|
continue; //wraiths spawn themselves, no need to do more
|
||||||
case 1:
|
case 1:
|
||||||
//yes it's intended that these are likely to die right away
|
//yes it's intended that these are likely to die right away
|
||||||
|
|||||||
Reference in New Issue
Block a user