@Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { // 112.10 while (permanent.getAbilities().remove(ability)) { } } return true; } }
@Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); if (permanent != null) { if (ability instanceof MageSingleton) { while (permanent.getAbilities().contains(ability)) { permanent.getAbilities().remove(ability); } } else { for (Iterator<Ability> iter = permanent.getAbilities().iterator(); iter.hasNext();) { Ability ab = iter.next(); if (ab.getClass().equals(ability.getClass())) { iter.remove(); } } } } return true; }
@Override public boolean apply(Game game, Ability source) { Permanent permanent = affectedObjectList.get(0).getPermanent(game); if (permanent != null) { Ability abilityToRemove = null; for (Ability ability : permanent.getAbilities()) { if (ability instanceof EnchantAbility) { abilityToRemove = ability; } } if (abilityToRemove != null) { permanent.getAbilities().remove(abilityToRemove); } permanent.addAbility(newAbility, source.getSourceId(), game); return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Permanent permanent = affectedObjectList.get(0).getPermanent(game); if (permanent != null) { Ability abilityToRemove = null; for (Ability ability : permanent.getAbilities()) { if (ability instanceof EnchantAbility) { abilityToRemove = ability; } } if (abilityToRemove != null) { permanent.getAbilities().remove(abilityToRemove); } permanent.addAbility(newAbility, source.getSourceId(), game); return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Set<UUID> opponents = game.getOpponents(source.getControllerId()); for (Permanent perm : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) { if (opponents.contains(perm.getControllerId())) { perm.getAbilities().remove(InfectAbility.getInstance()); } } return true; }
@Override public boolean apply(Game game, Ability source) { Permanent equipment = game.getPermanent(source.getSourceId()); if (equipment != null && equipment.getAttachedTo() != null) { Permanent creature = game.getPermanent(equipment.getAttachedTo()); if (creature != null) { while (creature.getAbilities().contains(ability)) { if (!creature.getAbilities().remove(ability)) { // Something went wrong - ability has an other id? logger.warn("ability" + ability.getRule() + "couldn't be removed."); } } } } return true; }
@Override public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { if (permanent != null) { while (permanent.getAbilities().remove(ability)) { // repeat as long as ability can be removed } } } return true; } return false; }