[CMR] fixed Armix, Filigree Thrasher - not working card, missing target (#7234);

This commit is contained in:
Oleg Agafonov 2020-12-19 18:18:47 +04:00
parent bf7f9931ee
commit 9f67765e2d
7 changed files with 60 additions and 23 deletions

View file

@ -143,7 +143,7 @@ public class SessionImpl implements Session {
logger.error("Connect: unknown server error", exep.getCause()); logger.error("Connect: unknown server error", exep.getCause());
} }
} else if (cause instanceof NoSuchMethodException) { } else if (cause instanceof NoSuchMethodException) {
// NoSuchMethodException is thrown on an invocation of an unknow JBoss remoting // NoSuchMethodException is thrown on an invocation of an unknown JBoss remoting
// method, so it's likely to be because of a version incompatibility. // method, so it's likely to be because of a version incompatibility.
addMessage = "The following method is not available in the server, probably the " addMessage = "The following method is not available in the server, probably the "
+ "server version is not compatible with the client: " + cause.getMessage(); + "server version is not compatible with the client: " + cause.getMessage();

View file

@ -17,8 +17,11 @@ import mage.constants.Duration;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.SuperType; import mage.constants.SuperType;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.DefendingPlayerControlsPredicate;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import mage.target.TargetPermanent;
import java.util.UUID; import java.util.UUID;
@ -27,6 +30,12 @@ import java.util.UUID;
*/ */
public final class ArmixFiligreeThrasher extends CardImpl { public final class ArmixFiligreeThrasher extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature defending player controls");
static {
filter.add(DefendingPlayerControlsPredicate.instance);
}
public ArmixFiligreeThrasher(UUID ownerId, CardSetInfo setInfo) { public ArmixFiligreeThrasher(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{2}{B}"); super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{2}{B}");
@ -44,6 +53,7 @@ public final class ArmixFiligreeThrasher extends CardImpl {
), false, "target creature defending player controls gets -X/-X until end of turn, " + ), false, "target creature defending player controls gets -X/-X until end of turn, " +
"where X is the number of artifacts you control plus the number of artifact cards in your graveyard" "where X is the number of artifacts you control plus the number of artifact cards in your graveyard"
); );
ability.addTarget(new TargetPermanent(filter));
this.addAbility(new AttacksTriggeredAbility(new DoWhenCostPaid( this.addAbility(new AttacksTriggeredAbility(new DoWhenCostPaid(
ability, new DiscardCardCost(), "Discard a card?" ability, new DiscardCardCost(), "Discard a card?"
), false)); ), false));

View file

@ -1,7 +1,5 @@
package mage.cards.b; package mage.cards.b;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.CastOnlyDuringPhaseStepSourceAbility; import mage.abilities.common.CastOnlyDuringPhaseStepSourceAbility;
import mage.abilities.condition.common.BeforeBlockersAreDeclaredCondition; import mage.abilities.condition.common.BeforeBlockersAreDeclaredCondition;
@ -13,15 +11,14 @@ import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.TurnPhase; import mage.constants.TurnPhase;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.ObjectPlayer; import mage.filter.predicate.permanent.DefendingPlayerControlsPredicate;
import mage.filter.predicate.ObjectPlayerPredicate;
import mage.game.Controllable;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/** /**
*
* @author L_J * @author L_J
*/ */
public final class BlazeOfGlory extends CardImpl { public final class BlazeOfGlory extends CardImpl {
@ -29,7 +26,7 @@ public final class BlazeOfGlory extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature defending player controls"); private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature defending player controls");
static { static {
filter.add(new BlazeOfGloryDefendingPlayerControlsPredicate()); filter.add(DefendingPlayerControlsPredicate.instance);
} }
public BlazeOfGlory(UUID ownerId, CardSetInfo setInfo) { public BlazeOfGlory(UUID ownerId, CardSetInfo setInfo) {
@ -54,14 +51,6 @@ public final class BlazeOfGlory extends CardImpl {
} }
} }
class BlazeOfGloryDefendingPlayerControlsPredicate implements ObjectPlayerPredicate<ObjectPlayer<Controllable>> {
@Override
public boolean apply(ObjectPlayer<Controllable> input, Game game) {
return game.getCombat().getPlayerDefenders(game).contains(input.getObject().getControllerId());
}
}
class BlazeOfGloryRequirementEffect extends RequirementEffect { class BlazeOfGloryRequirementEffect extends RequirementEffect {
public BlazeOfGloryRequirementEffect() { public BlazeOfGloryRequirementEffect() {

View file

@ -0,0 +1,39 @@
package org.mage.test.cards.single.cmr;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* @author JayDi85
*/
public class ArmixFiligreeThrasherTest extends CardTestPlayerBase {
@Test
public void test_Playable() {
// Whenever Armix, Filigree Thrasher attacks, you may discard a card. When you do,
// target creature defending player controls gets -X/-X until end of turn, where X is the number
// of artifacts you control plus the number of artifact cards in your graveyard.
addCard(Zone.BATTLEFIELD, playerA, "Armix, Filigree Thrasher", 1);
addCard(Zone.HAND, playerA, "Alpha Myr", 1);
addCard(Zone.BATTLEFIELD, playerA, "Alpha Myr", 1);
//
addCard(Zone.BATTLEFIELD, playerA, "Kitesail Corsair", 1);
addCard(Zone.BATTLEFIELD, playerB, "Grizzly Bears", 1); // 2/2
// attack and discard to kill bear
attack(1, playerA, "Armix, Filigree Thrasher", playerB);
setChoice(playerA, "Yes"); // pay discard cost
setChoice(playerA, "Alpha Myr");
addTarget(playerA, "Grizzly Bears"); // target for trigger (must kill)
setStrictChooseMode(true);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertAllCommandsUsed();
assertPermanentCount(playerB, "Grizzly Bears", 0);
}
}

View file

@ -737,7 +737,7 @@ public class TestPlayer implements Player {
return true; return true;
} }
Assert.fail("Unknow ai command: " + command); Assert.fail("Unknown ai command: " + command);
} else if (action.getAction().startsWith(RUN_PREFIX)) { } else if (action.getAction().startsWith(RUN_PREFIX)) {
String command = action.getAction(); String command = action.getAction();
command = command.substring(command.indexOf(RUN_PREFIX) + RUN_PREFIX.length()); command = command.substring(command.indexOf(RUN_PREFIX) + RUN_PREFIX.length());
@ -749,7 +749,7 @@ public class TestPlayer implements Player {
return true; return true;
} }
Assert.fail("Unknow run command: " + command); Assert.fail("Unknown run command: " + command);
} else if (action.getAction().startsWith(CHECK_PREFIX)) { } else if (action.getAction().startsWith(CHECK_PREFIX)) {
String command = action.getAction(); String command = action.getAction();
command = command.substring(command.indexOf(CHECK_PREFIX) + CHECK_PREFIX.length()); command = command.substring(command.indexOf(CHECK_PREFIX) + CHECK_PREFIX.length());
@ -915,7 +915,7 @@ public class TestPlayer implements Player {
if (wasProccessed) { if (wasProccessed) {
return true; return true;
} else { } else {
Assert.fail("Unknow check command or params: " + command); Assert.fail("Unknown check command or params: " + command);
} }
} else if (action.getAction().startsWith(SHOW_PREFIX)) { } else if (action.getAction().startsWith(SHOW_PREFIX)) {
String command = action.getAction(); String command = action.getAction();
@ -1022,7 +1022,7 @@ public class TestPlayer implements Player {
if (wasProccessed) { if (wasProccessed) {
return true; return true;
} else { } else {
Assert.fail("Unknow show command or params: " + command); Assert.fail("Unknown show command or params: " + command);
} }
} }

View file

@ -1,4 +1,3 @@
package mage.filter.predicate.permanent; package mage.filter.predicate.permanent;
import mage.filter.predicate.ObjectSourcePlayer; import mage.filter.predicate.ObjectSourcePlayer;
@ -19,6 +18,6 @@ public enum DefendingPlayerControlsPredicate implements ObjectSourcePlayerPredic
@Override @Override
public String toString() { public String toString() {
return "Another"; return "";
} }
} }

View file

@ -85,4 +85,4 @@ public class PlayerList extends CircularList<UUID> {
return new PlayerList(this); return new PlayerList(this);
} }
} }