mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 10:40:06 -08:00
Implement [ACR] Desmond Miles (#12497)
This commit is contained in:
parent
2daa2b8820
commit
89738d8675
3 changed files with 146 additions and 0 deletions
100
Mage.Sets/src/mage/cards/d/DesmondMiles.java
Normal file
100
Mage.Sets/src/mage/cards/d/DesmondMiles.java
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.dynamicvalue.AdditiveDynamicValue;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.common.*;
|
||||
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostSourceEffect;
|
||||
import mage.constants.*;
|
||||
import mage.abilities.keyword.MenaceAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.predicate.mageobject.AnotherPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author grimreap124
|
||||
*/
|
||||
public final class DesmondMiles extends CardImpl {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("Assassin card in your graveyard");
|
||||
private static final FilterControlledPermanent filter2 = new FilterControlledPermanent(SubType.ASSASSIN);
|
||||
private static final AdditiveDynamicValue assassinsCount;
|
||||
static {
|
||||
filter2.add(AnotherPredicate.instance);
|
||||
filter.add(SubType.ASSASSIN.getPredicate());
|
||||
assassinsCount = new AdditiveDynamicValue(new CardsInControllerGraveyardCount(filter), new PermanentsOnBattlefieldCount(filter2));
|
||||
}
|
||||
|
||||
public DesmondMiles(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}");
|
||||
|
||||
this.supertype.add(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.ASSASSIN);
|
||||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(3);
|
||||
|
||||
// Menace
|
||||
this.addAbility(new MenaceAbility());
|
||||
|
||||
// Desmond Miles gets +1/+0 for each other Assassin you control and each Assassin card in your graveyard.
|
||||
Ability ability = new SimpleStaticAbility(new BoostSourceEffect(assassinsCount, StaticValue.get(0), Duration.WhileOnBattlefield)
|
||||
.setText("{this} gets +1/+0 for each other Assassin you control and each Assassin card in your graveyard"));
|
||||
this.addAbility(ability);
|
||||
|
||||
// Whenever Desmond Miles deals combat damage to a player, surveil X, where X is the amount of damage it dealt to that player.
|
||||
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new DesmondMilesEffect(SavedDamageValue.MANY,
|
||||
"where X is the amount of damage it dealt to that player.")));
|
||||
}
|
||||
|
||||
private DesmondMiles(final DesmondMiles card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DesmondMiles copy() {
|
||||
return new DesmondMiles(this);
|
||||
}
|
||||
}
|
||||
|
||||
class DesmondMilesEffect extends OneShotEffect {
|
||||
|
||||
protected final DynamicValue amount;
|
||||
|
||||
public DesmondMilesEffect(DynamicValue amount, String message) {
|
||||
super(Outcome.Benefit);
|
||||
this.amount = amount;
|
||||
this.staticText = "surveil X" + (message.isEmpty() ? "" : ", ") + message;
|
||||
}
|
||||
|
||||
private DesmondMilesEffect(final DesmondMilesEffect effect) {
|
||||
super(effect);
|
||||
this.amount = effect.amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DesmondMilesEffect copy() {
|
||||
return new DesmondMilesEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
int xValue = amount.calculate(game, source, this);
|
||||
return player.surveil(xValue, source, game);
|
||||
}
|
||||
}
|
||||
|
|
@ -42,6 +42,7 @@ public final class AssassinsCreed extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Conspiracy", 88, Rarity.RARE, mage.cards.c.Conspiracy.class));
|
||||
cards.add(new SetCardInfo("Cover of Darkness", 89, Rarity.RARE, mage.cards.c.CoverOfDarkness.class));
|
||||
cards.add(new SetCardInfo("Crystal Skull, Isu Spyglass", 15, Rarity.RARE, mage.cards.c.CrystalSkullIsuSpyglass.class));
|
||||
cards.add(new SetCardInfo("Desmond Miles", 24, Rarity.RARE, mage.cards.d.DesmondMiles.class));
|
||||
cards.add(new SetCardInfo("Desynchronization", 16, Rarity.RARE, mage.cards.d.Desynchronization.class));
|
||||
cards.add(new SetCardInfo("Detained by Legionnaires", 277, Rarity.COMMON, mage.cards.d.DetainedByLegionnaires.class));
|
||||
cards.add(new SetCardInfo("Distract the Guards", 3, Rarity.UNCOMMON, mage.cards.d.DistractTheGuards.class));
|
||||
|
|
|
|||
|
|
@ -150,4 +150,49 @@ public class SurveilTest extends CardTestPlayerBase {
|
|||
assertHandCount(playerA, cardB, 1);
|
||||
assertLibrary(playerA, cardA, cardC, cardD);
|
||||
}
|
||||
|
||||
private static final String desmondMiles = "Desmond Miles";
|
||||
|
||||
@Test
|
||||
public void SurveilX_one_Yard() {
|
||||
setStrictChooseMode(true);
|
||||
initLibrary();
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, desmondMiles);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 2);
|
||||
|
||||
attack(1, playerA, desmondMiles, playerB);
|
||||
addTarget(playerA, cardA); // surveil one in graveyard
|
||||
|
||||
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertGraveyardCount(playerA, cardA, 1);
|
||||
assertLibrary(playerA, cardB, cardC, cardD);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void SurveilX_two_Yard() {
|
||||
setStrictChooseMode(true);
|
||||
initLibrary();
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, desmondMiles);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
|
||||
addCard(Zone.HAND, playerA, "Battlegrowth");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Battlegrowth");
|
||||
addTarget(playerA, desmondMiles);
|
||||
|
||||
attack(1, playerA, desmondMiles, playerB);
|
||||
addTarget(playerA, cardA + "^" + cardB); // surveil both in graveyard
|
||||
|
||||
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertGraveyardCount(playerA, cardA, 1);
|
||||
assertGraveyardCount(playerA, cardB, 1);
|
||||
assertGraveyardCount(playerA, "Battlegrowth", 1);
|
||||
assertGraveyardCount(playerA, 3);
|
||||
assertLibrary(playerA, cardC, cardD);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue