v2.0.0: fixed downed ghouls being considered dead in lots of cases

This commit is contained in:
Evan Debenham
2022-11-16 17:17:41 -05:00
parent 69a24db794
commit 1948c11480
5 changed files with 22 additions and 6 deletions
@@ -740,6 +740,10 @@ public abstract class Char extends Actor {
return HP > 0 || deathMarked;
}
public boolean isActive() {
return isAlive();
}
@Override
protected void spendConstant(float time) {
TimekeepersHourglass.timeFreeze freeze = buff(TimekeepersHourglass.timeFreeze.class);
@@ -1343,7 +1343,7 @@ public class Hero extends Char {
Char lastTarget = QuickSlotButton.lastTarget;
if (target != null && (lastTarget == null ||
!lastTarget.isAlive() ||
!lastTarget.isAlive() || !lastTarget.isActive() ||
lastTarget.alignment == Alignment.ALLY ||
!fieldOfView[lastTarget.pos])){
QuickSlotButton.target(target);
@@ -155,7 +155,6 @@ public class Ghoul extends Mob {
timesDowned++;
Buff.append(nearby, GhoulLifeLink.class).set(timesDowned*5, this);
((GhoulSprite)sprite).crumple();
beingLifeLinked = false;
return;
}
}
@@ -163,6 +162,16 @@ public class Ghoul extends Mob {
super.die(cause);
}
@Override
public boolean isAlive() {
return super.isAlive() || beingLifeLinked;
}
@Override
public boolean isActive() {
return !beingLifeLinked && isAlive();
}
@Override
protected synchronized void onRemove() {
if (beingLifeLinked) {
@@ -269,6 +278,7 @@ public class Ghoul extends Mob {
}
}
ghoul.HP = Math.round(ghoul.HT/10f);
ghoul.beingLifeLinked = false;
Actor.add(ghoul);
ghoul.timeToNow();
Dungeon.level.mobs.add(ghoul);
@@ -321,6 +331,7 @@ public class Ghoul extends Mob {
public void restoreFromBundle(Bundle bundle) {
super.restoreFromBundle(bundle);
ghoul = (Ghoul) bundle.get(GHOUL);
ghoul.beingLifeLinked = true;
turnsToRevive = bundle.getInt(LEFT);
}
@@ -22,6 +22,7 @@
package com.shatteredpixel.shatteredpixeldungeon.ui;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Ghoul;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
@@ -46,7 +47,7 @@ public class CharHealthIndicator extends HealthBar {
public void update() {
super.update();
if (target != null && target.isAlive() && target.sprite.visible) {
if (target != null && target.isAlive() && target.isActive() && target.sprite.visible) {
CharSprite sprite = target.sprite;
width = sprite.width()*(4/6f);
x = sprite.x + sprite.width()/6f;
@@ -59,7 +60,7 @@ public class CharHealthIndicator extends HealthBar {
}
public void target( Char ch ) {
if (ch != null && ch.isAlive()) {
if (ch != null && ch.isAlive() && ch.isActive()) {
target = ch;
} else {
target = null;
@@ -40,7 +40,7 @@ public class TargetHealthIndicator extends HealthBar {
public void update() {
super.update();
if (target != null && target.isAlive() && target.sprite.visible) {
if (target != null && target.isAlive() && target.isActive() && target.sprite.visible) {
CharSprite sprite = target.sprite;
width = sprite.width();
x = sprite.x;
@@ -53,7 +53,7 @@ public class TargetHealthIndicator extends HealthBar {
}
public void target( Char ch ) {
if (ch != null && ch.isAlive()) {
if (ch != null && ch.isAlive() && ch.isActive()) {
target = ch;
} else {
target = null;