diff --git a/Mage/src/main/java/mage/abilities/effects/common/ruleModifying/CombatDamageByToughnessTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ruleModifying/CombatDamageByToughnessTargetEffect.java index 7d7bc8de8cb..36da6ea92d2 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ruleModifying/CombatDamageByToughnessTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ruleModifying/CombatDamageByToughnessTargetEffect.java @@ -35,7 +35,7 @@ public class CombatDamageByToughnessTargetEffect extends ContinuousEffectImpl { public boolean apply(Game game, Ability source) { Set set = targetPointer.getTargets(game, source).stream() .map(game::getPermanent) - .filter(Objects::isNull) + .filter(Objects::nonNull) .collect(Collectors.toSet()); FilterCreaturePermanent filter = new FilterCreaturePermanent(); diff --git a/Mage/src/main/java/mage/abilities/keyword/BackupAbility.java b/Mage/src/main/java/mage/abilities/keyword/BackupAbility.java index 3a22b6e58a2..d88691e9247 100644 --- a/Mage/src/main/java/mage/abilities/keyword/BackupAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/BackupAbility.java @@ -18,6 +18,25 @@ import java.util.ArrayList; import java.util.List; /** + * 702.165. Backup + *

+ * 702.165a Backup is a triggered ability. “Backup N” means “When this creature enters the battlefield, + * put N +1/+1 counters on target creature. If that’s another creature, it also gains the non-backup + * abilities of this creature printed below this one until end of turn.” Cards with backup have one or more + * abilities printed after the backup ability. (Some cards with backup also have abilities printed before + * the backup ability.) + *

+ * 702.165b If a permanent enters the battlefield as a copy of a permanent with a backup ability or a token + * is created that is a copy of that permanent, the order of abilities printed on it is maintained. + *

+ * 702.165c Only abilities printed on the object with backup are granted by its backup ability. Any abilities + * gained by a permanent, whether due to a copy effect, an effect that grants an ability to a permanent, or an + * effect that creates a token with certain abilities, are not granted by a backup ability. + *

+ * 702.165d The abilities that a backup ability grants are determined as the ability is put on the stack. + * They won’t change if the permanent with backup loses any abilities after the ability is put on the stack + * but before it resolves. + * * @author TheElk801 */ public class BackupAbility extends EntersBattlefieldTriggeredAbility { @@ -65,13 +84,23 @@ public class BackupAbility extends EntersBattlefieldTriggeredAbility { addAbility(ability, null, dontAddToCard); } + /** + * + * @param ability + * @param watcher + * @param dontAddToCard use it on multiple instances of backups (example: Conclave Sledge-Captain) + */ public void addAbility(Ability ability, Watcher watcher, boolean dontAddToCard) { if (watcher != null) { ability.addWatcher(watcher); } + + // parent card must have only 1 instance of ability if (!dontAddToCard) { card.addAbility(ability); } + + // target permanent can have multiple instances of ability abilitiesToAdd.add(ability); CardUtil.castStream(this.getEffects().stream(), BackupEffect.class) .forEach(backupEffect -> backupEffect.addAbility(ability));