v2.5.0: fixed reclaim trap not triggering allied magic death badge

This commit is contained in:
Evan Debenham
2024-09-02 15:55:06 -04:00
committed by Evan Debenham
parent 2b8fa4acad
commit 7d77431534
9 changed files with 19 additions and 2 deletions

View File

@@ -74,6 +74,7 @@ public class ReclaimTrap extends TargetedSpell {
Sample.INSTANCE.play(Assets.Sounds.LIGHTNING);
ScrollOfRecharging.charge(hero);
storedTrap = t.getClass();
Bestiary.setSeen(t.getClass());
} else {
GLog.w(Messages.get(this, "no_trap"));
@@ -84,7 +85,7 @@ public class ReclaimTrap extends TargetedSpell {
storedTrap = null;
t.pos = bolt.collisionPos;
Bestiary.setSeen(t.getClass());
t.reclaimed = true;
Bestiary.countEncounter(t.getClass());
t.activate();

View File

@@ -88,6 +88,7 @@ public class DisintegrationTrap extends Trap {
Badges.validateDeathFromGrimOrDisintTrap();
Dungeon.fail( this );
GLog.n( Messages.get(this, "ondeath") );
if (reclaimed) Badges.validateDeathFromFriendlyMagic();
}
}
}

View File

@@ -21,6 +21,8 @@
package com.shatteredpixel.shatteredpixeldungeon.levels.traps;
import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.items.bombs.Bomb;
public class ExplosiveTrap extends Trap {
@@ -33,6 +35,9 @@ public class ExplosiveTrap extends Trap {
@Override
public void activate() {
new Bomb().explode(pos);
if (reclaimed && !Dungeon.hero.isAlive()) {
Badges.validateDeathFromFriendlyMagic();
}
}
}

View File

@@ -22,6 +22,7 @@
package com.shatteredpixel.shatteredpixeldungeon.levels.traps;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
@@ -90,6 +91,7 @@ public class GnollRockfallTrap extends RockfallTrap {
if (!ch.isAlive() && ch == Dungeon.hero){
Dungeon.fail( this );
GLog.n( Messages.get(this, "ondeath") );
if (reclaimed) Badges.validateDeathFromFriendlyMagic();
}
} else if (ch == null
&& Dungeon.level instanceof MiningLevel

View File

@@ -110,6 +110,7 @@ public class GrimTrap extends Trap {
Badges.validateDeathFromGrimOrDisintTrap();
Dungeon.fail( GrimTrap.this );
GLog.n( Messages.get(GrimTrap.class, "ondeath") );
if (reclaimed) Badges.validateDeathFromFriendlyMagic();
}
} else {
Sample.INSTANCE.play(Assets.Sounds.BURNING);

View File

@@ -22,6 +22,7 @@
package com.shatteredpixel.shatteredpixeldungeon.levels.traps;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
@@ -116,6 +117,7 @@ public class PoisonDartTrap extends Trap {
if (!finalTarget.isAlive()) {
Dungeon.fail(PoisonDartTrap.this);
GLog.n(Messages.get(PoisonDartTrap.class, "ondeath"));
if (reclaimed) Badges.validateDeathFromFriendlyMagic();
}
}
Buff.affect( finalTarget, Poison.class ).set( poisonAmount() );

View File

@@ -22,6 +22,7 @@
package com.shatteredpixel.shatteredpixeldungeon.levels.traps;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
@@ -103,6 +104,7 @@ public class RockfallTrap extends Trap {
if (!ch.isAlive() && ch == Dungeon.hero){
Dungeon.fail( this );
GLog.n( Messages.get(this, "ondeath") );
if (reclaimed) Badges.validateDeathFromFriendlyMagic();
}
}
}

View File

@@ -56,6 +56,7 @@ public abstract class Trap implements Bundlable {
public int shape;
public int pos;
public boolean reclaimed = false; //if this trap was spawned by reclaim trap
public boolean visible;
public boolean active = true;
@@ -111,7 +112,7 @@ public abstract class Trap implements Bundlable {
//If the trap is part of the level, it should use the true depth
//If it's not part of the level (e.g. effect from reclaim trap), use scaling depth
protected int scalingDepth(){
return Dungeon.level.traps.get(pos) == this ? Dungeon.depth : Dungeon.scalingDepth();
return (reclaimed || Dungeon.level.traps.get(pos) != this) ? Dungeon.scalingDepth() : Dungeon.depth;
}
public String name(){

View File

@@ -22,6 +22,7 @@
package com.shatteredpixel.shatteredpixeldungeon.levels.traps;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
@@ -95,6 +96,7 @@ public class WornDartTrap extends Trap {
if (finalTarget == Dungeon.hero && !finalTarget.isAlive()){
Dungeon.fail( WornDartTrap.this );
GLog.n(Messages.get(WornDartTrap.class, "ondeath"));
if (reclaimed) Badges.validateDeathFromFriendlyMagic();
}
Sample.INSTANCE.play(Assets.Sounds.HIT, 1, 1, Random.Float(0.8f, 1.25f));
finalTarget.sprite.bloodBurstA(finalTarget.sprite.center(), dmg);