mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 10:40:06 -08:00
[WHO] Implement Ashad, the Lone Cyberman (#13659)
This commit is contained in:
parent
d120215d64
commit
c58ecbcce3
2 changed files with 132 additions and 4 deletions
127
Mage.Sets/src/mage/cards/a/AshadTheLoneCyberman.java
Normal file
127
Mage.Sets/src/mage/cards/a/AshadTheLoneCyberman.java
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
package mage.cards.a;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.SacrificePermanentTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityControlledSpellsEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.abilities.keyword.CasualtyAbility;
|
||||
import mage.constants.*;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.common.FilterNonlandCard;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author padfoothelix
|
||||
*/
|
||||
public final class AshadTheLoneCyberman extends CardImpl {
|
||||
|
||||
private static final String rule = "The first nonlegendary artifact spell you cast each turn has casualty 2. " +
|
||||
"<i>(As you cast it, you may sacrifice a creature with power 2 or greater. When you do, copy it. " +
|
||||
"A copy of an artifact spell becomes a token.)</i>";
|
||||
private static final FilterNonlandCard filter = new FilterNonlandCard("the first nonlegendary artifact you cast each turn");
|
||||
static {
|
||||
filter.add(AshadTheLoneCybermanSpellPredicate.instance);
|
||||
}
|
||||
|
||||
public AshadTheLoneCyberman(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{1}{U}{B}{R}");
|
||||
|
||||
this.supertype.add(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.CYBERMAN);
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(3);
|
||||
|
||||
// The first nonlegendary artifact spell you cast each turn has casualty 2.
|
||||
this.addAbility(new SimpleStaticAbility(
|
||||
new GainAbilityControlledSpellsEffect(
|
||||
new CasualtyAbility(2),
|
||||
filter
|
||||
).setText(rule)),
|
||||
new AshadTheLoneCybermanWatcher()
|
||||
);
|
||||
|
||||
// Whenever you sacrifice another creature, put a +1/+1 counter on Ashad, the Lone Cyberman.
|
||||
this.addAbility(new SacrificePermanentTriggeredAbility(
|
||||
new AddCountersSourceEffect(CounterType.P1P1.createInstance()),
|
||||
StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE
|
||||
));
|
||||
}
|
||||
|
||||
private AshadTheLoneCyberman(final AshadTheLoneCyberman card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AshadTheLoneCyberman copy() {
|
||||
return new AshadTheLoneCyberman(this);
|
||||
}
|
||||
}
|
||||
|
||||
class AshadTheLoneCybermanWatcher extends Watcher {
|
||||
|
||||
// Based on Peri Brown which is based on Conduit of Ruin
|
||||
|
||||
private final Map<UUID, Integer> nonlegendaryArtifactSpells; // player id -> number
|
||||
|
||||
public AshadTheLoneCybermanWatcher() {
|
||||
super(WatcherScope.GAME);
|
||||
nonlegendaryArtifactSpells = new HashMap<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void watch(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.SPELL_CAST) {
|
||||
Spell spell = (Spell) game.getObject(event.getTargetId());
|
||||
if (spell != null
|
||||
&& !spell.isLegendary(game)
|
||||
&& spell.isArtifact(game)) {
|
||||
nonlegendaryArtifactSpells.put(event.getPlayerId(), nonlegendaryArtifactSpellsCastThisTurn(event.getPlayerId()) + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int nonlegendaryArtifactSpellsCastThisTurn(UUID playerId) {
|
||||
return nonlegendaryArtifactSpells.getOrDefault(playerId, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
nonlegendaryArtifactSpells.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
enum AshadTheLoneCybermanSpellPredicate implements ObjectSourcePlayerPredicate<Card> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectSourcePlayer<Card> input, Game game) {
|
||||
if (input.getObject() != null
|
||||
&& !input.getObject().isLegendary(game)
|
||||
&& input.getObject().isArtifact(game)) {
|
||||
AshadTheLoneCybermanWatcher watcher = game.getState().getWatcher(AshadTheLoneCybermanWatcher.class);
|
||||
return watcher != null && watcher.nonlegendaryArtifactSpellsCastThisTurn(input.getPlayerId()) == 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "The first nonlegendary artifact spell you cast each turn";
|
||||
}
|
||||
}
|
||||
|
|
@ -61,10 +61,10 @@ public final class DoctorWho extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("As Foretold", 805, Rarity.RARE, mage.cards.a.AsForetold.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Ash Barrens", 257, Rarity.UNCOMMON, mage.cards.a.AshBarrens.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Ash Barrens", 848, Rarity.UNCOMMON, mage.cards.a.AshBarrens.class, NON_FULL_USE_VARIOUS));
|
||||
//cards.add(new SetCardInfo("Ashad, the Lone Cyberman", 113, Rarity.RARE, mage.cards.a.AshadTheLoneCyberman.class, NON_FULL_USE_VARIOUS));
|
||||
//cards.add(new SetCardInfo("Ashad, the Lone Cyberman", 402, Rarity.RARE, mage.cards.a.AshadTheLoneCyberman.class, NON_FULL_USE_VARIOUS));
|
||||
//cards.add(new SetCardInfo("Ashad, the Lone Cyberman", 718, Rarity.RARE, mage.cards.a.AshadTheLoneCyberman.class, NON_FULL_USE_VARIOUS));
|
||||
//cards.add(new SetCardInfo("Ashad, the Lone Cyberman", 993, Rarity.RARE, mage.cards.a.AshadTheLoneCyberman.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Ashad, the Lone Cyberman", 113, Rarity.RARE, mage.cards.a.AshadTheLoneCyberman.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Ashad, the Lone Cyberman", 402, Rarity.RARE, mage.cards.a.AshadTheLoneCyberman.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Ashad, the Lone Cyberman", 718, Rarity.RARE, mage.cards.a.AshadTheLoneCyberman.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Ashad, the Lone Cyberman", 993, Rarity.RARE, mage.cards.a.AshadTheLoneCyberman.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Astrid Peth", 11, Rarity.RARE, mage.cards.a.AstridPeth.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Astrid Peth", 334, Rarity.RARE, mage.cards.a.AstridPeth.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Astrid Peth", 616, Rarity.RARE, mage.cards.a.AstridPeth.class, NON_FULL_USE_VARIOUS));
|
||||
|
|
@ -931,6 +931,7 @@ public final class DoctorWho extends ExpansionSet {
|
|||
//cards.add(new SetCardInfo("The Five Doctors", 394, Rarity.RARE, mage.cards.t.TheFiveDoctors.class, NON_FULL_USE_VARIOUS));
|
||||
//cards.add(new SetCardInfo("The Five Doctors", 706, Rarity.RARE, mage.cards.t.TheFiveDoctors.class, NON_FULL_USE_VARIOUS));
|
||||
//cards.add(new SetCardInfo("The Five Doctors", 985, Rarity.RARE, mage.cards.t.TheFiveDoctors.class, NON_FULL_USE_VARIOUS));
|
||||
//cards.add(new SetCardInfo("The Five Doctors", 101, Rarity.RARE, mage.cards.t.TheFiveDoctors.class));
|
||||
cards.add(new SetCardInfo("The Flood of Mars", 360, Rarity.RARE, mage.cards.t.TheFloodOfMars.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("The Flood of Mars", 45, Rarity.RARE, mage.cards.t.TheFloodOfMars.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("The Flood of Mars", 650, Rarity.RARE, mage.cards.t.TheFloodOfMars.class, NON_FULL_USE_VARIOUS));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue