@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { List<Permanent> toDestroy = new ArrayList<>(); for (UUID attachmentId : controller.getAttachments()) { Permanent attachment = game.getPermanent(attachmentId); if (attachment != null && attachment.hasSubtype(SubType.CURSE, game)) { toDestroy.add(attachment); } } for (Permanent curse : toDestroy) { curse.destroy(source.getSourceId(), game, false); } return true; } return false; }
@Override public int calculate(Game game, Ability sourceAbility, Effect effect) { int count = 0; Permanent enchantment = game.getPermanent(sourceAbility.getSourceId()); if (enchantment != null && enchantment.getAttachedTo() != null) { Player player = game.getPlayer(enchantment.getAttachedTo()); if (player != null) { for (UUID attachmentId: player.getAttachments()) { Permanent attachment = game.getPermanent(attachmentId); if (attachment != null && attachment.hasSubtype(SubType.CURSE, game)) count++; } } } return count; }
this.canLoseLife = player.isCanLoseLife(); this.attachments.clear(); this.attachments.addAll(player.getAttachments());
if (player.getAttachments() != null) { attachments.addAll(player.getAttachments());
filter.add(new SubtypePredicate(SubType.CURSE)); for (UUID attachmentId: targetPlayer.getAttachments()) { Permanent attachment = game.getPermanent(attachmentId); if (attachment != null && attachment.hasSubtype(SubType.CURSE, game)) {