mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 03:51:58 -08:00
[CMR] Implemented Sakashima's Will
This commit is contained in:
parent
549e959928
commit
e006119e5d
2 changed files with 141 additions and 0 deletions
140
Mage.Sets/src/mage/cards/s/SakashimasWill.java
Normal file
140
Mage.Sets/src/mage/cards/s/SakashimasWill.java
Normal file
|
|
@ -0,0 +1,140 @@
|
|||
package mage.cards.s;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.condition.common.ControlACommanderCondition;
|
||||
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.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
import mage.target.common.TargetOpponent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
import mage.util.functions.EmptyApplyToPermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class SakashimasWill extends CardImpl {
|
||||
|
||||
public SakashimasWill(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{U}");
|
||||
|
||||
// Choose one. If you control a commander as you cast this spell, you may choose both.
|
||||
this.getSpellAbility().getModes().setChooseText(
|
||||
"Choose one. If you control a commander as you cast this spell, you may choose both."
|
||||
);
|
||||
this.getSpellAbility().getModes().setMoreCondition(ControlACommanderCondition.instance);
|
||||
|
||||
// • Target opponent chooses a creature they control. You gain control of it.
|
||||
this.getSpellAbility().addEffect(new SakashimasWillStealEffect());
|
||||
this.getSpellAbility().addTarget(new TargetOpponent());
|
||||
|
||||
// • Choose a creature you control. Each other creautre you control becomes a copy of that creature until end of turn.
|
||||
this.getSpellAbility().addMode(new Mode(new SakashimasWillCopyEffect()));
|
||||
}
|
||||
|
||||
private SakashimasWill(final SakashimasWill card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SakashimasWill copy() {
|
||||
return new SakashimasWill(this);
|
||||
}
|
||||
}
|
||||
|
||||
class SakashimasWillStealEffect extends OneShotEffect {
|
||||
|
||||
SakashimasWillStealEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "target opponent chooses a creature they control. You gain control of it";
|
||||
}
|
||||
|
||||
private SakashimasWillStealEffect(final SakashimasWillStealEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SakashimasWillStealEffect copy() {
|
||||
return new SakashimasWillStealEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getFirstTarget());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
TargetPermanent target = new TargetControlledCreaturePermanent();
|
||||
target.setNotTarget(true);
|
||||
if (!target.canChoose(source.getSourceId(), player.getId(), game)) {
|
||||
return false;
|
||||
}
|
||||
player.choose(outcome, target, source.getSourceId(), game);
|
||||
if (game.getPermanent(target.getFirstTarget()) == null) {
|
||||
return false;
|
||||
}
|
||||
game.addEffect(new GainControlTargetEffect(
|
||||
Duration.Custom, true, source.getControllerId()
|
||||
).setTargetPointer(new FixedTarget(target.getFirstTarget(), game)), source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class SakashimasWillCopyEffect extends OneShotEffect {
|
||||
|
||||
SakashimasWillCopyEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "choose a creature you control. Each other creautre you control becomes a copy of that creature until end of turn";
|
||||
}
|
||||
|
||||
private SakashimasWillCopyEffect(final SakashimasWillCopyEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SakashimasWillCopyEffect copy() {
|
||||
return new SakashimasWillCopyEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
TargetPermanent target = new TargetControlledCreaturePermanent();
|
||||
target.setNotTarget(true);
|
||||
if (!target.canChoose(source.getSourceId(), player.getId(), game)) {
|
||||
return false;
|
||||
}
|
||||
player.choose(outcome, target, source.getSourceId(), game);
|
||||
Permanent chosenCreature = game.getPermanent(target.getFirstTarget());
|
||||
if (chosenCreature == null) {
|
||||
return false;
|
||||
}
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(
|
||||
StaticFilters.FILTER_CONTROLLED_CREATURE,
|
||||
player.getId(), source.getSourceId(), game
|
||||
)) {
|
||||
if (permanent == null || permanent.getId().equals(chosenCreature.getId())) {
|
||||
continue;
|
||||
}
|
||||
game.copyPermanent(
|
||||
Duration.EndOfTurn, chosenCreature, permanent.getId(), source, new EmptyApplyToPermanent()
|
||||
);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -222,6 +222,7 @@ public final class CommanderLegends extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Run Away Together", 87, Rarity.COMMON, mage.cards.r.RunAwayTogether.class));
|
||||
cards.add(new SetCardInfo("Sakashima of a Thousand Faces", 89, Rarity.MYTHIC, mage.cards.s.SakashimaOfAThousandFaces.class));
|
||||
cards.add(new SetCardInfo("Sakashima's Protege", 90, Rarity.RARE, mage.cards.s.SakashimasProtege.class));
|
||||
cards.add(new SetCardInfo("Sakashima's Will", 91, Rarity.RARE, mage.cards.s.SakashimasWill.class));
|
||||
cards.add(new SetCardInfo("Sandstone Oracle", 336, Rarity.UNCOMMON, mage.cards.s.SandstoneOracle.class));
|
||||
cards.add(new SetCardInfo("Sanitarium Skeleton", 148, Rarity.COMMON, mage.cards.s.SanitariumSkeleton.class));
|
||||
cards.add(new SetCardInfo("Scholar of the Ages", 93, Rarity.UNCOMMON, mage.cards.s.ScholarOfTheAges.class));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue