@Override public boolean apply(Game game, Ability source) { for (Iterator<MageObjectReference> it = affectedObjectList.iterator(); it.hasNext();) { Permanent permanent = it.next().getPermanent(game); if (permanent != null) { permanent.getSubtype(game).retainAll(SubType.getLandTypes(false)); } else { it.remove(); } } return true; } }
@Override public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) { if (!permanent.hasSubtype(subtype, game)) { permanent.getSubtype(game).add(subtype); } return true; }
@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; }
@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.BIRD, SubType.GIANT); } break; } return true; }
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; }
@Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanentEntering(source.getSourceId()); SubType subtype = (SubType) game.getState().getValue(source.getSourceId() + "_type"); if (permanent != null && subtype != null) { if (!permanent.getSubtype(game).contains(subtype)) { permanent.getSubtype(game).add(subtype); } 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; }
@Override public boolean apply(Game game, Ability source) { Permanent target = game.getPermanent(targetPointer.getFirst(game, source)); if (target != null) { if (!target.hasSubtype(addedSubType, game)) { target.getSubtype(game).add(addedSubType); } } else { if (duration == Duration.Custom) { discard(); } } return false; }
@Override public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { for (Permanent land : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) { switch (layer) { case AbilityAddingRemovingEffects_6: land.removeAllAbilities(source.getSourceId(), game); land.addAbility(new WhiteManaAbility(), source.getSourceId(), game); break; case TypeChangingEffects_4: land.getSubtype(game).clear(); land.getSubtype(game).add(SubType.PLAINS); break; } } return true; }
@Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); if (permanent != null) { permanent.setIsAllCreatureTypes(false); return permanent.getSubtype(game).retainAll(SubType.getLandTypes(false)); } return false; }
@Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { SubType subType = ChooseCreatureTypeEffect.getChosenCreatureType(permanent.getId(), game); if (subType != null && !permanent.hasSubtype(subType, game)) { permanent.getSubtype(game).add(subType); } } return true; }
@Override public boolean apply(Game game, Ability source) { for (Permanent perm : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { if (perm != null && !perm.hasSubtype(addedSubtype, game)) { perm.getSubtype(game).add(addedSubtype); } } return true; }
@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.hasSubtype(addedSubtype, game)) target.getSubtype(game).add(addedSubtype); } return true; }
@Override public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) { if (!permanent.hasSubtype(SubType.ILLUSION, game)) { permanent.getSubtype(game).add(SubType.ILLUSION); } // Add directly because the created permanent is only used to copy from, so there is no need to add the ability to e.g. TriggeredAbilities permanent.getAbilities().add(new BecomesTargetTriggeredAbility(new SacrificeSourceEffect())); //permanent.addAbility(new BecomesTargetTriggeredAbility(new SacrificeSourceEffect()), game); return true; }
@Override public boolean apply(Game game, Ability source) { SubType subType = ChooseCreatureTypeEffect.getChosenCreatureType(source.getSourceId(), game); if (subType != null) { List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game); for (Permanent permanent : permanents) { if (permanent != null && !permanent.hasSubtype(subType, game)) { permanent.getSubtype(game).add(subType); } } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game); for (Permanent permanent : permanents) { if (permanent != null) { SubTypeList subtype = permanent.getSubtype(game); if (subtype != null && (subtype.size() != 1 || !subtype.contains(SubType.SHADE))) { subtype.removeAll(SubType.getCreatureTypes(false)); subtype.add(SubType.SHADE); } } } return true; }
static public void becomeCreature(Permanent permanent, Game game) { if (permanent != null) { MageObject basicObject = permanent.getBasicMageObject(game); if (basicObject != null) { basicObject.getSubtype(null).remove(SubType.AURA); if (!basicObject.isCreature()) { basicObject.addCardType(CardType.CREATURE); } } permanent.getSubtype(null).remove(SubType.AURA); if (!permanent.isCreature()) { permanent.addCardType(CardType.CREATURE); } } } }
@Override public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { for (Permanent object: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) { switch (layer) { case AbilityAddingRemovingEffects_6: object.addAbility(new BecomesTargetTriggeredAbility(new SacrificeSourceEffect()), source.getSourceId(), game); break; case TypeChangingEffects_4: if (!object.hasSubtype(SubType.ILLUSION, game)) { object.getSubtype(game).add(SubType.ILLUSION); } break; } } return true; }
@Override public boolean apply(Game game, Ability source) { for (Permanent creature : game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), source.getSourceId(), game)) { int count = 0; List<UUID> attachments = creature.getAttachments(); for (UUID attachmentId : attachments) { Permanent attached = game.getPermanent(attachmentId); if (attached != null && attached.getSubtype(game).contains(SubType.AURA)) { count++; } } creature.damage(count * 2, source.getId(), game, false, true); } return true; } }
@Override public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) { switch (layer) { case AbilityAddingRemovingEffects_6: creature.addAbility(new DealsDamageToACreatureTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false, false, false), source.getSourceId(), game); break; case TypeChangingEffects_4: if (!creature.hasSubtype(SubType.VAMPIRE, game)) { creature.getSubtype(game).add(SubType.VAMPIRE); } break; } } return true; }