mirror of
https://github.com/correl/mage.git
synced 2024-11-24 19:19:56 +00:00
[J22] Implement Synchronized Eviction
This commit is contained in:
parent
0069f6181b
commit
3a036fe52a
2 changed files with 89 additions and 0 deletions
88
Mage.Sets/src/mage/cards/s/SynchronizedEviction.java
Normal file
88
Mage.Sets/src/mage/cards/s/SynchronizedEviction.java
Normal file
|
@ -0,0 +1,88 @@
|
|||
package mage.cards.s;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.dynamicvalue.common.GreatestSharedCreatureTypeCount;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.cost.SpellCostReductionSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetNonlandPermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class SynchronizedEviction extends CardImpl {
|
||||
|
||||
public SynchronizedEviction(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{4}{U}");
|
||||
|
||||
// This spell costs {2} less to cast if you control two or more creatures that share a creature type.
|
||||
this.addAbility(new SimpleStaticAbility(
|
||||
Zone.ALL, new SpellCostReductionSourceEffect(2, SynchronizedEvictionCondition.instance))
|
||||
.addHint(GreatestSharedCreatureTypeCount.getHint()).setRuleAtTheTop(true)
|
||||
);
|
||||
|
||||
// Put target nonland permanent into its owner's library second from the top.
|
||||
this.getSpellAbility().addEffect(new SynchronizedEvictionEffect());
|
||||
this.getSpellAbility().addTarget(new TargetNonlandPermanent());
|
||||
}
|
||||
|
||||
private SynchronizedEviction(final SynchronizedEviction card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SynchronizedEviction copy() {
|
||||
return new SynchronizedEviction(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum SynchronizedEvictionCondition implements Condition {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return GreatestSharedCreatureTypeCount.instance.calculate(game, source, null) >= 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "you control two or more creatures that share a creature type";
|
||||
}
|
||||
}
|
||||
|
||||
class SynchronizedEvictionEffect extends OneShotEffect {
|
||||
|
||||
SynchronizedEvictionEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "put target nonland permanent into its owner's library second from the top";
|
||||
}
|
||||
|
||||
private SynchronizedEvictionEffect(final SynchronizedEvictionEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SynchronizedEvictionEffect copy() {
|
||||
return new SynchronizedEvictionEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
return controller != null
|
||||
&& permanent != null
|
||||
&& controller.putCardOnTopXOfLibrary(permanent, game, source, 2, true);
|
||||
}
|
||||
}
|
|
@ -79,6 +79,7 @@ public final class Jumpstart2022 extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Spectral Sailor", 64, Rarity.UNCOMMON, mage.cards.s.SpectralSailor.class));
|
||||
cards.add(new SetCardInfo("Spellstutter Sprite", 65, Rarity.COMMON, mage.cards.s.SpellstutterSprite.class));
|
||||
cards.add(new SetCardInfo("Suspicious Shambler", 27, Rarity.COMMON, mage.cards.s.SuspiciousShambler.class));
|
||||
cards.add(new SetCardInfo("Synchronized Eviction", 18, Rarity.UNCOMMON, mage.cards.s.SynchronizedEviction.class));
|
||||
cards.add(new SetCardInfo("Thrashing Brontodon", 92, Rarity.UNCOMMON, mage.cards.t.ThrashingBrontodon.class));
|
||||
cards.add(new SetCardInfo("Towering Gibbon", 46, Rarity.UNCOMMON, mage.cards.t.ToweringGibbon.class));
|
||||
cards.add(new SetCardInfo("Trove Warden", 259, Rarity.RARE, mage.cards.t.TroveWarden.class));
|
||||
|
|
Loading…
Reference in a new issue