v3.3.2: sniper's mark + force cube now prefers the primary target

This commit is contained in:
Evan Debenham
2026-01-02 10:56:00 -05:00
parent 80231df6eb
commit 07487dc992

View File

@@ -26,6 +26,11 @@ import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.SnipersMark;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfBlastWave; import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfBlastWave;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.TenguDartTrap; import com.shatteredpixel.shatteredpixeldungeon.levels.traps.TenguDartTrap;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
@@ -78,7 +83,13 @@ public class ForceCube extends MissileWeapon {
Dungeon.level.pressCell(cell); Dungeon.level.pressCell(cell);
ArrayList<Char> targets = new ArrayList<>(); ArrayList<Char> targets = new ArrayList<>();
if (Actor.findChar(cell) != null) targets.add(Actor.findChar(cell)); Char primaryTarget;
if (Actor.findChar(cell) != null) {
primaryTarget = Actor.findChar(cell);
targets.add(primaryTarget);
} else {
primaryTarget = null;
}
for (int i : PathFinder.NEIGHBOURS8){ for (int i : PathFinder.NEIGHBOURS8){
if (!(Dungeon.level.traps.get(cell+i) instanceof TenguDartTrap)) Dungeon.level.pressCell(cell+i); if (!(Dungeon.level.traps.get(cell+i) instanceof TenguDartTrap)) Dungeon.level.pressCell(cell+i);
@@ -102,6 +113,26 @@ public class ForceCube extends MissileWeapon {
} }
} }
//if we're applying sniper's mark, prioritize giving it to the primary target of the attack
if (curUser.subClass == HeroSubClass.SNIPER && primaryTarget != null && primaryTarget.isActive()){
Actor.add(new Actor() {
{
actPriority = VFX_PRIO-1;
}
@Override
protected boolean act() {
SnipersMark mark = Dungeon.hero.buff(SnipersMark.class);
if (mark != null && primaryTarget.isActive()){
mark.object = primaryTarget.id();
}
Actor.remove(this);
return true;
}
});
}
WandOfBlastWave.BlastWave.blast(cell); WandOfBlastWave.BlastWave.blast(cell);
Sample.INSTANCE.play( Assets.Sounds.BLAST ); Sample.INSTANCE.play( Assets.Sounds.BLAST );
} }