v0.9.0: fixed shadows buff detaching on mind vision enemies

This commit is contained in:
Evan Debenham 2020-09-04 21:56:38 -04:00
parent 77249e84ea
commit dc4b05be43
2 changed files with 24 additions and 11 deletions

View File

@ -21,7 +21,6 @@
package com.shatteredpixel.shatteredpixeldungeon.actors.blobs;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Shadows;
@ -32,7 +31,6 @@ import com.shatteredpixel.shatteredpixeldungeon.journal.Notes;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.watabou.noosa.audio.Sample;
public class Foliage extends Blob {
@ -66,12 +64,9 @@ public class Foliage extends Blob {
}
Hero hero = Dungeon.hero;
if (hero.isAlive() && hero.visibleEnemies() == 0 && cur[hero.pos] > 0) {
Shadows s = hero.buff(Shadows.class);
if (s == null){
Buff.affect( hero, Shadows.class ).prolong();
Sample.INSTANCE.play( Assets.Sounds.MELD );
} else {
if (hero.isAlive() && cur[hero.pos] > 0) {
Shadows s = Buff.affect( hero, Shadows.class );
if (s != null){
s.prolong();
}
}

View File

@ -21,10 +21,13 @@
package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Bundle;
public class Shadows extends Invisibility {
@ -52,9 +55,18 @@ public class Shadows extends Invisibility {
@Override
public boolean attachTo( Char target ) {
if (Dungeon.level != null) {
for (Mob m : Dungeon.level.mobs) {
if (Dungeon.level.adjacent(m.pos, target.pos) && m.alignment != target.alignment) {
return false;
}
}
}
if (super.attachTo( target )) {
if (Dungeon.level != null)
if (Dungeon.level != null) {
Sample.INSTANCE.play( Assets.Sounds.MELD );
Dungeon.observe();
}
return true;
} else {
return false;
@ -71,11 +83,17 @@ public class Shadows extends Invisibility {
public boolean act() {
if (target.isAlive()) {
spend( TICK * 2 );
spend( TICK );
if (--left <= 0 || Dungeon.hero.visibleEnemies() > 0) {
if (--left <= 0) {
detach();
}
for (Mob m : Dungeon.level.mobs){
if (Dungeon.level.adjacent(m.pos, target.pos) && m.alignment != target.alignment){
detach();
}
}
} else {