@Override public Boolean apply(Game game, MageObject mageObject) { if (!mageObject.getCardType().contains(cardType)) { mageObject.getCardType().add(cardType); } return true; }
@Override public boolean apply(Game game, Ability source, UUID manaProducer, Cost costToPay) { if (super.apply(game, source)) { MageObject object = game.getObject(source.getSourceId()); if (object.hasSubtype("Dragon", game) && object.getCardType().contains(CardType.CREATURE)) { return true; } } return false; }
@Override public boolean applies(GameEvent event, Ability source, Game game) { if ((event.getType() == GameEvent.EventType.CAST_SPELL) && event.getPlayerId() == source.getControllerId()) { MageObject spellObject = game.getObject(event.getSourceId()); if (spellObject != null && spellObject.getCardType().contains(CardType.CREATURE) && spellObject.getCardType().contains(CardType.ARTIFACT)) { return true; } } return false; }
@Override public Token apply(Card source) { if (target == null) { throw new IllegalArgumentException("Target can't be null"); } // A copy contains only the attributes of the basic card or basic Token that's the base of the // permanent // else gained abililies would be copied too. MageObject sourceObj = source; if (source instanceof PermanentToken) { sourceObj = ((PermanentToken) source).getToken(); // to show the source image, the original values have to be used target.setOriginalExpansionSetCode(((Token) sourceObj).getOriginalExpansionSetCode()); target.setOriginalCardNumber(((Token) sourceObj).getOriginalCardNumber()); target.setCopySourceCard(((PermanentToken) source).getToken().getCopySourceCard()); } else if (source instanceof PermanentCard) { if (((PermanentCard) source).isMorphed() || ((PermanentCard) source).isManifested()) { MorphAbility.setPermanentToFaceDownCreature(target); return target; } else { if (((PermanentCard) source).isTransformed() && source.getSecondCardFace() != null) { sourceObj = ((PermanentCard) source).getSecondCardFace(); } else { sourceObj = ((PermanentCard) source).getCard(); } target.setOriginalExpansionSetCode(source.getExpansionSetCode()); target.setOriginalCardNumber(source.getCardNumber()); target.setCopySourceCard((Card) sourceObj); } } else { target.setOriginalExpansionSetCode(source.getExpansionSetCode()); target.setOriginalCardNumber(source.getCardNumber()); if (source instanceof Card) { target.setCopySourceCard(source); } } target.setName(sourceObj.getName()); target.getColor(null).setColor(sourceObj.getColor(null)); target.getManaCost().clear(); target.getManaCost().add(sourceObj.getManaCost()); target.getCardType().clear(); for (CardType type : sourceObj.getCardType()) { target.getCardType().add(type); } target.getSubtype().clear(); for (String type : sourceObj.getSubtype()) { target.getSubtype().add(type); } target.getSupertype().clear(); for (String type : sourceObj.getSupertype()) { target.getSupertype().add(type); } target.getAbilities().clear(); for (Ability ability0 : sourceObj.getAbilities()) { Ability ability = ability0.copy(); ability.newId(); ability.setSourceId(target.getId()); target.addAbility(ability); } target.getPower().modifyBaseValue(sourceObj.getPower().getBaseValueModified()); target.getToughness().modifyBaseValue(sourceObj.getToughness().getBaseValueModified()); return target; }
@Override public boolean apply(MageObject input, Game game) { return input.getCardType().contains(cardType); }