This commit is contained in:
jeffwadsworth 2020-01-17 14:39:00 -06:00
parent 1ac9502748
commit 70c81bb1f9

View file

@ -29,10 +29,13 @@ public final class MandateOfPeace extends CardImpl {
public MandateOfPeace(UUID ownerId, CardSetInfo setInfo) { public MandateOfPeace(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{W}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{W}");
// Cast this spell only during combat. // Cast this spell only during combat.
this.addAbility(new CastOnlyDuringPhaseStepSourceAbility(TurnPhase.COMBAT)); this.addAbility(new CastOnlyDuringPhaseStepSourceAbility(TurnPhase.COMBAT));
// Your opponents can't cast spells this turn. // Your opponents can't cast spells this turn.
this.getSpellAbility().addEffect(new MandateOfPeaceOpponentsCantCastSpellsEffect()); this.getSpellAbility().addEffect(new MandateOfPeaceOpponentsCantCastSpellsEffect());
// End the combat phase. // End the combat phase.
this.getSpellAbility().addEffect(new MandateOfPeaceEndCombatEffect()); this.getSpellAbility().addEffect(new MandateOfPeaceEndCombatEffect());
} }
@ -93,7 +96,9 @@ class MandateOfPeaceEndCombatEffect extends OneShotEffect {
public MandateOfPeaceEndCombatEffect() { public MandateOfPeaceEndCombatEffect() {
super(Outcome.Benefit); super(Outcome.Benefit);
this.staticText = "End the combat phase. <i>(Remove all attackers and blockers from combat. Exile all spells and abilities from the stack, including this spell.)</i>"; this.staticText = "End the combat phase. <i>(Remove all attackers "
+ "and blockers from combat. Exile all spells and abilities "
+ "from the stack, including this spell.)</i>";
} }
public MandateOfPeaceEndCombatEffect(OneShotEffect effect) { public MandateOfPeaceEndCombatEffect(OneShotEffect effect) {
@ -109,16 +114,16 @@ class MandateOfPeaceEndCombatEffect extends OneShotEffect {
.map(id -> game.getPermanent(id)) .map(id -> game.getPermanent(id))
.filter(e -> e != null) .filter(e -> e != null)
.forEach(permanent -> permanent.removeFromCombat(game)); .forEach(permanent -> permanent.removeFromCombat(game));
combat.endCombat(game);
if (!game.getStack().isEmpty()) {
game.getStack().stream() game.getStack().stream()
.filter(stackObject -> stackObject instanceof Spell) .filter(stackObject -> stackObject instanceof Spell)
.forEach(stackObject -> ((Spell) stackObject).moveToExile(null, "", null, game)); .forEach(stackObject -> ((Spell) stackObject).moveToExile(null, "", null, game));
game.getStack().stream() game.getStack().stream()
.filter(stackObject -> stackObject instanceof Ability) .filter(stackObject -> stackObject instanceof Ability)
.forEach(stackObject -> game.getStack().counter(stackObject.getId(), source.getSourceId(), game)); .forEach(stackObject -> game.getStack().remove(stackObject, game));
}
combat.endCombat(game);
return true; return true;
} }