v3.3.2: sniper's mark + force cube now prefers the primary target
This commit is contained in:
@@ -26,6 +26,11 @@ import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||
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.levels.traps.TenguDartTrap;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
@@ -78,8 +83,14 @@ public class ForceCube extends MissileWeapon {
|
||||
Dungeon.level.pressCell(cell);
|
||||
|
||||
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){
|
||||
if (!(Dungeon.level.traps.get(cell+i) instanceof TenguDartTrap)) Dungeon.level.pressCell(cell+i);
|
||||
if (Actor.findChar(cell + i) != null) targets.add(Actor.findChar(cell + i));
|
||||
@@ -101,6 +112,26 @@ public class ForceCube extends MissileWeapon {
|
||||
GLog.n(Messages.get(this, "ondeath"));
|
||||
}
|
||||
}
|
||||
|
||||
//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);
|
||||
Sample.INSTANCE.play( Assets.Sounds.BLAST );
|
||||
|
||||
Reference in New Issue
Block a user