v2.2.0: bosses from the sewers quest now tend to wander towards the hero

This commit is contained in:
Evan Debenham
2023-07-23 16:01:35 -04:00
parent 97b8edd4d6
commit af0cef90de
5 changed files with 58 additions and 2 deletions

View File

@@ -21,6 +21,7 @@
package com.shatteredpixel.shatteredpixeldungeon.actors.mobs;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.StenchGas;
@@ -29,6 +30,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Ooze;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Ghost;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.FetidRatSprite;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Random;
public class FetidRat extends Rat {
@@ -41,6 +43,7 @@ public class FetidRat extends Rat {
EXP = 4;
WANDERING = new Wandering();
state = WANDERING;
properties.add(Property.MINIBOSS);
@@ -81,6 +84,21 @@ public class FetidRat extends Rat {
Ghost.Quest.process();
}
protected class Wandering extends Mob.Wandering{
@Override
protected int randomDestination() {
//of two potential wander positions, picks the one closest to the hero
int pos1 = super.randomDestination();
int pos2 = super.randomDestination();
PathFinder.buildDistanceMap(Dungeon.hero.pos, Dungeon.level.passable);
if (PathFinder.distance[pos2] < PathFinder.distance[pos1]){
return pos2;
} else {
return pos1;
}
}
}
{
immunities.add( StenchGas.class );

View File

@@ -36,6 +36,7 @@ import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.GnollTricksterSprite;
import com.watabou.utils.Bundle;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Random;
public class GnollTrickster extends Gnoll {
@@ -48,6 +49,7 @@ public class GnollTrickster extends Gnoll {
EXP = 5;
WANDERING = new Wandering();
state = WANDERING;
//at half quantity, see createLoot()
@@ -125,6 +127,21 @@ public class GnollTrickster extends Gnoll {
Ghost.Quest.process();
}
protected class Wandering extends Mob.Wandering{
@Override
protected int randomDestination() {
//of two potential wander positions, picks the one closest to the hero
int pos1 = super.randomDestination();
int pos2 = super.randomDestination();
PathFinder.buildDistanceMap(Dungeon.hero.pos, Dungeon.level.passable);
if (PathFinder.distance[pos2] < PathFinder.distance[pos1]){
return pos2;
} else {
return pos1;
}
}
}
private static final String COMBO = "combo";
@Override

View File

@@ -197,7 +197,7 @@ public class Golem extends Mob {
teleporting = true;
spend( 2*TICK );
} else {
target = Dungeon.level.randomDestination( Golem.this );
target = randomDestination();
spend( TICK );
}

View File

@@ -32,6 +32,7 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.GreatCrabSprite;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Random;
public class GreatCrab extends Crab {
@@ -45,6 +46,7 @@ public class GreatCrab extends Crab {
EXP = 6;
WANDERING = new Wandering();
state = WANDERING;
loot = new MysteryMeat().quantity(2);
@@ -109,4 +111,19 @@ public class GreatCrab extends Crab {
Ghost.Quest.process();
}
protected class Wandering extends Mob.Wandering{
@Override
protected int randomDestination() {
//of two potential wander positions, picks the one closest to the hero
int pos1 = super.randomDestination();
int pos2 = super.randomDestination();
PathFinder.buildDistanceMap(Dungeon.hero.pos, Dungeon.level.passable);
if (PathFinder.distance[pos2] < PathFinder.distance[pos1]){
return pos2;
} else {
return pos1;
}
}
}
}

View File

@@ -1081,12 +1081,16 @@ public abstract class Mob extends Char {
spend( 1 / speed() );
return moveSprite( oldPos, pos );
} else {
target = Dungeon.level.randomDestination( Mob.this );
target = randomDestination();
spend( TICK );
}
return true;
}
protected int randomDestination(){
return Dungeon.level.randomDestination( Mob.this );
}
}