[CLB] Implemented Undercellar Sweep

This commit is contained in:
Evan Kranzler 2022-06-03 20:48:16 -04:00
parent e9044d69e9
commit b09ee6ced1
2 changed files with 66 additions and 0 deletions

View file

@ -0,0 +1,65 @@
package mage.cards.u;
import mage.abilities.Ability;
import mage.abilities.common.AttacksWithCreaturesTriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.TakeTheInitiativeEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.game.Game;
import mage.game.permanent.token.SoldierToken;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class UndercellarSweep extends CardImpl {
public UndercellarSweep(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{4}{W}");
// When Undercellar Sweep enters the battlefield, you take the initiative.
this.addAbility(new EntersBattlefieldTriggeredAbility(new TakeTheInitiativeEffect()));
// Whenever you attack, if you or a player you're attacking has the initiative, you create two 1/1 white Soldier creature token that are tapped and attacking.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new AttacksWithCreaturesTriggeredAbility(
new CreateTokenEffect(new SoldierToken(), 2, true, true), 1
), UndercellarSweepCondition.instance, "Whenever you attack, if you or a player you're attacking " +
"has the initiative, you create two 1/1 white Soldier creature token that are tapped and attacking."
));
}
private UndercellarSweep(final UndercellarSweep card) {
super(card);
}
@Override
public UndercellarSweep copy() {
return new UndercellarSweep(this);
}
}
enum UndercellarSweepCondition implements Condition {
instance;
@Override
public boolean apply(Game game, Ability source) {
if (game.getInitiativeId() == null) {
return false;
}
return source.isControlledBy(game.getInitiativeId())
|| game
.getCombat()
.getAttackers()
.stream()
.filter(uuid -> source.isControlledBy(game.getControllerId(uuid)))
.map(game.getCombat()::getDefenderId)
.anyMatch(game.getInitiativeId()::equals);
}
}

View file

@ -557,6 +557,7 @@ public final class CommanderLegendsBattleForBaldursGate extends ExpansionSet {
cards.add(new SetCardInfo("Uchuulon", 673, Rarity.RARE, mage.cards.u.Uchuulon.class));
cards.add(new SetCardInfo("Unbreakable Formation", 710, Rarity.RARE, mage.cards.u.UnbreakableFormation.class));
cards.add(new SetCardInfo("Undercellar Myconid", 259, Rarity.COMMON, mage.cards.u.UndercellarMyconid.class));
cards.add(new SetCardInfo("Undercellar Sweep", 47, Rarity.UNCOMMON, mage.cards.u.UndercellarSweep.class));
cards.add(new SetCardInfo("Underdark Explorer", 154, Rarity.COMMON, mage.cards.u.UnderdarkExplorer.class));
cards.add(new SetCardInfo("Undermountain Adventurer", 260, Rarity.RARE, mage.cards.u.UndermountainAdventurer.class));
cards.add(new SetCardInfo("Universal Solvent", 342, Rarity.COMMON, mage.cards.u.UniversalSolvent.class));