1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-04-01 19:07:57 -09:00

[J22] Implement Pirated Copy

This commit is contained in:
theelk801 2023-04-25 08:28:39 -04:00
parent 2b7e48bcc1
commit 0bb56e99fd
2 changed files with 86 additions and 0 deletions
Mage.Sets/src/mage

View file

@ -0,0 +1,85 @@
package mage.cards.p;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.DealsDamageToAPlayerAllTriggeredAbility;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.effects.common.CopyPermanentEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SetTargetPointer;
import mage.constants.SubType;
import mage.filter.FilterPermanent;
import mage.filter.predicate.ObjectSourcePlayer;
import mage.filter.predicate.ObjectSourcePlayerPredicate;
import mage.filter.predicate.mageobject.AnotherPredicate;
import mage.game.Game;
import mage.util.CardUtil;
import mage.util.functions.CopyApplier;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class PiratedCopy extends CardImpl {
private static final FilterPermanent filter
= new FilterPermanent("this creature or another creature with the same name");
static {
filter.add(PiratedCopyPredicate.instance);
}
private static final CopyApplier applier = new CopyApplier() {
@Override
public boolean apply(Game game, MageObject blueprint, Ability source, UUID copyToObjectId) {
blueprint.addSubType(SubType.PIRATE);
blueprint.getAbilities().add(new DealsDamageToAPlayerAllTriggeredAbility(
new DrawCardSourceControllerEffect(1), filter,
true, SetTargetPointer.NONE, true
));
return true;
}
@Override
public String toString() {
return ", except it's a Pirate in addition to its other types and it has \"Whenever this creature " +
"or another creature with the same name deals combat damage to a player, you may draw a card.\"";
}
};
public PiratedCopy(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{U}");
this.subtype.add(SubType.SHAPESHIFTER);
this.subtype.add(SubType.PIRATE);
this.power = new MageInt(0);
this.toughness = new MageInt(0);
// You may have Pirated Copy enter the battlefield as a copy of any creature on the battlefield, except it's a Pirate in addition to its other types and it has "Whenever this creature or another creature with the same name deals combat damage to a player, you may draw a card."
this.addAbility(new EntersBattlefieldAbility(new CopyPermanentEffect(applier), true));
}
private PiratedCopy(final PiratedCopy card) {
super(card);
}
@Override
public PiratedCopy copy() {
return new PiratedCopy(this);
}
}
enum PiratedCopyPredicate implements ObjectSourcePlayerPredicate<MageObject> {
instance;
@Override
public boolean apply(ObjectSourcePlayer<MageObject> input, Game game) {
return !AnotherPredicate.instance.apply(input, game)
|| (input.getObject().isCreature(game) && CardUtil.haveSameNames(input.getObject(), input.getSource().getSourcePermanentOrLKI(game)));
}
}

View file

@ -548,6 +548,7 @@ public final class Jumpstart2022 extends ExpansionSet {
cards.add(new SetCardInfo("Pillardrop Rescuer", 226, Rarity.COMMON, mage.cards.p.PillardropRescuer.class));
cards.add(new SetCardInfo("Pious Wayfarer", 227, Rarity.COMMON, mage.cards.p.PiousWayfarer.class));
cards.add(new SetCardInfo("Piranha Marsh", 818, Rarity.COMMON, mage.cards.p.PiranhaMarsh.class));
cards.add(new SetCardInfo("Pirated Copy", 16, Rarity.MYTHIC, mage.cards.p.PiratedCopy.class));
cards.add(new SetCardInfo("Pit Keeper", 455, Rarity.COMMON, mage.cards.p.PitKeeper.class));
cards.add(new SetCardInfo("Plague Spitter", 456, Rarity.UNCOMMON, mage.cards.p.PlagueSpitter.class));
cards.add(new SetCardInfo("Plaguecrafter", 72, Rarity.UNCOMMON, mage.cards.p.Plaguecrafter.class));