v0.8.0: various bugfixes and small functionality tweaks:

- ankhs are now blessed when thrown into water of health
- demon spawners are no longer removed by unblessed ankhs
- golems now interrupt the hero when teleporting them
- fixed mimics not revealing themselves in some cases where they should
- tweaked when a space is considered open for large enemies
- fixed further AI weirdness with retreating characters
This commit is contained in:
Evan Debenham 2019-12-18 17:26:22 -05:00
parent e874dea93e
commit 6b0b4f60e1
7 changed files with 51 additions and 9 deletions

View File

@ -129,7 +129,7 @@ public class PathFinder {
public static int getStepBack( int cur, int from, boolean[] passable ) { public static int getStepBack( int cur, int from, boolean[] passable ) {
int d = buildEscapeDistanceMap( cur, from, 5f, passable ); int d = buildEscapeDistanceMap( cur, from, 5, passable );
for (int i=0; i < size; i++) { for (int i=0; i < size; i++) {
goals[i] = distance[i] == d; goals[i] = distance[i] == d;
} }
@ -285,7 +285,7 @@ public class PathFinder {
return pathFound; return pathFound;
} }
private static int buildEscapeDistanceMap( int cur, int from, float factor, boolean[] passable ) { private static int buildEscapeDistanceMap( int cur, int from, int lookAhead, boolean[] passable ) {
System.arraycopy(maxVal, 0, distance, 0, maxVal.length); System.arraycopy(maxVal, 0, distance, 0, maxVal.length);
@ -311,7 +311,7 @@ public class PathFinder {
} }
if (step == cur) { if (step == cur) {
destDist = (int)(dist * factor) + 1; destDist = dist + lookAhead;
} }
int nextDistance = dist + 1; int nextDistance = dist + 1;

View File

@ -30,6 +30,7 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShadowParticle; import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShadowParticle;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShaftParticle; import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShaftParticle;
import com.shatteredpixel.shatteredpixeldungeon.items.Ankh;
import com.shatteredpixel.shatteredpixeldungeon.items.DewVial; import com.shatteredpixel.shatteredpixeldungeon.items.DewVial;
import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing; import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing;
@ -71,6 +72,9 @@ public class WaterOfHealth extends WellWater {
CellEmitter.get( pos ).start( Speck.factory( Speck.HEALING ), 0.4f, 4 ); CellEmitter.get( pos ).start( Speck.factory( Speck.HEALING ), 0.4f, 4 );
} else if (ScrollOfRemoveCurse.uncurse( null, item )){ } else if (ScrollOfRemoveCurse.uncurse( null, item )){
CellEmitter.get( pos ).start( ShadowParticle.UP, 0.05f, 10 ); CellEmitter.get( pos ).start( ShadowParticle.UP, 0.05f, 10 );
} if ( item instanceof Ankh && !(((Ankh) item).isBlessed())){
((Ankh) item).bless();
CellEmitter.get( pos ).start(Speck.factory(Speck.LIGHT), 0.2f, 3);
} }
Sample.INSTANCE.play( Assets.SND_DRINK ); Sample.INSTANCE.play( Assets.SND_DRINK );
return item; return item;

View File

@ -67,6 +67,11 @@ public class DemonSpawner extends Mob {
//do nothing //do nothing
} }
@Override
public boolean reset() {
return true;
}
private float spawnCooldown = 50; private float spawnCooldown = 50;
@Override @Override

View File

@ -27,6 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Amok; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Amok;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Sleep; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Sleep;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Terror; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Terror;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Imp; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Imp;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation;
import com.shatteredpixel.shatteredpixeldungeon.sprites.GolemSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.GolemSprite;
@ -107,6 +108,8 @@ public class Golem extends Mob {
if (Actor.findChar(target) == null) { if (Actor.findChar(target) == null) {
ScrollOfTeleportation.appear(this, target); ScrollOfTeleportation.appear(this, target);
selfTeleCooldown = 30; selfTeleCooldown = 30;
} else {
target = Dungeon.level.randomDestination(this);
} }
teleporting = false; teleporting = false;
spend(TICK); spend(TICK);
@ -134,6 +137,9 @@ public class Golem extends Mob {
if (bestPos != enemy.pos){ if (bestPos != enemy.pos){
ScrollOfTeleportation.appear(enemy, bestPos); ScrollOfTeleportation.appear(enemy, bestPos);
if (enemy instanceof Hero){
((Hero) enemy).interrupt();
}
} }
enemyTeleCooldown = 20; enemyTeleCooldown = 20;

View File

@ -109,6 +109,17 @@ public class Mimic extends Mob {
} }
} }
@Override
protected boolean act() {
if (alignment == Alignment.NEUTRAL && state != PASSIVE){
alignment = Alignment.ENEMY;
GLog.w(Messages.get(this, "reveal") );
CellEmitter.get(pos).burst(Speck.factory(Speck.STAR), 10);
Sample.INSTANCE.play(Assets.SND_MIMIC);
}
return super.act();
}
@Override @Override
public CharSprite sprite() { public CharSprite sprite() {
MimicSprite sprite = (MimicSprite) super.sprite(); MimicSprite sprite = (MimicSprite) super.sprite();

View File

@ -46,7 +46,7 @@ public class Ankh extends Item {
bones = true; bones = true;
} }
private Boolean blessed = false; private boolean blessed = false;
@Override @Override
public boolean isUpgradable() { public boolean isUpgradable() {
@ -98,10 +98,14 @@ public class Ankh extends Item {
return super.desc(); return super.desc();
} }
public Boolean isBlessed(){ public boolean isBlessed(){
return blessed; return blessed;
} }
public void bless(){
blessed = true;
}
private static final Glowing WHITE = new Glowing( 0xFFFFCC ); private static final Glowing WHITE = new Glowing( 0xFFFFCC );
@Override @Override

View File

@ -630,11 +630,21 @@ public abstract class Level implements Bundlable {
} }
//an open space is large enough to fit large mobs. A space is open when it is not solid //an open space is large enough to fit large mobs. A space is open when it is not solid
// and there also aren't solid spaces above&below, or left&right // and there is a group of 3 or more adjacent cells which aren't solid
for (int i=0; i < length(); i++) { for (int i=0; i < length(); i++) {
openSpace[i] = !solid[i] && if (solid[i]){
(!solid[i-1] || !solid[i+1]) && openSpace[i] = false;
(!solid[i-width()] || !solid[i+width()]); } else {
for (int j = 0; j < PathFinder.CIRCLE8.length; j++){
if (solid[i+PathFinder.CIRCLE8[j]]) {
openSpace[i] = false;
} else if (!solid[i+PathFinder.CIRCLE8[(j+1)%8]]
&& !solid[i+PathFinder.CIRCLE8[(j+2)%8]]){
openSpace[i] = true;
break;
}
}
}
} }
} }
@ -693,6 +703,8 @@ public abstract class Level implements Bundlable {
if (s != null && s.volume > 0){ if (s != null && s.volume > 0){
level.losBlocking[cell] = level.losBlocking[cell] || s.cur[cell] > 0; level.losBlocking[cell] = level.losBlocking[cell] || s.cur[cell] > 0;
} }
//TODO update openSpace here too
} }
public Heap drop( Item item, int cell ) { public Heap drop( Item item, int cell ) {