if (!getTargets().isEmpty()) { SubTypeList landTypes = new SubTypeList(); for (UUID landId : getTargets()) { Card landCard = game.getCard(landId); if (landCard != null) { if (landTypes.isEmpty()) { landTypes.addAll(landCard.getSubtype(game)); } else { landTypes.removeIf(next -> !landCard.hasSubtype(next, game)); if (card != null && !landTypes.isEmpty()) { for (Iterator<SubType> iterator = landTypes.iterator(); iterator.hasNext();) { SubType next = iterator.next(); if (card.hasSubtype(next, game)) {
@Override public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent == null) { return false; } switch (layer) { case TypeChangingEffects_4: if (sublayer == SubLayer.NA) { permanent.getSubtype(game).clear(); permanent.getSubtype(game).add(SubType.BEAR); permanent.getSubtype(game).add(SubType.BERSERKER); } break; } return true; }
private static SubTypeList createArrayList(SubType subtype) { SubTypeList subtypes = new SubTypeList(); subtypes.add(subtype); return subtypes; }
public static int getFixedPermanentScore(final Game game, final Permanent permanent) { //TODO: cache it inside Card int score = getCardDefinitionScore(game, permanent); score += PERMANENT_SCORE; if (permanent.getCardType().contains(CardType.CREATURE)) { // TODO: implement in the mage core //score + =cardDefinition.getActivations().size()*50; //score += cardDefinition.getManaActivations().size()*80; } else { if (permanent.getSubtype(game).contains(SubType.EQUIPMENT)) { score += 100; } } return score; }
land.getSubtype(game).clear(); land.getSubtype(game).add(SubType.MOUNTAIN); land.removeAllAbilities(source.getSourceId(), game); break; case AbilityAddingRemovingEffects_6: land.removeAllAbilities(source.getSourceId(), game); if (land.getSubtype(game).contains(SubType.FOREST)) { land.addAbility(new GreenManaAbility(), source.getSourceId(), game); if (land.getSubtype(game).contains(SubType.PLAINS)) { land.addAbility(new WhiteManaAbility(), source.getSourceId(), game); if (land.getSubtype(game).contains(SubType.MOUNTAIN)) { land.addAbility(new RedManaAbility(), source.getSourceId(), game); if (land.getSubtype(game).contains(SubType.ISLAND)) { land.addAbility(new BlueManaAbility(), source.getSourceId(), game); if (land.getSubtype(game).contains(SubType.SWAMP)) { land.addAbility(new BlackManaAbility(), source.getSourceId(), game);
if (sublayer == SubLayer.NA) { if (loseAllAbilities) { permanent.getSubtype(game).retainAll(SubType.getLandTypes(false)); permanent.getSubtype(game).addAll(token.getSubtype(game)); } else { if (!token.getSubtype(game).isEmpty()) { for (SubType subtype : token.getSubtype(game)) { if (!permanent.hasSubtype(subtype, game)) { permanent.getSubtype(game).add(subtype);
protected String getCardSubTypeLine() { StringBuilder subType = new StringBuilder(); if (!cardView.getSubTypes().isEmpty()) { for (SubType sType : cardView.getSubTypes()) { subType.append(sType).append(' '); } } return subType.toString(); }
if (!card.getSubtype(game).contains(SubType.AURA)) { card.getSubtype(game).add(SubType.AURA); card.addCardType(CardType.CREATURE); card.getSubtype(game).remove(SubType.AURA); if (permanent instanceof PermanentCard) { ((PermanentCard) permanent).getCard().addCardType(CardType.CREATURE); ((PermanentCard) permanent).getCard().getSubtype(game).remove(SubType.AURA); return true;
public String getTypeText() { StringBuilder type = new StringBuilder(); if (!getSuperTypes().isEmpty()) { type.append(String.join(" ", getSuperTypes().stream().map(SuperType::toString).collect(Collectors.toList()))); type.append(" "); } if (!getCardTypes().isEmpty()) { type.append(String.join(" ", getCardTypes().stream().map(CardType::toString).collect(Collectors.toList()))); type.append(" "); } if (!getSubTypes().isEmpty()) { type.append(" - "); type.append(String.join(" ", getSubTypes().stream().map(SubType::toString).collect(Collectors.toList()))); } return type.toString(); }
@Override public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { for (UUID targetPermanent : targetPointer.getTargets(game, source)) { Permanent permanent = game.getPermanent(targetPermanent); if (permanent != null) { switch (layer) { case TypeChangingEffects_4: if (loseOther) { permanent.getSubtype(game).retainAll(SubType.getLandTypes(false)); permanent.getSubtype(game).addAll(subtypes); } else { for (SubType subtype : subtypes) { if (!permanent.hasSubtype(subtype, game)) { permanent.getSubtype(game).add(subtype); } } } break; } } else { if (duration == Duration.Custom) { discard(); } } } return true; }
@Override public SubTypeList getSubtype(Game game) { return new SubTypeList(); }
@Override public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { Permanent permanent = affectedObjectList.get(0).getPermanent(game); if (permanent != null) { switch (layer) { case TypeChangingEffects_4: if (sublayer == SubLayer.NA) { permanent.getCardType().clear(); permanent.getSubtype(game).clear(); if (!permanent.getCardType().contains(CardType.ENCHANTMENT)) { permanent.getCardType().add(CardType.ENCHANTMENT); } } break; } return true; } this.discard(); return false; }
private void copyFromToken(Token token, Game game, boolean reset) { this.name = token.getName(); this.abilities.clear(); if (reset) { this.abilities.addAll(token.getAbilities()); } else { // first time -> create ContinuousEffects only once for (Ability ability : token.getAbilities()) { this.addAbility(ability, game); } } this.abilities.setControllerId(this.controllerId); this.manaCost.clear(); for (ManaCost cost : token.getManaCost()) { this.getManaCost().add(cost.copy()); } this.cardType.clear(); this.cardType.addAll(token.getCardType()); this.color = token.getColor(game).copy(); this.frameColor = token.getFrameColor(game); this.frameStyle = token.getFrameStyle(); this.supertype.clear(); this.supertype.addAll(token.getSuperType()); this.subtype.clear(); this.subtype.addAll(token.getSubtype(game)); this.isAllCreatureTypes = token.isAllCreatureTypes(); this.tokenDescriptor = token.getTokenDescriptor(); }
public CardAttribute(Card card, Game game) { color = card.getColor(null).copy(); subtype = new SubTypeList(); subtype.addAll(card.getSubtype(game)); }
if (game.getOpponents(this.getId()).contains(permanent.getControllerId()) && permanent.getCardType().contains(CardType.CREATURE) && !permanent.getSubtype(game).isEmpty()) { if (choice.getChoices().contains(permanent.getSubtype(game).get(0).toString())) { choice.setChoice(permanent.getSubtype(game).get(0).toString()); break; Player opponent = game.getPlayer(opponentId); for (Card card : opponent.getGraveyard().getCards(game)) { if (card != null && card.getCardType().contains(CardType.CREATURE) && !card.getSubtype(game).isEmpty()) { if (choice.getChoices().contains(card.getSubtype(game).get(0).toString())) { choice.setChoice(card.getSubtype(game).get(0).toString()); break; if (card != null && card.getCardType().contains(CardType.CREATURE) && !card.getSubtype(game).isEmpty()) { if (choice.getChoices().contains(card.getSubtype(game).get(0).toString())) { choice.setChoice(card.getSubtype(game).get(0).toString()); break; for (UUID cardId : this.getLibrary().getCardList()) { Card card = game.getCard(cardId); if (card != null && card.getCardType().contains(CardType.CREATURE) && !card.getSubtype(game).isEmpty()) { if (choice.getChoices().contains(card.getSubtype(game).get(0).toString())) { choice.setChoice(card.getSubtype(game).get(0).toString()); break;