mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
Reworking card types in preparation for implementing Grist, the Hunger Tide (#7899)
Co-authored-by: Oleg Agafonov <jaydi85@gmail.com>
This commit is contained in:
parent
07e1dff10c
commit
572104b8fc
1159 changed files with 2704 additions and 2203 deletions
|
@ -9,6 +9,7 @@ import java.awt.*;
|
|||
import java.awt.geom.Rectangle2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -16,7 +17,7 @@ import java.util.List;
|
|||
*/
|
||||
public class ModernSplitCardRenderer extends ModernCardRenderer {
|
||||
|
||||
private class HalfCardProps {
|
||||
private static class HalfCardProps {
|
||||
|
||||
int x, y, w, h, cw, ch;
|
||||
|
||||
|
@ -28,11 +29,7 @@ public class ModernSplitCardRenderer extends ModernCardRenderer {
|
|||
List<TextboxRule> keywords = new ArrayList<>();
|
||||
}
|
||||
|
||||
private static final ArrayList<CardType> ONLY_LAND_TYPE = new ArrayList<CardType>() {
|
||||
{
|
||||
add(CardType.LAND);
|
||||
}
|
||||
};
|
||||
private static final List<CardType> ONLY_LAND_TYPE = Arrays.asList(CardType.LAND);
|
||||
|
||||
// Right and left halves of the card content
|
||||
private HalfCardProps rightHalf = new HalfCardProps();
|
||||
|
|
|
@ -59,7 +59,7 @@ public class CardView extends SimpleCardView {
|
|||
@Expose
|
||||
protected String loyalty = "";
|
||||
protected String startingLoyalty;
|
||||
protected ArrayList<CardType> cardTypes;
|
||||
protected List<CardType> cardTypes;
|
||||
protected SubTypes subTypes;
|
||||
protected Set<SuperType> superTypes;
|
||||
protected ObjectColor color;
|
||||
|
@ -246,7 +246,7 @@ public class CardView extends SimpleCardView {
|
|||
for (SuperType superType : card.getSuperType()) {
|
||||
sbType.append(superType).append(' ');
|
||||
}
|
||||
for (CardType cardType : card.getCardType()) {
|
||||
for (CardType cardType : card.getCardType(game)) {
|
||||
sbType.append(cardType.toString()).append(' ');
|
||||
}
|
||||
if (!card.getSubtype(game).isEmpty()) {
|
||||
|
@ -312,7 +312,7 @@ public class CardView extends SimpleCardView {
|
|||
} else if (card instanceof Permanent) {
|
||||
this.power = Integer.toString(card.getPower().getValue());
|
||||
this.toughness = Integer.toString(card.getToughness().getValue());
|
||||
this.cardTypes = card.getCardType();
|
||||
this.cardTypes = card.getCardType(game);
|
||||
this.faceDown = card.isFaceDown(game);
|
||||
} else {
|
||||
// this.hideInfo = true;
|
||||
|
@ -434,7 +434,7 @@ public class CardView extends SimpleCardView {
|
|||
}
|
||||
this.power = Integer.toString(card.getPower().getValue());
|
||||
this.toughness = Integer.toString(card.getToughness().getValue());
|
||||
this.cardTypes = card.getCardType();
|
||||
this.cardTypes = card.getCardType(game);
|
||||
this.subTypes = card.getSubtype(game);
|
||||
this.superTypes = card.getSuperType();
|
||||
this.color = card.getColor(game);
|
||||
|
@ -561,7 +561,7 @@ public class CardView extends SimpleCardView {
|
|||
this.toughness = object.getToughness().toString();
|
||||
this.loyalty = "";
|
||||
}
|
||||
this.cardTypes = object.getCardType();
|
||||
this.cardTypes = object.getCardType(game);
|
||||
this.subTypes = object.getSubtype(game);
|
||||
this.superTypes = object.getSuperType();
|
||||
this.color = object.getColor(game);
|
||||
|
@ -749,7 +749,7 @@ public class CardView extends SimpleCardView {
|
|||
this.toughness = token.getToughness().toString();
|
||||
this.loyalty = "";
|
||||
this.startingLoyalty = "";
|
||||
this.cardTypes = token.getCardType();
|
||||
this.cardTypes = token.getCardType(game);
|
||||
this.subTypes = token.getSubtype(game);
|
||||
this.superTypes = token.getSuperType();
|
||||
this.color = token.getColor(game);
|
||||
|
@ -842,7 +842,7 @@ public class CardView extends SimpleCardView {
|
|||
return startingLoyalty;
|
||||
}
|
||||
|
||||
public ArrayList<CardType> getCardTypes() {
|
||||
public List<CardType> getCardTypes() {
|
||||
return cardTypes;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,13 +40,13 @@ public class StackAbilityView extends CardView {
|
|||
this.name = "Ability";
|
||||
this.loyalty = "";
|
||||
|
||||
this.cardTypes = ability.getCardType();
|
||||
this.cardTypes = ability.getCardType(game);
|
||||
this.subTypes = ability.getSubtype(game);
|
||||
this.superTypes = ability.getSuperType();
|
||||
this.color = ability.getColor(game);
|
||||
this.manaCostLeftStr = String.join("", ability.getManaCostSymbols());
|
||||
this.manaCostRightStr = "";
|
||||
this.cardTypes = ability.getCardType();
|
||||
this.cardTypes = ability.getCardType(game);
|
||||
this.subTypes = ability.getSubtype(game);
|
||||
this.superTypes = ability.getSuperType();
|
||||
this.color = ability.getColor(game);
|
||||
|
|
|
@ -7,6 +7,7 @@ import mage.cards.Card;
|
|||
import mage.cards.decks.Constructed;
|
||||
import mage.cards.decks.Deck;
|
||||
import mage.cards.decks.DeckValidatorErrorType;
|
||||
import mage.constants.CardType;
|
||||
import mage.filter.FilterMana;
|
||||
import mage.util.ManaUtil;
|
||||
|
||||
|
@ -77,8 +78,9 @@ public class Brawl extends Constructed {
|
|||
addError(DeckValidatorErrorType.PRIMARY, brawler.getName(), "Brawler banned (" + brawler.getName() + ')', true);
|
||||
valid = false;
|
||||
}
|
||||
if (!((brawler.isCreature() && brawler.isLegendary())
|
||||
|| brawler.isPlaneswalker() || brawler.getAbilities().contains(CanBeYourCommanderAbility.getInstance()))) {
|
||||
if (!((brawler.hasCardTypeForDeckbuilding(CardType.CREATURE) && brawler.isLegendary())
|
||||
|| brawler.hasCardTypeForDeckbuilding(CardType.PLANESWALKER)
|
||||
|| brawler.getAbilities().contains(CanBeYourCommanderAbility.getInstance()))) {
|
||||
addError(DeckValidatorErrorType.PRIMARY, brawler.getName(), "Brawler Invalid (" + brawler.getName() + ')', true);
|
||||
valid = false;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package mage.deck;
|
|||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.CanBeYourCommanderAbility;
|
||||
import mage.abilities.costs.mana.ManaCost;
|
||||
import mage.abilities.keyword.CompanionAbility;
|
||||
import mage.abilities.keyword.PartnerAbility;
|
||||
import mage.abilities.keyword.PartnerWithAbility;
|
||||
|
@ -13,6 +12,7 @@ import mage.cards.Sets;
|
|||
import mage.cards.decks.Constructed;
|
||||
import mage.cards.decks.Deck;
|
||||
import mage.cards.decks.DeckValidatorErrorType;
|
||||
import mage.constants.CardType;
|
||||
import mage.filter.FilterMana;
|
||||
import mage.util.ManaUtil;
|
||||
|
||||
|
@ -101,48 +101,61 @@ public class Commander extends Constructed {
|
|||
errorsList.clear();
|
||||
FilterMana colorIdentity = new FilterMana();
|
||||
Set<Card> commanders = new HashSet<>();
|
||||
Card companion = null;
|
||||
Card companion;
|
||||
|
||||
if (deck.getSideboard().size() == 1) {
|
||||
commanders.add(deck.getSideboard().iterator().next());
|
||||
} else if (deck.getSideboard().size() == 2) {
|
||||
Iterator<Card> iter = deck.getSideboard().iterator();
|
||||
Card card1 = iter.next();
|
||||
Card card2 = iter.next();
|
||||
if (card1.getAbilities().stream().anyMatch(ability -> ability instanceof CompanionAbility)) {
|
||||
companion = card1;
|
||||
commanders.add(card2);
|
||||
} else if (card2.getAbilities().stream().anyMatch(ability -> ability instanceof CompanionAbility)) {
|
||||
companion = card2;
|
||||
commanders.add(card1);
|
||||
} else {
|
||||
commanders.add(card1);
|
||||
commanders.add(card2);
|
||||
}
|
||||
} else if (deck.getSideboard().size() == 3) {
|
||||
Iterator<Card> iter = deck.getSideboard().iterator();
|
||||
Card card1 = iter.next();
|
||||
Card card2 = iter.next();
|
||||
Card card3 = iter.next();
|
||||
if (card1.getAbilities().stream().anyMatch(ability -> ability instanceof CompanionAbility)) {
|
||||
companion = card1;
|
||||
commanders.add(card2);
|
||||
commanders.add(card3);
|
||||
} else if (card2.getAbilities().stream().anyMatch(ability -> ability instanceof CompanionAbility)) {
|
||||
companion = card2;
|
||||
commanders.add(card1);
|
||||
commanders.add(card3);
|
||||
} else if (card3.getAbilities().stream().anyMatch(ability -> ability instanceof CompanionAbility)) {
|
||||
companion = card3;
|
||||
commanders.add(card1);
|
||||
commanders.add(card2);
|
||||
} else {
|
||||
int sbsize = deck.getSideboard().size();
|
||||
Card card1;
|
||||
Card card2;
|
||||
Card card3;
|
||||
Iterator<Card> iter;
|
||||
switch (deck.getSideboard().size()) {
|
||||
case 1:
|
||||
companion = null;
|
||||
commanders.add(deck.getSideboard().iterator().next());
|
||||
break;
|
||||
case 2:
|
||||
iter = deck.getSideboard().iterator();
|
||||
card1 = iter.next();
|
||||
card2 = iter.next();
|
||||
if (card1.getAbilities().stream().anyMatch(CompanionAbility.class::isInstance)) {
|
||||
companion = card1;
|
||||
commanders.add(card2);
|
||||
} else if (card2.getAbilities().stream().anyMatch(CompanionAbility.class::isInstance)) {
|
||||
companion = card2;
|
||||
commanders.add(card1);
|
||||
} else {
|
||||
companion = null;
|
||||
commanders.add(card1);
|
||||
commanders.add(card2);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
iter = deck.getSideboard().iterator();
|
||||
card1 = iter.next();
|
||||
card2 = iter.next();
|
||||
card3 = iter.next();
|
||||
if (card1.getAbilities().stream().anyMatch(CompanionAbility.class::isInstance)) {
|
||||
companion = card1;
|
||||
commanders.add(card2);
|
||||
commanders.add(card3);
|
||||
} else if (card2.getAbilities().stream().anyMatch(CompanionAbility.class::isInstance)) {
|
||||
companion = card2;
|
||||
commanders.add(card1);
|
||||
commanders.add(card3);
|
||||
} else if (card3.getAbilities().stream().anyMatch(CompanionAbility.class::isInstance)) {
|
||||
companion = card3;
|
||||
commanders.add(card1);
|
||||
commanders.add(card2);
|
||||
} else {
|
||||
companion = null;
|
||||
addError(DeckValidatorErrorType.PRIMARY, "Commander", "Sideboard must contain only the commander(s) and up to 1 companion");
|
||||
valid = false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
companion = null;
|
||||
addError(DeckValidatorErrorType.PRIMARY, "Commander", "Sideboard must contain only the commander(s) and up to 1 companion");
|
||||
valid = false;
|
||||
}
|
||||
} else {
|
||||
addError(DeckValidatorErrorType.PRIMARY, "Commander", "Sideboard must contain only the commander(s) and up to 1 companion");
|
||||
valid = false;
|
||||
}
|
||||
|
||||
if (companion != null && deck.getCards().size() + deck.getSideboard().size() != 101) {
|
||||
|
@ -174,8 +187,8 @@ public class Commander extends Constructed {
|
|||
addError(DeckValidatorErrorType.PRIMARY, commander.getName(), "Commander banned (" + commander.getName() + ')', true);
|
||||
valid = false;
|
||||
}
|
||||
if ((!commander.isCreature() || !commander.isLegendary())
|
||||
&& (!commander.isPlaneswalker() || !commander.getAbilities().contains(CanBeYourCommanderAbility.getInstance()))) {
|
||||
if ((!commander.hasCardTypeForDeckbuilding(CardType.CREATURE) || !commander.isLegendary())
|
||||
&& !commander.getAbilities().contains(CanBeYourCommanderAbility.getInstance())) {
|
||||
addError(DeckValidatorErrorType.PRIMARY, commander.getName(), "Commander invalid (" + commander.getName() + ')', true);
|
||||
valid = false;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import mage.cards.Sets;
|
|||
import mage.cards.decks.Constructed;
|
||||
import mage.cards.decks.Deck;
|
||||
import mage.cards.decks.DeckValidatorErrorType;
|
||||
import mage.constants.CardType;
|
||||
import mage.filter.FilterMana;
|
||||
import mage.util.ManaUtil;
|
||||
|
||||
|
@ -119,7 +120,7 @@ public class FreeformCommander extends Constructed {
|
|||
commanderNames.add(commander.getName());
|
||||
}
|
||||
for (Card commander : commanders) {
|
||||
if (!(commander.isCreature() || commander.isLegendary())) {
|
||||
if (!commander.hasCardTypeForDeckbuilding(CardType.CREATURE) && !commander.isLegendary()) {
|
||||
addError(DeckValidatorErrorType.PRIMARY, commander.getName(), "For Freeform Commander, the commander must be a creature or be legendary. Yours was: " + commander.getName(), true);
|
||||
valid = false;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import mage.abilities.keyword.PartnerWithAbility;
|
|||
import mage.cards.Card;
|
||||
import mage.cards.decks.Deck;
|
||||
import mage.cards.decks.DeckValidatorErrorType;
|
||||
import mage.constants.CardType;
|
||||
import mage.filter.FilterMana;
|
||||
import mage.util.ManaUtil;
|
||||
|
||||
|
@ -125,7 +126,7 @@ public class Oathbreaker extends Vintage {
|
|||
if (commander.isInstantOrSorcery()) {
|
||||
signatureSpells.add(commander.getName());
|
||||
} else {
|
||||
if (commander.isPlaneswalker()) {
|
||||
if (commander.hasCardTypeForDeckbuilding(CardType.PLANESWALKER)) {
|
||||
commanderNames.add(commander.getName());
|
||||
|
||||
// color identity from commanders only, not spell
|
||||
|
|
|
@ -12,6 +12,7 @@ import mage.cards.decks.Constructed;
|
|||
import mage.cards.decks.Deck;
|
||||
import mage.cards.decks.DeckValidatorErrorType;
|
||||
import mage.cards.decks.PennyDreadfulLegalityUtil;
|
||||
import mage.constants.CardType;
|
||||
import mage.filter.FilterMana;
|
||||
import mage.util.ManaUtil;
|
||||
|
||||
|
@ -127,8 +128,8 @@ public class PennyDreadfulCommander extends Constructed {
|
|||
addError(DeckValidatorErrorType.PRIMARY, commander.getName(), "Commander banned (" + commander.getName() + ')', true);
|
||||
valid = false;
|
||||
}
|
||||
if ((!commander.isCreature() || !commander.isLegendary())
|
||||
&& (!commander.isPlaneswalker() || !commander.getAbilities().contains(CanBeYourCommanderAbility.getInstance()))) {
|
||||
if ((!commander.hasCardTypeForDeckbuilding(CardType.CREATURE) || !commander.isLegendary())
|
||||
&& !commander.getAbilities().contains(CanBeYourCommanderAbility.getInstance())) {
|
||||
addError(DeckValidatorErrorType.PRIMARY, commander.getName(), "Commander invalid (" + commander.getName() + ')', true);
|
||||
valid = false;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import mage.cards.*;
|
|||
import mage.cards.decks.Constructed;
|
||||
import mage.cards.decks.Deck;
|
||||
import mage.cards.decks.DeckValidatorErrorType;
|
||||
import mage.constants.CardType;
|
||||
import mage.filter.FilterMana;
|
||||
import mage.game.GameTinyLeadersImpl;
|
||||
|
||||
|
@ -146,7 +147,8 @@ public class TinyLeaders extends Constructed {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
if ((commander.isCreature() && commander.isLegendary()) || commander.isPlaneswalker()) {
|
||||
if ((commander.hasCardTypeForDeckbuilding(CardType.CREATURE) && commander.isLegendary())
|
||||
|| commander.hasCardTypeForDeckbuilding(CardType.PLANESWALKER)) {
|
||||
if (!bannedCommander.contains(commander.getName())) {
|
||||
FilterMana color = commander.getColorIdentity();
|
||||
for (Card card : deck.getCards()) {
|
||||
|
|
|
@ -28,7 +28,7 @@ public final class ArtificialScoringSystem {
|
|||
|
||||
public static int getCardDefinitionScore(final Game game, final Card card) {
|
||||
int value = 3; //TODO: add new rating system card value
|
||||
if (card.isLand()) {
|
||||
if (card.isLand(game)) {
|
||||
int score = (int) ((value / 2.0f) * 50);
|
||||
//TODO: check this for "any color" lands
|
||||
//TODO: check this for dual and filter lands
|
||||
|
@ -40,7 +40,7 @@ public final class ArtificialScoringSystem {
|
|||
}
|
||||
|
||||
final int score = value * 100 - card.getManaCost().manaValue() * 20;
|
||||
if (card.getCardType().contains(CardType.CREATURE)) {
|
||||
if (card.getCardType(game).contains(CardType.CREATURE)) {
|
||||
return score + (card.getPower().getValue() + card.getToughness().getValue()) * 10;
|
||||
} else {
|
||||
return score + (/*card.getRemoval()*50*/+(card.getRarity() == null ? 0 : card.getRarity().getRating() * 30));
|
||||
|
@ -51,7 +51,7 @@ public final class ArtificialScoringSystem {
|
|||
//TODO: cache it inside Card
|
||||
int score = getCardDefinitionScore(game, permanent);
|
||||
score += PERMANENT_SCORE;
|
||||
if (permanent.getCardType().contains(CardType.CREATURE)) {
|
||||
if (permanent.getCardType(game).contains(CardType.CREATURE)) {
|
||||
// TODO: implement in the mage core
|
||||
//score + =cardDefinition.getActivations().size()*50;
|
||||
//score += cardDefinition.getManaActivations().size()*80;
|
||||
|
@ -68,10 +68,10 @@ public final class ArtificialScoringSystem {
|
|||
int score = permanent.getCounters(game).getCount(CounterType.CHARGE) * 30;
|
||||
score += permanent.getCounters(game).getCount(CounterType.LEVEL) * 30;
|
||||
score -= permanent.getDamage() * 2;
|
||||
if (!canTap(permanent, game)) {
|
||||
score += getTappedScore(permanent);
|
||||
if (!canTap(game, permanent)) {
|
||||
score += getTappedScore(game, permanent);
|
||||
}
|
||||
if (permanent.getCardType().contains(CardType.CREATURE)) {
|
||||
if (permanent.getCardType(game).contains(CardType.CREATURE)) {
|
||||
final int power = permanent.getPower().getValue();
|
||||
final int toughness = permanent.getToughness().getValue();
|
||||
int abilityScore = 0;
|
||||
|
@ -86,7 +86,7 @@ public final class ArtificialScoringSystem {
|
|||
if (object instanceof Card) {
|
||||
Card card = (Card) object;
|
||||
int outcomeScore = card.getAbilities(game).getOutcomeTotal();
|
||||
if (card.getCardType().contains(CardType.ENCHANTMENT)) {
|
||||
if (card.getCardType(game).contains(CardType.ENCHANTMENT)) {
|
||||
enchantments = enchantments + outcomeScore * 100;
|
||||
} else {
|
||||
equipments = equipments + outcomeScore * 50;
|
||||
|
@ -106,10 +106,10 @@ public final class ArtificialScoringSystem {
|
|||
return score;
|
||||
}
|
||||
|
||||
private static boolean canTap(Permanent permanent, Game game) {
|
||||
private static boolean canTap(Game game, Permanent permanent) {
|
||||
return !permanent.isTapped()
|
||||
&& (!permanent.hasSummoningSickness()
|
||||
|| !permanent.getCardType().contains(CardType.CREATURE)
|
||||
|| !permanent.getCardType(game).contains(CardType.CREATURE)
|
||||
|| permanent.getAbilities(game).contains(HasteAbility.getInstance()));
|
||||
}
|
||||
|
||||
|
@ -117,10 +117,10 @@ public final class ArtificialScoringSystem {
|
|||
return Math.max(0, value);
|
||||
}
|
||||
|
||||
public static int getTappedScore(final Permanent permanent) {
|
||||
if (permanent.getCardType().contains(CardType.CREATURE)) {
|
||||
public static int getTappedScore(Game game, final Permanent permanent) {
|
||||
if (permanent.isCreature(game)) {
|
||||
return -100;
|
||||
} else if (permanent.getCardType().contains(CardType.LAND)) {
|
||||
} else if (permanent.isLand(game)) {
|
||||
return -20; // means probably no mana available (should be greater than passivity penalty
|
||||
} else {
|
||||
return -2;
|
||||
|
|
|
@ -1034,7 +1034,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
|
||||
// planeswalker kill
|
||||
for (Permanent permanent : targets) {
|
||||
if (permanent.isPlaneswalker() && target.canTarget(getId(), permanent.getId(), source, game)) {
|
||||
if (permanent.isPlaneswalker(game) && target.canTarget(getId(), permanent.getId(), source, game)) {
|
||||
int loy = permanent.getCounters(game).getCount(CounterType.LOYALTY);
|
||||
if (loy <= target.getAmountRemaining()) {
|
||||
return tryAddTarget(target, permanent.getId(), loy, source, game);
|
||||
|
@ -1044,7 +1044,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
|
||||
// creature kill
|
||||
for (Permanent permanent : targets) {
|
||||
if (permanent.isCreature() && target.canTarget(getId(), permanent.getId(), source, game)) {
|
||||
if (permanent.isCreature(game) && target.canTarget(getId(), permanent.getId(), source, game)) {
|
||||
if (permanent.getToughness().getValue() <= target.getAmountRemaining()) {
|
||||
return tryAddTarget(target, permanent.getId(), permanent.getToughness().getValue(), source, game);
|
||||
}
|
||||
|
@ -1064,7 +1064,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
|
||||
// planeswalkers
|
||||
for (Permanent permanent : targets) {
|
||||
if (permanent.isPlaneswalker() && target.canTarget(getId(), permanent.getId(), source, game)) {
|
||||
if (permanent.isPlaneswalker(game) && target.canTarget(getId(), permanent.getId(), source, game)) {
|
||||
return tryAddTarget(target, permanent.getId(), target.getAmountRemaining(), source, game);
|
||||
}
|
||||
}
|
||||
|
@ -1079,7 +1079,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
|
||||
// creature
|
||||
for (Permanent permanent : targets) {
|
||||
if (permanent.isCreature() && target.canTarget(getId(), permanent.getId(), source, game)) {
|
||||
if (permanent.isCreature(game) && target.canTarget(getId(), permanent.getId(), source, game)) {
|
||||
return tryAddTarget(target, permanent.getId(), target.getAmountRemaining(), source, game);
|
||||
}
|
||||
}
|
||||
|
@ -1100,7 +1100,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
|
||||
// creatures - non killable (TODO: add extra skill checks like undestructeable)
|
||||
for (Permanent permanent : targets) {
|
||||
if (permanent.isCreature() && target.canTarget(getId(), permanent.getId(), source, game)) {
|
||||
if (permanent.isCreature(game) && target.canTarget(getId(), permanent.getId(), source, game)) {
|
||||
int safeDamage = Math.min(permanent.getToughness().getValue() - 1, target.getAmountRemaining());
|
||||
if (safeDamage > 0) {
|
||||
return tryAddTarget(target, permanent.getId(), safeDamage, source, game);
|
||||
|
@ -1110,14 +1110,14 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
|
||||
// creatures - all
|
||||
for (Permanent permanent : targets) {
|
||||
if (permanent.isCreature() && target.canTarget(getId(), permanent.getId(), source, game)) {
|
||||
if (permanent.isCreature(game) && target.canTarget(getId(), permanent.getId(), source, game)) {
|
||||
return tryAddTarget(target, permanent.getId(), target.getAmountRemaining(), source, game);
|
||||
}
|
||||
}
|
||||
|
||||
// planeswalkers
|
||||
for (Permanent permanent : targets) {
|
||||
if (permanent.isPlaneswalker() && target.canTarget(getId(), permanent.getId(), source, game)) {
|
||||
if (permanent.isPlaneswalker(game) && target.canTarget(getId(), permanent.getId(), source, game)) {
|
||||
return tryAddTarget(target, permanent.getId(), target.getAmountRemaining(), source, game);
|
||||
}
|
||||
}
|
||||
|
@ -1319,7 +1319,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
SpellAbility ability = card.getSpellAbility();
|
||||
if (ability != null && ability.canActivate(playerId, game).canActivate()
|
||||
&& !game.getContinuousEffects().preventedByRuleModification(GameEvent.getEvent(GameEvent.EventType.CAST_SPELL, ability.getSourceId(), ability, playerId), ability, game, true)) {
|
||||
if (card.getCardType().contains(CardType.INSTANT)
|
||||
if (card.getCardType(game).contains(CardType.INSTANT)
|
||||
|| card.hasAbility(FlashAbility.getInstance(), game)) {
|
||||
playableInstant.add(card);
|
||||
} else {
|
||||
|
@ -1689,9 +1689,9 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
if (score > 0) { // score mana producers that produce other mana types and have other uses higher
|
||||
score += mageObject.getAbilities().getAvailableActivatedManaAbilities(Zone.BATTLEFIELD, playerId, game).size();
|
||||
score += mageObject.getAbilities().getActivatedAbilities(Zone.BATTLEFIELD).size();
|
||||
if (!mageObject.getCardType().contains(CardType.LAND)) {
|
||||
if (!mageObject.getCardType(game).contains(CardType.LAND)) {
|
||||
score += 2;
|
||||
} else if (mageObject.getCardType().contains(CardType.CREATURE)) {
|
||||
} else if (mageObject.getCardType(game).contains(CardType.CREATURE)) {
|
||||
score += 2;
|
||||
}
|
||||
}
|
||||
|
@ -1823,7 +1823,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
// choose a creature type of opponent on battlefield or graveyard
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(this.getId(), game)) {
|
||||
if (game.getOpponents(this.getId()).contains(permanent.getControllerId())
|
||||
&& permanent.getCardType().contains(CardType.CREATURE)
|
||||
&& permanent.getCardType(game).contains(CardType.CREATURE)
|
||||
&& !permanent.getSubtype(game).isEmpty()) {
|
||||
if (choice.getChoices().contains(permanent.getSubtype(game).get(0).toString())) {
|
||||
choice.setChoice(permanent.getSubtype(game).get(0).toString());
|
||||
|
@ -1836,7 +1836,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
for (UUID opponentId : game.getOpponents(this.getId())) {
|
||||
Player opponent = game.getPlayer(opponentId);
|
||||
for (Card card : opponent.getGraveyard().getCards(game)) {
|
||||
if (card != null && card.getCardType().contains(CardType.CREATURE) && !card.getSubtype(game).isEmpty()) {
|
||||
if (card != null && card.getCardType(game).contains(CardType.CREATURE) && !card.getSubtype(game).isEmpty()) {
|
||||
if (choice.getChoices().contains(card.getSubtype(game).get(0).toString())) {
|
||||
choice.setChoice(card.getSubtype(game).get(0).toString());
|
||||
break;
|
||||
|
@ -1852,7 +1852,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
// choose a creature type of hand or library
|
||||
for (UUID cardId : this.getHand()) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card != null && card.getCardType().contains(CardType.CREATURE) && !card.getSubtype(game).isEmpty()) {
|
||||
if (card != null && card.getCardType(game).contains(CardType.CREATURE) && !card.getSubtype(game).isEmpty()) {
|
||||
if (choice.getChoices().contains(card.getSubtype(game).get(0).toString())) {
|
||||
choice.setChoice(card.getSubtype(game).get(0).toString());
|
||||
break;
|
||||
|
@ -1862,7 +1862,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
if (!choice.isChosen()) {
|
||||
for (UUID cardId : this.getLibrary().getCardList()) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card != null && card.getCardType().contains(CardType.CREATURE) && !card.getSubtype(game).isEmpty()) {
|
||||
if (card != null && card.getCardType(game).contains(CardType.CREATURE) && !card.getSubtype(game).isEmpty()) {
|
||||
if (choice.getChoices().contains(card.getSubtype(game).get(0).toString())) {
|
||||
choice.setChoice(card.getSubtype(game).get(0).toString());
|
||||
break;
|
||||
|
|
|
@ -21,10 +21,10 @@ public class PermanentEvaluator {
|
|||
// more score -- more valueable/powerfull permanent
|
||||
if (!values.containsKey(permanent.getId())) {
|
||||
int value = 0;
|
||||
if (permanent.isCreature()) {
|
||||
if (permanent.isCreature(game)) {
|
||||
value += combat.evaluate(permanent, game);
|
||||
}
|
||||
if (permanent.isPlaneswalker()) {
|
||||
if (permanent.isPlaneswalker(game)) {
|
||||
value += 2 * permanent.getCounters(game).getCount(CounterType.LOYALTY); // planeswalker is more valuable
|
||||
}
|
||||
value += permanent.getAbilities().getActivatedManaAbilities(Zone.BATTLEFIELD).size();
|
||||
|
|
|
@ -80,7 +80,7 @@ public final class GameStateEvaluator {
|
|||
} else {
|
||||
value = permanent.isTapped() ? 4 : 5;
|
||||
}
|
||||
if (permanent.getCardType().contains(CardType.CREATURE)) {
|
||||
if (permanent.getCardType(game).contains(CardType.CREATURE)) {
|
||||
value += evaluateCreature(permanent, game) * CREATURE_FACTOR;
|
||||
}
|
||||
value += permanent.getAbilities().getActivatedManaAbilities(Zone.BATTLEFIELD).size();
|
||||
|
|
|
@ -2062,7 +2062,7 @@ public class HumanPlayer extends PlayerImpl {
|
|||
return;
|
||||
}
|
||||
}
|
||||
if (userData.isUseFirstManaAbility() && object instanceof Permanent && object.isLand()) {
|
||||
if (userData.isUseFirstManaAbility() && object instanceof Permanent && object.isLand(game)) {
|
||||
ActivatedAbility ability = abilities.values().iterator().next();
|
||||
if (ability instanceof ActivatedManaAbilityImpl) {
|
||||
activateAbility(ability, game);
|
||||
|
|
|
@ -17,7 +17,6 @@ import mage.constants.CardType;
|
|||
import mage.constants.Outcome;
|
||||
import mage.constants.Planes;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.Counter;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.GameCommanderImpl;
|
||||
|
@ -518,7 +517,7 @@ public final class SystemUtil {
|
|||
}
|
||||
} else if ("loyalty".equalsIgnoreCase(command.zone)) {
|
||||
for (Permanent perm : game.getBattlefield().getAllActivePermanents(player.getId())) {
|
||||
if (perm.getName().equals(command.cardName) && perm.getCardType().contains(CardType.PLANESWALKER)) {
|
||||
if (perm.getName().equals(command.cardName) && perm.getCardType(game).contains(CardType.PLANESWALKER)) {
|
||||
perm.addCounters(CounterType.LOYALTY.createInstance(command.Amount), fakeSourceAbility.getControllerId(), fakeSourceAbility, game);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ public final class AAT1 extends CardImpl {
|
|||
Card card = game.getCard(event.getTargetId());
|
||||
if (card != null
|
||||
&& event.getPlayerId().equals(game.getControllerId(sourceId))
|
||||
&& card.isCreature()
|
||||
&& card.isCreature(game)
|
||||
&& game.getState().getZone(card.getId()) == Zone.GRAVEYARD
|
||||
&& event.getData().equals("repair")) {
|
||||
return true;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
package mage.cards.a;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
@ -69,7 +68,7 @@ class AberrantResearcherEffect extends OneShotEffect {
|
|||
.millCards(1, source, game)
|
||||
.getCards(game)
|
||||
.stream()
|
||||
.noneMatch(MageObject::isInstantOrSorcery)) {
|
||||
.noneMatch(card -> card.isInstantOrSorcery(game))) {
|
||||
return false;
|
||||
}
|
||||
new TransformSourceEffect(true).apply(game, source);
|
||||
|
|
|
@ -87,7 +87,7 @@ class AbeyanceEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
return false;
|
||||
}
|
||||
if (event.getType() == GameEvent.EventType.CAST_SPELL
|
||||
&& object.isInstantOrSorcery()) {
|
||||
&& object.isInstantOrSorcery(game)) {
|
||||
return true;
|
||||
}
|
||||
if (event.getType() == GameEvent.EventType.ACTIVATE_ABILITY) {
|
||||
|
|
|
@ -68,7 +68,7 @@ class AbundantHarvestEffect extends OneShotEffect {
|
|||
continue;
|
||||
}
|
||||
toReveal.add(card);
|
||||
if (card.isLand() == land) {
|
||||
if (card.isLand(game) == land) {
|
||||
toHand = card;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ import mage.constants.Zone;
|
|||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetOpponentOrPlaneswalker;
|
||||
|
||||
|
@ -67,7 +66,7 @@ class AetherChargeTriggeredAbility extends TriggeredAbilityImpl {
|
|||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
if (permanent != null && permanent.isCreature() && permanent.hasSubtype(SubType.BEAST, game)
|
||||
if (permanent != null && permanent.isCreature(game) && permanent.hasSubtype(SubType.BEAST, game)
|
||||
&& permanent.isControlledBy(this.controllerId)) {
|
||||
Effect effect = this.getEffects().get(0);
|
||||
effect.setValue("damageSource", event.getTargetId());
|
||||
|
|
|
@ -65,7 +65,7 @@ class AetherRiftEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
Card card = controller.discardOne(true, false, source, game);
|
||||
if (card != null && card.isCreature()) {
|
||||
if (card != null && card.isCreature(game)) {
|
||||
Effect returnEffect = new ReturnFromGraveyardToBattlefieldTargetEffect();
|
||||
returnEffect.setTargetPointer(new FixedTarget(card.getId()));
|
||||
Effect doEffect = new DoUnlessAnyPlayerPaysEffect(returnEffect, new PayLifeCost(5),
|
||||
|
|
|
@ -11,7 +11,6 @@ import mage.constants.CardType;
|
|||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
|
@ -62,7 +61,7 @@ class AetherStingTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (game.getOpponents(controllerId).contains(event.getPlayerId())) {
|
||||
Card card = game.getCard(event.getSourceId());
|
||||
if (card != null && card.isCreature()) {
|
||||
if (card != null && card.isCreature(game)) {
|
||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ class AetherStormReplacementEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
Card card = game.getCard(event.getSourceId());
|
||||
return card != null && card.isCreature();
|
||||
return card != null && card.isCreature(game);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ class AetherplasmEffect extends OneShotEffect {
|
|||
&& game.getCombat() != null && blockedCreature != null) {
|
||||
CombatGroup attacker = game.getCombat().findGroup(blockedCreature.getId());
|
||||
Permanent putIntoPlay = game.getPermanent(target.getFirstTarget());
|
||||
if (putIntoPlay != null && putIntoPlay.isCreature() && attacker != null) {
|
||||
if (putIntoPlay != null && putIntoPlay.isCreature(game) && attacker != null) {
|
||||
game.getCombat().findGroup(blockedCreature.getId()).addBlocker(putIntoPlay.getId(), source.getControllerId(), game);
|
||||
|
||||
}
|
||||
|
|
|
@ -84,8 +84,8 @@ class AjanisLastStandTriggeredAbility extends TriggeredAbilityImpl {
|
|||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||
if (zEvent.isDiesEvent()) {
|
||||
if (zEvent.getTarget().isControlledBy(controllerId)
|
||||
&& (zEvent.getTarget().isCreature()
|
||||
|| zEvent.getTarget().isPlaneswalker())) {
|
||||
&& (zEvent.getTarget().isCreature(game)
|
||||
|| zEvent.getTarget().isPlaneswalker(game))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ class AkoumFirebirdLandfallAbility extends TriggeredAbilityImpl {
|
|||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
return permanent != null && permanent.isLand() && permanent.isControlledBy(this.controllerId);
|
||||
return permanent != null && permanent.isLand(game) && permanent.isControlledBy(this.controllerId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -76,7 +76,7 @@ class AkoumHellkiteTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
if (permanent != null
|
||||
&& permanent.isLand()
|
||||
&& permanent.isLand(game)
|
||||
&& permanent.isControlledBy(getControllerId())) {
|
||||
Permanent sourcePermanent = game.getPermanent(getSourceId());
|
||||
if (sourcePermanent != null) {
|
||||
|
|
|
@ -112,7 +112,7 @@ class AlenaKessigTrapperWatcher extends Watcher {
|
|||
.filter(Objects::nonNull)
|
||||
.map(mor -> mor.getPermanent(game))
|
||||
.filter(Objects::nonNull)
|
||||
.filter(MageObject::isCreature)
|
||||
.filter(permanent1 -> permanent1.isCreature(game))
|
||||
.filter(permanent -> permanent.isControlledBy(playerId))
|
||||
.map(MageObject::getPower)
|
||||
.mapToInt(MageInt::getValue)
|
||||
|
|
|
@ -95,7 +95,7 @@ class AllHallowsEveEffect extends OneShotEffect {
|
|||
.map(Player::getGraveyard)
|
||||
.map(g -> g.getCards(game))
|
||||
.flatMap(Collection::stream)
|
||||
.filter(MageObject::isCreature)
|
||||
.filter(card1 -> card1.isCreature(game))
|
||||
.forEach(cards::add);
|
||||
controller.moveCards(card, Zone.BATTLEFIELD, source, game, false, false, true, null);
|
||||
return true;
|
||||
|
|
|
@ -113,7 +113,7 @@ class AlrundGodOfTheCosmosEffect extends OneShotEffect {
|
|||
cards.addAll(twoCardsFromTop);
|
||||
controller.revealCards(source, cards, game);
|
||||
for (Card card : cards.getCards(game)) {
|
||||
if (card.getCardType().toString().contains(chosenCardType)) {
|
||||
if (card.getCardType(game).toString().contains(chosenCardType)) {
|
||||
cardsToHand.add(card);
|
||||
} else {
|
||||
cardsToBottomOfLibrary.add(card);
|
||||
|
|
|
@ -88,7 +88,7 @@ class AmarethTheLustrousEffect extends OneShotEffect {
|
|||
permanent = (Permanent) obj;
|
||||
}
|
||||
if (permanent == null
|
||||
|| card.getCardType().stream().noneMatch(permanent.getCardType()::contains)
|
||||
|| card.getCardType(game).stream().noneMatch(permanent.getCardType(game)::contains)
|
||||
|| !player.chooseUse(Outcome.DrawCard, "Reveal " + card.getName() + " and put it into your hand?", source, game)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -149,7 +149,7 @@ class AminatousAuguryCastFromExileEffect extends AsThoughEffectImpl {
|
|||
if (card != null
|
||||
&& game.getState().getZone(objectId) == Zone.EXILED) {
|
||||
EnumSet<CardType> unusedCardTypes = EnumSet.noneOf(CardType.class);
|
||||
for (CardType cardT : card.getCardType()) {
|
||||
for (CardType cardT : card.getCardType(game)) {
|
||||
if (!usedCardTypes.contains(cardT)) {
|
||||
unusedCardTypes.add(cardT);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package mage.cards.a;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.*;
|
||||
|
@ -59,7 +58,7 @@ class AmnesiaEffect extends OneShotEffect {
|
|||
Cards hand = player.getHand();
|
||||
player.revealCards(source, hand, game);
|
||||
Set<Card> cards = hand.getCards(game);
|
||||
cards.removeIf(MageObject::isLand);
|
||||
cards.removeIf(card -> card.isLand(game));
|
||||
player.discard(new CardsImpl(cards), false, source, game);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ class AmplifireEffect extends OneShotEffect {
|
|||
for (Card card : player.getLibrary().getCards(game)) {
|
||||
if (card != null) {
|
||||
cards.add(card);
|
||||
if (card.isCreature()) {
|
||||
if (card.isCreature(game)) {
|
||||
lastCard = card;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -117,10 +117,10 @@ class AnafenzaTheForemostEffect extends ReplacementEffectImpl {
|
|||
Card card = game.getCard(event.getTargetId());
|
||||
if (card != null && game.getOpponents(source.getControllerId()).contains(card.getOwnerId())) { // Anafenza only cares about cards
|
||||
if (zEvent.getTarget() != null) { // if it comes from permanent, check if it was a creature on the battlefield
|
||||
if (zEvent.getTarget().isCreature()) {
|
||||
if (zEvent.getTarget().isCreature(game)) {
|
||||
return true;
|
||||
}
|
||||
} else if (card.isCreature()) {
|
||||
} else if (card.isCreature(game)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ class AncientGreenwardenEffect extends ReplacementEffectImpl {
|
|||
if (sourceEvent == null
|
||||
|| sourceEvent.getType() != GameEvent.EventType.ENTERS_THE_BATTLEFIELD
|
||||
|| !(sourceEvent instanceof EntersTheBattlefieldEvent)
|
||||
|| !((EntersTheBattlefieldEvent) sourceEvent).getTarget().isLand()) {
|
||||
|| !((EntersTheBattlefieldEvent) sourceEvent).getTarget().isLand(game)) {
|
||||
return false;
|
||||
}
|
||||
return game.getPermanent(numberOfTriggersEvent.getSourceId()) != null;
|
||||
|
|
|
@ -10,7 +10,6 @@ import mage.constants.Outcome;
|
|||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
|
@ -57,7 +56,7 @@ class AngelicChorusTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
if (permanent != null
|
||||
&& permanent.isCreature()
|
||||
&& permanent.isCreature(game)
|
||||
&& permanent.isControlledBy(this.controllerId)) {
|
||||
this.getEffects().get(0).setValue("lifeSource", event.getTargetId());
|
||||
return true;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package mage.cards.a;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AttacksWithCreaturesTriggeredAbility;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
|
@ -75,7 +74,7 @@ class AngelicGuardianGainEffect extends OneShotEffect {
|
|||
.map(game::getPermanent)
|
||||
.filter(Objects::nonNull)
|
||||
.filter(permanent -> permanent.isControlledBy(you.getId()))
|
||||
.filter(MageObject::isCreature)
|
||||
.filter(permanent1 -> permanent1.isCreature(game))
|
||||
.forEach(permanent -> {
|
||||
ContinuousEffect effect = new GainAbilityTargetEffect(IndestructibleAbility.getInstance(), Duration.EndOfTurn);
|
||||
effect.setTargetPointer(new FixedTarget(permanent, game));
|
||||
|
|
|
@ -83,7 +83,7 @@ class AnimarCostReductionEffect extends CostModificationEffectImpl {
|
|||
if (abilityToModify.isControlledBy(source.getControllerId())) {
|
||||
Card spellCard = ((SpellAbility) abilityToModify).getCharacteristics(game);
|
||||
if (spellCard != null) {
|
||||
return spellCard.isCreature();
|
||||
return spellCard.isCreature(game);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,9 +77,9 @@ class AnimateArtifactContinuousEffect extends ContinuousEffectImpl {
|
|||
Permanent enchantment = game.getPermanent(source.getSourceId());
|
||||
if (enchantment != null) {
|
||||
Permanent permanent = game.getPermanent(enchantment.getAttachedTo());
|
||||
if (permanent != null && !permanent.isCreature()) {
|
||||
if (permanent != null && !permanent.isCreature(game)) {
|
||||
if (sublayer == SubLayer.NA) {
|
||||
permanent.addCardType(CardType.CREATURE);
|
||||
permanent.addCardType(game, CardType.CREATURE);
|
||||
permanent.getPower().setValue(permanent.getManaValue());
|
||||
permanent.getToughness().setValue(permanent.getManaValue());
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ import mage.constants.CardType;
|
|||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
@ -64,7 +63,7 @@ class AnkhOfMishraAbility extends TriggeredAbilityImpl {
|
|||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
if (permanent != null && permanent.isLand()) {
|
||||
if (permanent != null && permanent.isLand(game)) {
|
||||
Player player = game.getPlayer(permanent.getControllerId());
|
||||
if (player != null) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
|
|
|
@ -68,7 +68,7 @@ class AnsweredPrayersEffect extends OneShotEffect {
|
|||
if (permanent == null) {
|
||||
return false;
|
||||
}
|
||||
if (permanent.isCreature()) {
|
||||
if (permanent.isCreature(game)) {
|
||||
return true;
|
||||
}
|
||||
game.addEffect(new BecomesCreatureSourceEffect(
|
||||
|
|
|
@ -76,7 +76,7 @@ class ApexOfPowerSpellEffect extends OneShotEffect {
|
|||
}
|
||||
controller.moveCards(cards, Zone.EXILED, source, game);
|
||||
for (Card card : cards) {
|
||||
if (card.isLand()) {
|
||||
if (card.isLand(game)) {
|
||||
continue;
|
||||
}
|
||||
ContinuousEffect effect = new PlayFromNotOwnHandZoneTargetEffect(Zone.EXILED, Duration.EndOfTurn);
|
||||
|
|
|
@ -98,7 +98,7 @@ class ArahboEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent creature = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
if (creature != null && creature.isCreature()) {
|
||||
if (creature != null && creature.isCreature(game)) {
|
||||
int pow = creature.getPower().getValue();
|
||||
ContinuousEffect effect = new BoostTargetEffect(pow, pow, Duration.EndOfTurn);
|
||||
effect.setTargetPointer(new FixedTarget(creature, game));
|
||||
|
|
|
@ -76,26 +76,26 @@ class ArcaneAdaptationEffect extends ContinuousEffectImpl {
|
|||
// in graveyard
|
||||
for (UUID cardId : controller.getGraveyard()) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card != null && card.isCreature() && !card.hasSubtype(subType, game)) {
|
||||
if (card != null && card.isCreature(game) && !card.hasSubtype(subType, game)) {
|
||||
game.getState().getCreateMageObjectAttribute(card, game).getSubtype().add(subType);
|
||||
}
|
||||
}
|
||||
// on Hand
|
||||
for (UUID cardId : controller.getHand()) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card != null && card.isCreature() && !card.hasSubtype(subType, game)) {
|
||||
if (card != null && card.isCreature(game) && !card.hasSubtype(subType, game)) {
|
||||
game.getState().getCreateMageObjectAttribute(card, game).getSubtype().add(subType);
|
||||
}
|
||||
}
|
||||
// in Exile
|
||||
for (Card card : game.getState().getExile().getAllCards(game)) {
|
||||
if (card.isCreature() && !card.hasSubtype(subType, game)) {
|
||||
if (card.isCreature(game) && !card.hasSubtype(subType, game)) {
|
||||
game.getState().getCreateMageObjectAttribute(card, game).getSubtype().add(subType);
|
||||
}
|
||||
}
|
||||
// in Library (e.g. for Mystical Teachings)
|
||||
for (Card card : controller.getLibrary().getCards(game)) {
|
||||
if (card.isOwnedBy(controller.getId()) && card.isCreature() && !card.hasSubtype(subType, game)) {
|
||||
if (card.isOwnedBy(controller.getId()) && card.isCreature(game) && !card.hasSubtype(subType, game)) {
|
||||
game.getState().getCreateMageObjectAttribute(card, game).getSubtype().add(subType);
|
||||
}
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ class ArcaneAdaptationEffect extends ContinuousEffectImpl {
|
|||
if (commandObject instanceof Commander) {
|
||||
Card card = game.getCard(((Commander) commandObject).getId());
|
||||
if (card != null && card.isOwnedBy(controller.getId())
|
||||
&& card.isCreature() && !card.hasSubtype(subType, game)) {
|
||||
&& card.isCreature(game) && !card.hasSubtype(subType, game)) {
|
||||
game.getState().getCreateMageObjectAttribute(card, game).getSubtype().add(subType);
|
||||
}
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ class ArcaneAdaptationEffect extends ContinuousEffectImpl {
|
|||
StackObject stackObject = iterator.next();
|
||||
if (stackObject instanceof Spell
|
||||
&& stackObject.isControlledBy(source.getControllerId())
|
||||
&& stackObject.isCreature()
|
||||
&& stackObject.isCreature(game)
|
||||
&& !stackObject.hasSubtype(subType, game)) {
|
||||
Card card = ((Spell) stackObject).getCard();
|
||||
game.getState().getCreateMageObjectAttribute(card, game).getSubtype().add(subType);
|
||||
|
|
|
@ -101,7 +101,7 @@ class ArcaneArtisanCreateTokenEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (card.isCreature()) {
|
||||
if (card.isCreature(game)) {
|
||||
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(player.getId());
|
||||
effect.setTargetPointer(new FixedTarget(card.getId(), game));
|
||||
effect.apply(game, source);
|
||||
|
|
|
@ -77,7 +77,7 @@ class ArchonOfEmeriaEffect extends ReplacementEffectImpl {
|
|||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
|
||||
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (permanent != null && permanent.isLand() && !permanent.isBasic()) {
|
||||
if (permanent != null && permanent.isLand(game) && !permanent.isBasic()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ class ArchonOfValorsReachReplacementEffect extends ContinuousRuleModifyingEffect
|
|||
|
||||
if (savedType instanceof String && card != null) {
|
||||
CardType cardType = CardType.fromString((String) savedType);
|
||||
if (cardType != null && card.getCardType().contains(cardType)) {
|
||||
if (cardType != null && card.getCardType(game).contains(cardType)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ class ArclightPhoenixWatcher extends Watcher {
|
|||
public void watch(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.SPELL_CAST) {
|
||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||
if (spell == null || !spell.isInstantOrSorcery()) {
|
||||
if (spell == null || !spell.isInstantOrSorcery(game)) {
|
||||
return;
|
||||
}
|
||||
this.instantSorceryCount.putIfAbsent(spell.getControllerId(), 0);
|
||||
|
|
|
@ -76,7 +76,7 @@ class ArgothianPixiesPreventDamageFromArtifactsEffect extends PreventionEffectIm
|
|||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (super.applies(event, source, game)) {
|
||||
MageObject sourceObject = game.getObject(event.getSourceId());
|
||||
if (sourceObject != null && sourceObject.getCardType().contains(CardType.ARTIFACT)) {
|
||||
if (sourceObject != null && sourceObject.getCardType(game).contains(CardType.ARTIFACT)) {
|
||||
return (event.getTargetId().equals(source.getSourceId()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ class PreventDamageToSourceByCardTypeEffect extends PreventAllDamageToSourceEffe
|
|||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (super.applies(event, source, game)) {
|
||||
MageObject sourceObject = game.getObject(event.getSourceId());
|
||||
if (sourceObject != null && sourceObject.getCardType().contains(cardType)) {
|
||||
if (sourceObject != null && sourceObject.getCardType(game).contains(cardType)) {
|
||||
return event.getTargetId().equals(source.getSourceId());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,8 +92,8 @@ class ArixmethesIsLandEffect extends ContinuousEffectImpl {
|
|||
if (permanent == null) {
|
||||
return false;
|
||||
}
|
||||
permanent.getCardType().clear();
|
||||
permanent.addCardType(CardType.LAND);
|
||||
permanent.removeAllCardTypes(game);
|
||||
permanent.addCardType(game, CardType.LAND);
|
||||
permanent.removeAllSubTypes(game);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ class ArlinnVoiceOfThePackReplacementEffect extends ReplacementEffectImpl {
|
|||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
return creature != null && creature.isControlledBy(source.getControllerId())
|
||||
&& creature.isCreature()
|
||||
&& creature.isCreature(game)
|
||||
&& (creature.hasSubtype(SubType.WOLF, game)
|
||||
|| creature.hasSubtype(SubType.WEREWOLF, game));
|
||||
}
|
||||
|
|
|
@ -62,8 +62,8 @@ class ArmedAndArmoredEffect extends ContinuousEffectImpl {
|
|||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(source.getControllerId())) {
|
||||
if (permanent != null && permanent.hasSubtype(SubType.VEHICLE, game)) {
|
||||
if (sublayer == SubLayer.NA) {
|
||||
permanent.addCardType(CardType.ARTIFACT);
|
||||
permanent.addCardType(CardType.CREATURE);// TODO: Check if giving CREATURE Type is correct
|
||||
permanent.addCardType(game, CardType.ARTIFACT);
|
||||
permanent.addCardType(game, CardType.CREATURE);// TODO: Check if giving CREATURE Type is correct
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ class ArtificersHexEffect extends OneShotEffect {
|
|||
Permanent equipment = game.getPermanent(enchantment.getAttachedTo());
|
||||
if (equipment != null && equipment.getAttachedTo() != null) {
|
||||
Permanent creature = game.getPermanent(equipment.getAttachedTo());
|
||||
if (creature != null && creature.isCreature()) {
|
||||
if (creature != null && creature.isCreature(game)) {
|
||||
return creature.destroy(source, game, false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ class SpellWithManaCostLessThanOrEqualToCondition implements Condition {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
MageObject object = game.getObject(source.getSourceId());
|
||||
return object != null
|
||||
&& !object.isLand()
|
||||
&& !object.isLand(game)
|
||||
&& object.getManaValue() <= counters;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -134,7 +134,7 @@ class AscentOfTheWorthyRedirectEffect extends ReplacementEffectImpl {
|
|||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
return permanent != null && permanent.isCreature() && permanent.isControlledBy(source.getControllerId());
|
||||
return permanent != null && permanent.isCreature(game) && permanent.isControlledBy(source.getControllerId());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -86,8 +86,8 @@ class AshayaSoulOfTheWildEffect extends ContinuousEffectImpl {
|
|||
for (Permanent permanent : game.getBattlefield().getActivePermanents(
|
||||
filter, source.getControllerId(), source.getSourceId(), game
|
||||
)) {
|
||||
if (!permanent.isLand()) {
|
||||
permanent.addCardType(CardType.LAND);
|
||||
if (!permanent.isLand(game)) {
|
||||
permanent.addCardType(game, CardType.LAND);
|
||||
}
|
||||
permanent.addSubType(game, SubType.FOREST);
|
||||
if (!permanent.getAbilities(game).containsClass(GreenManaAbility.class)) {
|
||||
|
|
|
@ -69,7 +69,7 @@ enum AshenGhoulCondition implements Condition {
|
|||
int cardsAbove = 0;
|
||||
boolean aboveCards = false;
|
||||
for (Card card : controller.getGraveyard().getCards(game)) {
|
||||
if (aboveCards && card.isCreature()) {
|
||||
if (aboveCards && card.isCreature(game)) {
|
||||
cardsAbove++;
|
||||
if (cardsAbove > 2) {
|
||||
return true;
|
||||
|
|
|
@ -61,7 +61,7 @@ class AshesOfTheFallenEffect extends ContinuousEffectImpl {
|
|||
if (subType != null) {
|
||||
for (UUID cardId : controller.getGraveyard()) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card != null && card.isCreature() && !card.hasSubtype(subType, game)) {
|
||||
if (card != null && card.isCreature(game) && !card.hasSubtype(subType, game)) {
|
||||
game.getState().getCreateMageObjectAttribute(card, game).getSubtype().add(subType);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ class AsmiraHolyAvengerWatcher extends Watcher {
|
|||
public void watch(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).isDiesEvent()) {
|
||||
MageObject card = game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD);
|
||||
if (card != null && ((Card) card).isOwnedBy(this.controllerId) && card.isCreature()) {
|
||||
if (card != null && ((Card) card).isOwnedBy(this.controllerId) && card.isCreature(game)) {
|
||||
creaturesCount++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ class AthreosShroudVeiledTriggeredAbility extends TriggeredAbilityImpl {
|
|||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||
Permanent permanent = zEvent.getTarget();
|
||||
if (permanent == null
|
||||
|| !permanent.isCreature()
|
||||
|| !permanent.isCreature(game)
|
||||
|| !permanent.getCounters(game).containsKey(CounterType.COIN)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ class AtlaPalaniNestTenderEffect extends OneShotEffect {
|
|||
Card toBattlefield = null;
|
||||
for (Card card : library.getCards(game)) {
|
||||
cards.add(card);
|
||||
if (card.isCreature()) {
|
||||
if (card.isCreature(game)) {
|
||||
toBattlefield = card;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ class AudaciousReshapersEffect extends OneShotEffect {
|
|||
continue;
|
||||
}
|
||||
cards.add(card);
|
||||
if (card.isArtifact()) {
|
||||
if (card.isArtifact(game)) {
|
||||
artifact = card;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ class EchoingEquationEffect extends OneShotEffect {
|
|||
Permanent copyFrom = game.getPermanent(source.getFirstTarget());
|
||||
if (copyFrom != null) {
|
||||
game.getBattlefield().getAllActivePermanents(source.getControllerId()).stream()
|
||||
.filter(permanent -> permanent.isCreature() && !permanent.getId().equals(copyFrom.getId()))
|
||||
.filter(permanent -> permanent.isCreature(game) && !permanent.getId().equals(copyFrom.getId()))
|
||||
.forEach(copyTo -> game.copyPermanent(Duration.EndOfTurn, copyFrom, copyTo.getId(), source, new CopyApplier() {
|
||||
@Override
|
||||
public boolean apply(Game game, MageObject blueprint, Ability source, UUID targetObjectId) {
|
||||
|
|
|
@ -66,7 +66,7 @@ public final class AuraBarbs extends CardImpl {
|
|||
for (Permanent auraEnchantment : game.getBattlefield().getActivePermanents(filterEnchantments, source.getControllerId(), source.getSourceId(), game)) {
|
||||
if (auraEnchantment.getAttachedTo() != null) {
|
||||
Permanent attachedToCreature = game.getPermanent(auraEnchantment.getAttachedTo());
|
||||
if (attachedToCreature != null && attachedToCreature.isCreature()) {
|
||||
if (attachedToCreature != null && attachedToCreature.isCreature(game)) {
|
||||
attachedToCreature.damage(2, auraEnchantment.getId(), source, game, false, true);
|
||||
game.informPlayers("2 damage assigned to " + attachedToCreature.getName() + " from " + auraEnchantment.getName());
|
||||
}
|
||||
|
|
|
@ -157,7 +157,7 @@ class AureliasFuryCantCastEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||
if (player != null && player.getId().equals(event.getPlayerId())) {
|
||||
Card card = game.getCard(event.getSourceId());
|
||||
if (card != null && !card.isCreature()) {
|
||||
if (card != null && !card.isCreature(game)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ class AureliasFuryDamagedByWatcher extends Watcher {
|
|||
switch (event.getType()) {
|
||||
case DAMAGED_PERMANENT:
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
if (permanent != null && permanent.isCreature()) {
|
||||
if (permanent != null && permanent.isCreature(game)) {
|
||||
damagedCreatures.add(event.getTargetId());
|
||||
}
|
||||
return;
|
||||
|
|
|
@ -87,7 +87,7 @@ public final class Aurification extends CardImpl {
|
|||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getPlayerId().equals(this.getControllerId())) {
|
||||
Permanent permanent = game.getPermanent(event.getSourceId());
|
||||
if (permanent != null && permanent.isCreature()) {
|
||||
if (permanent != null && permanent.isCreature(game)) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getSourceId()));
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ public final class Aurification extends CardImpl {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(CardType.CREATURE)) {
|
||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(CardType.CREATURE, game)) {
|
||||
if (permanent != null) {
|
||||
int numToRemove = permanent.getCounters(game).getCount(CounterType.GOLD);
|
||||
if (numToRemove > 0) {
|
||||
|
|
|
@ -75,7 +75,7 @@ class AuspiciousStarrixEffect extends OneShotEffect {
|
|||
Cards toExile = new CardsImpl();
|
||||
Cards toBattlefield = new CardsImpl();
|
||||
for (Card card : player.getLibrary().getCards(game)) {
|
||||
if (card != null && card.isPermanent()) {
|
||||
if (card != null && card.isPermanent(game)) {
|
||||
toBattlefield.add(card);
|
||||
count++;
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ class AuthorityOfTheConsulsTapEffect extends ReplacementEffectImpl {
|
|||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
|
||||
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (permanent != null && permanent.isCreature()) {
|
||||
if (permanent != null && permanent.isCreature(game)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ class AwakenedAmalgamLandNamesCount implements DynamicValue {
|
|||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
Set<String> landNames = new HashSet<>();
|
||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(sourceAbility.getControllerId())) {
|
||||
if (permanent.isLand()) {
|
||||
if (permanent.isLand(game)) {
|
||||
landNames.add(permanent.getName());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ class AzorTheLawbringerCantCastEffect extends ContinuousRuleModifyingEffectImpl
|
|||
if (opponentId.equals(event.getPlayerId())) {
|
||||
MageObject object = game.getObject(event.getSourceId());
|
||||
if (event.getType() == GameEvent.EventType.CAST_SPELL) {
|
||||
if (object.isInstantOrSorcery()) {
|
||||
if (object.isInstantOrSorcery(game)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package mage.cards.b;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AttacksTriggeredAbility;
|
||||
|
@ -76,7 +75,7 @@ class BackdraftHellkiteEffect extends ContinuousEffectImpl {
|
|||
player.getGraveyard()
|
||||
.stream()
|
||||
.map((cardId) -> game.getCard(cardId))
|
||||
.filter(MageObject::isInstantOrSorcery)
|
||||
.filter(card1 -> card1.isInstantOrSorcery(game))
|
||||
.forEachOrdered(card -> affectedObjectList.add(new MageObjectReference(card, game)));
|
||||
}
|
||||
|
||||
|
@ -95,9 +94,9 @@ class BackdraftHellkiteEffect extends ContinuousEffectImpl {
|
|||
return;
|
||||
}
|
||||
FlashbackAbility ability = null;
|
||||
if (card.isInstant()) {
|
||||
if (card.isInstant(game)) {
|
||||
ability = new FlashbackAbility(card.getManaCost(), TimingRule.INSTANT);
|
||||
} else if (card.isSorcery()) {
|
||||
} else if (card.isSorcery(game)) {
|
||||
ability = new FlashbackAbility(card.getManaCost(), TimingRule.SORCERY);
|
||||
}
|
||||
if (ability == null) {
|
||||
|
|
|
@ -96,7 +96,7 @@ class BalduvianWarlordUnblockEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
// Choose new creature to block
|
||||
if (permanent.isCreature()) {
|
||||
if (permanent.isCreature(game)) {
|
||||
// according to the following mail response from MTG Rules Management about False Orders:
|
||||
// "if Player A attacks Players B and C, Player B's creatures cannot block creatures attacking Player C"
|
||||
// therefore we need to single out creatures attacking the target blocker's controller (disappointing, I know)
|
||||
|
@ -123,7 +123,7 @@ class BalduvianWarlordUnblockEffect extends OneShotEffect {
|
|||
return true;
|
||||
}
|
||||
Permanent chosenPermanent = game.getPermanent(target.getFirstTarget());
|
||||
if (chosenPermanent != null && chosenPermanent.isCreature()) {
|
||||
if (chosenPermanent != null && chosenPermanent.isCreature(game)) {
|
||||
CombatGroup chosenGroup = game.getCombat().findGroup(chosenPermanent.getId());
|
||||
if (chosenGroup != null) {
|
||||
// Relevant ruling for Balduvian Warlord:
|
||||
|
|
|
@ -56,7 +56,7 @@ enum BalothCageTrapCondition implements Condition {
|
|||
List<Permanent> permanents = watcher.getThisTurnEnteringPermanents(opponentId);
|
||||
if (permanents != null) {
|
||||
for (Permanent permanent : permanents) {
|
||||
if (permanent.isArtifact()) {
|
||||
if (permanent.isArtifact(game)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ class BalustradeSpyEffect extends OneShotEffect {
|
|||
for (Card card : controller.getLibrary().getCards(game)) {
|
||||
if (card != null) {
|
||||
toGraveyard.add(card);
|
||||
if (card.isLand()) {
|
||||
if (card.isLand(game)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ import mage.constants.CardType;
|
|||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.token.KnightToken;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.target.common.TargetNonlandPermanent;
|
||||
|
@ -117,14 +116,14 @@ class BanishIntoFableEffect extends OneShotEffect {
|
|||
if (game.getBattlefield()
|
||||
.getAllActivePermanents(source.getControllerId())
|
||||
.stream()
|
||||
.filter(Permanent::isArtifact)
|
||||
.filter(permanent -> permanent.isArtifact(game))
|
||||
.count() > 0) {
|
||||
spell.createCopyOnStack(game, source, source.getControllerId(), true);
|
||||
}
|
||||
if (game.getBattlefield()
|
||||
.getAllActivePermanents(source.getControllerId())
|
||||
.stream()
|
||||
.filter(Permanent::isEnchantment)
|
||||
.filter(permanent -> permanent.isEnchantment(game))
|
||||
.count() > 0) {
|
||||
spell.createCopyOnStack(game, source, source.getControllerId(), true);
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ class BattlefieldThaumaturgeSpellsCostReductionEffect extends CostModificationEf
|
|||
}
|
||||
for (UUID uuid : target.getTargets()) {
|
||||
Permanent permanent = game.getPermanent(uuid);
|
||||
if (permanent != null && permanent.isCreature()) {
|
||||
if (permanent != null && permanent.isCreature(game)) {
|
||||
creaturesTargeted.add(permanent.getId());
|
||||
}
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ class BattlefieldThaumaturgeSpellsCostReductionEffect extends CostModificationEf
|
|||
Set<UUID> possibleList = target.possibleTargets(ability.getSourceId(), ability.getControllerId(), game);
|
||||
possibleList.removeIf(id -> {
|
||||
Permanent permanent = game.getPermanent(id);
|
||||
return permanent == null || !permanent.isCreature();
|
||||
return permanent == null || !permanent.isCreature(game);
|
||||
});
|
||||
int possibleAmount = Math.min(possibleList.size(), target.getMaxNumberOfTargets());
|
||||
maxAmount = Math.max(maxAmount, possibleAmount);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package mage.cards.b;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.AbilityImpl;
|
||||
|
@ -85,7 +84,7 @@ class BeamsplitterMageTriggeredAbility extends TriggeredAbilityImpl {
|
|||
return false;
|
||||
}
|
||||
Spell spell = game.getSpellOrLKIStack(event.getTargetId());
|
||||
if (spell == null || !spell.isInstantOrSorcery()) {
|
||||
if (spell == null || !spell.isInstantOrSorcery(game)) {
|
||||
return false;
|
||||
}
|
||||
if (spell.getSpellAbilities()
|
||||
|
@ -116,7 +115,7 @@ class BeamsplitterMageTriggeredAbility extends TriggeredAbilityImpl {
|
|||
getControllerId(), getSourceId(), game
|
||||
).stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(MageObject::isCreature)
|
||||
.filter(permanent -> permanent.isCreature(game))
|
||||
.filter(p -> checkNotSource(p, game))
|
||||
.anyMatch(p -> spell.canTarget(game, p.getId()));
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ class BellowingElkWatcher extends Watcher {
|
|||
if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
|
||||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||
if (zEvent.getToZone() == Zone.BATTLEFIELD
|
||||
&& zEvent.getTarget().isCreature()) {
|
||||
&& zEvent.getTarget().isCreature(game)) {
|
||||
playerMap.putIfAbsent(zEvent.getTarget().getControllerId(), new HashSet<>());
|
||||
playerMap.get(zEvent.getTarget().getControllerId()).add(zEvent.getTargetId());
|
||||
}
|
||||
|
|
|
@ -70,10 +70,10 @@ class BenefactionOfRhonasEffect extends OneShotEffect {
|
|||
Card card = game.getCard(cardId);
|
||||
if (card != null) {
|
||||
cards.add(card);
|
||||
if (card.isCreature()) {
|
||||
if (card.isCreature(game)) {
|
||||
creatureCardFound = true;
|
||||
}
|
||||
if (card.isEnchantment()) {
|
||||
if (card.isEnchantment(game)) {
|
||||
enchantmentCardFound = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ class BenthicExplorersManaEffect extends ManaEffect {
|
|||
Set<ManaType> manaTypes = EnumSet.noneOf(ManaType.class);
|
||||
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
|
||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(opponentId)) {
|
||||
if (permanent.isLand() && permanent.isTapped()) {
|
||||
if (permanent.isLand(game) && permanent.isTapped()) {
|
||||
for (ActivatedManaAbilityImpl ability : permanent.getAbilities(game).getActivatedManaAbilities(Zone.BATTLEFIELD)) {
|
||||
manaTypes.addAll(ability.getProducableManaTypes(game));
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ import mage.constants.CardType;
|
|||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
@ -63,7 +62,7 @@ class BereavementTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (((ZoneChangeEvent)event).isDiesEvent()) {
|
||||
Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD);
|
||||
if (permanent != null && permanent.isCreature() && permanent.getColor(game).isGreen()) {
|
||||
if (permanent != null && permanent.isCreature(game) && permanent.getColor(game).isGreen()) {
|
||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(permanent.getControllerId()));
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ class BioessenceHydraTriggeredAbility extends TriggeredAbilityImpl {
|
|||
}
|
||||
if (permanent != null
|
||||
&& !event.getTargetId().equals(this.getSourceId())
|
||||
&& permanent.isPlaneswalker()
|
||||
&& permanent.isPlaneswalker(game)
|
||||
&& permanent.isControlledBy(this.getControllerId())) {
|
||||
this.getEffects().clear();
|
||||
if (event.getAmount() > 0) {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package mage.cards.b;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.ActivatedAbility;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
|
@ -93,7 +92,7 @@ class BiomancersFamiliarCostReductionEffect extends CostModificationEffectImpl {
|
|||
//Activated abilities of creatures you control
|
||||
Permanent permanent = game.getPermanentOrLKIBattlefield(abilityToModify.getSourceId());
|
||||
return permanent != null
|
||||
&& permanent.isCreature()
|
||||
&& permanent.isCreature(game)
|
||||
&& permanent.isControlledBy(source.getControllerId());
|
||||
}
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ class BioplasmEffect extends OneShotEffect {
|
|||
if (card == null) {
|
||||
return false;
|
||||
}
|
||||
if (player.moveCards(card, Zone.EXILED, source, game) && card.isCreature()) {
|
||||
if (player.moveCards(card, Zone.EXILED, source, game) && card.isCreature(game)) {
|
||||
game.addEffect(new BoostSourceEffect(card.getPower().getValue(), card.getToughness().getValue(), Duration.EndOfTurn), source);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -53,7 +53,7 @@ class BlackSunsZenithEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
int amount = source.getManaCostsToPay().getX();
|
||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents()) {
|
||||
if (permanent != null && permanent.isCreature()) {
|
||||
if (permanent != null && permanent.isCreature(game)) {
|
||||
permanent.addCounters(CounterType.M1M1.createInstance(amount), source.getControllerId(), source, game);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ class BlacksmithsSkillEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(source.getFirstTarget());
|
||||
if (permanent != null && permanent.isArtifact() && permanent.isCreature()) {
|
||||
if (permanent != null && permanent.isArtifact(game) && permanent.isCreature(game)) {
|
||||
game.addEffect(new BoostTargetEffect(2, 2), source);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ import mage.constants.SubType;
|
|||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.token.SoldierTokenWithHaste;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -93,7 +92,7 @@ class BlazeCommandoTriggeredAbility extends TriggeredAbilityImpl {
|
|||
if (isControlledBy(game.getControllerId(event.getSourceId()))) {
|
||||
MageObject damageSource = game.getObject(event.getSourceId());
|
||||
if (damageSource != null) {
|
||||
if (damageSource.isInstantOrSorcery()) {
|
||||
if (damageSource.isInstantOrSorcery(game)) {
|
||||
if (!handledStackObjects.contains(damageSource.getId())) {
|
||||
handledStackObjects.add(damageSource.getId());
|
||||
return true;
|
||||
|
|
|
@ -83,7 +83,7 @@ class BlessedReincarnationEffect extends OneShotEffect {
|
|||
Cards toReveal = new CardsImpl();
|
||||
for (Card card : library.getCards(game)) {
|
||||
toReveal.add(card);
|
||||
if (card.isCreature()) {
|
||||
if (card.isCreature(game)) {
|
||||
permanentController.moveCards(card, Zone.BATTLEFIELD, source, game);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ class BlightbeetleEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
return false;
|
||||
}
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
if (permanent == null || !permanent.isCreature()) {
|
||||
if (permanent == null || !permanent.isCreature(game)) {
|
||||
return false;
|
||||
}
|
||||
Player player = game.getPlayer(permanent.getControllerId());
|
||||
|
|
|
@ -70,7 +70,7 @@ class FurnaceOfRathEffect extends ReplacementEffectImpl {
|
|||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
Permanent permanent = game.getPermanent(event.getSourceId());
|
||||
return permanent != null
|
||||
&& permanent.isCreature()
|
||||
&& permanent.isCreature(game)
|
||||
&& ((DamageEvent) event).isCombatDamage();
|
||||
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ class BlindObedienceTapEffect extends ReplacementEffectImpl {
|
|||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
|
||||
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (permanent != null && (permanent.isCreature() || permanent.isArtifact())) {
|
||||
if (permanent != null && (permanent.isCreature(game) || permanent.isArtifact(game))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package mage.cards.b;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.CardsImpl;
|
||||
|
@ -73,14 +72,14 @@ class BloodForBonesEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null || player.getGraveyard().getCards(game).stream().noneMatch(Card::isCreature)) {
|
||||
if (player == null || player.getGraveyard().getCards(game).stream().noneMatch(card -> card.isCreature(game))) {
|
||||
return false;
|
||||
}
|
||||
TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(filter);
|
||||
if (player.choose(outcome, player.getGraveyard(), target, game)) {
|
||||
player.moveCards(new CardsImpl(target.getTargets()), Zone.BATTLEFIELD, source, game);
|
||||
}
|
||||
if (player.getGraveyard().getCards(game).stream().noneMatch(Card::isCreature)) {
|
||||
if (player.getGraveyard().getCards(game).stream().noneMatch(card -> card.isCreature(game))) {
|
||||
return true;
|
||||
}
|
||||
target = new TargetCardInYourGraveyard(filter2);
|
||||
|
|
|
@ -106,7 +106,7 @@ class BloodOathEffect extends OneShotEffect {
|
|||
Set<Card> cards = hand.getCards(game);
|
||||
int damageToDeal = 0;
|
||||
for (Card card : cards) {
|
||||
if (card != null && card.getCardType().contains(type)) {
|
||||
if (card != null && card.getCardType(game).contains(type)) {
|
||||
damageToDeal += 3;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ class BloodOfTheMartyrEffect extends ReplacementEffectImpl {
|
|||
DamageEvent damageEvent = (DamageEvent) event;
|
||||
return controller != null
|
||||
&& permanent != null
|
||||
&& permanent.isCreature()
|
||||
&& permanent.isCreature(game)
|
||||
&& controller.chooseUse(outcome, "Have " + damageEvent.getAmount() + " damage dealt to you instead of " + permanent.getLogName() + "?", source, game);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ import mage.constants.Zone;
|
|||
import mage.game.Game;
|
||||
import mage.game.events.EntersTheBattlefieldEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
|
@ -70,7 +69,7 @@ class BloodSeekerTriggeredAbility extends TriggeredAbilityImpl {
|
|||
if (game.getOpponents(this.controllerId).contains(event.getPlayerId())) {
|
||||
EntersTheBattlefieldEvent zEvent = (EntersTheBattlefieldEvent) event;
|
||||
Card card = zEvent.getTarget();
|
||||
if (card != null && card.isCreature()) {
|
||||
if (card != null && card.isCreature(game)) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
}
|
||||
|
|
|
@ -65,12 +65,12 @@ class BloodfireEnforcersCondition implements Condition {
|
|||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
for(Card card : player.getGraveyard().getCards(game)) {
|
||||
if (card.isInstant()) {
|
||||
if (card.isInstant(game)) {
|
||||
if (sorceryFound) {
|
||||
return true;
|
||||
}
|
||||
instantFound = true;
|
||||
} else if (card.isSorcery()) {
|
||||
} else if (card.isSorcery(game)) {
|
||||
if (instantFound) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ class BloodsporeThrinaxEntersBattlefieldEffect extends ReplacementEffectImpl {
|
|||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
return creature != null && creature.isControlledBy(source.getControllerId())
|
||||
&& creature.isCreature()
|
||||
&& creature.isCreature(game)
|
||||
&& !event.getTargetId().equals(source.getSourceId());
|
||||
}
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ class BolassCitadelPlayTheTopCardEffect extends AsThoughEffectImpl {
|
|||
}
|
||||
|
||||
// allows to play/cast with alternative life cost
|
||||
if (!cardToCheck.isLand()) {
|
||||
if (!cardToCheck.isLand(game)) {
|
||||
PayLifeCost lifeCost = new PayLifeCost(cardToCheck.getSpellAbility().getManaCosts().manaValue());
|
||||
Costs newCosts = new CostsImpl();
|
||||
newCosts.add(lifeCost);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue