Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ACR] Implement Eivor, Wolf-Kissed #12499

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
131 changes: 131 additions & 0 deletions Mage.Sets/src/mage/cards/e/EivorWolfKissed.java
Original file line number Diff line number Diff line change
@@ -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();
}
}
1 change: 1 addition & 0 deletions Mage.Sets/src/mage/sets/AssassinsCreed.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ private AssassinsCreed() {
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));
Expand Down
Original file line number Diff line number Diff line change
@@ -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());
}
}
7 changes: 6 additions & 1 deletion Mage/src/main/java/mage/constants/CardType.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/**
* @author North
*/
public enum CardType {
public enum CardType implements MagicType {
ARTIFACT("Artifact", true, true),
BATTLE("Battle", true, true),
CONSPIRACY("Conspiracy", false, false),
Expand Down Expand Up @@ -49,6 +49,11 @@ public String getPluralName() {
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)) {
Expand Down
12 changes: 12 additions & 0 deletions Mage/src/main/java/mage/constants/MagicType.java
Original file line number Diff line number Diff line change
@@ -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);
}
7 changes: 6 additions & 1 deletion Mage/src/main/java/mage/constants/SubType.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
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),
Expand Down Expand Up @@ -578,6 +578,11 @@ public String toString() {
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;
}
Expand Down
7 changes: 6 additions & 1 deletion Mage/src/main/java/mage/constants/SuperType.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/**
* Created by IGOUDT on 26-3-2017.
*/
public enum SuperType {
public enum SuperType implements MagicType {

BASIC("Basic"),
ELITE("Elite"),
Expand Down Expand Up @@ -51,4 +51,9 @@ public String toString() {
public SuperTypePredicate getPredicate() {
return predicate;
}

@Override
public boolean checkObject(MageObject mageObject, Game game) {
return mageObject != null && mageObject.getSuperType(game).contains(this);
}
}