[ONE] Implement Compleat Devotion (#9987)

Co-authored-by: Daniel Eberhard <daniel.h.e@gmx.de>
This commit is contained in:
Merlingilb 2023-02-17 11:36:04 +01:00 committed by GitHub
parent 664414d300
commit c2d1c3751d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 71 additions and 0 deletions

View file

@ -0,0 +1,70 @@
package mage.cards.c;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.abilities.keyword.ToxicAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetControlledCreaturePermanent;
import java.util.UUID;
public class CompleatDevotion extends CardImpl {
public CompleatDevotion(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{W}");
//Target creature you control gets +2/+2 until end of turn. If that creature has toxic, draw a card.
this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent());
this.getSpellAbility().addEffect(new CompleatDevotionEffect());
this.getSpellAbility().addEffect(new BoostTargetEffect(2, 2, Duration.EndOfTurn)
.setText("Target creature you control gets +2/+2 until end of turn. If that creature has toxic, draw a card."));
}
private CompleatDevotion(final CompleatDevotion card) {
super(card);
}
@Override
public CompleatDevotion copy() {
return new CompleatDevotion(this);
}
}
class CompleatDevotionEffect extends OneShotEffect {
public CompleatDevotionEffect() {
super(Outcome.Benefit);
staticText = "";
}
public CompleatDevotionEffect(final CompleatDevotionEffect effect) {
super(effect);
}
@Override
public CompleatDevotionEffect copy() {
return new CompleatDevotionEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (permanent != null) {
if (permanent.getAbilities().stream().anyMatch(ability -> (ability instanceof ToxicAbility))) {
Player controller = game.getPlayer(permanent.getControllerId());
if (controller != null) {
controller.drawCards(1, source, game);
}
}
return true;
}
return false;
}
}

View file

@ -54,6 +54,7 @@ public final class PhyrexiaAllWillBeOne extends ExpansionSet {
cards.add(new SetCardInfo("Chimney Rabble", 126, Rarity.COMMON, mage.cards.c.ChimneyRabble.class));
cards.add(new SetCardInfo("Chittering Skitterling", 87, Rarity.UNCOMMON, mage.cards.c.ChitteringSkitterling.class));
cards.add(new SetCardInfo("Chrome Prowler", 45, Rarity.COMMON, mage.cards.c.ChromeProwler.class));
cards.add(new SetCardInfo("Compleat Devotion", 7, Rarity.COMMON, mage.cards.c.CompleatDevotion.class));
cards.add(new SetCardInfo("Copper Longlegs", 165, Rarity.COMMON, mage.cards.c.CopperLonglegs.class));
cards.add(new SetCardInfo("Copperline Gorge", 249, Rarity.RARE, mage.cards.c.CopperlineGorge.class));
cards.add(new SetCardInfo("Crawling Chorus", 8, Rarity.COMMON, mage.cards.c.CrawlingChorus.class));