mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
Fix "becomes the target of" logic to check all modes (#12452)
* check all targets from all modes for getTargetingStackObject
* update logic related to a97dec3
This commit is contained in:
parent
e209ce1c97
commit
fc21365847
3 changed files with 94 additions and 6 deletions
|
|
@ -5,6 +5,7 @@ import mage.abilities.condition.Condition;
|
|||
import mage.filter.FilterPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.stack.StackObject;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
|
|
@ -25,9 +26,8 @@ public class SourceTargetsPermanentCondition implements Condition {
|
|||
if (stackObject == null) {
|
||||
return false;
|
||||
}
|
||||
return stackObject.getStackAbility().getTargets()
|
||||
return CardUtil.getAllSelectedTargets(stackObject.getStackAbility(), game)
|
||||
.stream()
|
||||
.flatMap(t -> t.getTargets().stream())
|
||||
.map(game::getPermanentOrLKIBattlefield)
|
||||
.filter(Objects::nonNull)
|
||||
.anyMatch(p -> filter.match(p, source.getControllerId(), source, game));
|
||||
|
|
|
|||
|
|
@ -1054,10 +1054,8 @@ public final class CardUtil {
|
|||
if (stackAbility == null || !stackAbility.getSourceId().equals(event.getSourceId())) {
|
||||
continue;
|
||||
}
|
||||
for (Target target : stackAbility.getTargets()) {
|
||||
if (target.getTargets().contains(event.getTargetId())) {
|
||||
return stackObject;
|
||||
}
|
||||
if (CardUtil.getAllSelectedTargets(stackAbility, game).contains(event.getTargetId())) {
|
||||
return stackObject;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue