@Override public AddCardTypeSourceEffect copy() { return new AddCardTypeSourceEffect(this); }
@Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null && affectedObjectList.contains(new MageObjectReference(permanent, game))) { for (CardType cardType : addedCardTypes) { if (!permanent.getCardType().contains(cardType)) { permanent.addCardType(cardType); } } return true; } else if (this.getDuration() == Duration.Custom) { this.discard(); } return false; }
@Override public String getText(Mode mode) { if (staticText != null && !staticText.isEmpty()) { return staticText; } StringBuilder sb = new StringBuilder(); sb.append("{this} becomes "); boolean article = false; for (CardType cardType : addedCardTypes) { if (!article) { if (cardType.toString().startsWith("A") || cardType.toString().startsWith("E")) { sb.append("an "); } else { sb.append("a "); } article = true; } sb.append(cardType.toString().toLowerCase(Locale.ENGLISH)).append(" "); } sb.append(" in addition to its other types ").append(this.getDuration().toString()); return sb.toString(); } }
public CrewAbility(int value) { super(Zone.BATTLEFIELD, new AddCardTypeSourceEffect(Duration.EndOfTurn, CardType.ARTIFACT), new CrewCost(value)); this.addEffect(new AddCardTypeSourceEffect(Duration.EndOfTurn, CardType.ARTIFACT, CardType.CREATURE)); this.value = value; }
public FleetwheelCruiser(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{4}"); this.subtype.add(SubType.VEHICLE); this.power = new MageInt(5); this.toughness = new MageInt(3); // Trample this.addAbility(TrampleAbility.getInstance()); // Haste this.addAbility(HasteAbility.getInstance()); // When Fleetwheel Cruiser enters the battlefield, it becomes an artifact creature until the end of turn. this.addAbility(new EntersBattlefieldTriggeredAbility( new AddCardTypeSourceEffect(Duration.EndOfTurn, CardType.ARTIFACT, CardType.CREATURE))); // Crew 2 this.addAbility(new CrewAbility(2)); }
@Override public boolean apply(Game game, Ability source) { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); Permanent copyFromPermanent = game.getPermanent(getTargetPointer().getFirst(game, source)); if (sourcePermanent != null && copyFromPermanent != null) { game.copyPermanent(Duration.EndOfTurn, copyFromPermanent, sourcePermanent.getId(), source, new EmptyApplyToPermanent()); game.addEffect(new AddCardTypeSourceEffect(Duration.EndOfTurn, CardType.ARTIFACT), source); return true; } return false; } }
public HeartOfKiran(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}"); addSuperType(SuperType.LEGENDARY); this.subtype.add(SubType.VEHICLE); this.power = new MageInt(4); this.toughness = new MageInt(4); // Flying this.addAbility(FlyingAbility.getInstance()); // Vigilance this.addAbility(VigilanceAbility.getInstance()); // Crew 3 this.addAbility(new CrewAbility(3)); // You may remove a loyalty counter from a planeswalker you control rather than pay Heart of Kiran's crew cost. Cost cost = new HeartOfKiranAlternateCrewCost(CounterType.LOYALTY, 1); Effect effect = new AddCardTypeSourceEffect(Duration.EndOfTurn, CardType.CREATURE); effect.setText("You may remove a loyalty counter from a planeswalker you control rather than pay {this}'s crew cost"); this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, cost)); }