[ACR] Implement Eivor, Wolf-Kissed

This commit is contained in:
theelk801 2024-06-20 15:41:25 -04:00
parent bbe09d34f2
commit 7bc43f7fc2
7 changed files with 186 additions and 3 deletions

View file

@ -0,0 +1,131 @@
package mage.cards.e;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.assignment.common.TypeAssignment;
import mage.abilities.common.DealsCombatDamageTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.HasteAbility;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.*;
import mage.constants.*;
import mage.filter.FilterCard;
import mage.filter.predicate.Predicates;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class EivorWolfKissed extends CardImpl {
public EivorWolfKissed(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}{G}{W}");
this.supertype.add(SuperType.LEGENDARY);
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.ASSASSIN);
this.subtype.add(SubType.WARRIOR);
this.power = new MageInt(7);
this.toughness = new MageInt(6);
// Trample
this.addAbility(TrampleAbility.getInstance());
// Haste
this.addAbility(HasteAbility.getInstance());
// Whenever Eivor, Wolf-Kissed deals combat damage to a player, you mill that many cards. You may put a Saga card and/or a land card from among them onto the battlefield.
this.addAbility(new DealsCombatDamageTriggeredAbility(new EivorWolfKissedEffect(), false));
}
private EivorWolfKissed(final EivorWolfKissed card) {
super(card);
}
@Override
public EivorWolfKissed copy() {
return new EivorWolfKissed(this);
}
}
class EivorWolfKissedEffect extends OneShotEffect {
EivorWolfKissedEffect() {
super(Outcome.Benefit);
staticText = "you mill that many cards. You may put a Saga card " +
"and/or a land card from among them onto the battlefield";
}
private EivorWolfKissedEffect(final EivorWolfKissedEffect effect) {
super(effect);
}
@Override
public EivorWolfKissedEffect copy() {
return new EivorWolfKissedEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
int damage = (Integer) getValue("damage");
if (player == null || damage < 1) {
return false;
}
Cards cards = player.millCards(damage, source, game);
TargetCard target = new EivorWolfKissedTarget();
player.choose(outcome, cards, target, source, game);
player.moveCards(new CardsImpl(target.getTargets()), Zone.BATTLEFIELD, source, game);
return true;
}
}
class EivorWolfKissedTarget extends TargetCard {
private static final FilterCard filter
= new FilterCard("a Saga card and/or a land card");
static {
filter.add(Predicates.or(
SubType.SAGA.getPredicate(),
CardType.LAND.getPredicate()
));
}
private static final TypeAssignment typeAssigner = new TypeAssignment(SubType.SAGA, CardType.LAND);
EivorWolfKissedTarget() {
super(0, 2, Zone.ALL, filter);
notTarget = true;
}
private EivorWolfKissedTarget(final EivorWolfKissedTarget target) {
super(target);
}
@Override
public EivorWolfKissedTarget copy() {
return new EivorWolfKissedTarget(this);
}
@Override
public boolean canTarget(UUID playerId, UUID id, Ability source, Game game) {
if (!super.canTarget(playerId, id, source, game)) {
return false;
}
Card card = game.getCard(id);
if (card == null) {
return false;
}
if (this.getTargets().isEmpty()) {
return true;
}
Cards cards = new CardsImpl(this.getTargets());
cards.add(card);
return typeAssigner.getRoleCount(cards, game) >= cards.size();
}
}

View file

@ -40,6 +40,7 @@ public final class AssassinsCreed extends ExpansionSet {
cards.add(new SetCardInfo("Detained by Legionnaires", 277, Rarity.COMMON, mage.cards.d.DetainedByLegionnaires.class));
cards.add(new SetCardInfo("Eagle Vision", 17, Rarity.UNCOMMON, mage.cards.e.EagleVision.class));
cards.add(new SetCardInfo("Eivor, Battle-Ready", 274, Rarity.MYTHIC, mage.cards.e.EivorBattleReady.class));
cards.add(new SetCardInfo("Eivor, Wolf-Kissed", 54, Rarity.MYTHIC, mage.cards.e.EivorWolfKissed.class));
cards.add(new SetCardInfo("Escarpment Fortress", 278, Rarity.RARE, mage.cards.e.EscarpmentFortress.class));
cards.add(new SetCardInfo("Ezio, Blade of Vengeance", 275, Rarity.MYTHIC, mage.cards.e.EzioBladeOfVengeance.class));
cards.add(new SetCardInfo("Fatal Push", 90, Rarity.UNCOMMON, mage.cards.f.FatalPush.class));

View file

@ -0,0 +1,24 @@
package mage.abilities.assignment.common;
import mage.abilities.assignment.RoleAssignment;
import mage.cards.Card;
import mage.constants.MagicType;
import mage.game.Game;
import java.util.Set;
import java.util.stream.Collectors;
public class TypeAssignment extends RoleAssignment<MagicType> {
public TypeAssignment(MagicType... types) {
super(types);
}
@Override
protected Set<MagicType> makeSet(Card card, Game game) {
return attributes
.stream()
.filter(type -> type.checkObject(card, game))
.collect(Collectors.toSet());
}
}

View file

@ -11,7 +11,7 @@ import java.util.List;
/**
* @author North
*/
public enum CardType {
public enum CardType implements MagicType {
ARTIFACT("Artifact", true, true),
BATTLE("Battle", true, true),
CONSPIRACY("Conspiracy", false, false),
@ -49,6 +49,11 @@ public enum CardType {
return text.endsWith("y") ? text.substring(0, text.length() - 1) + "ies" : text + 's';
}
@Override
public boolean checkObject(MageObject mageObject, Game game) {
return mageObject != null && mageObject.getCardType(game).contains(this);
}
public static CardType fromString(String value) {
for (CardType ct : CardType.values()) {
if (ct.toString().equals(value)) {

View file

@ -0,0 +1,12 @@
package mage.constants;
import mage.MageObject;
import mage.game.Game;
/**
* @author TheElk801
*/
public interface MagicType {
boolean checkObject(MageObject mageObject, Game game);
}

View file

@ -7,7 +7,7 @@ import mage.game.Game;
import java.util.*;
import java.util.stream.Collectors;
public enum SubType {
public enum SubType implements MagicType {
//205.3k Instants and sorceries share their lists of subtypes; these subtypes are called spell types.
ADVENTURE("Adventure", SubTypeSet.SpellType),
@ -578,6 +578,11 @@ public enum SubType {
this.predicate = new SubTypePredicate(this);
}
@Override
public boolean checkObject(MageObject mageObject, Game game) {
return mageObject != null && mageObject.hasSubtype(this, game);
}
public String getDescription() {
return description;
}

View file

@ -7,7 +7,7 @@ import mage.game.Game;
/**
* Created by IGOUDT on 26-3-2017.
*/
public enum SuperType {
public enum SuperType implements MagicType {
BASIC("Basic"),
ELITE("Elite"),
@ -51,4 +51,9 @@ public enum SuperType {
public SuperTypePredicate getPredicate() {
return predicate;
}
@Override
public boolean checkObject(MageObject mageObject, Game game) {
return mageObject != null && mageObject.getSuperType(game).contains(this);
}
}