[BOT] Implemented Ultra Magnus, Tactician / Ultra Magnus, Armored Carrier

This commit is contained in:
Evan Kranzler 2022-10-01 21:25:00 -04:00
parent db3c03f3fa
commit 09095f4447
3 changed files with 199 additions and 0 deletions

View file

@ -0,0 +1,87 @@
package mage.cards.u;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.effects.common.TransformSourceEffect;
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
import mage.abilities.keyword.HasteAbility;
import mage.abilities.keyword.IndestructibleAbility;
import mage.abilities.keyword.LivingMetalAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.FilterPermanent;
import mage.filter.StaticFilters;
import mage.filter.common.FilterAttackingCreature;
import mage.game.Game;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class UltraMagnusArmoredCarrier extends CardImpl {
public UltraMagnusArmoredCarrier(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.VEHICLE);
this.power = new MageInt(4);
this.toughness = new MageInt(7);
this.color.setRed(true);
this.color.setGreen(true);
this.color.setWhite(true);
this.nightCard = true;
// Living metal
this.addAbility(new LivingMetalAbility());
// Haste
this.addAbility(HasteAbility.getInstance());
// Formidable -- Whenever Ultra Magnus attacks, attacking creatures you control gain indestructible until end of turn. If those creatures have total power 8 or greater, convert Ultra Magnus.
Ability ability = new AttacksTriggeredAbility(new GainAbilityControlledEffect(
IndestructibleAbility.getInstance(), Duration.EndOfTurn,
StaticFilters.FILTER_ATTACKING_CREATURES
));
ability.addEffect(new ConditionalOneShotEffect(
new TransformSourceEffect(), UltraMagnusArmoredCarrierCondition.instance,
"If those creatures have total power 8 or greater, convert {this}"
));
this.addAbility(ability.setAbilityWord(AbilityWord.FORMIDABLE));
}
private UltraMagnusArmoredCarrier(final UltraMagnusArmoredCarrier card) {
super(card);
}
@Override
public UltraMagnusArmoredCarrier copy() {
return new UltraMagnusArmoredCarrier(this);
}
}
enum UltraMagnusArmoredCarrierCondition implements Condition {
instance;
private static final FilterPermanent filter = new FilterAttackingCreature();
static {
filter.add(TargetController.YOU.getControllerPredicate());
}
@Override
public boolean apply(Game game, Ability source) {
return game
.getBattlefield()
.getActivePermanents(filter, source.getControllerId(), source, game)
.stream()
.map(MageObject::getPower)
.mapToInt(MageInt::getValue)
.sum() >= 8;
}
}

View file

@ -0,0 +1,110 @@
package mage.cards.u;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.TransformSourceEffect;
import mage.abilities.keyword.MoreThanMeetsTheEyeAbility;
import mage.abilities.keyword.WardAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.FilterCard;
import mage.filter.common.FilterArtifactCard;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetCard;
import mage.target.common.TargetCardInHand;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class UltraMagnusTactician extends CardImpl {
public UltraMagnusTactician(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{4}{R}{G}{W}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.ROBOT);
this.power = new MageInt(7);
this.toughness = new MageInt(7);
this.secondSideCardClazz = mage.cards.u.UltraMagnusArmoredCarrier.class;
// More Than Meets the Eye {2}{R}{G}{W}
this.addAbility(new MoreThanMeetsTheEyeAbility(this, "{2}{R}{G}{W}"));
// Ward {2}
this.addAbility(new WardAbility(new ManaCostsImpl<>("{2}")));
// Whenever Ultra Magnus attacks, you may put an artifact creature card from your hand onto the battlefield tapped and attacking. If you do, convert Ultra Magnus at end of combat.
this.addAbility(new AttacksTriggeredAbility(new UltraMagnusTacticianEffect()));
}
private UltraMagnusTactician(final UltraMagnusTactician card) {
super(card);
}
@Override
public UltraMagnusTactician copy() {
return new UltraMagnusTactician(this);
}
}
class UltraMagnusTacticianEffect extends OneShotEffect {
private static final FilterCard filter = new FilterArtifactCard("artifact creature card");
static {
filter.add(CardType.CREATURE.getPredicate());
}
UltraMagnusTacticianEffect() {
super(Outcome.PutCreatureInPlay);
staticText = "you may put an artifact creature card from your hand onto the battlefield " +
"tapped and attacking. If you do, convert {this} at end of combat";
}
private UltraMagnusTacticianEffect(final UltraMagnusTacticianEffect effect) {
super(effect);
}
@Override
public UltraMagnusTacticianEffect copy() {
return new UltraMagnusTacticianEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null || player.getHand().isEmpty()) {
return false;
}
TargetCard target = new TargetCardInHand(0, 1, filter);
player.choose(outcome, player.getHand(), target, game);
Card card = game.getCard(target.getFirstTarget());
if (card == null) {
return false;
}
player.moveCards(
card, Zone.BATTLEFIELD, source, game, true,
false, false, null
);
Permanent permanent = game.getPermanent(card.getId());
if (permanent == null) {
return true;
}
game.getCombat().addAttackingCreature(permanent.getId(), game);
game.addDelayedTriggeredAbility(new AtTheEndOfCombatDelayedTriggeredAbility(
new TransformSourceEffect().setText("convert {this}")
), source);
return true;
}
}

View file

@ -21,5 +21,7 @@ public final class Transformers extends ExpansionSet {
cards.add(new SetCardInfo("Goldbug, Humanity's Ally", 11, Rarity.MYTHIC, mage.cards.g.GoldbugHumanitysAlly.class));
cards.add(new SetCardInfo("Goldbug, Scrappy Scout", 11, Rarity.MYTHIC, mage.cards.g.GoldbugScrappyScout.class));
cards.add(new SetCardInfo("Ultra Magnus, Armored Carrier", 15, Rarity.MYTHIC, mage.cards.u.UltraMagnusArmoredCarrier.class));
cards.add(new SetCardInfo("Ultra Magnus, Tactician", 15, Rarity.MYTHIC, mage.cards.u.UltraMagnusTactician.class));
}
}