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:
Evan Kranzler 2021-07-08 23:28:43 -04:00 committed by GitHub
parent 07e1dff10c
commit 572104b8fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1159 changed files with 2704 additions and 2203 deletions

View file

@ -9,6 +9,7 @@ import java.awt.*;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
/** /**
@ -16,7 +17,7 @@ import java.util.List;
*/ */
public class ModernSplitCardRenderer extends ModernCardRenderer { public class ModernSplitCardRenderer extends ModernCardRenderer {
private class HalfCardProps { private static class HalfCardProps {
int x, y, w, h, cw, ch; int x, y, w, h, cw, ch;
@ -28,11 +29,7 @@ public class ModernSplitCardRenderer extends ModernCardRenderer {
List<TextboxRule> keywords = new ArrayList<>(); List<TextboxRule> keywords = new ArrayList<>();
} }
private static final ArrayList<CardType> ONLY_LAND_TYPE = new ArrayList<CardType>() { private static final List<CardType> ONLY_LAND_TYPE = Arrays.asList(CardType.LAND);
{
add(CardType.LAND);
}
};
// Right and left halves of the card content // Right and left halves of the card content
private HalfCardProps rightHalf = new HalfCardProps(); private HalfCardProps rightHalf = new HalfCardProps();

View file

@ -59,7 +59,7 @@ public class CardView extends SimpleCardView {
@Expose @Expose
protected String loyalty = ""; protected String loyalty = "";
protected String startingLoyalty; protected String startingLoyalty;
protected ArrayList<CardType> cardTypes; protected List<CardType> cardTypes;
protected SubTypes subTypes; protected SubTypes subTypes;
protected Set<SuperType> superTypes; protected Set<SuperType> superTypes;
protected ObjectColor color; protected ObjectColor color;
@ -246,7 +246,7 @@ public class CardView extends SimpleCardView {
for (SuperType superType : card.getSuperType()) { for (SuperType superType : card.getSuperType()) {
sbType.append(superType).append(' '); sbType.append(superType).append(' ');
} }
for (CardType cardType : card.getCardType()) { for (CardType cardType : card.getCardType(game)) {
sbType.append(cardType.toString()).append(' '); sbType.append(cardType.toString()).append(' ');
} }
if (!card.getSubtype(game).isEmpty()) { if (!card.getSubtype(game).isEmpty()) {
@ -312,7 +312,7 @@ public class CardView extends SimpleCardView {
} else if (card instanceof Permanent) { } else if (card instanceof Permanent) {
this.power = Integer.toString(card.getPower().getValue()); this.power = Integer.toString(card.getPower().getValue());
this.toughness = Integer.toString(card.getToughness().getValue()); this.toughness = Integer.toString(card.getToughness().getValue());
this.cardTypes = card.getCardType(); this.cardTypes = card.getCardType(game);
this.faceDown = card.isFaceDown(game); this.faceDown = card.isFaceDown(game);
} else { } else {
// this.hideInfo = true; // this.hideInfo = true;
@ -434,7 +434,7 @@ public class CardView extends SimpleCardView {
} }
this.power = Integer.toString(card.getPower().getValue()); this.power = Integer.toString(card.getPower().getValue());
this.toughness = Integer.toString(card.getToughness().getValue()); this.toughness = Integer.toString(card.getToughness().getValue());
this.cardTypes = card.getCardType(); this.cardTypes = card.getCardType(game);
this.subTypes = card.getSubtype(game); this.subTypes = card.getSubtype(game);
this.superTypes = card.getSuperType(); this.superTypes = card.getSuperType();
this.color = card.getColor(game); this.color = card.getColor(game);
@ -561,7 +561,7 @@ public class CardView extends SimpleCardView {
this.toughness = object.getToughness().toString(); this.toughness = object.getToughness().toString();
this.loyalty = ""; this.loyalty = "";
} }
this.cardTypes = object.getCardType(); this.cardTypes = object.getCardType(game);
this.subTypes = object.getSubtype(game); this.subTypes = object.getSubtype(game);
this.superTypes = object.getSuperType(); this.superTypes = object.getSuperType();
this.color = object.getColor(game); this.color = object.getColor(game);
@ -749,7 +749,7 @@ public class CardView extends SimpleCardView {
this.toughness = token.getToughness().toString(); this.toughness = token.getToughness().toString();
this.loyalty = ""; this.loyalty = "";
this.startingLoyalty = ""; this.startingLoyalty = "";
this.cardTypes = token.getCardType(); this.cardTypes = token.getCardType(game);
this.subTypes = token.getSubtype(game); this.subTypes = token.getSubtype(game);
this.superTypes = token.getSuperType(); this.superTypes = token.getSuperType();
this.color = token.getColor(game); this.color = token.getColor(game);
@ -842,7 +842,7 @@ public class CardView extends SimpleCardView {
return startingLoyalty; return startingLoyalty;
} }
public ArrayList<CardType> getCardTypes() { public List<CardType> getCardTypes() {
return cardTypes; return cardTypes;
} }

View file

@ -40,13 +40,13 @@ public class StackAbilityView extends CardView {
this.name = "Ability"; this.name = "Ability";
this.loyalty = ""; this.loyalty = "";
this.cardTypes = ability.getCardType(); this.cardTypes = ability.getCardType(game);
this.subTypes = ability.getSubtype(game); this.subTypes = ability.getSubtype(game);
this.superTypes = ability.getSuperType(); this.superTypes = ability.getSuperType();
this.color = ability.getColor(game); this.color = ability.getColor(game);
this.manaCostLeftStr = String.join("", ability.getManaCostSymbols()); this.manaCostLeftStr = String.join("", ability.getManaCostSymbols());
this.manaCostRightStr = ""; this.manaCostRightStr = "";
this.cardTypes = ability.getCardType(); this.cardTypes = ability.getCardType(game);
this.subTypes = ability.getSubtype(game); this.subTypes = ability.getSubtype(game);
this.superTypes = ability.getSuperType(); this.superTypes = ability.getSuperType();
this.color = ability.getColor(game); this.color = ability.getColor(game);

View file

@ -7,6 +7,7 @@ import mage.cards.Card;
import mage.cards.decks.Constructed; import mage.cards.decks.Constructed;
import mage.cards.decks.Deck; import mage.cards.decks.Deck;
import mage.cards.decks.DeckValidatorErrorType; import mage.cards.decks.DeckValidatorErrorType;
import mage.constants.CardType;
import mage.filter.FilterMana; import mage.filter.FilterMana;
import mage.util.ManaUtil; import mage.util.ManaUtil;
@ -77,8 +78,9 @@ public class Brawl extends Constructed {
addError(DeckValidatorErrorType.PRIMARY, brawler.getName(), "Brawler banned (" + brawler.getName() + ')', true); addError(DeckValidatorErrorType.PRIMARY, brawler.getName(), "Brawler banned (" + brawler.getName() + ')', true);
valid = false; valid = false;
} }
if (!((brawler.isCreature() && brawler.isLegendary()) if (!((brawler.hasCardTypeForDeckbuilding(CardType.CREATURE) && brawler.isLegendary())
|| brawler.isPlaneswalker() || brawler.getAbilities().contains(CanBeYourCommanderAbility.getInstance()))) { || brawler.hasCardTypeForDeckbuilding(CardType.PLANESWALKER)
|| brawler.getAbilities().contains(CanBeYourCommanderAbility.getInstance()))) {
addError(DeckValidatorErrorType.PRIMARY, brawler.getName(), "Brawler Invalid (" + brawler.getName() + ')', true); addError(DeckValidatorErrorType.PRIMARY, brawler.getName(), "Brawler Invalid (" + brawler.getName() + ')', true);
valid = false; valid = false;
} }

View file

@ -3,7 +3,6 @@ package mage.deck;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.CanBeYourCommanderAbility; import mage.abilities.common.CanBeYourCommanderAbility;
import mage.abilities.costs.mana.ManaCost;
import mage.abilities.keyword.CompanionAbility; import mage.abilities.keyword.CompanionAbility;
import mage.abilities.keyword.PartnerAbility; import mage.abilities.keyword.PartnerAbility;
import mage.abilities.keyword.PartnerWithAbility; import mage.abilities.keyword.PartnerWithAbility;
@ -13,6 +12,7 @@ import mage.cards.Sets;
import mage.cards.decks.Constructed; import mage.cards.decks.Constructed;
import mage.cards.decks.Deck; import mage.cards.decks.Deck;
import mage.cards.decks.DeckValidatorErrorType; import mage.cards.decks.DeckValidatorErrorType;
import mage.constants.CardType;
import mage.filter.FilterMana; import mage.filter.FilterMana;
import mage.util.ManaUtil; import mage.util.ManaUtil;
@ -101,48 +101,61 @@ public class Commander extends Constructed {
errorsList.clear(); errorsList.clear();
FilterMana colorIdentity = new FilterMana(); FilterMana colorIdentity = new FilterMana();
Set<Card> commanders = new HashSet<>(); Set<Card> commanders = new HashSet<>();
Card companion = null; Card companion;
if (deck.getSideboard().size() == 1) { int sbsize = deck.getSideboard().size();
commanders.add(deck.getSideboard().iterator().next()); Card card1;
} else if (deck.getSideboard().size() == 2) { Card card2;
Iterator<Card> iter = deck.getSideboard().iterator(); Card card3;
Card card1 = iter.next(); Iterator<Card> iter;
Card card2 = iter.next(); switch (deck.getSideboard().size()) {
if (card1.getAbilities().stream().anyMatch(ability -> ability instanceof CompanionAbility)) { case 1:
companion = card1; companion = null;
commanders.add(card2); commanders.add(deck.getSideboard().iterator().next());
} else if (card2.getAbilities().stream().anyMatch(ability -> ability instanceof CompanionAbility)) { break;
companion = card2; case 2:
commanders.add(card1); iter = deck.getSideboard().iterator();
} else { card1 = iter.next();
commanders.add(card1); card2 = iter.next();
commanders.add(card2); if (card1.getAbilities().stream().anyMatch(CompanionAbility.class::isInstance)) {
} companion = card1;
} else if (deck.getSideboard().size() == 3) { commanders.add(card2);
Iterator<Card> iter = deck.getSideboard().iterator(); } else if (card2.getAbilities().stream().anyMatch(CompanionAbility.class::isInstance)) {
Card card1 = iter.next(); companion = card2;
Card card2 = iter.next(); commanders.add(card1);
Card card3 = iter.next(); } else {
if (card1.getAbilities().stream().anyMatch(ability -> ability instanceof CompanionAbility)) { companion = null;
companion = card1; commanders.add(card1);
commanders.add(card2); commanders.add(card2);
commanders.add(card3); }
} else if (card2.getAbilities().stream().anyMatch(ability -> ability instanceof CompanionAbility)) { break;
companion = card2; case 3:
commanders.add(card1); iter = deck.getSideboard().iterator();
commanders.add(card3); card1 = iter.next();
} else if (card3.getAbilities().stream().anyMatch(ability -> ability instanceof CompanionAbility)) { card2 = iter.next();
companion = card3; card3 = iter.next();
commanders.add(card1); if (card1.getAbilities().stream().anyMatch(CompanionAbility.class::isInstance)) {
commanders.add(card2); companion = card1;
} else { 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"); addError(DeckValidatorErrorType.PRIMARY, "Commander", "Sideboard must contain only the commander(s) and up to 1 companion");
valid = false; 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) { 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); addError(DeckValidatorErrorType.PRIMARY, commander.getName(), "Commander banned (" + commander.getName() + ')', true);
valid = false; valid = false;
} }
if ((!commander.isCreature() || !commander.isLegendary()) if ((!commander.hasCardTypeForDeckbuilding(CardType.CREATURE) || !commander.isLegendary())
&& (!commander.isPlaneswalker() || !commander.getAbilities().contains(CanBeYourCommanderAbility.getInstance()))) { && !commander.getAbilities().contains(CanBeYourCommanderAbility.getInstance())) {
addError(DeckValidatorErrorType.PRIMARY, commander.getName(), "Commander invalid (" + commander.getName() + ')', true); addError(DeckValidatorErrorType.PRIMARY, commander.getName(), "Commander invalid (" + commander.getName() + ')', true);
valid = false; valid = false;
} }

View file

@ -10,6 +10,7 @@ import mage.cards.Sets;
import mage.cards.decks.Constructed; import mage.cards.decks.Constructed;
import mage.cards.decks.Deck; import mage.cards.decks.Deck;
import mage.cards.decks.DeckValidatorErrorType; import mage.cards.decks.DeckValidatorErrorType;
import mage.constants.CardType;
import mage.filter.FilterMana; import mage.filter.FilterMana;
import mage.util.ManaUtil; import mage.util.ManaUtil;
@ -119,7 +120,7 @@ public class FreeformCommander extends Constructed {
commanderNames.add(commander.getName()); commanderNames.add(commander.getName());
} }
for (Card commander : commanders) { 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); addError(DeckValidatorErrorType.PRIMARY, commander.getName(), "For Freeform Commander, the commander must be a creature or be legendary. Yours was: " + commander.getName(), true);
valid = false; valid = false;
} }

View file

@ -6,6 +6,7 @@ import mage.abilities.keyword.PartnerWithAbility;
import mage.cards.Card; import mage.cards.Card;
import mage.cards.decks.Deck; import mage.cards.decks.Deck;
import mage.cards.decks.DeckValidatorErrorType; import mage.cards.decks.DeckValidatorErrorType;
import mage.constants.CardType;
import mage.filter.FilterMana; import mage.filter.FilterMana;
import mage.util.ManaUtil; import mage.util.ManaUtil;
@ -125,7 +126,7 @@ public class Oathbreaker extends Vintage {
if (commander.isInstantOrSorcery()) { if (commander.isInstantOrSorcery()) {
signatureSpells.add(commander.getName()); signatureSpells.add(commander.getName());
} else { } else {
if (commander.isPlaneswalker()) { if (commander.hasCardTypeForDeckbuilding(CardType.PLANESWALKER)) {
commanderNames.add(commander.getName()); commanderNames.add(commander.getName());
// color identity from commanders only, not spell // color identity from commanders only, not spell

View file

@ -12,6 +12,7 @@ import mage.cards.decks.Constructed;
import mage.cards.decks.Deck; import mage.cards.decks.Deck;
import mage.cards.decks.DeckValidatorErrorType; import mage.cards.decks.DeckValidatorErrorType;
import mage.cards.decks.PennyDreadfulLegalityUtil; import mage.cards.decks.PennyDreadfulLegalityUtil;
import mage.constants.CardType;
import mage.filter.FilterMana; import mage.filter.FilterMana;
import mage.util.ManaUtil; import mage.util.ManaUtil;
@ -127,8 +128,8 @@ public class PennyDreadfulCommander extends Constructed {
addError(DeckValidatorErrorType.PRIMARY, commander.getName(), "Commander banned (" + commander.getName() + ')', true); addError(DeckValidatorErrorType.PRIMARY, commander.getName(), "Commander banned (" + commander.getName() + ')', true);
valid = false; valid = false;
} }
if ((!commander.isCreature() || !commander.isLegendary()) if ((!commander.hasCardTypeForDeckbuilding(CardType.CREATURE) || !commander.isLegendary())
&& (!commander.isPlaneswalker() || !commander.getAbilities().contains(CanBeYourCommanderAbility.getInstance()))) { && !commander.getAbilities().contains(CanBeYourCommanderAbility.getInstance())) {
addError(DeckValidatorErrorType.PRIMARY, commander.getName(), "Commander invalid (" + commander.getName() + ')', true); addError(DeckValidatorErrorType.PRIMARY, commander.getName(), "Commander invalid (" + commander.getName() + ')', true);
valid = false; valid = false;
} }

View file

@ -4,6 +4,7 @@ import mage.cards.*;
import mage.cards.decks.Constructed; import mage.cards.decks.Constructed;
import mage.cards.decks.Deck; import mage.cards.decks.Deck;
import mage.cards.decks.DeckValidatorErrorType; import mage.cards.decks.DeckValidatorErrorType;
import mage.constants.CardType;
import mage.filter.FilterMana; import mage.filter.FilterMana;
import mage.game.GameTinyLeadersImpl; import mage.game.GameTinyLeadersImpl;
@ -146,7 +147,8 @@ public class TinyLeaders extends Constructed {
} }
return false; 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())) { if (!bannedCommander.contains(commander.getName())) {
FilterMana color = commander.getColorIdentity(); FilterMana color = commander.getColorIdentity();
for (Card card : deck.getCards()) { for (Card card : deck.getCards()) {

View file

@ -28,7 +28,7 @@ public final class ArtificialScoringSystem {
public static int getCardDefinitionScore(final Game game, final Card card) { public static int getCardDefinitionScore(final Game game, final Card card) {
int value = 3; //TODO: add new rating system card value int value = 3; //TODO: add new rating system card value
if (card.isLand()) { if (card.isLand(game)) {
int score = (int) ((value / 2.0f) * 50); int score = (int) ((value / 2.0f) * 50);
//TODO: check this for "any color" lands //TODO: check this for "any color" lands
//TODO: check this for dual and filter 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; 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; return score + (card.getPower().getValue() + card.getToughness().getValue()) * 10;
} else { } else {
return score + (/*card.getRemoval()*50*/+(card.getRarity() == null ? 0 : card.getRarity().getRating() * 30)); 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 //TODO: cache it inside Card
int score = getCardDefinitionScore(game, permanent); int score = getCardDefinitionScore(game, permanent);
score += PERMANENT_SCORE; score += PERMANENT_SCORE;
if (permanent.getCardType().contains(CardType.CREATURE)) { if (permanent.getCardType(game).contains(CardType.CREATURE)) {
// TODO: implement in the mage core // TODO: implement in the mage core
//score + =cardDefinition.getActivations().size()*50; //score + =cardDefinition.getActivations().size()*50;
//score += cardDefinition.getManaActivations().size()*80; //score += cardDefinition.getManaActivations().size()*80;
@ -68,10 +68,10 @@ public final class ArtificialScoringSystem {
int score = permanent.getCounters(game).getCount(CounterType.CHARGE) * 30; int score = permanent.getCounters(game).getCount(CounterType.CHARGE) * 30;
score += permanent.getCounters(game).getCount(CounterType.LEVEL) * 30; score += permanent.getCounters(game).getCount(CounterType.LEVEL) * 30;
score -= permanent.getDamage() * 2; score -= permanent.getDamage() * 2;
if (!canTap(permanent, game)) { if (!canTap(game, permanent)) {
score += getTappedScore(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 power = permanent.getPower().getValue();
final int toughness = permanent.getToughness().getValue(); final int toughness = permanent.getToughness().getValue();
int abilityScore = 0; int abilityScore = 0;
@ -86,7 +86,7 @@ public final class ArtificialScoringSystem {
if (object instanceof Card) { if (object instanceof Card) {
Card card = (Card) object; Card card = (Card) object;
int outcomeScore = card.getAbilities(game).getOutcomeTotal(); int outcomeScore = card.getAbilities(game).getOutcomeTotal();
if (card.getCardType().contains(CardType.ENCHANTMENT)) { if (card.getCardType(game).contains(CardType.ENCHANTMENT)) {
enchantments = enchantments + outcomeScore * 100; enchantments = enchantments + outcomeScore * 100;
} else { } else {
equipments = equipments + outcomeScore * 50; equipments = equipments + outcomeScore * 50;
@ -106,10 +106,10 @@ public final class ArtificialScoringSystem {
return score; return score;
} }
private static boolean canTap(Permanent permanent, Game game) { private static boolean canTap(Game game, Permanent permanent) {
return !permanent.isTapped() return !permanent.isTapped()
&& (!permanent.hasSummoningSickness() && (!permanent.hasSummoningSickness()
|| !permanent.getCardType().contains(CardType.CREATURE) || !permanent.getCardType(game).contains(CardType.CREATURE)
|| permanent.getAbilities(game).contains(HasteAbility.getInstance())); || permanent.getAbilities(game).contains(HasteAbility.getInstance()));
} }
@ -117,10 +117,10 @@ public final class ArtificialScoringSystem {
return Math.max(0, value); return Math.max(0, value);
} }
public static int getTappedScore(final Permanent permanent) { public static int getTappedScore(Game game, final Permanent permanent) {
if (permanent.getCardType().contains(CardType.CREATURE)) { if (permanent.isCreature(game)) {
return -100; 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 return -20; // means probably no mana available (should be greater than passivity penalty
} else { } else {
return -2; return -2;

View file

@ -1034,7 +1034,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
// planeswalker kill // planeswalker kill
for (Permanent permanent : targets) { 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); int loy = permanent.getCounters(game).getCount(CounterType.LOYALTY);
if (loy <= target.getAmountRemaining()) { if (loy <= target.getAmountRemaining()) {
return tryAddTarget(target, permanent.getId(), loy, source, game); return tryAddTarget(target, permanent.getId(), loy, source, game);
@ -1044,7 +1044,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
// creature kill // creature kill
for (Permanent permanent : targets) { 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()) { if (permanent.getToughness().getValue() <= target.getAmountRemaining()) {
return tryAddTarget(target, permanent.getId(), permanent.getToughness().getValue(), source, game); return tryAddTarget(target, permanent.getId(), permanent.getToughness().getValue(), source, game);
} }
@ -1064,7 +1064,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
// planeswalkers // planeswalkers
for (Permanent permanent : targets) { 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); return tryAddTarget(target, permanent.getId(), target.getAmountRemaining(), source, game);
} }
} }
@ -1079,7 +1079,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
// creature // creature
for (Permanent permanent : targets) { 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); 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) // creatures - non killable (TODO: add extra skill checks like undestructeable)
for (Permanent permanent : targets) { 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()); int safeDamage = Math.min(permanent.getToughness().getValue() - 1, target.getAmountRemaining());
if (safeDamage > 0) { if (safeDamage > 0) {
return tryAddTarget(target, permanent.getId(), safeDamage, source, game); return tryAddTarget(target, permanent.getId(), safeDamage, source, game);
@ -1110,14 +1110,14 @@ public class ComputerPlayer extends PlayerImpl implements Player {
// creatures - all // creatures - all
for (Permanent permanent : targets) { 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); return tryAddTarget(target, permanent.getId(), target.getAmountRemaining(), source, game);
} }
} }
// planeswalkers // planeswalkers
for (Permanent permanent : targets) { 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); return tryAddTarget(target, permanent.getId(), target.getAmountRemaining(), source, game);
} }
} }
@ -1319,7 +1319,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
SpellAbility ability = card.getSpellAbility(); SpellAbility ability = card.getSpellAbility();
if (ability != null && ability.canActivate(playerId, game).canActivate() if (ability != null && ability.canActivate(playerId, game).canActivate()
&& !game.getContinuousEffects().preventedByRuleModification(GameEvent.getEvent(GameEvent.EventType.CAST_SPELL, ability.getSourceId(), ability, playerId), ability, game, true)) { && !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)) { || card.hasAbility(FlashAbility.getInstance(), game)) {
playableInstant.add(card); playableInstant.add(card);
} else { } 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 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().getAvailableActivatedManaAbilities(Zone.BATTLEFIELD, playerId, game).size();
score += mageObject.getAbilities().getActivatedAbilities(Zone.BATTLEFIELD).size(); score += mageObject.getAbilities().getActivatedAbilities(Zone.BATTLEFIELD).size();
if (!mageObject.getCardType().contains(CardType.LAND)) { if (!mageObject.getCardType(game).contains(CardType.LAND)) {
score += 2; score += 2;
} else if (mageObject.getCardType().contains(CardType.CREATURE)) { } else if (mageObject.getCardType(game).contains(CardType.CREATURE)) {
score += 2; score += 2;
} }
} }
@ -1823,7 +1823,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
// choose a creature type of opponent on battlefield or graveyard // choose a creature type of opponent on battlefield or graveyard
for (Permanent permanent : game.getBattlefield().getActivePermanents(this.getId(), game)) { for (Permanent permanent : game.getBattlefield().getActivePermanents(this.getId(), game)) {
if (game.getOpponents(this.getId()).contains(permanent.getControllerId()) if (game.getOpponents(this.getId()).contains(permanent.getControllerId())
&& permanent.getCardType().contains(CardType.CREATURE) && permanent.getCardType(game).contains(CardType.CREATURE)
&& !permanent.getSubtype(game).isEmpty()) { && !permanent.getSubtype(game).isEmpty()) {
if (choice.getChoices().contains(permanent.getSubtype(game).get(0).toString())) { if (choice.getChoices().contains(permanent.getSubtype(game).get(0).toString())) {
choice.setChoice(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())) { for (UUID opponentId : game.getOpponents(this.getId())) {
Player opponent = game.getPlayer(opponentId); Player opponent = game.getPlayer(opponentId);
for (Card card : opponent.getGraveyard().getCards(game)) { 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())) { if (choice.getChoices().contains(card.getSubtype(game).get(0).toString())) {
choice.setChoice(card.getSubtype(game).get(0).toString()); choice.setChoice(card.getSubtype(game).get(0).toString());
break; break;
@ -1852,7 +1852,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
// choose a creature type of hand or library // choose a creature type of hand or library
for (UUID cardId : this.getHand()) { for (UUID cardId : this.getHand()) {
Card card = game.getCard(cardId); 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())) { if (choice.getChoices().contains(card.getSubtype(game).get(0).toString())) {
choice.setChoice(card.getSubtype(game).get(0).toString()); choice.setChoice(card.getSubtype(game).get(0).toString());
break; break;
@ -1862,7 +1862,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
if (!choice.isChosen()) { if (!choice.isChosen()) {
for (UUID cardId : this.getLibrary().getCardList()) { for (UUID cardId : this.getLibrary().getCardList()) {
Card card = game.getCard(cardId); 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())) { if (choice.getChoices().contains(card.getSubtype(game).get(0).toString())) {
choice.setChoice(card.getSubtype(game).get(0).toString()); choice.setChoice(card.getSubtype(game).get(0).toString());
break; break;

View file

@ -21,10 +21,10 @@ public class PermanentEvaluator {
// more score -- more valueable/powerfull permanent // more score -- more valueable/powerfull permanent
if (!values.containsKey(permanent.getId())) { if (!values.containsKey(permanent.getId())) {
int value = 0; int value = 0;
if (permanent.isCreature()) { if (permanent.isCreature(game)) {
value += combat.evaluate(permanent, 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 += 2 * permanent.getCounters(game).getCount(CounterType.LOYALTY); // planeswalker is more valuable
} }
value += permanent.getAbilities().getActivatedManaAbilities(Zone.BATTLEFIELD).size(); value += permanent.getAbilities().getActivatedManaAbilities(Zone.BATTLEFIELD).size();

View file

@ -80,7 +80,7 @@ public final class GameStateEvaluator {
} else { } else {
value = permanent.isTapped() ? 4 : 5; 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 += evaluateCreature(permanent, game) * CREATURE_FACTOR;
} }
value += permanent.getAbilities().getActivatedManaAbilities(Zone.BATTLEFIELD).size(); value += permanent.getAbilities().getActivatedManaAbilities(Zone.BATTLEFIELD).size();

View file

@ -2062,7 +2062,7 @@ public class HumanPlayer extends PlayerImpl {
return; return;
} }
} }
if (userData.isUseFirstManaAbility() && object instanceof Permanent && object.isLand()) { if (userData.isUseFirstManaAbility() && object instanceof Permanent && object.isLand(game)) {
ActivatedAbility ability = abilities.values().iterator().next(); ActivatedAbility ability = abilities.values().iterator().next();
if (ability instanceof ActivatedManaAbilityImpl) { if (ability instanceof ActivatedManaAbilityImpl) {
activateAbility(ability, game); activateAbility(ability, game);

View file

@ -17,7 +17,6 @@ import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Planes; import mage.constants.Planes;
import mage.constants.Zone; import mage.constants.Zone;
import mage.counters.Counter;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.game.Game; import mage.game.Game;
import mage.game.GameCommanderImpl; import mage.game.GameCommanderImpl;
@ -518,7 +517,7 @@ public final class SystemUtil {
} }
} else if ("loyalty".equalsIgnoreCase(command.zone)) { } else if ("loyalty".equalsIgnoreCase(command.zone)) {
for (Permanent perm : game.getBattlefield().getAllActivePermanents(player.getId())) { 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); perm.addCounters(CounterType.LOYALTY.createInstance(command.Amount), fakeSourceAbility.getControllerId(), fakeSourceAbility, game);
} }
} }

View file

@ -75,7 +75,7 @@ public final class AAT1 extends CardImpl {
Card card = game.getCard(event.getTargetId()); Card card = game.getCard(event.getTargetId());
if (card != null if (card != null
&& event.getPlayerId().equals(game.getControllerId(sourceId)) && event.getPlayerId().equals(game.getControllerId(sourceId))
&& card.isCreature() && card.isCreature(game)
&& game.getState().getZone(card.getId()) == Zone.GRAVEYARD && game.getState().getZone(card.getId()) == Zone.GRAVEYARD
&& event.getData().equals("repair")) { && event.getData().equals("repair")) {
return true; return true;

View file

@ -2,7 +2,6 @@
package mage.cards.a; package mage.cards.a;
import mage.MageInt; import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
@ -69,7 +68,7 @@ class AberrantResearcherEffect extends OneShotEffect {
.millCards(1, source, game) .millCards(1, source, game)
.getCards(game) .getCards(game)
.stream() .stream()
.noneMatch(MageObject::isInstantOrSorcery)) { .noneMatch(card -> card.isInstantOrSorcery(game))) {
return false; return false;
} }
new TransformSourceEffect(true).apply(game, source); new TransformSourceEffect(true).apply(game, source);

View file

@ -87,7 +87,7 @@ class AbeyanceEffect extends ContinuousRuleModifyingEffectImpl {
return false; return false;
} }
if (event.getType() == GameEvent.EventType.CAST_SPELL if (event.getType() == GameEvent.EventType.CAST_SPELL
&& object.isInstantOrSorcery()) { && object.isInstantOrSorcery(game)) {
return true; return true;
} }
if (event.getType() == GameEvent.EventType.ACTIVATE_ABILITY) { if (event.getType() == GameEvent.EventType.ACTIVATE_ABILITY) {

View file

@ -68,7 +68,7 @@ class AbundantHarvestEffect extends OneShotEffect {
continue; continue;
} }
toReveal.add(card); toReveal.add(card);
if (card.isLand() == land) { if (card.isLand(game) == land) {
toHand = card; toHand = card;
break; break;
} }

View file

@ -13,7 +13,6 @@ import mage.constants.Zone;
import mage.filter.common.FilterControlledPermanent; import mage.filter.common.FilterControlledPermanent;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.common.TargetOpponentOrPlaneswalker; import mage.target.common.TargetOpponentOrPlaneswalker;
@ -67,7 +66,7 @@ class AetherChargeTriggeredAbility extends TriggeredAbilityImpl {
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
Permanent permanent = game.getPermanent(event.getTargetId()); 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)) { && permanent.isControlledBy(this.controllerId)) {
Effect effect = this.getEffects().get(0); Effect effect = this.getEffects().get(0);
effect.setValue("damageSource", event.getTargetId()); effect.setValue("damageSource", event.getTargetId());

View file

@ -65,7 +65,7 @@ class AetherRiftEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (controller != null) { if (controller != null) {
Card card = controller.discardOne(true, false, source, game); Card card = controller.discardOne(true, false, source, game);
if (card != null && card.isCreature()) { if (card != null && card.isCreature(game)) {
Effect returnEffect = new ReturnFromGraveyardToBattlefieldTargetEffect(); Effect returnEffect = new ReturnFromGraveyardToBattlefieldTargetEffect();
returnEffect.setTargetPointer(new FixedTarget(card.getId())); returnEffect.setTargetPointer(new FixedTarget(card.getId()));
Effect doEffect = new DoUnlessAnyPlayerPaysEffect(returnEffect, new PayLifeCost(5), Effect doEffect = new DoUnlessAnyPlayerPaysEffect(returnEffect, new PayLifeCost(5),

View file

@ -11,7 +11,6 @@ import mage.constants.CardType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
/** /**
@ -62,7 +61,7 @@ class AetherStingTriggeredAbility extends TriggeredAbilityImpl {
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
if (game.getOpponents(controllerId).contains(event.getPlayerId())) { if (game.getOpponents(controllerId).contains(event.getPlayerId())) {
Card card = game.getCard(event.getSourceId()); 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())); this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getPlayerId()));
return true; return true;
} }

View file

@ -75,7 +75,7 @@ class AetherStormReplacementEffect extends ContinuousRuleModifyingEffectImpl {
@Override @Override
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
Card card = game.getCard(event.getSourceId()); Card card = game.getCard(event.getSourceId());
return card != null && card.isCreature(); return card != null && card.isCreature(game);
} }
} }

View file

@ -75,7 +75,7 @@ class AetherplasmEffect extends OneShotEffect {
&& game.getCombat() != null && blockedCreature != null) { && game.getCombat() != null && blockedCreature != null) {
CombatGroup attacker = game.getCombat().findGroup(blockedCreature.getId()); CombatGroup attacker = game.getCombat().findGroup(blockedCreature.getId());
Permanent putIntoPlay = game.getPermanent(target.getFirstTarget()); 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); game.getCombat().findGroup(blockedCreature.getId()).addBlocker(putIntoPlay.getId(), source.getControllerId(), game);
} }

View file

@ -84,8 +84,8 @@ class AjanisLastStandTriggeredAbility extends TriggeredAbilityImpl {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event; ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.isDiesEvent()) { if (zEvent.isDiesEvent()) {
if (zEvent.getTarget().isControlledBy(controllerId) if (zEvent.getTarget().isControlledBy(controllerId)
&& (zEvent.getTarget().isCreature() && (zEvent.getTarget().isCreature(game)
|| zEvent.getTarget().isPlaneswalker())) { || zEvent.getTarget().isPlaneswalker(game))) {
return true; return true;
} }
} }

View file

@ -79,7 +79,7 @@ class AkoumFirebirdLandfallAbility extends TriggeredAbilityImpl {
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
Permanent permanent = game.getPermanent(event.getTargetId()); 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 @Override

View file

@ -76,7 +76,7 @@ class AkoumHellkiteTriggeredAbility extends TriggeredAbilityImpl {
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
Permanent permanent = game.getPermanent(event.getTargetId()); Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null if (permanent != null
&& permanent.isLand() && permanent.isLand(game)
&& permanent.isControlledBy(getControllerId())) { && permanent.isControlledBy(getControllerId())) {
Permanent sourcePermanent = game.getPermanent(getSourceId()); Permanent sourcePermanent = game.getPermanent(getSourceId());
if (sourcePermanent != null) { if (sourcePermanent != null) {

View file

@ -112,7 +112,7 @@ class AlenaKessigTrapperWatcher extends Watcher {
.filter(Objects::nonNull) .filter(Objects::nonNull)
.map(mor -> mor.getPermanent(game)) .map(mor -> mor.getPermanent(game))
.filter(Objects::nonNull) .filter(Objects::nonNull)
.filter(MageObject::isCreature) .filter(permanent1 -> permanent1.isCreature(game))
.filter(permanent -> permanent.isControlledBy(playerId)) .filter(permanent -> permanent.isControlledBy(playerId))
.map(MageObject::getPower) .map(MageObject::getPower)
.mapToInt(MageInt::getValue) .mapToInt(MageInt::getValue)

View file

@ -95,7 +95,7 @@ class AllHallowsEveEffect extends OneShotEffect {
.map(Player::getGraveyard) .map(Player::getGraveyard)
.map(g -> g.getCards(game)) .map(g -> g.getCards(game))
.flatMap(Collection::stream) .flatMap(Collection::stream)
.filter(MageObject::isCreature) .filter(card1 -> card1.isCreature(game))
.forEach(cards::add); .forEach(cards::add);
controller.moveCards(card, Zone.BATTLEFIELD, source, game, false, false, true, null); controller.moveCards(card, Zone.BATTLEFIELD, source, game, false, false, true, null);
return true; return true;

View file

@ -113,7 +113,7 @@ class AlrundGodOfTheCosmosEffect extends OneShotEffect {
cards.addAll(twoCardsFromTop); cards.addAll(twoCardsFromTop);
controller.revealCards(source, cards, game); controller.revealCards(source, cards, game);
for (Card card : cards.getCards(game)) { for (Card card : cards.getCards(game)) {
if (card.getCardType().toString().contains(chosenCardType)) { if (card.getCardType(game).toString().contains(chosenCardType)) {
cardsToHand.add(card); cardsToHand.add(card);
} else { } else {
cardsToBottomOfLibrary.add(card); cardsToBottomOfLibrary.add(card);

View file

@ -88,7 +88,7 @@ class AmarethTheLustrousEffect extends OneShotEffect {
permanent = (Permanent) obj; permanent = (Permanent) obj;
} }
if (permanent == null 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)) { || !player.chooseUse(Outcome.DrawCard, "Reveal " + card.getName() + " and put it into your hand?", source, game)) {
return false; return false;
} }

View file

@ -149,7 +149,7 @@ class AminatousAuguryCastFromExileEffect extends AsThoughEffectImpl {
if (card != null if (card != null
&& game.getState().getZone(objectId) == Zone.EXILED) { && game.getState().getZone(objectId) == Zone.EXILED) {
EnumSet<CardType> unusedCardTypes = EnumSet.noneOf(CardType.class); EnumSet<CardType> unusedCardTypes = EnumSet.noneOf(CardType.class);
for (CardType cardT : card.getCardType()) { for (CardType cardT : card.getCardType(game)) {
if (!usedCardTypes.contains(cardT)) { if (!usedCardTypes.contains(cardT)) {
unusedCardTypes.add(cardT); unusedCardTypes.add(cardT);
} }

View file

@ -1,6 +1,5 @@
package mage.cards.a; package mage.cards.a;
import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.cards.*; import mage.cards.*;
@ -59,7 +58,7 @@ class AmnesiaEffect extends OneShotEffect {
Cards hand = player.getHand(); Cards hand = player.getHand();
player.revealCards(source, hand, game); player.revealCards(source, hand, game);
Set<Card> cards = hand.getCards(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); player.discard(new CardsImpl(cards), false, source, game);
return true; return true;
} }

View file

@ -70,7 +70,7 @@ class AmplifireEffect extends OneShotEffect {
for (Card card : player.getLibrary().getCards(game)) { for (Card card : player.getLibrary().getCards(game)) {
if (card != null) { if (card != null) {
cards.add(card); cards.add(card);
if (card.isCreature()) { if (card.isCreature(game)) {
lastCard = card; lastCard = card;
break; break;
} }

View file

@ -117,10 +117,10 @@ class AnafenzaTheForemostEffect extends ReplacementEffectImpl {
Card card = game.getCard(event.getTargetId()); Card card = game.getCard(event.getTargetId());
if (card != null && game.getOpponents(source.getControllerId()).contains(card.getOwnerId())) { // Anafenza only cares about cards 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() != 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; return true;
} }
} else if (card.isCreature()) { } else if (card.isCreature(game)) {
return true; return true;
} }
} }

View file

@ -86,7 +86,7 @@ class AncientGreenwardenEffect extends ReplacementEffectImpl {
if (sourceEvent == null if (sourceEvent == null
|| sourceEvent.getType() != GameEvent.EventType.ENTERS_THE_BATTLEFIELD || sourceEvent.getType() != GameEvent.EventType.ENTERS_THE_BATTLEFIELD
|| !(sourceEvent instanceof EntersTheBattlefieldEvent) || !(sourceEvent instanceof EntersTheBattlefieldEvent)
|| !((EntersTheBattlefieldEvent) sourceEvent).getTarget().isLand()) { || !((EntersTheBattlefieldEvent) sourceEvent).getTarget().isLand(game)) {
return false; return false;
} }
return game.getPermanent(numberOfTriggersEvent.getSourceId()) != null; return game.getPermanent(numberOfTriggersEvent.getSourceId()) != null;

View file

@ -10,7 +10,6 @@ import mage.constants.Outcome;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
@ -57,7 +56,7 @@ class AngelicChorusTriggeredAbility extends TriggeredAbilityImpl {
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
Permanent permanent = game.getPermanent(event.getTargetId()); Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null if (permanent != null
&& permanent.isCreature() && permanent.isCreature(game)
&& permanent.isControlledBy(this.controllerId)) { && permanent.isControlledBy(this.controllerId)) {
this.getEffects().get(0).setValue("lifeSource", event.getTargetId()); this.getEffects().get(0).setValue("lifeSource", event.getTargetId());
return true; return true;

View file

@ -1,7 +1,6 @@
package mage.cards.a; package mage.cards.a;
import mage.MageInt; import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.AttacksWithCreaturesTriggeredAbility; import mage.abilities.common.AttacksWithCreaturesTriggeredAbility;
import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.ContinuousEffect;
@ -75,7 +74,7 @@ class AngelicGuardianGainEffect extends OneShotEffect {
.map(game::getPermanent) .map(game::getPermanent)
.filter(Objects::nonNull) .filter(Objects::nonNull)
.filter(permanent -> permanent.isControlledBy(you.getId())) .filter(permanent -> permanent.isControlledBy(you.getId()))
.filter(MageObject::isCreature) .filter(permanent1 -> permanent1.isCreature(game))
.forEach(permanent -> { .forEach(permanent -> {
ContinuousEffect effect = new GainAbilityTargetEffect(IndestructibleAbility.getInstance(), Duration.EndOfTurn); ContinuousEffect effect = new GainAbilityTargetEffect(IndestructibleAbility.getInstance(), Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(permanent, game)); effect.setTargetPointer(new FixedTarget(permanent, game));

View file

@ -83,7 +83,7 @@ class AnimarCostReductionEffect extends CostModificationEffectImpl {
if (abilityToModify.isControlledBy(source.getControllerId())) { if (abilityToModify.isControlledBy(source.getControllerId())) {
Card spellCard = ((SpellAbility) abilityToModify).getCharacteristics(game); Card spellCard = ((SpellAbility) abilityToModify).getCharacteristics(game);
if (spellCard != null) { if (spellCard != null) {
return spellCard.isCreature(); return spellCard.isCreature(game);
} }
} }
} }

View file

@ -77,9 +77,9 @@ class AnimateArtifactContinuousEffect extends ContinuousEffectImpl {
Permanent enchantment = game.getPermanent(source.getSourceId()); Permanent enchantment = game.getPermanent(source.getSourceId());
if (enchantment != null) { if (enchantment != null) {
Permanent permanent = game.getPermanent(enchantment.getAttachedTo()); Permanent permanent = game.getPermanent(enchantment.getAttachedTo());
if (permanent != null && !permanent.isCreature()) { if (permanent != null && !permanent.isCreature(game)) {
if (sublayer == SubLayer.NA) { if (sublayer == SubLayer.NA) {
permanent.addCardType(CardType.CREATURE); permanent.addCardType(game, CardType.CREATURE);
permanent.getPower().setValue(permanent.getManaValue()); permanent.getPower().setValue(permanent.getManaValue());
permanent.getToughness().setValue(permanent.getManaValue()); permanent.getToughness().setValue(permanent.getManaValue());
} }

View file

@ -11,7 +11,6 @@ import mage.constants.CardType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
@ -64,7 +63,7 @@ class AnkhOfMishraAbility extends TriggeredAbilityImpl {
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
Permanent permanent = game.getPermanent(event.getTargetId()); Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.isLand()) { if (permanent != null && permanent.isLand(game)) {
Player player = game.getPlayer(permanent.getControllerId()); Player player = game.getPlayer(permanent.getControllerId());
if (player != null) { if (player != null) {
for (Effect effect : this.getEffects()) { for (Effect effect : this.getEffects()) {

View file

@ -68,7 +68,7 @@ class AnsweredPrayersEffect extends OneShotEffect {
if (permanent == null) { if (permanent == null) {
return false; return false;
} }
if (permanent.isCreature()) { if (permanent.isCreature(game)) {
return true; return true;
} }
game.addEffect(new BecomesCreatureSourceEffect( game.addEffect(new BecomesCreatureSourceEffect(

View file

@ -76,7 +76,7 @@ class ApexOfPowerSpellEffect extends OneShotEffect {
} }
controller.moveCards(cards, Zone.EXILED, source, game); controller.moveCards(cards, Zone.EXILED, source, game);
for (Card card : cards) { for (Card card : cards) {
if (card.isLand()) { if (card.isLand(game)) {
continue; continue;
} }
ContinuousEffect effect = new PlayFromNotOwnHandZoneTargetEffect(Zone.EXILED, Duration.EndOfTurn); ContinuousEffect effect = new PlayFromNotOwnHandZoneTargetEffect(Zone.EXILED, Duration.EndOfTurn);

View file

@ -98,7 +98,7 @@ class ArahboEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Permanent creature = game.getPermanent(targetPointer.getFirst(game, 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(); int pow = creature.getPower().getValue();
ContinuousEffect effect = new BoostTargetEffect(pow, pow, Duration.EndOfTurn); ContinuousEffect effect = new BoostTargetEffect(pow, pow, Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(creature, game)); effect.setTargetPointer(new FixedTarget(creature, game));

View file

@ -76,26 +76,26 @@ class ArcaneAdaptationEffect extends ContinuousEffectImpl {
// in graveyard // in graveyard
for (UUID cardId : controller.getGraveyard()) { for (UUID cardId : controller.getGraveyard()) {
Card card = game.getCard(cardId); 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); game.getState().getCreateMageObjectAttribute(card, game).getSubtype().add(subType);
} }
} }
// on Hand // on Hand
for (UUID cardId : controller.getHand()) { for (UUID cardId : controller.getHand()) {
Card card = game.getCard(cardId); 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); game.getState().getCreateMageObjectAttribute(card, game).getSubtype().add(subType);
} }
} }
// in Exile // in Exile
for (Card card : game.getState().getExile().getAllCards(game)) { 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); game.getState().getCreateMageObjectAttribute(card, game).getSubtype().add(subType);
} }
} }
// in Library (e.g. for Mystical Teachings) // in Library (e.g. for Mystical Teachings)
for (Card card : controller.getLibrary().getCards(game)) { 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); game.getState().getCreateMageObjectAttribute(card, game).getSubtype().add(subType);
} }
} }
@ -104,7 +104,7 @@ class ArcaneAdaptationEffect extends ContinuousEffectImpl {
if (commandObject instanceof Commander) { if (commandObject instanceof Commander) {
Card card = game.getCard(((Commander) commandObject).getId()); Card card = game.getCard(((Commander) commandObject).getId());
if (card != null && card.isOwnedBy(controller.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); game.getState().getCreateMageObjectAttribute(card, game).getSubtype().add(subType);
} }
} }
@ -114,7 +114,7 @@ class ArcaneAdaptationEffect extends ContinuousEffectImpl {
StackObject stackObject = iterator.next(); StackObject stackObject = iterator.next();
if (stackObject instanceof Spell if (stackObject instanceof Spell
&& stackObject.isControlledBy(source.getControllerId()) && stackObject.isControlledBy(source.getControllerId())
&& stackObject.isCreature() && stackObject.isCreature(game)
&& !stackObject.hasSubtype(subType, game)) { && !stackObject.hasSubtype(subType, game)) {
Card card = ((Spell) stackObject).getCard(); Card card = ((Spell) stackObject).getCard();
game.getState().getCreateMageObjectAttribute(card, game).getSubtype().add(subType); game.getState().getCreateMageObjectAttribute(card, game).getSubtype().add(subType);

View file

@ -101,7 +101,7 @@ class ArcaneArtisanCreateTokenEffect extends OneShotEffect {
return false; return false;
} }
if (card.isCreature()) { if (card.isCreature(game)) {
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(player.getId()); CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(player.getId());
effect.setTargetPointer(new FixedTarget(card.getId(), game)); effect.setTargetPointer(new FixedTarget(card.getId(), game));
effect.apply(game, source); effect.apply(game, source);

View file

@ -77,7 +77,7 @@ class ArchonOfEmeriaEffect extends ReplacementEffectImpl {
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) { if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget(); Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
if (permanent != null && permanent.isLand() && !permanent.isBasic()) { if (permanent != null && permanent.isLand(game) && !permanent.isBasic()) {
return true; return true;
} }
} }

View file

@ -102,7 +102,7 @@ class ArchonOfValorsReachReplacementEffect extends ContinuousRuleModifyingEffect
if (savedType instanceof String && card != null) { if (savedType instanceof String && card != null) {
CardType cardType = CardType.fromString((String) savedType); CardType cardType = CardType.fromString((String) savedType);
if (cardType != null && card.getCardType().contains(cardType)) { if (cardType != null && card.getCardType(game).contains(cardType)) {
return true; return true;
} }
} }

View file

@ -84,7 +84,7 @@ class ArclightPhoenixWatcher extends Watcher {
public void watch(GameEvent event, Game game) { public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.SPELL_CAST) { if (event.getType() == GameEvent.EventType.SPELL_CAST) {
Spell spell = game.getStack().getSpell(event.getTargetId()); Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell == null || !spell.isInstantOrSorcery()) { if (spell == null || !spell.isInstantOrSorcery(game)) {
return; return;
} }
this.instantSorceryCount.putIfAbsent(spell.getControllerId(), 0); this.instantSorceryCount.putIfAbsent(spell.getControllerId(), 0);

View file

@ -76,7 +76,7 @@ class ArgothianPixiesPreventDamageFromArtifactsEffect extends PreventionEffectIm
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
if (super.applies(event, source, game)) { if (super.applies(event, source, game)) {
MageObject sourceObject = game.getObject(event.getSourceId()); 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())); return (event.getTargetId().equals(source.getSourceId()));
} }
} }

View file

@ -59,7 +59,7 @@ class PreventDamageToSourceByCardTypeEffect extends PreventAllDamageToSourceEffe
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
if (super.applies(event, source, game)) { if (super.applies(event, source, game)) {
MageObject sourceObject = game.getObject(event.getSourceId()); 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()); return event.getTargetId().equals(source.getSourceId());
} }
} }

View file

@ -92,8 +92,8 @@ class ArixmethesIsLandEffect extends ContinuousEffectImpl {
if (permanent == null) { if (permanent == null) {
return false; return false;
} }
permanent.getCardType().clear(); permanent.removeAllCardTypes(game);
permanent.addCardType(CardType.LAND); permanent.addCardType(game, CardType.LAND);
permanent.removeAllSubTypes(game); permanent.removeAllSubTypes(game);
return true; return true;
} }

View file

@ -68,7 +68,7 @@ class ArlinnVoiceOfThePackReplacementEffect extends ReplacementEffectImpl {
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
return creature != null && creature.isControlledBy(source.getControllerId()) return creature != null && creature.isControlledBy(source.getControllerId())
&& creature.isCreature() && creature.isCreature(game)
&& (creature.hasSubtype(SubType.WOLF, game) && (creature.hasSubtype(SubType.WOLF, game)
|| creature.hasSubtype(SubType.WEREWOLF, game)); || creature.hasSubtype(SubType.WEREWOLF, game));
} }

View file

@ -62,8 +62,8 @@ class ArmedAndArmoredEffect extends ContinuousEffectImpl {
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(source.getControllerId())) { for (Permanent permanent : game.getBattlefield().getAllActivePermanents(source.getControllerId())) {
if (permanent != null && permanent.hasSubtype(SubType.VEHICLE, game)) { if (permanent != null && permanent.hasSubtype(SubType.VEHICLE, game)) {
if (sublayer == SubLayer.NA) { if (sublayer == SubLayer.NA) {
permanent.addCardType(CardType.ARTIFACT); permanent.addCardType(game, CardType.ARTIFACT);
permanent.addCardType(CardType.CREATURE);// TODO: Check if giving CREATURE Type is correct permanent.addCardType(game, CardType.CREATURE);// TODO: Check if giving CREATURE Type is correct
} }
} }
} }

View file

@ -76,7 +76,7 @@ class ArtificersHexEffect extends OneShotEffect {
Permanent equipment = game.getPermanent(enchantment.getAttachedTo()); Permanent equipment = game.getPermanent(enchantment.getAttachedTo());
if (equipment != null && equipment.getAttachedTo() != null) { if (equipment != null && equipment.getAttachedTo() != null) {
Permanent creature = game.getPermanent(equipment.getAttachedTo()); Permanent creature = game.getPermanent(equipment.getAttachedTo());
if (creature != null && creature.isCreature()) { if (creature != null && creature.isCreature(game)) {
return creature.destroy(source, game, false); return creature.destroy(source, game, false);
} }
} }

View file

@ -71,7 +71,7 @@ class SpellWithManaCostLessThanOrEqualToCondition implements Condition {
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
MageObject object = game.getObject(source.getSourceId()); MageObject object = game.getObject(source.getSourceId());
return object != null return object != null
&& !object.isLand() && !object.isLand(game)
&& object.getManaValue() <= counters; && object.getManaValue() <= counters;
} }
} }

View file

@ -134,7 +134,7 @@ class AscentOfTheWorthyRedirectEffect extends ReplacementEffectImpl {
@Override @Override
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
Permanent permanent = game.getPermanent(event.getTargetId()); 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 @Override

View file

@ -86,8 +86,8 @@ class AshayaSoulOfTheWildEffect extends ContinuousEffectImpl {
for (Permanent permanent : game.getBattlefield().getActivePermanents( for (Permanent permanent : game.getBattlefield().getActivePermanents(
filter, source.getControllerId(), source.getSourceId(), game filter, source.getControllerId(), source.getSourceId(), game
)) { )) {
if (!permanent.isLand()) { if (!permanent.isLand(game)) {
permanent.addCardType(CardType.LAND); permanent.addCardType(game, CardType.LAND);
} }
permanent.addSubType(game, SubType.FOREST); permanent.addSubType(game, SubType.FOREST);
if (!permanent.getAbilities(game).containsClass(GreenManaAbility.class)) { if (!permanent.getAbilities(game).containsClass(GreenManaAbility.class)) {

View file

@ -69,7 +69,7 @@ enum AshenGhoulCondition implements Condition {
int cardsAbove = 0; int cardsAbove = 0;
boolean aboveCards = false; boolean aboveCards = false;
for (Card card : controller.getGraveyard().getCards(game)) { for (Card card : controller.getGraveyard().getCards(game)) {
if (aboveCards && card.isCreature()) { if (aboveCards && card.isCreature(game)) {
cardsAbove++; cardsAbove++;
if (cardsAbove > 2) { if (cardsAbove > 2) {
return true; return true;

View file

@ -61,7 +61,7 @@ class AshesOfTheFallenEffect extends ContinuousEffectImpl {
if (subType != null) { if (subType != null) {
for (UUID cardId : controller.getGraveyard()) { for (UUID cardId : controller.getGraveyard()) {
Card card = game.getCard(cardId); 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); game.getState().getCreateMageObjectAttribute(card, game).getSubtype().add(subType);
} }
} }

View file

@ -68,7 +68,7 @@ class AsmiraHolyAvengerWatcher extends Watcher {
public void watch(GameEvent event, Game game) { public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).isDiesEvent()) { if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).isDiesEvent()) {
MageObject card = game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); 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++; creaturesCount++;
} }
} }

View file

@ -103,7 +103,7 @@ class AthreosShroudVeiledTriggeredAbility extends TriggeredAbilityImpl {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event; ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
Permanent permanent = zEvent.getTarget(); Permanent permanent = zEvent.getTarget();
if (permanent == null if (permanent == null
|| !permanent.isCreature() || !permanent.isCreature(game)
|| !permanent.getCounters(game).containsKey(CounterType.COIN)) { || !permanent.getCounters(game).containsKey(CounterType.COIN)) {
return false; return false;
} }

View file

@ -90,7 +90,7 @@ class AtlaPalaniNestTenderEffect extends OneShotEffect {
Card toBattlefield = null; Card toBattlefield = null;
for (Card card : library.getCards(game)) { for (Card card : library.getCards(game)) {
cards.add(card); cards.add(card);
if (card.isCreature()) { if (card.isCreature(game)) {
toBattlefield = card; toBattlefield = card;
break; break;
} }

View file

@ -80,7 +80,7 @@ class AudaciousReshapersEffect extends OneShotEffect {
continue; continue;
} }
cards.add(card); cards.add(card);
if (card.isArtifact()) { if (card.isArtifact(game)) {
artifact = card; artifact = card;
break; break;
} }

View file

@ -95,7 +95,7 @@ class EchoingEquationEffect extends OneShotEffect {
Permanent copyFrom = game.getPermanent(source.getFirstTarget()); Permanent copyFrom = game.getPermanent(source.getFirstTarget());
if (copyFrom != null) { if (copyFrom != null) {
game.getBattlefield().getAllActivePermanents(source.getControllerId()).stream() 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() { .forEach(copyTo -> game.copyPermanent(Duration.EndOfTurn, copyFrom, copyTo.getId(), source, new CopyApplier() {
@Override @Override
public boolean apply(Game game, MageObject blueprint, Ability source, UUID targetObjectId) { public boolean apply(Game game, MageObject blueprint, Ability source, UUID targetObjectId) {

View file

@ -66,7 +66,7 @@ public final class AuraBarbs extends CardImpl {
for (Permanent auraEnchantment : game.getBattlefield().getActivePermanents(filterEnchantments, source.getControllerId(), source.getSourceId(), game)) { for (Permanent auraEnchantment : game.getBattlefield().getActivePermanents(filterEnchantments, source.getControllerId(), source.getSourceId(), game)) {
if (auraEnchantment.getAttachedTo() != null) { if (auraEnchantment.getAttachedTo() != null) {
Permanent attachedToCreature = game.getPermanent(auraEnchantment.getAttachedTo()); 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); attachedToCreature.damage(2, auraEnchantment.getId(), source, game, false, true);
game.informPlayers("2 damage assigned to " + attachedToCreature.getName() + " from " + auraEnchantment.getName()); game.informPlayers("2 damage assigned to " + attachedToCreature.getName() + " from " + auraEnchantment.getName());
} }

View file

@ -157,7 +157,7 @@ class AureliasFuryCantCastEffect extends ContinuousRuleModifyingEffectImpl {
Player player = game.getPlayer(getTargetPointer().getFirst(game, source)); Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
if (player != null && player.getId().equals(event.getPlayerId())) { if (player != null && player.getId().equals(event.getPlayerId())) {
Card card = game.getCard(event.getSourceId()); Card card = game.getCard(event.getSourceId());
if (card != null && !card.isCreature()) { if (card != null && !card.isCreature(game)) {
return true; return true;
} }
} }
@ -183,7 +183,7 @@ class AureliasFuryDamagedByWatcher extends Watcher {
switch (event.getType()) { switch (event.getType()) {
case DAMAGED_PERMANENT: case DAMAGED_PERMANENT:
Permanent permanent = game.getPermanent(event.getTargetId()); Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.isCreature()) { if (permanent != null && permanent.isCreature(game)) {
damagedCreatures.add(event.getTargetId()); damagedCreatures.add(event.getTargetId());
} }
return; return;

View file

@ -87,7 +87,7 @@ public final class Aurification extends CardImpl {
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
if (event.getPlayerId().equals(this.getControllerId())) { if (event.getPlayerId().equals(this.getControllerId())) {
Permanent permanent = game.getPermanent(event.getSourceId()); Permanent permanent = game.getPermanent(event.getSourceId());
if (permanent != null && permanent.isCreature()) { if (permanent != null && permanent.isCreature(game)) {
for (Effect effect : this.getEffects()) { for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getSourceId())); effect.setTargetPointer(new FixedTarget(event.getSourceId()));
} }
@ -121,7 +121,7 @@ public final class Aurification extends CardImpl {
@Override @Override
public boolean apply(Game game, Ability source) { 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) { if (permanent != null) {
int numToRemove = permanent.getCounters(game).getCount(CounterType.GOLD); int numToRemove = permanent.getCounters(game).getCount(CounterType.GOLD);
if (numToRemove > 0) { if (numToRemove > 0) {

View file

@ -75,7 +75,7 @@ class AuspiciousStarrixEffect extends OneShotEffect {
Cards toExile = new CardsImpl(); Cards toExile = new CardsImpl();
Cards toBattlefield = new CardsImpl(); Cards toBattlefield = new CardsImpl();
for (Card card : player.getLibrary().getCards(game)) { for (Card card : player.getLibrary().getCards(game)) {
if (card != null && card.isPermanent()) { if (card != null && card.isPermanent(game)) {
toBattlefield.add(card); toBattlefield.add(card);
count++; count++;
} }

View file

@ -78,7 +78,7 @@ class AuthorityOfTheConsulsTapEffect extends ReplacementEffectImpl {
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) { if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget(); Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
if (permanent != null && permanent.isCreature()) { if (permanent != null && permanent.isCreature(game)) {
return true; return true;
} }
} }

View file

@ -59,7 +59,7 @@ class AwakenedAmalgamLandNamesCount implements DynamicValue {
public int calculate(Game game, Ability sourceAbility, Effect effect) { public int calculate(Game game, Ability sourceAbility, Effect effect) {
Set<String> landNames = new HashSet<>(); Set<String> landNames = new HashSet<>();
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(sourceAbility.getControllerId())) { for (Permanent permanent : game.getBattlefield().getAllActivePermanents(sourceAbility.getControllerId())) {
if (permanent.isLand()) { if (permanent.isLand(game)) {
landNames.add(permanent.getName()); landNames.add(permanent.getName());
} }
} }

View file

@ -131,7 +131,7 @@ class AzorTheLawbringerCantCastEffect extends ContinuousRuleModifyingEffectImpl
if (opponentId.equals(event.getPlayerId())) { if (opponentId.equals(event.getPlayerId())) {
MageObject object = game.getObject(event.getSourceId()); MageObject object = game.getObject(event.getSourceId());
if (event.getType() == GameEvent.EventType.CAST_SPELL) { if (event.getType() == GameEvent.EventType.CAST_SPELL) {
if (object.isInstantOrSorcery()) { if (object.isInstantOrSorcery(game)) {
return true; return true;
} }
} }

View file

@ -1,7 +1,6 @@
package mage.cards.b; package mage.cards.b;
import mage.MageInt; import mage.MageInt;
import mage.MageObject;
import mage.MageObjectReference; import mage.MageObjectReference;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.AttacksTriggeredAbility; import mage.abilities.common.AttacksTriggeredAbility;
@ -76,7 +75,7 @@ class BackdraftHellkiteEffect extends ContinuousEffectImpl {
player.getGraveyard() player.getGraveyard()
.stream() .stream()
.map((cardId) -> game.getCard(cardId)) .map((cardId) -> game.getCard(cardId))
.filter(MageObject::isInstantOrSorcery) .filter(card1 -> card1.isInstantOrSorcery(game))
.forEachOrdered(card -> affectedObjectList.add(new MageObjectReference(card, game))); .forEachOrdered(card -> affectedObjectList.add(new MageObjectReference(card, game)));
} }
@ -95,9 +94,9 @@ class BackdraftHellkiteEffect extends ContinuousEffectImpl {
return; return;
} }
FlashbackAbility ability = null; FlashbackAbility ability = null;
if (card.isInstant()) { if (card.isInstant(game)) {
ability = new FlashbackAbility(card.getManaCost(), TimingRule.INSTANT); ability = new FlashbackAbility(card.getManaCost(), TimingRule.INSTANT);
} else if (card.isSorcery()) { } else if (card.isSorcery(game)) {
ability = new FlashbackAbility(card.getManaCost(), TimingRule.SORCERY); ability = new FlashbackAbility(card.getManaCost(), TimingRule.SORCERY);
} }
if (ability == null) { if (ability == null) {

View file

@ -96,7 +96,7 @@ class BalduvianWarlordUnblockEffect extends OneShotEffect {
} }
// Choose new creature to block // 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: // 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" // "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) // 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; return true;
} }
Permanent chosenPermanent = game.getPermanent(target.getFirstTarget()); Permanent chosenPermanent = game.getPermanent(target.getFirstTarget());
if (chosenPermanent != null && chosenPermanent.isCreature()) { if (chosenPermanent != null && chosenPermanent.isCreature(game)) {
CombatGroup chosenGroup = game.getCombat().findGroup(chosenPermanent.getId()); CombatGroup chosenGroup = game.getCombat().findGroup(chosenPermanent.getId());
if (chosenGroup != null) { if (chosenGroup != null) {
// Relevant ruling for Balduvian Warlord: // Relevant ruling for Balduvian Warlord:

View file

@ -56,7 +56,7 @@ enum BalothCageTrapCondition implements Condition {
List<Permanent> permanents = watcher.getThisTurnEnteringPermanents(opponentId); List<Permanent> permanents = watcher.getThisTurnEnteringPermanents(opponentId);
if (permanents != null) { if (permanents != null) {
for (Permanent permanent : permanents) { for (Permanent permanent : permanents) {
if (permanent.isArtifact()) { if (permanent.isArtifact(game)) {
return true; return true;
} }
} }

View file

@ -77,7 +77,7 @@ class BalustradeSpyEffect extends OneShotEffect {
for (Card card : controller.getLibrary().getCards(game)) { for (Card card : controller.getLibrary().getCards(game)) {
if (card != null) { if (card != null) {
toGraveyard.add(card); toGraveyard.add(card);
if (card.isLand()) { if (card.isLand(game)) {
break; break;
} }
} }

View file

@ -11,7 +11,6 @@ import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.KnightToken; import mage.game.permanent.token.KnightToken;
import mage.game.stack.Spell; import mage.game.stack.Spell;
import mage.target.common.TargetNonlandPermanent; import mage.target.common.TargetNonlandPermanent;
@ -117,14 +116,14 @@ class BanishIntoFableEffect extends OneShotEffect {
if (game.getBattlefield() if (game.getBattlefield()
.getAllActivePermanents(source.getControllerId()) .getAllActivePermanents(source.getControllerId())
.stream() .stream()
.filter(Permanent::isArtifact) .filter(permanent -> permanent.isArtifact(game))
.count() > 0) { .count() > 0) {
spell.createCopyOnStack(game, source, source.getControllerId(), true); spell.createCopyOnStack(game, source, source.getControllerId(), true);
} }
if (game.getBattlefield() if (game.getBattlefield()
.getAllActivePermanents(source.getControllerId()) .getAllActivePermanents(source.getControllerId())
.stream() .stream()
.filter(Permanent::isEnchantment) .filter(permanent -> permanent.isEnchantment(game))
.count() > 0) { .count() > 0) {
spell.createCopyOnStack(game, source, source.getControllerId(), true); spell.createCopyOnStack(game, source, source.getControllerId(), true);
} }

View file

@ -79,7 +79,7 @@ class BattlefieldThaumaturgeSpellsCostReductionEffect extends CostModificationEf
} }
for (UUID uuid : target.getTargets()) { for (UUID uuid : target.getTargets()) {
Permanent permanent = game.getPermanent(uuid); Permanent permanent = game.getPermanent(uuid);
if (permanent != null && permanent.isCreature()) { if (permanent != null && permanent.isCreature(game)) {
creaturesTargeted.add(permanent.getId()); creaturesTargeted.add(permanent.getId());
} }
} }
@ -102,7 +102,7 @@ class BattlefieldThaumaturgeSpellsCostReductionEffect extends CostModificationEf
Set<UUID> possibleList = target.possibleTargets(ability.getSourceId(), ability.getControllerId(), game); Set<UUID> possibleList = target.possibleTargets(ability.getSourceId(), ability.getControllerId(), game);
possibleList.removeIf(id -> { possibleList.removeIf(id -> {
Permanent permanent = game.getPermanent(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()); int possibleAmount = Math.min(possibleList.size(), target.getMaxNumberOfTargets());
maxAmount = Math.max(maxAmount, possibleAmount); maxAmount = Math.max(maxAmount, possibleAmount);

View file

@ -1,7 +1,6 @@
package mage.cards.b; package mage.cards.b;
import mage.MageInt; import mage.MageInt;
import mage.MageObject;
import mage.MageObjectReference; import mage.MageObjectReference;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.AbilityImpl; import mage.abilities.AbilityImpl;
@ -85,7 +84,7 @@ class BeamsplitterMageTriggeredAbility extends TriggeredAbilityImpl {
return false; return false;
} }
Spell spell = game.getSpellOrLKIStack(event.getTargetId()); Spell spell = game.getSpellOrLKIStack(event.getTargetId());
if (spell == null || !spell.isInstantOrSorcery()) { if (spell == null || !spell.isInstantOrSorcery(game)) {
return false; return false;
} }
if (spell.getSpellAbilities() if (spell.getSpellAbilities()
@ -116,7 +115,7 @@ class BeamsplitterMageTriggeredAbility extends TriggeredAbilityImpl {
getControllerId(), getSourceId(), game getControllerId(), getSourceId(), game
).stream() ).stream()
.filter(Objects::nonNull) .filter(Objects::nonNull)
.filter(MageObject::isCreature) .filter(permanent -> permanent.isCreature(game))
.filter(p -> checkNotSource(p, game)) .filter(p -> checkNotSource(p, game))
.anyMatch(p -> spell.canTarget(game, p.getId())); .anyMatch(p -> spell.canTarget(game, p.getId()));
} }

View file

@ -81,7 +81,7 @@ class BellowingElkWatcher extends Watcher {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE) { if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event; ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getToZone() == Zone.BATTLEFIELD if (zEvent.getToZone() == Zone.BATTLEFIELD
&& zEvent.getTarget().isCreature()) { && zEvent.getTarget().isCreature(game)) {
playerMap.putIfAbsent(zEvent.getTarget().getControllerId(), new HashSet<>()); playerMap.putIfAbsent(zEvent.getTarget().getControllerId(), new HashSet<>());
playerMap.get(zEvent.getTarget().getControllerId()).add(zEvent.getTargetId()); playerMap.get(zEvent.getTarget().getControllerId()).add(zEvent.getTargetId());
} }

View file

@ -70,10 +70,10 @@ class BenefactionOfRhonasEffect extends OneShotEffect {
Card card = game.getCard(cardId); Card card = game.getCard(cardId);
if (card != null) { if (card != null) {
cards.add(card); cards.add(card);
if (card.isCreature()) { if (card.isCreature(game)) {
creatureCardFound = true; creatureCardFound = true;
} }
if (card.isEnchantment()) { if (card.isEnchantment(game)) {
enchantmentCardFound = true; enchantmentCardFound = true;
} }
} }

View file

@ -142,7 +142,7 @@ class BenthicExplorersManaEffect extends ManaEffect {
Set<ManaType> manaTypes = EnumSet.noneOf(ManaType.class); Set<ManaType> manaTypes = EnumSet.noneOf(ManaType.class);
for (UUID opponentId : game.getOpponents(source.getControllerId())) { for (UUID opponentId : game.getOpponents(source.getControllerId())) {
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(opponentId)) { 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)) { for (ActivatedManaAbilityImpl ability : permanent.getAbilities(game).getActivatedManaAbilities(Zone.BATTLEFIELD)) {
manaTypes.addAll(ability.getProducableManaTypes(game)); manaTypes.addAll(ability.getProducableManaTypes(game));
} }

View file

@ -10,7 +10,6 @@ import mage.constants.CardType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.events.ZoneChangeEvent; import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
@ -63,7 +62,7 @@ class BereavementTriggeredAbility extends TriggeredAbilityImpl {
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
if (((ZoneChangeEvent)event).isDiesEvent()) { if (((ZoneChangeEvent)event).isDiesEvent()) {
Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); 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())); this.getEffects().get(0).setTargetPointer(new FixedTarget(permanent.getControllerId()));
return true; return true;
} }

View file

@ -113,7 +113,7 @@ class BioessenceHydraTriggeredAbility extends TriggeredAbilityImpl {
} }
if (permanent != null if (permanent != null
&& !event.getTargetId().equals(this.getSourceId()) && !event.getTargetId().equals(this.getSourceId())
&& permanent.isPlaneswalker() && permanent.isPlaneswalker(game)
&& permanent.isControlledBy(this.getControllerId())) { && permanent.isControlledBy(this.getControllerId())) {
this.getEffects().clear(); this.getEffects().clear();
if (event.getAmount() > 0) { if (event.getAmount() > 0) {

View file

@ -1,7 +1,6 @@
package mage.cards.b; package mage.cards.b;
import mage.MageInt; import mage.MageInt;
import mage.Mana;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.ActivatedAbility; import mage.abilities.ActivatedAbility;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
@ -93,7 +92,7 @@ class BiomancersFamiliarCostReductionEffect extends CostModificationEffectImpl {
//Activated abilities of creatures you control //Activated abilities of creatures you control
Permanent permanent = game.getPermanentOrLKIBattlefield(abilityToModify.getSourceId()); Permanent permanent = game.getPermanentOrLKIBattlefield(abilityToModify.getSourceId());
return permanent != null return permanent != null
&& permanent.isCreature() && permanent.isCreature(game)
&& permanent.isControlledBy(source.getControllerId()); && permanent.isControlledBy(source.getControllerId());
} }

View file

@ -76,7 +76,7 @@ class BioplasmEffect extends OneShotEffect {
if (card == null) { if (card == null) {
return false; 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); game.addEffect(new BoostSourceEffect(card.getPower().getValue(), card.getToughness().getValue(), Duration.EndOfTurn), source);
} }
return true; return true;

View file

@ -53,7 +53,7 @@ class BlackSunsZenithEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
int amount = source.getManaCostsToPay().getX(); int amount = source.getManaCostsToPay().getX();
for (Permanent permanent : game.getBattlefield().getAllActivePermanents()) { 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); permanent.addCounters(CounterType.M1M1.createInstance(amount), source.getControllerId(), source, game);
} }
} }

View file

@ -65,7 +65,7 @@ class BlacksmithsSkillEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget()); 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); game.addEffect(new BoostTargetEffect(2, 2), source);
return true; return true;
} }

View file

@ -13,7 +13,6 @@ import mage.constants.SubType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.token.SoldierTokenWithHaste; import mage.game.permanent.token.SoldierTokenWithHaste;
import java.util.ArrayList; import java.util.ArrayList;
@ -93,7 +92,7 @@ class BlazeCommandoTriggeredAbility extends TriggeredAbilityImpl {
if (isControlledBy(game.getControllerId(event.getSourceId()))) { if (isControlledBy(game.getControllerId(event.getSourceId()))) {
MageObject damageSource = game.getObject(event.getSourceId()); MageObject damageSource = game.getObject(event.getSourceId());
if (damageSource != null) { if (damageSource != null) {
if (damageSource.isInstantOrSorcery()) { if (damageSource.isInstantOrSorcery(game)) {
if (!handledStackObjects.contains(damageSource.getId())) { if (!handledStackObjects.contains(damageSource.getId())) {
handledStackObjects.add(damageSource.getId()); handledStackObjects.add(damageSource.getId());
return true; return true;

View file

@ -83,7 +83,7 @@ class BlessedReincarnationEffect extends OneShotEffect {
Cards toReveal = new CardsImpl(); Cards toReveal = new CardsImpl();
for (Card card : library.getCards(game)) { for (Card card : library.getCards(game)) {
toReveal.add(card); toReveal.add(card);
if (card.isCreature()) { if (card.isCreature(game)) {
permanentController.moveCards(card, Zone.BATTLEFIELD, source, game); permanentController.moveCards(card, Zone.BATTLEFIELD, source, game);
break; break;
} }

View file

@ -76,7 +76,7 @@ class BlightbeetleEffect extends ContinuousRuleModifyingEffectImpl {
return false; return false;
} }
Permanent permanent = game.getPermanent(event.getTargetId()); Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent == null || !permanent.isCreature()) { if (permanent == null || !permanent.isCreature(game)) {
return false; return false;
} }
Player player = game.getPlayer(permanent.getControllerId()); Player player = game.getPlayer(permanent.getControllerId());

View file

@ -70,7 +70,7 @@ class FurnaceOfRathEffect extends ReplacementEffectImpl {
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
Permanent permanent = game.getPermanent(event.getSourceId()); Permanent permanent = game.getPermanent(event.getSourceId());
return permanent != null return permanent != null
&& permanent.isCreature() && permanent.isCreature(game)
&& ((DamageEvent) event).isCombatDamage(); && ((DamageEvent) event).isCombatDamage();
} }

View file

@ -73,7 +73,7 @@ class BlindObedienceTapEffect extends ReplacementEffectImpl {
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) { if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget(); Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
if (permanent != null && (permanent.isCreature() || permanent.isArtifact())) { if (permanent != null && (permanent.isCreature(game) || permanent.isArtifact(game))) {
return true; return true;
} }
} }

View file

@ -3,7 +3,6 @@ package mage.cards.b;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.costs.common.SacrificeTargetCost; import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.cards.CardsImpl; import mage.cards.CardsImpl;
@ -73,14 +72,14 @@ class BloodForBonesEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId()); 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; return false;
} }
TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(filter); TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(filter);
if (player.choose(outcome, player.getGraveyard(), target, game)) { if (player.choose(outcome, player.getGraveyard(), target, game)) {
player.moveCards(new CardsImpl(target.getTargets()), Zone.BATTLEFIELD, source, 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; return true;
} }
target = new TargetCardInYourGraveyard(filter2); target = new TargetCardInYourGraveyard(filter2);

View file

@ -106,7 +106,7 @@ class BloodOathEffect extends OneShotEffect {
Set<Card> cards = hand.getCards(game); Set<Card> cards = hand.getCards(game);
int damageToDeal = 0; int damageToDeal = 0;
for (Card card : cards) { for (Card card : cards) {
if (card != null && card.getCardType().contains(type)) { if (card != null && card.getCardType(game).contains(type)) {
damageToDeal += 3; damageToDeal += 3;
} }
} }

View file

@ -82,7 +82,7 @@ class BloodOfTheMartyrEffect extends ReplacementEffectImpl {
DamageEvent damageEvent = (DamageEvent) event; DamageEvent damageEvent = (DamageEvent) event;
return controller != null return controller != null
&& permanent != null && permanent != null
&& permanent.isCreature() && permanent.isCreature(game)
&& controller.chooseUse(outcome, "Have " + damageEvent.getAmount() + " damage dealt to you instead of " + permanent.getLogName() + "?", source, game); && controller.chooseUse(outcome, "Have " + damageEvent.getAmount() + " damage dealt to you instead of " + permanent.getLogName() + "?", source, game);
} }
} }

View file

@ -15,7 +15,6 @@ import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent; import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
/** /**
@ -70,7 +69,7 @@ class BloodSeekerTriggeredAbility extends TriggeredAbilityImpl {
if (game.getOpponents(this.controllerId).contains(event.getPlayerId())) { if (game.getOpponents(this.controllerId).contains(event.getPlayerId())) {
EntersTheBattlefieldEvent zEvent = (EntersTheBattlefieldEvent) event; EntersTheBattlefieldEvent zEvent = (EntersTheBattlefieldEvent) event;
Card card = zEvent.getTarget(); Card card = zEvent.getTarget();
if (card != null && card.isCreature()) { if (card != null && card.isCreature(game)) {
for (Effect effect : this.getEffects()) { for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getPlayerId())); effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
} }

View file

@ -65,12 +65,12 @@ class BloodfireEnforcersCondition implements Condition {
Player player = game.getPlayer(source.getControllerId()); Player player = game.getPlayer(source.getControllerId());
if (player != null) { if (player != null) {
for(Card card : player.getGraveyard().getCards(game)) { for(Card card : player.getGraveyard().getCards(game)) {
if (card.isInstant()) { if (card.isInstant(game)) {
if (sorceryFound) { if (sorceryFound) {
return true; return true;
} }
instantFound = true; instantFound = true;
} else if (card.isSorcery()) { } else if (card.isSorcery(game)) {
if (instantFound) { if (instantFound) {
return true; return true;
} }

View file

@ -66,7 +66,7 @@ class BloodsporeThrinaxEntersBattlefieldEffect extends ReplacementEffectImpl {
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
return creature != null && creature.isControlledBy(source.getControllerId()) return creature != null && creature.isControlledBy(source.getControllerId())
&& creature.isCreature() && creature.isCreature(game)
&& !event.getTargetId().equals(source.getSourceId()); && !event.getTargetId().equals(source.getSourceId());
} }

View file

@ -113,7 +113,7 @@ class BolassCitadelPlayTheTopCardEffect extends AsThoughEffectImpl {
} }
// allows to play/cast with alternative life cost // allows to play/cast with alternative life cost
if (!cardToCheck.isLand()) { if (!cardToCheck.isLand(game)) {
PayLifeCost lifeCost = new PayLifeCost(cardToCheck.getSpellAbility().getManaCosts().manaValue()); PayLifeCost lifeCost = new PayLifeCost(cardToCheck.getSpellAbility().getManaCosts().manaValue());
Costs newCosts = new CostsImpl(); Costs newCosts = new CostsImpl();
newCosts.add(lifeCost); newCosts.add(lifeCost);

Some files were not shown because too many files have changed in this diff Show more