Implement Brazen Cannonade, and new UntilEndOfNextCombatStep duration (#10047)

This commit is contained in:
Sean Walsh 2023-04-10 19:36:21 -05:00 committed by GitHub
parent f1fdfc2c70
commit 7db278bdf1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 91 additions and 0 deletions

View file

@ -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);
}
}

View file

@ -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));

View file

@ -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;

View file

@ -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

View file

@ -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),