v0.9.0: fixed shadows buff detaching on mind vision enemies
This commit is contained in:
parent
77249e84ea
commit
dc4b05be43
|
@ -21,7 +21,6 @@
|
||||||
|
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.actors.blobs;
|
package com.shatteredpixel.shatteredpixeldungeon.actors.blobs;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Shadows;
|
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.levels.Terrain;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||||
import com.watabou.noosa.audio.Sample;
|
|
||||||
|
|
||||||
public class Foliage extends Blob {
|
public class Foliage extends Blob {
|
||||||
|
|
||||||
|
@ -66,12 +64,9 @@ public class Foliage extends Blob {
|
||||||
}
|
}
|
||||||
|
|
||||||
Hero hero = Dungeon.hero;
|
Hero hero = Dungeon.hero;
|
||||||
if (hero.isAlive() && hero.visibleEnemies() == 0 && cur[hero.pos] > 0) {
|
if (hero.isAlive() && cur[hero.pos] > 0) {
|
||||||
Shadows s = hero.buff(Shadows.class);
|
Shadows s = Buff.affect( hero, Shadows.class );
|
||||||
if (s == null){
|
if (s != null){
|
||||||
Buff.affect( hero, Shadows.class ).prolong();
|
|
||||||
Sample.INSTANCE.play( Assets.Sounds.MELD );
|
|
||||||
} else {
|
|
||||||
s.prolong();
|
s.prolong();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,10 +21,13 @@
|
||||||
|
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
|
package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
|
||||||
|
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||||
|
import com.watabou.noosa.audio.Sample;
|
||||||
import com.watabou.utils.Bundle;
|
import com.watabou.utils.Bundle;
|
||||||
|
|
||||||
public class Shadows extends Invisibility {
|
public class Shadows extends Invisibility {
|
||||||
|
@ -52,9 +55,18 @@ public class Shadows extends Invisibility {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean attachTo( Char target ) {
|
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 (super.attachTo( target )) {
|
||||||
if (Dungeon.level != null)
|
if (Dungeon.level != null) {
|
||||||
|
Sample.INSTANCE.play( Assets.Sounds.MELD );
|
||||||
Dungeon.observe();
|
Dungeon.observe();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
@ -71,12 +83,18 @@ public class Shadows extends Invisibility {
|
||||||
public boolean act() {
|
public boolean act() {
|
||||||
if (target.isAlive()) {
|
if (target.isAlive()) {
|
||||||
|
|
||||||
spend( TICK * 2 );
|
spend( TICK );
|
||||||
|
|
||||||
if (--left <= 0 || Dungeon.hero.visibleEnemies() > 0) {
|
if (--left <= 0) {
|
||||||
detach();
|
detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (Mob m : Dungeon.level.mobs){
|
||||||
|
if (Dungeon.level.adjacent(m.pos, target.pos) && m.alignment != target.alignment){
|
||||||
|
detach();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
detach();
|
detach();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user