[BRO] Implemented Ashnod's Intervention

This commit is contained in:
Daniel Bomar 2022-11-08 16:43:03 -06:00
parent b57dccf10a
commit d8fa5eaeee
No known key found for this signature in database
GPG key ID: C86C8658F4023918
3 changed files with 79 additions and 0 deletions

View file

@ -0,0 +1,77 @@
package mage.cards.a;
import java.util.UUID;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.ReturnToHandSourceEffect;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author weirddan455
*/
public final class AshnodsIntervention extends CardImpl {
public AshnodsIntervention(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{B}");
// Until end of turn, target creature gets +2/+0 and gains "When this creature dies or is put into exile from the battlefield, return it to its owner's hand."
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
this.getSpellAbility().addEffect(new BoostTargetEffect(2, 0)
.setText("until end of turn, target creature gets +2/+0"));
this.getSpellAbility().addEffect(new GainAbilityTargetEffect(new AshnodsInterventionAbility())
.setText("and gains \"When this creature dies or is put into exile from the battlefield, return it to its owner's hand.\""));
}
private AshnodsIntervention(final AshnodsIntervention card) {
super(card);
}
@Override
public AshnodsIntervention copy() {
return new AshnodsIntervention(this);
}
}
class AshnodsInterventionAbility extends TriggeredAbilityImpl {
public AshnodsInterventionAbility() {
super(Zone.ALL, new ReturnToHandSourceEffect());
setLeavesTheBattlefieldTrigger(true);
}
private AshnodsInterventionAbility(final AshnodsInterventionAbility ability) {
super(ability);
}
@Override
public AshnodsInterventionAbility copy() {
return new AshnodsInterventionAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ZONE_CHANGE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
return zEvent.getTargetId().equals(sourceId) && zEvent.getFromZone() == Zone.BATTLEFIELD
&& (zEvent.getToZone() == Zone.GRAVEYARD || zEvent.getToZone() == Zone.EXILED);
}
@Override
public String getRule() {
return "When {this} dies or is put into exile from the battlefield, return it to its owner's hand";
}
}

View file

@ -48,6 +48,7 @@ public final class TheBrothersWar extends ExpansionSet {
cards.add(new SetCardInfo("Argothian Sprite", 168, Rarity.COMMON, mage.cards.a.ArgothianSprite.class));
cards.add(new SetCardInfo("Artificer's Dragon", 291, Rarity.RARE, mage.cards.a.ArtificersDragon.class));
cards.add(new SetCardInfo("Ashnod's Harvester", 117, Rarity.UNCOMMON, mage.cards.a.AshnodsHarvester.class));
cards.add(new SetCardInfo("Ashnod's Intervention", 85, Rarity.COMMON, mage.cards.a.AshnodsIntervention.class));
cards.add(new SetCardInfo("Ashnod, Flesh Mechanist", 84, Rarity.RARE, mage.cards.a.AshnodFleshMechanist.class));
cards.add(new SetCardInfo("Audacity", 169, Rarity.UNCOMMON, mage.cards.a.Audacity.class));
cards.add(new SetCardInfo("Autonomous Assembler", 34, Rarity.RARE, mage.cards.a.AutonomousAssembler.class));

View file

@ -78,6 +78,7 @@ public class ReturnToHandSourceEffect extends OneShotEffect {
}
break;
case GRAVEYARD:
case EXILED:
Card card = (Card) mageObject;
return !fromBattlefieldOnly && controller.moveCards(card, Zone.HAND, source, game);
case STACK: