updated Sorrow's Path to work with new blocking rules

This commit is contained in:
Evan Kranzler 2020-07-02 22:56:19 -04:00
parent e471fef399
commit f2cdf1740b

View file

@ -1,10 +1,6 @@
package mage.cards.s; package mage.cards.s;
import java.util.HashSet; import mage.MageObjectReference;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.BecomesTappedSourceTriggeredAbility; import mage.abilities.common.BecomesTappedSourceTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
@ -16,19 +12,22 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Zone; import mage.filter.StaticFilters;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterOpponentsCreaturePermanent; import mage.filter.common.FilterOpponentsCreaturePermanent;
import mage.filter.predicate.permanent.BlockingPredicate; import mage.filter.predicate.permanent.BlockingPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.combat.CombatGroup; import mage.game.combat.CombatGroup;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetCreaturePermanentSameController; import mage.target.common.TargetCreaturePermanentSameController;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
/** /**
*
* @author L_J * @author L_J
*/ */
public final class SorrowsPath extends CardImpl { public final class SorrowsPath extends CardImpl {
@ -43,17 +42,19 @@ public final class SorrowsPath extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.LAND}, ""); super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");
// {T}: Choose two target blocking creatures an opponent controls. If each of those creatures could block all creatures that the other is blocking, remove both of them from combat. Each one then blocks all creatures the other was blocking. // {T}: Choose two target blocking creatures an opponent controls. If each of those creatures could block all creatures that the other is blocking, remove both of them from combat. Each one then blocks all creatures the other was blocking.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SorrowsPathSwitchBlockersEffect(), new TapSourceCost()); Ability ability = new SimpleActivatedAbility(new SorrowsPathSwitchBlockersEffect(), new TapSourceCost());
ability.addTarget(new TargetCreaturePermanentSameController(2, 2, filter, false)); ability.addTarget(new TargetCreaturePermanentSameController(2, 2, filter, false));
this.addAbility(ability); this.addAbility(ability);
// Whenever Sorrow's Path becomes tapped, it deals 2 damage to you and each creature you control. // Whenever Sorrow's Path becomes tapped, it deals 2 damage to you and each creature you control.
Ability ability2 = new BecomesTappedSourceTriggeredAbility(new DamageControllerEffect(2)); Ability ability2 = new BecomesTappedSourceTriggeredAbility(new DamageControllerEffect(2));
ability2.addEffect(new DamageAllEffect(2, new FilterControlledCreaturePermanent()).setText("and each creature you control")); ability2.addEffect(new DamageAllEffect(
2, StaticFilters.FILTER_CONTROLLED_CREATURE
).setText("and each creature you control"));
this.addAbility(ability2); this.addAbility(ability2);
} }
public SorrowsPath(final SorrowsPath card) { private SorrowsPath(final SorrowsPath card) {
super(card); super(card);
} }
@ -66,12 +67,14 @@ public final class SorrowsPath extends CardImpl {
class SorrowsPathSwitchBlockersEffect extends OneShotEffect { class SorrowsPathSwitchBlockersEffect extends OneShotEffect {
public SorrowsPathSwitchBlockersEffect() { SorrowsPathSwitchBlockersEffect() {
super(Outcome.Detriment); super(Outcome.Detriment);
this.staticText = "Choose two target blocking creatures an opponent controls. If each of those creatures could block all creatures that the other is blocking, remove both of them from combat. Each one then blocks all creatures the other was blocking"; this.staticText = "Choose two target blocking creatures an opponent controls. " +
"If each of those creatures could block all creatures that the other is blocking, " +
"remove both of them from combat. Each one then blocks all creatures the other was blocking";
} }
public SorrowsPathSwitchBlockersEffect(final SorrowsPathSwitchBlockersEffect effect) { private SorrowsPathSwitchBlockersEffect(final SorrowsPathSwitchBlockersEffect effect) {
super(effect); super(effect);
} }
@ -119,6 +122,22 @@ class SorrowsPathSwitchBlockersEffect extends OneShotEffect {
// trigger whenever a creature blocks one of the attacking creatures will trigger again, though; those kinds of abilities trigger once for each creature that blocks. // trigger whenever a creature blocks one of the attacking creatures will trigger again, though; those kinds of abilities trigger once for each creature that blocks.
reassignBlocker(blocker1, attackers2, game); reassignBlocker(blocker1, attackers2, game);
reassignBlocker(blocker2, attackers1, game); reassignBlocker(blocker2, attackers1, game);
Set<MageObjectReference> morSet = new HashSet<>();
attackers1
.stream()
.map(permanent -> new MageObjectReference(permanent, game))
.forEach(morSet::add);
attackers2
.stream()
.map(permanent -> new MageObjectReference(permanent, game))
.forEach(morSet::add);
String key = UUID.randomUUID().toString();
game.getState().setValue("becameBlocked_" + key, morSet);
game.fireEvent(GameEvent.getEvent(
GameEvent.EventType.BATCH_BLOCK_NONCOMBAT,
source.getSourceId(), source.getSourceId(),
source.getControllerId(), key, 0)
);
return true; return true;
} }
} }