v2.2.0: bosses from the sewers quest now tend to wander towards the hero
This commit is contained in:
@@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.actors.mobs;
|
package com.shatteredpixel.shatteredpixeldungeon.actors.mobs;
|
||||||
|
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.StenchGas;
|
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.actors.mobs.npcs.Ghost;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.FetidRatSprite;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.FetidRatSprite;
|
||||||
|
import com.watabou.utils.PathFinder;
|
||||||
import com.watabou.utils.Random;
|
import com.watabou.utils.Random;
|
||||||
|
|
||||||
public class FetidRat extends Rat {
|
public class FetidRat extends Rat {
|
||||||
@@ -41,6 +43,7 @@ public class FetidRat extends Rat {
|
|||||||
|
|
||||||
EXP = 4;
|
EXP = 4;
|
||||||
|
|
||||||
|
WANDERING = new Wandering();
|
||||||
state = WANDERING;
|
state = WANDERING;
|
||||||
|
|
||||||
properties.add(Property.MINIBOSS);
|
properties.add(Property.MINIBOSS);
|
||||||
@@ -82,6 +85,21 @@ public class FetidRat extends Rat {
|
|||||||
Ghost.Quest.process();
|
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 );
|
immunities.add( StenchGas.class );
|
||||||
}
|
}
|
||||||
|
|||||||
+17
@@ -36,6 +36,7 @@ import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
|
|||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.GnollTricksterSprite;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.GnollTricksterSprite;
|
||||||
import com.watabou.utils.Bundle;
|
import com.watabou.utils.Bundle;
|
||||||
|
import com.watabou.utils.PathFinder;
|
||||||
import com.watabou.utils.Random;
|
import com.watabou.utils.Random;
|
||||||
|
|
||||||
public class GnollTrickster extends Gnoll {
|
public class GnollTrickster extends Gnoll {
|
||||||
@@ -48,6 +49,7 @@ public class GnollTrickster extends Gnoll {
|
|||||||
|
|
||||||
EXP = 5;
|
EXP = 5;
|
||||||
|
|
||||||
|
WANDERING = new Wandering();
|
||||||
state = WANDERING;
|
state = WANDERING;
|
||||||
|
|
||||||
//at half quantity, see createLoot()
|
//at half quantity, see createLoot()
|
||||||
@@ -125,6 +127,21 @@ public class GnollTrickster extends Gnoll {
|
|||||||
Ghost.Quest.process();
|
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";
|
private static final String COMBO = "combo";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ public class Golem extends Mob {
|
|||||||
teleporting = true;
|
teleporting = true;
|
||||||
spend( 2*TICK );
|
spend( 2*TICK );
|
||||||
} else {
|
} else {
|
||||||
target = Dungeon.level.randomDestination( Golem.this );
|
target = randomDestination();
|
||||||
spend( TICK );
|
spend( TICK );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+17
@@ -32,6 +32,7 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
|
|||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.GreatCrabSprite;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.GreatCrabSprite;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||||
import com.watabou.noosa.audio.Sample;
|
import com.watabou.noosa.audio.Sample;
|
||||||
|
import com.watabou.utils.PathFinder;
|
||||||
import com.watabou.utils.Random;
|
import com.watabou.utils.Random;
|
||||||
|
|
||||||
public class GreatCrab extends Crab {
|
public class GreatCrab extends Crab {
|
||||||
@@ -45,6 +46,7 @@ public class GreatCrab extends Crab {
|
|||||||
|
|
||||||
EXP = 6;
|
EXP = 6;
|
||||||
|
|
||||||
|
WANDERING = new Wandering();
|
||||||
state = WANDERING;
|
state = WANDERING;
|
||||||
|
|
||||||
loot = new MysteryMeat().quantity(2);
|
loot = new MysteryMeat().quantity(2);
|
||||||
@@ -109,4 +111,19 @@ public class GreatCrab extends Crab {
|
|||||||
|
|
||||||
Ghost.Quest.process();
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1081,13 +1081,17 @@ public abstract class Mob extends Char {
|
|||||||
spend( 1 / speed() );
|
spend( 1 / speed() );
|
||||||
return moveSprite( oldPos, pos );
|
return moveSprite( oldPos, pos );
|
||||||
} else {
|
} else {
|
||||||
target = Dungeon.level.randomDestination( Mob.this );
|
target = randomDestination();
|
||||||
spend( TICK );
|
spend( TICK );
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected int randomDestination(){
|
||||||
|
return Dungeon.level.randomDestination( Mob.this );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected class Hunting implements AiState {
|
protected class Hunting implements AiState {
|
||||||
|
|||||||
Reference in New Issue
Block a user