fix test failures

This commit is contained in:
theelk801 2025-06-20 08:52:41 -04:00
parent e7b5f9ba04
commit 4ce5d2d431
3 changed files with 40 additions and 5 deletions

View file

@ -60,7 +60,7 @@ class CurseOfTheWerefoxEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Permanent target = game.getPermanent(source.getFirstTarget());
if (target == null || !RoleType.MONSTER.createToken(target, game, source).getLastAddedTokenIds().isEmpty()) {
if (target == null || RoleType.MONSTER.createToken(target, game, source).getLastAddedTokenIds().isEmpty()) {
return false;
}

View file

@ -1,18 +1,21 @@
package mage.cards.r;
import mage.abilities.Ability;
import mage.abilities.effects.common.FightTargetsEffect;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
import java.util.stream.Collectors;
/**
* @author LevelX2
@ -23,8 +26,7 @@ public final class RivalsDuel extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{R}");
// Choose two target creatures that share no creature types. Those creatures fight each other.
this.getSpellAbility().addEffect(new FightTargetsEffect()
.setText("Choose two target creatures that share no creature types. Those creatures fight each other."));
this.getSpellAbility().addEffect(new RivalsDuelEffect());
this.getSpellAbility().addTarget(new RivalsDuelTarget());
}
@ -38,6 +40,38 @@ public final class RivalsDuel extends CardImpl {
}
}
class RivalsDuelEffect extends OneShotEffect {
RivalsDuelEffect() {
super(Outcome.Benefit);
staticText = "choose two target creatures that share no creature types. Those creatures fight each other";
}
private RivalsDuelEffect(final RivalsDuelEffect effect) {
super(effect);
}
@Override
public RivalsDuelEffect copy() {
return new RivalsDuelEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
List<Permanent> permanents = this
.getTargetPointer()
.getTargets(game, source)
.stream()
.map(game::getPermanent)
.filter(Objects::nonNull)
.collect(Collectors.toList());
System.out.println(permanents.size());
System.out.println(permanents.get(0));
System.out.println(permanents.get(1));
return permanents.size() >= 2 && permanents.get(0).fight(permanents.get(1), source, game);
}
}
class RivalsDuelTarget extends TargetPermanent {
private static final FilterPermanent filter = new FilterCreaturePermanent("creatures that share no creature types");
@ -65,6 +99,7 @@ class RivalsDuelTarget extends TargetPermanent {
&& this
.getTargets()
.stream()
.filter(uuid -> !id.equals(uuid))
.map(game::getPermanent)
.filter(Objects::nonNull)
.noneMatch(permanent -> permanent.shareCreatureTypes(game, creature));

View file

@ -35,7 +35,7 @@ public class SupportAbility extends EntersBattlefieldTriggeredAbility {
if (card.isInstantOrSorcery()) {
return;
}
if (card.isCreature()) {
if (!card.isCreature()) {
addTarget(new TargetPermanent(0, amount, StaticFilters.FILTER_PERMANENT_CREATURES));
} else {
addTarget(new TargetPermanent(0, amount, filter));