public BecomesCreatureTypeTargetEffect(final BecomesCreatureTypeTargetEffect effect) { super(effect); this.subtypes.addAll(effect.subtypes); this.loseOther = effect.loseOther; this.loseOther = effect.loseOther; }
public BecomesSubtypeAllEffect(final BecomesSubtypeAllEffect effect) { super(effect); this.subtypes.addAll(effect.subtypes); this.loseOther = effect.loseOther; this.filter = effect.filter; }
public CreatureToken(int power, int toughness, String description, SubTypeList extraSubTypes) { super("", description); this.cardType.add(CardType.CREATURE); this.power = new MageInt(power); this.toughness = new MageInt(toughness); if (extraSubTypes != null) { this.subtype.addAll(extraSubTypes); } }
public CardAttribute(Card card, Game game) { color = card.getColor(null).copy(); subtype = new SubTypeList(); subtype.addAll(card.getSubtype(game)); }
public MageObjectImpl(final MageObjectImpl object) { objectId = object.objectId; name = object.name; manaCost = object.manaCost.copy(); text = object.text; color = object.color.copy(); frameColor = object.frameColor.copy(); frameStyle = object.frameStyle; power = object.power.copy(); toughness = object.toughness.copy(); abilities = object.abilities.copy(); this.cardType.addAll(object.cardType); this.subtype.addAll(object.subtype); isAllCreatureTypes = object.isAllCreatureTypes; supertype.addAll(object.supertype); this.copy = object.copy; this.copyFrom = (object.copyFrom != null ? object.copyFrom.copy() : null); textParts = new ArrayList<>(); textParts.addAll(object.textParts); }
@Override public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { if (!permanent.getImprinted().isEmpty()) { List<UUID> imprinted = permanent.getImprinted(); if (imprinted == null || imprinted.isEmpty()) { return false; } Card card = game.getCard(imprinted.get(imprinted.size() - 1)); if (card != null && card.isCreature()) { switch (layer) { case TypeChangingEffects_4: if (sublayer == SubLayer.NA) { permanent.getSubtype(game).addAll(card.getSubtype(game)); } break; case PTChangingEffects_7: if (sublayer == SubLayer.SetPT_7b) { permanent.getPower().setValue(card.getPower().getValue()); permanent.getToughness().setValue(card.getToughness().getValue()); } } return true; } } } return false; }
@Override public boolean apply(Game game, Ability source) { Permanent equipment = game.getPermanent(source.getSourceId()); if (equipment != null && equipment.getAttachedTo() != null) { Permanent target = game.getPermanent(equipment.getAttachedTo()); if (target != null) { target.getSubtype(game).retainAll(SubType.getLandTypes(false)); target.getSubtype(game).addAll(setSubtypes); } } return true; }
if (landCard != null) { if (landTypes.isEmpty()) { landTypes.addAll(landCard.getSubtype(game)); } else { landTypes.removeIf(next -> !landCard.hasSubtype(next, game));
if (sublayer == SubLayer.NA) { perm.addCardTypes(token.getCardType()); perm.getSubtype(game).addAll(token.getSubtype(game));
@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 boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { 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; }
permanent.getSubtype(game).addAll(token.getSubtype(game));
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(); }
this.subtype.addAll(card.getSubtype(game)); this.isAllCreatureTypes = card.isAllCreatureTypes(); this.supertype.clear();
permanent.getSubtype(game).addAll(token.getSubtype(game));
land.getSubtype(game).addAll(landTypes); } else { landTypesToAdd.clear();
permanent.getSubtype(game).addAll(token.getSubtype(game));
if (loseAllAbilities) { permanent.getSubtype(game).retainAll(SubType.getLandTypes(false)); permanent.getSubtype(game).addAll(token.getSubtype(game)); } else { if (!token.getSubtype(game).isEmpty()) {
permanent.getSubtype(game).addAll(landTypes); break;