v0.8.1: fixed shadows sfx playing on game load

This commit is contained in:
Evan Debenham 2020-06-27 02:07:50 -04:00
parent 79767810fc
commit 9cd9cb5730
2 changed files with 9 additions and 2 deletions

View File

@ -21,6 +21,7 @@
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;
@ -31,6 +32,7 @@ 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 {
@ -65,7 +67,13 @@ public class Foliage extends Blob {
Hero hero = Dungeon.hero;
if (hero.isAlive() && hero.visibleEnemies() == 0 && cur[hero.pos] > 0) {
Buff.affect( hero, Shadows.class ).prolong();
Shadows s = hero.buff(Shadows.class);
if (s == null){
Buff.affect( hero, Shadows.class ).prolong();
Sample.INSTANCE.play( Assets.Sounds.MELD );
} else {
s.prolong();
}
}
if (visible) {

View File

@ -56,7 +56,6 @@ public class Shadows extends Invisibility {
@Override
public boolean attachTo( Char target ) {
if (super.attachTo( target )) {
Sample.INSTANCE.play( Assets.Sounds.MELD );
if (Dungeon.level != null)
Dungeon.observe();
return true;