v3.1.0: added a few crash safety checks

This commit is contained in:
Evan Debenham
2025-04-01 12:48:06 -04:00
parent 7909952ab6
commit e378152da8
3 changed files with 6 additions and 4 deletions

View File

@@ -586,7 +586,9 @@ public abstract class Char extends Actor {
} else {
enemy.sprite.showStatus( CharSprite.NEUTRAL, enemy.defenseVerb() );
if (enemy.sprite != null){
enemy.sprite.showStatus( CharSprite.NEUTRAL, enemy.defenseVerb() );
}
if (visibleFight) {
//TODO enemy.defenseSound? currently miss plays for monks/crab even when they parry
Sample.INSTANCE.play(Assets.Sounds.MISS);

View File

@@ -37,7 +37,7 @@ public class EnhancedRings extends FlavourBuff {
@Override
public boolean attachTo(Char target) {
if (super.attachTo(target)){
if (target instanceof Hero) ((Hero) target).updateHT(false);
if (target == Dungeon.hero) ((Hero) target).updateHT(false);
return true;
}
return false;
@@ -46,7 +46,7 @@ public class EnhancedRings extends FlavourBuff {
@Override
public void detach() {
super.detach();
if (target instanceof Hero) ((Hero) target).updateHT(false);
if (target == Dungeon.hero) ((Hero) target).updateHT(false);
}
@Override

View File

@@ -67,7 +67,7 @@ public class MobSprite extends CharSprite {
health.killAndErase();
}
parent.add( new ScaleTweener( this, new PointF( 0, 0 ), FALL_TIME ) {
if (parent != null) parent.add( new ScaleTweener( this, new PointF( 0, 0 ), FALL_TIME ) {
@Override
protected void onComplete() {
MobSprite.this.killAndErase();