mirror of
https://github.com/correl/mage.git
synced 2024-11-17 11:09:32 +00:00
Merge origin/master
This commit is contained in:
commit
8365593adb
2 changed files with 83 additions and 0 deletions
82
Mage.Sets/src/mage/cards/s/SuddenSubstitution.java
Normal file
82
Mage.Sets/src/mage/cards/s/SuddenSubstitution.java
Normal file
|
@ -0,0 +1,82 @@
|
|||
package mage.cards.s;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
|
||||
import mage.abilities.keyword.SplitSecondAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.target.TargetSpell;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import static mage.constants.Outcome.Benefit;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class SuddenSubstitution extends CardImpl {
|
||||
|
||||
public SuddenSubstitution(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{U}{U}");
|
||||
|
||||
// Split second
|
||||
this.addAbility(new SplitSecondAbility());
|
||||
|
||||
// Exchange control of target noncreature spell and target creature. Then the spell's controller may choose new targets for it.
|
||||
this.getSpellAbility().addEffect(new SuddenSubstitutionEffect());
|
||||
this.getSpellAbility().addTarget(new TargetSpell(StaticFilters.FILTER_SPELL_NON_CREATURE));
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
}
|
||||
|
||||
private SuddenSubstitution(final SuddenSubstitution card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuddenSubstitution copy() {
|
||||
return new SuddenSubstitution(this);
|
||||
}
|
||||
}
|
||||
|
||||
class SuddenSubstitutionEffect extends OneShotEffect {
|
||||
|
||||
SuddenSubstitutionEffect() {
|
||||
super(Benefit);
|
||||
staticText = "Exchange control of target noncreature spell and target creature. " +
|
||||
"Then the spell's controller may choose new targets for it.";
|
||||
}
|
||||
|
||||
private SuddenSubstitutionEffect(final SuddenSubstitutionEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuddenSubstitutionEffect copy() {
|
||||
return new SuddenSubstitutionEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Spell spell = game.getSpell(source.getTargets().get(0).getFirstTarget());
|
||||
Permanent creature = game.getPermanent(source.getTargets().get(1).getFirstTarget());
|
||||
if (spell == null || creature == null) {
|
||||
return false;
|
||||
}
|
||||
ContinuousEffect effect = new GainControlTargetEffect(Duration.Custom, spell.getControllerId());
|
||||
effect.setTargetPointer(new FixedTarget(creature, game));
|
||||
spell.setControllerId(creature.getControllerId());
|
||||
spell.chooseNewTargets(game, creature.getControllerId());
|
||||
game.addEffect(effect, source);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -259,6 +259,7 @@ public final class Commander2019Edition extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Stratus Dancer", 96, Rarity.RARE, mage.cards.s.StratusDancer.class));
|
||||
cards.add(new SetCardInfo("Strionic Resonator", 224, Rarity.RARE, mage.cards.s.StrionicResonator.class));
|
||||
cards.add(new SetCardInfo("Stromkirk Occultist", 153, Rarity.RARE, mage.cards.s.StromkirkOccultist.class));
|
||||
cards.add(new SetCardInfo("Sudden Substitution", 11, Rarity.RARE, mage.cards.s.SuddenSubstitution.class));
|
||||
cards.add(new SetCardInfo("Sultai Charm", 202, Rarity.UNCOMMON, mage.cards.s.SultaiCharm.class));
|
||||
cards.add(new SetCardInfo("Sun Titan", 76, Rarity.MYTHIC, mage.cards.s.SunTitan.class));
|
||||
cards.add(new SetCardInfo("Sundering Growth", 203, Rarity.COMMON, mage.cards.s.SunderingGrowth.class));
|
||||
|
|
Loading…
Reference in a new issue