use of mage.filter.predicate.mageobject.AnotherCardPredicate in project mage by magefree.
the class ArsenalThresherEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
Permanent arsenalThresher = game.getPermanentEntering(source.getSourceId());
FilterArtifactCard filter = new FilterArtifactCard();
filter.add(new AnotherCardPredicate());
if (controller.chooseUse(Outcome.Benefit, "Reveal other artifacts in your hand?", source, game)) {
Cards cards = new CardsImpl();
if (controller.getHand().count(filter, source.getSourceId(), source.getControllerId(), game) > 0) {
TargetCardInHand target = new TargetCardInHand(0, Integer.MAX_VALUE, filter);
if (controller.choose(Outcome.Benefit, target, source.getSourceId(), game)) {
for (UUID uuid : target.getTargets()) {
cards.add(controller.getHand().get(uuid, game));
}
if (arsenalThresher != null) {
controller.revealCards(arsenalThresher.getIdName(), cards, game);
// the basic event is the EntersBattlefieldEvent, so use already applied replacement effects from that event
List<UUID> appliedEffects = (ArrayList<UUID>) this.getValue("appliedEffects");
arsenalThresher.addCounters(CounterType.P1P1.createInstance(cards.size()), source.getControllerId(), source, game, appliedEffects);
}
}
}
return true;
}
return false;
}
use of mage.filter.predicate.mageobject.AnotherCardPredicate in project mage by magefree.
the class RelentlessDeadEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
if (controller.chooseUse(Outcome.Benefit, "Do you want to pay {X} to return zombie?", source, game)) {
int payCount = ManaUtil.playerPaysXGenericMana(true, "Relentless Dead", controller, source, game);
// can be 0
FilterCard filter = new FilterCard("Another target Zombie card with mana value {" + payCount + "}");
filter.add(SubType.ZOMBIE.getPredicate());
filter.add(new ManaValuePredicate(ComparisonType.EQUAL_TO, payCount));
filter.add(new AnotherCardPredicate());
TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(filter);
if (controller.chooseTarget(outcome, target, source, game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
}
}
}
return true;
}
return false;
}
Aggregations