v0.8.2d: tweaked enemy surprise behaviour, fixes a bug in piranhas
This commit is contained in:
parent
527ad068e5
commit
d0ba33cbb8
|
@ -532,9 +532,7 @@ public abstract class Mob extends Char {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int defenseSkill( Char enemy ) {
|
public int defenseSkill( Char enemy ) {
|
||||||
boolean seen = (enemySeen && enemy.invisible == 0);
|
if ( !surprisedBy(enemy)
|
||||||
if (enemy == Dungeon.hero && !Dungeon.hero.canSurpriseAttack()) seen = true;
|
|
||||||
if ( seen
|
|
||||||
&& paralysed == 0
|
&& paralysed == 0
|
||||||
&& !(alignment == Alignment.ALLY && enemy == Dungeon.hero)) {
|
&& !(alignment == Alignment.ALLY && enemy == Dungeon.hero)) {
|
||||||
return this.defenseSkill;
|
return this.defenseSkill;
|
||||||
|
@ -552,7 +550,7 @@ public abstract class Mob extends Char {
|
||||||
hitWithRanged = true;
|
hitWithRanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (surprisedBy(enemy) && Dungeon.hero.canSurpriseAttack()) {
|
if (surprisedBy(enemy)) {
|
||||||
Statistics.sneakAttacks++;
|
Statistics.sneakAttacks++;
|
||||||
Badges.validateRogueUnlock();
|
Badges.validateRogueUnlock();
|
||||||
//TODO this is somewhat messy, it would be nicer to not have to manually handle delays here
|
//TODO this is somewhat messy, it would be nicer to not have to manually handle delays here
|
||||||
|
@ -594,7 +592,9 @@ public abstract class Mob extends Char {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean surprisedBy( Char enemy ){
|
public boolean surprisedBy( Char enemy ){
|
||||||
return enemy == Dungeon.hero && (enemy.invisible > 0 || !enemySeen);
|
return enemy == Dungeon.hero
|
||||||
|
&& (enemy.invisible > 0 || !enemySeen)
|
||||||
|
&& ((Hero)enemy).canSurpriseAttack();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void aggro( Char ch ) {
|
public void aggro( Char ch ) {
|
||||||
|
|
|
@ -26,6 +26,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
|
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.MysteryMeat;
|
import com.shatteredpixel.shatteredpixeldungeon.items.food.MysteryMeat;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.PiranhaSprite;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.PiranhaSprite;
|
||||||
import com.watabou.utils.PathFinder;
|
import com.watabou.utils.PathFinder;
|
||||||
|
@ -87,7 +88,7 @@ public class Piranha extends Mob {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean surprisedBy(Char enemy) {
|
public boolean surprisedBy(Char enemy) {
|
||||||
if (enemy == Dungeon.hero){
|
if (enemy == Dungeon.hero && ((Hero)enemy).canSurpriseAttack()){
|
||||||
if (fieldOfView == null || fieldOfView.length != Dungeon.level.length()){
|
if (fieldOfView == null || fieldOfView.length != Dungeon.level.length()){
|
||||||
fieldOfView = new boolean[Dungeon.level.length()];
|
fieldOfView = new boolean[Dungeon.level.length()];
|
||||||
Dungeon.level.updateFieldOfView( this, fieldOfView );
|
Dungeon.level.updateFieldOfView( this, fieldOfView );
|
||||||
|
|
Loading…
Reference in New Issue
Block a user