forked from External/mage
[STX] Implemented Tempted by the Oriq
This commit is contained in:
parent
619c62b081
commit
70f857c9f0
3 changed files with 81 additions and 42 deletions
|
|
@ -1,26 +1,22 @@
|
|||
package mage.cards.b;
|
||||
|
||||
import java.util.*;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.predicate.permanent.ControllerIdPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author emerald000
|
||||
*/
|
||||
public final class BlatantThievery extends CardImpl {
|
||||
|
|
@ -29,7 +25,8 @@ public final class BlatantThievery extends CardImpl {
|
|||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{U}{U}{U}");
|
||||
|
||||
// For each opponent, gain control of target permanent that player controls.
|
||||
this.getSpellAbility().addEffect(new BlatantThieveryEffect());
|
||||
this.getSpellAbility().addEffect(new GainControlTargetEffect(Duration.EndOfGame)
|
||||
.setText("for each opponent, gain control of target permanent that player controls"));
|
||||
this.getSpellAbility().setTargetAdjuster(BlatantThieveryAdjuster.instance);
|
||||
}
|
||||
|
||||
|
|
@ -51,41 +48,16 @@ enum BlatantThieveryAdjuster implements TargetAdjuster {
|
|||
ability.getTargets().clear();
|
||||
for (UUID opponentId : game.getOpponents(ability.getControllerId())) {
|
||||
Player opponent = game.getPlayer(opponentId);
|
||||
if (opponent != null) {
|
||||
FilterPermanent filter = new FilterPermanent("Permanent of player " + opponent.getName());
|
||||
filter.add(new ControllerIdPredicate(opponentId));
|
||||
TargetPermanent targetPermanent = new TargetPermanent(filter);
|
||||
ability.addTarget(targetPermanent);
|
||||
if (opponent == null || game.getBattlefield().count(
|
||||
StaticFilters.FILTER_CONTROLLED_PERMANENT,
|
||||
ability.getSourceId(), opponentId, game
|
||||
) < 1) {
|
||||
continue;
|
||||
}
|
||||
FilterPermanent filter = new FilterPermanent("Permanent controlled by " + opponent.getName());
|
||||
filter.add(new ControllerIdPredicate(opponentId));
|
||||
TargetPermanent targetPermanent = new TargetPermanent(filter);
|
||||
ability.addTarget(targetPermanent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class BlatantThieveryEffect extends OneShotEffect {
|
||||
|
||||
BlatantThieveryEffect() {
|
||||
super(Outcome.GainControl);
|
||||
this.staticText = "For each opponent, gain control of target permanent that player controls";
|
||||
}
|
||||
|
||||
BlatantThieveryEffect(final BlatantThieveryEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlatantThieveryEffect copy() {
|
||||
return new BlatantThieveryEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
for (Target target : source.getTargets()) {
|
||||
if (target.getFirstTarget() != null) {
|
||||
ContinuousEffect effect = new GainControlTargetEffect(Duration.EndOfGame);
|
||||
effect.setTargetPointer(new FixedTarget(target.getFirstTarget()));
|
||||
game.addEffect(effect, source);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
66
Mage.Sets/src/mage/cards/t/TemptedByTheOriq.java
Normal file
66
Mage.Sets/src/mage/cards/t/TemptedByTheOriq.java
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
package mage.cards.t;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.ComparisonType;
|
||||
import mage.constants.Duration;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterCreatureOrPlaneswalkerPermanent;
|
||||
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
|
||||
import mage.filter.predicate.permanent.ControllerIdPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class TemptedByTheOriq extends CardImpl {
|
||||
|
||||
public TemptedByTheOriq(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{U}{U}{U}");
|
||||
|
||||
// For each opponent, gain control of up to one target creature or planeswalker that player controls with mana value 3 or less.
|
||||
this.getSpellAbility().addEffect(new GainControlTargetEffect(Duration.EndOfGame).setText(
|
||||
"for each opponent, gain control of up to one target creature or planeswalker " +
|
||||
"that player controls with mana value 3 or less"
|
||||
));
|
||||
this.getSpellAbility().setTargetAdjuster(TemptedByTheOriqAdjuster.instance);
|
||||
}
|
||||
|
||||
private TemptedByTheOriq(final TemptedByTheOriq card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TemptedByTheOriq copy() {
|
||||
return new TemptedByTheOriq(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum TemptedByTheOriqAdjuster implements TargetAdjuster {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.getTargets().clear();
|
||||
for (UUID opponentId : game.getOpponents(ability.getControllerId())) {
|
||||
Player opponent = game.getPlayer(opponentId);
|
||||
if (opponent == null) {
|
||||
continue;
|
||||
}
|
||||
FilterPermanent filter = new FilterCreatureOrPlaneswalkerPermanent(
|
||||
"creature or planeswalker " + opponent.getName() + " controls with mana value 3 or less"
|
||||
);
|
||||
filter.add(new ControllerIdPredicate(opponentId));
|
||||
filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, 4));
|
||||
ability.addTarget(new TargetPermanent(0, 1, filter, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -211,6 +211,7 @@ public final class StrixhavenSchoolOfMages extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Tangletrap", 145, Rarity.COMMON, mage.cards.t.Tangletrap.class));
|
||||
cards.add(new SetCardInfo("Teach by Example", 241, Rarity.COMMON, mage.cards.t.TeachByExample.class));
|
||||
cards.add(new SetCardInfo("Team Pennant", 260, Rarity.UNCOMMON, mage.cards.t.TeamPennant.class));
|
||||
cards.add(new SetCardInfo("Tempted by the Oriq", 58, Rarity.RARE, mage.cards.t.TemptedByTheOriq.class));
|
||||
cards.add(new SetCardInfo("Tenured Inkcaster", 88, Rarity.UNCOMMON, mage.cards.t.TenuredInkcaster.class));
|
||||
cards.add(new SetCardInfo("Thrilling Discovery", 243, Rarity.COMMON, mage.cards.t.ThrillingDiscovery.class));
|
||||
cards.add(new SetCardInfo("Thunderous Orator", 35, Rarity.UNCOMMON, mage.cards.t.ThunderousOrator.class));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue