forked from External/mage
Fix AerithRescueMission stunning all targets
This commit is contained in:
parent
b235e5e99d
commit
4a458800aa
1 changed files with 43 additions and 2 deletions
|
|
@ -1,17 +1,28 @@
|
|||
package mage.cards.a;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.abilities.effects.common.TapTargetEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.permanent.PermanentReferenceInCollectionPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.token.HeroToken;
|
||||
import mage.target.Target;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
|
|
@ -28,8 +39,7 @@ public final class AerithRescueMission extends CardImpl {
|
|||
|
||||
// * Take 59 Flights of Stairs -- Tap up to three target creatures. Put a stun counter on one of them.
|
||||
this.getSpellAbility().addMode(new Mode(new TapTargetEffect())
|
||||
.addEffect(new AddCountersTargetEffect(CounterType.STUN.createInstance())
|
||||
.setText("Put a stun counter on one of them"))
|
||||
.addEffect(new AerithRescueMissionStunEffect())
|
||||
.addTarget(new TargetCreaturePermanent(0, 3))
|
||||
.withFlavorWord("Take 59 Flights of Stairs"));
|
||||
}
|
||||
|
|
@ -43,3 +53,34 @@ public final class AerithRescueMission extends CardImpl {
|
|||
return new AerithRescueMission(this);
|
||||
}
|
||||
}
|
||||
|
||||
class AerithRescueMissionStunEffect extends OneShotEffect {
|
||||
|
||||
AerithRescueMissionStunEffect() {
|
||||
super(Outcome.Detriment);
|
||||
staticText = "Put a stun counter on one of them";
|
||||
}
|
||||
|
||||
private AerithRescueMissionStunEffect(final AerithRescueMissionStunEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AerithRescueMissionStunEffect copy() {
|
||||
return new AerithRescueMissionStunEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
FilterPermanent filter = new FilterPermanent("creature to put a stun counter on");
|
||||
filter.add(new PermanentReferenceInCollectionPredicate(this.getTargetPointer().getTargets(game, source).stream()
|
||||
.map(game::getPermanent).collect(Collectors.toList()), game));
|
||||
Target target = new TargetPermanent(filter).withNotTarget(true);
|
||||
if (target.choose(Outcome.UnboostCreature, source.getControllerId(), source, game)) {
|
||||
Effect eff = new AddCountersTargetEffect(CounterType.STUN.createInstance());
|
||||
eff.setTargetPointer(new FixedTarget(target.getFirstTarget(), game));
|
||||
return eff.apply(game, source);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue