[BOT] Implemented Ratchet, Field Medic / Ratcher, Rescue Racer

This commit is contained in:
Evan Kranzler 2022-10-13 20:02:38 -04:00
parent 3ac222270e
commit adfaa74fad
3 changed files with 178 additions and 0 deletions

View file

@ -0,0 +1,115 @@
package mage.cards.r;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.GainLifeControllerTriggeredAbility;
import mage.abilities.common.delayed.ReflexiveTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect;
import mage.abilities.keyword.LifelinkAbility;
import mage.abilities.keyword.MoreThanMeetsTheEyeAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.filter.FilterCard;
import mage.filter.common.FilterArtifactCard;
import mage.filter.predicate.Predicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCardInYourGraveyard;
import mage.watchers.common.PlayerGainedLifeWatcher;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class RatchetFieldMedic extends CardImpl {
public RatchetFieldMedic(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{2}{W}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.ROBOT);
this.power = new MageInt(2);
this.toughness = new MageInt(4);
this.secondSideCardClazz = mage.cards.r.RatchetRescueRacer.class;
// More Than Meets the Eye {1}{W}
this.addAbility(new MoreThanMeetsTheEyeAbility(this, "{1}{W}"));
// Lifelink
this.addAbility(LifelinkAbility.getInstance());
// Whenever you gain life, you may convert Ratchet. When you do, return target artifact card with mana value less than or equal to the amount of life you gained this turn from your graveyard to the battlefield tapped.
this.addAbility(new GainLifeControllerTriggeredAbility(
new RatchetFieldMedicEffect(), true
), new PlayerGainedLifeWatcher());
}
private RatchetFieldMedic(final RatchetFieldMedic card) {
super(card);
}
@Override
public RatchetFieldMedic copy() {
return new RatchetFieldMedic(this);
}
}
class RatchetFieldMedicEffect extends OneShotEffect {
private static final FilterCard filter = new FilterArtifactCard("artifact card with mana value " +
"less than or equal to the amount of life you gained this turn from your graveyard");
static {
filter.add(RatchetFieldMedicPredicate.instance);
}
RatchetFieldMedicEffect() {
super(Outcome.Benefit);
staticText = "convert {this}. When you do, return target artifact card with mana value less than or equal to the amount of life you gained this turn from your graveyard to the battlefield tapped";
}
private RatchetFieldMedicEffect(final RatchetFieldMedicEffect effect) {
super(effect);
}
@Override
public RatchetFieldMedicEffect copy() {
return new RatchetFieldMedicEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
// check not to transform twice the same side
if (permanent == null || !permanent.transform(source, game)) {
return false;
}
ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility(
new ReturnFromGraveyardToBattlefieldTargetEffect(true), false
);
ability.addTarget(new TargetCardInYourGraveyard(filter));
game.fireReflexiveTriggeredAbility(ability, source);
return true;
}
}
enum RatchetFieldMedicPredicate implements Predicate<Card> {
instance;
@Override
public boolean apply(Card input, Game game) {
return input
.getManaValue()
<= game
.getState()
.getWatcher(PlayerGainedLifeWatcher.class)
.getLifeGained(input.getOwnerId());
}
}

View file

@ -0,0 +1,61 @@
package mage.cards.r;
import mage.MageInt;
import mage.abilities.common.DiesCreatureTriggeredAbility;
import mage.abilities.effects.common.TransformSourceEffect;
import mage.abilities.keyword.LifelinkAbility;
import mage.abilities.keyword.LivingMetalAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledArtifactPermanent;
import mage.filter.predicate.permanent.TokenPredicate;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class RatchetRescueRacer extends CardImpl {
private static final FilterPermanent filter = new FilterControlledArtifactPermanent();
static {
filter.add(TokenPredicate.FALSE);
}
public RatchetRescueRacer(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.VEHICLE);
this.power = new MageInt(1);
this.toughness = new MageInt(4);
this.color.setWhite(true);
this.nightCard = true;
// Living metal
this.addAbility(new LivingMetalAbility());
// Lifelink
this.addAbility(LifelinkAbility.getInstance());
// Whenever one or more nontoken artifacts you control are put into a graveyard from the battlefield, convert Ratchet. This ability triggers only once each turn.
this.addAbility(new DiesCreatureTriggeredAbility(
new TransformSourceEffect().setText("convert {this}"), false, filter
).setTriggerPhrase("Whenever one or more nontoken artifacts you control " +
"are put into a graveyard from the battlefield, ").setTriggersOnce(true));
}
private RatchetRescueRacer(final RatchetRescueRacer card) {
super(card);
}
@Override
public RatchetRescueRacer copy() {
return new RatchetRescueRacer(this);
}
}

View file

@ -25,6 +25,8 @@ public final class Transformers extends ExpansionSet {
cards.add(new SetCardInfo("Goldbug, Scrappy Scout", 11, Rarity.MYTHIC, mage.cards.g.GoldbugScrappyScout.class));
cards.add(new SetCardInfo("Jetfire, Air Guardian", 3, Rarity.MYTHIC, mage.cards.j.JetfireAirGuardian.class));
cards.add(new SetCardInfo("Jetfire, Ingenious Scientist", 3, Rarity.MYTHIC, mage.cards.j.JetfireIngeniousScientist.class));
cards.add(new SetCardInfo("Ratchet, Field Medic", 2, Rarity.MYTHIC, mage.cards.r.RatchetFieldMedic.class));
cards.add(new SetCardInfo("Ratchet, Rescue Racer", 2, Rarity.MYTHIC, mage.cards.r.RatchetRescueRacer.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));
}