[MKM] Implement Break Out (#12054)

This commit is contained in:
Matthew Wilson 2024-04-05 05:20:58 +03:00 committed by GitHub
parent 83aadadec4
commit f94d7d6b21
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 112 additions and 0 deletions

View file

@ -0,0 +1,111 @@
package mage.cards.b;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
import mage.abilities.keyword.HasteAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.PutCards;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetCard;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author DominionSpy
*/
public final class BreakOut extends CardImpl {
public BreakOut(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{R}{G}");
// Look at the top six cards of your library. You may reveal a creature card from among them.
// If that card has mana value 2 or less, you may put it onto the battlefield and it gains haste until end of turn.
// If you didn't put the revealed card onto the battlefield this way, put it into your hand.
// Put the rest on the bottom of your library in a random order.
this.getSpellAbility().addEffect(new BreakOutEffect());
}
private BreakOut(final BreakOut card) {
super(card);
}
@Override
public BreakOut copy() {
return new BreakOut(this);
}
}
class BreakOutEffect extends OneShotEffect {
BreakOutEffect() {
super(Outcome.Benefit);
staticText = "Look at the top six cards of your library. You may reveal a creature card from among them. " +
"If that card has mana value 2 or less, you may put it onto the battlefield and it gains haste until end of turn. " +
"If you didn't put the revealed card onto the battlefield this way, put it into your hand. " +
"Put the rest on the bottom of your library in a random order.";
}
private BreakOutEffect(final BreakOutEffect effect) {
super(effect);
}
@Override
public BreakOutEffect copy() {
return new BreakOutEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 6));
controller.lookAtCards(source, null, cards, game);
TargetCard target = new TargetCard(0, 1, Zone.LIBRARY, StaticFilters.FILTER_CARD_CREATURE);
target.withChooseHint("Reveal a creature card?");
if (!controller.chooseTarget(outcome, cards, target, source, game)) {
return PutCards.BOTTOM_RANDOM.moveCards(controller, cards, source, game);
}
Card pickedCard = game.getCard(target.getFirstTarget());
if (pickedCard != null) {
controller.revealCards(source, new CardsImpl(pickedCard), game);
cards.remove(pickedCard);
if (pickedCard.getManaValue() <= 2 &&
controller.chooseUse(Outcome.PutCardInPlay, "Put it onto the battlefield?", source, game) &&
controller.moveCards(pickedCard, Zone.BATTLEFIELD, source, game)) {
Permanent permanent = game.getPermanent(pickedCard.getId());
if (permanent != null) {
ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(permanent, game));
game.addEffect(effect, source);
}
} else {
controller.moveCards(pickedCard, Zone.HAND, source, game);
}
}
PutCards.BOTTOM_RANDOM.moveCards(controller, cards, source, game);
return true;
}
}

View file

@ -50,6 +50,7 @@ public final class MurdersAtKarlovManor extends ExpansionSet {
cards.add(new SetCardInfo("Blood Spatter Analysis", 413, Rarity.RARE, mage.cards.b.BloodSpatterAnalysis.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Blood Spatter Analysis", 413, Rarity.RARE, mage.cards.b.BloodSpatterAnalysis.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Bolrac-Clan Basher", 112, Rarity.UNCOMMON, mage.cards.b.BolracClanBasher.class)); cards.add(new SetCardInfo("Bolrac-Clan Basher", 112, Rarity.UNCOMMON, mage.cards.b.BolracClanBasher.class));
cards.add(new SetCardInfo("Branch of Vitu-Ghazi", 258, Rarity.UNCOMMON, mage.cards.b.BranchOfVituGhazi.class)); cards.add(new SetCardInfo("Branch of Vitu-Ghazi", 258, Rarity.UNCOMMON, mage.cards.b.BranchOfVituGhazi.class));
cards.add(new SetCardInfo("Break Out", 190, Rarity.UNCOMMON, mage.cards.b.BreakOut.class));
cards.add(new SetCardInfo("Bubble Smuggler", 41, Rarity.COMMON, mage.cards.b.BubbleSmuggler.class)); cards.add(new SetCardInfo("Bubble Smuggler", 41, Rarity.COMMON, mage.cards.b.BubbleSmuggler.class));
cards.add(new SetCardInfo("Burden of Proof", 42, Rarity.UNCOMMON, mage.cards.b.BurdenOfProof.class)); cards.add(new SetCardInfo("Burden of Proof", 42, Rarity.UNCOMMON, mage.cards.b.BurdenOfProof.class));
cards.add(new SetCardInfo("Buried in the Garden", 191, Rarity.UNCOMMON, mage.cards.b.BuriedInTheGarden.class)); cards.add(new SetCardInfo("Buried in the Garden", 191, Rarity.UNCOMMON, mage.cards.b.BuriedInTheGarden.class));