From 7db278bdf1e12b32c0de5751655be8e1937d82aa Mon Sep 17 00:00:00 2001 From: Sean Walsh <40175938+stwalsh4118@users.noreply.github.com> Date: Mon, 10 Apr 2023 19:36:21 -0500 Subject: [PATCH] Implement Brazen Cannonade, and new UntilEndOfNextCombatStep duration (#10047) --- .../src/mage/cards/b/BrazenCannonade.java | 75 +++++++++++++++++++ Mage.Sets/src/mage/sets/Jumpstart2022.java | 1 + .../effects/ContinuousEffectImpl.java | 13 ++++ .../effects/ContinuousEffectsList.java | 1 + .../main/java/mage/constants/Duration.java | 1 + 5 files changed, 91 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/b/BrazenCannonade.java diff --git a/Mage.Sets/src/mage/cards/b/BrazenCannonade.java b/Mage.Sets/src/mage/cards/b/BrazenCannonade.java new file mode 100644 index 0000000000..f466ea7fda --- /dev/null +++ b/Mage.Sets/src/mage/cards/b/BrazenCannonade.java @@ -0,0 +1,75 @@ +package mage.cards.b; + +import java.util.UUID; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfEndStepTriggeredAbility; +import mage.abilities.common.BeginningOfPostCombatMainTriggeredAbility; +import mage.abilities.condition.common.RaidCondition; +import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility; +import mage.abilities.effects.common.DamagePlayersEffect; +import mage.abilities.effects.common.DrawDiscardControllerEffect; +import mage.abilities.effects.common.ExileTopXMayPlayUntilEndOfTurnEffect; +import mage.abilities.hint.common.RaidHint; +import mage.constants.AbilityWord; +import mage.constants.TargetController; +import mage.filter.common.FilterAttackingCreature; +import mage.watchers.common.PlayerAttackedWatcher; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.DiesCreatureTriggeredAbility; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.RestrictionEffect; +import mage.abilities.effects.common.GainLifeEffect; +import mage.abilities.effects.common.LoseLifeOpponentsEffect; +import mage.abilities.effects.common.combat.AttacksIfAbleAllEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.StaticFilters; +import mage.filter.common.FilterAttackingCreature; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * + * @author @stwalsh4118 + */ +public final class BrazenCannonade extends CardImpl { + + private static final FilterAttackingCreature filter = new FilterAttackingCreature("an attacking creature"); + + public BrazenCannonade(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{R}"); + + + // Whenever an attacking creature you control dies, Brazen Cannonade deals 2 damage to each opponent. + Ability ability = new DiesCreatureTriggeredAbility(new DamagePlayersEffect(2, TargetController.OPPONENT), false, filter); + this.addAbility(ability); + + // Raid -- At the beginning of your postcombat main phase, if you attacked with a creature this turn, exile the top card of your library. Until end of combat on your next turn, you may play that card. + Ability raidAbility = new ConditionalInterveningIfTriggeredAbility(new BeginningOfPostCombatMainTriggeredAbility(new ExileTopXMayPlayUntilEndOfTurnEffect(1, false, Duration.UntilYourNextEndCombatStep), TargetController.YOU, false), + RaidCondition.instance, + "At the beginning of your postcombat main phase, " + + "if you attacked with a creature this turn, " + + "exile the top card of your library. " + + "Until end of combat on your next turn, " + + "you may play that card."); + raidAbility.setAbilityWord(AbilityWord.RAID); + raidAbility.addHint(RaidHint.instance); + this.addAbility(raidAbility, new PlayerAttackedWatcher()); + } + + private BrazenCannonade(final BrazenCannonade card) { + super(card); + } + + @Override + public BrazenCannonade copy() { + return new BrazenCannonade(this); + } +} diff --git a/Mage.Sets/src/mage/sets/Jumpstart2022.java b/Mage.Sets/src/mage/sets/Jumpstart2022.java index a8232718a2..cadc930b7e 100644 --- a/Mage.Sets/src/mage/sets/Jumpstart2022.java +++ b/Mage.Sets/src/mage/sets/Jumpstart2022.java @@ -102,6 +102,7 @@ public final class Jumpstart2022 extends ExpansionSet { cards.add(new SetCardInfo("Bone Picker", 383, Rarity.UNCOMMON, mage.cards.b.BonePicker.class)); cards.add(new SetCardInfo("Borderland Marauder", 505, Rarity.COMMON, mage.cards.b.BorderlandMarauder.class)); cards.add(new SetCardInfo("Bounding Wolf", 633, Rarity.COMMON, mage.cards.b.BoundingWolf.class)); + cards.add(new SetCardInfo("Brazen Cannonade", 31, Rarity.RARE, mage.cards.b.BrazenCannonade.class)); cards.add(new SetCardInfo("Brazen Freebooter", 506, Rarity.COMMON, mage.cards.b.BrazenFreebooter.class)); cards.add(new SetCardInfo("Brazen Wolves", 507, Rarity.COMMON, mage.cards.b.BrazenWolves.class)); cards.add(new SetCardInfo("Briarpack Alpha", 634, Rarity.UNCOMMON, mage.cards.b.BriarpackAlpha.class)); diff --git a/Mage/src/main/java/mage/abilities/effects/ContinuousEffectImpl.java b/Mage/src/main/java/mage/abilities/effects/ContinuousEffectImpl.java index 35b89c6758..bcbb57432b 100644 --- a/Mage/src/main/java/mage/abilities/effects/ContinuousEffectImpl.java +++ b/Mage/src/main/java/mage/abilities/effects/ContinuousEffectImpl.java @@ -228,6 +228,12 @@ public abstract class ContinuousEffectImpl extends EffectImpl implements Continu return EndStepCountWatcher.getCount(startingControllerId, game) > effectStartingEndStep; } + public boolean isYourNextEndCombatStep(Game game) { + return effectStartingOnTurn < game.getTurnNum() + && game.isActivePlayer(startingControllerId) + && game.getPhase().getType() == TurnPhase.POSTCOMBAT_MAIN; + } + @Override public boolean isInactive(Ability source, Game game) { // YOUR turn checks @@ -237,6 +243,7 @@ public abstract class ContinuousEffectImpl extends EffectImpl implements Continu case UntilYourNextTurn: case UntilEndOfYourNextTurn: case UntilYourNextEndStep: + case UntilYourNextEndCombatStep: break; default: return false; @@ -278,6 +285,12 @@ public abstract class ContinuousEffectImpl extends EffectImpl implements Continu if (player != null && player.isInGame()) { return this.isYourNextEndStep(game); } + break; + case UntilYourNextEndCombatStep: + if (player != null && player.isInGame()) { + return this.isYourNextEndCombatStep(game); + } + break; } return canDelete; diff --git a/Mage/src/main/java/mage/abilities/effects/ContinuousEffectsList.java b/Mage/src/main/java/mage/abilities/effects/ContinuousEffectsList.java index e6ed614520..6e48c6cda8 100644 --- a/Mage/src/main/java/mage/abilities/effects/ContinuousEffectsList.java +++ b/Mage/src/main/java/mage/abilities/effects/ContinuousEffectsList.java @@ -154,6 +154,7 @@ public class ContinuousEffectsList<T extends ContinuousEffect> extends ArrayList case Custom: case UntilYourNextTurn: case UntilEndOfYourNextTurn: + case UntilYourNextEndCombatStep: case UntilYourNextEndStep: // until your turn effects continue until real turn reached, their used it's own inactive method // 514.2 Second, the following actions happen simultaneously: all damage marked on permanents diff --git a/Mage/src/main/java/mage/constants/Duration.java b/Mage/src/main/java/mage/constants/Duration.java index 84bf0aa1fb..db4cd221b3 100644 --- a/Mage/src/main/java/mage/constants/Duration.java +++ b/Mage/src/main/java/mage/constants/Duration.java @@ -13,6 +13,7 @@ public enum Duration { EndOfTurn("until end of turn", true, true), UntilYourNextTurn("until your next turn", true, true), UntilYourNextEndStep("until your next end step", true, true), + UntilYourNextEndCombatStep("until your next end of combat step", false, true), UntilEndOfYourNextTurn("until the end of your next turn", true, true), UntilSourceLeavesBattlefield("until {this} leaves the battlefield", true, false), // supported for continuous layered effects EndOfCombat("until end of combat", true, true),