v0.9.3: Various death mark fixes:

- fixed various bugs with invalid targets
- fixed it breaking invis
- fixed fear the reaper not triggering on assassinate
This commit is contained in:
Evan Debenham 2021-05-26 18:24:13 -04:00
parent 79364238fa
commit 5b2df8b7d5
2 changed files with 37 additions and 25 deletions

View File

@ -364,6 +364,7 @@ public abstract class Char extends Actor {
} else {
//helps with triggering any on-damage effects that need to activate
enemy.damage(-1, this);
DeathMark.processFearTheReaper(enemy);
}
enemy.sprite.showStatus(CharSprite.NEGATIVE, Messages.get(Preparation.class, "assassinated"));
}
@ -606,27 +607,7 @@ public abstract class Char extends Actor {
if (!isAlive()) {
die( src );
} else if (HP == 0 && buff(DeathMark.DeathMarkTracker.class) != null){
if (Dungeon.hero.hasTalent(Talent.FEAR_THE_REAPER)) {
if (Dungeon.hero.pointsInTalent(Talent.FEAR_THE_REAPER) >= 2) {
Buff.prolong(this, Terror.class, 5f).target = Dungeon.hero;
}
Buff.prolong(this, Cripple.class, 5f);
if (Dungeon.hero.pointsInTalent(Talent.FEAR_THE_REAPER) >= 3) {
boolean[] passable = BArray.not(Dungeon.level.solid, null);
PathFinder.buildDistanceMap(pos, passable, 3);
for (Char ch : Actor.chars()) {
if (ch != this && ch.alignment == Alignment.ENEMY
&& PathFinder.distance[ch.pos] != Integer.MAX_VALUE) {
if (Dungeon.hero.pointsInTalent(Talent.FEAR_THE_REAPER) == 4) {
Buff.prolong(ch, Terror.class, 5f).target = Dungeon.hero;
}
Buff.prolong(ch, Cripple.class, 5f);
}
}
}
}
DeathMark.processFearTheReaper(this);
}
}

View File

@ -27,17 +27,20 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Barrier;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Cripple;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FlavourBuff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Terror;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.ArmorAbility;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClassArmor;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Bundle;
import com.watabou.utils.PathFinder;
public class DeathMark extends ArmorAbility {
@ -66,20 +69,20 @@ public class DeathMark extends ArmorAbility {
if (ch == null){
GLog.w(Messages.get(this, "no_target"));
return;
} else if (ch.alignment != Char.Alignment.ENEMY){
GLog.w(Messages.get(this, "ally_target"));
return;
}
if (ch != null){
Buff.affect(ch, DeathMarkTracker.class, 5f);
ch.buff(DeathMarkTracker.class).setInitialHP(ch.HP);
Buff.affect(ch, DeathMarkTracker.class, 5f).setInitialHP(ch.HP);
}
armor.charge -= chargeUse( hero );
armor.updateQuickslot();
hero.sprite.zap(target);
Invisibility.dispel();
hero.next();
if (hero.buff(DoubleMarkTracker.class) != null){
@ -90,6 +93,34 @@ public class DeathMark extends ArmorAbility {
}
public static void processFearTheReaper( Char ch ){
if (ch.HP > 0 || ch.buff(DeathMarkTracker.class) == null){
return;
}
if (Dungeon.hero.hasTalent(Talent.FEAR_THE_REAPER)) {
if (Dungeon.hero.pointsInTalent(Talent.FEAR_THE_REAPER) >= 2) {
Buff.prolong(ch, Terror.class, 5f).target = Dungeon.hero;
}
Buff.prolong(ch, Cripple.class, 5f);
if (Dungeon.hero.pointsInTalent(Talent.FEAR_THE_REAPER) >= 3) {
boolean[] passable = BArray.not(Dungeon.level.solid, null);
PathFinder.buildDistanceMap(ch.pos, passable, 3);
for (Char near : Actor.chars()) {
if (near != ch && near.alignment == Char.Alignment.ENEMY
&& PathFinder.distance[near.pos] != Integer.MAX_VALUE) {
if (Dungeon.hero.pointsInTalent(Talent.FEAR_THE_REAPER) == 4) {
Buff.prolong(near, Terror.class, 5f).target = Dungeon.hero;
}
Buff.prolong(near, Cripple.class, 5f);
}
}
}
}
}
public static class DoubleMarkTracker extends FlavourBuff{};
@Override