[MOM] Implement Enduring Bondwarden

This commit is contained in:
theelk801 2023-04-05 09:30:17 -04:00
parent 2ca6b535b3
commit f409a72221
6 changed files with 104 additions and 111 deletions

View file

@ -0,0 +1,47 @@
package mage.cards.e;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesSourceTriggeredAbility;
import mage.abilities.effects.common.PutSourceCountersOnTargetEffect;
import mage.abilities.keyword.BackupAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.target.common.TargetControlledCreaturePermanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class EnduringBondwarden extends CardImpl {
public EnduringBondwarden(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.SCOUT);
this.power = new MageInt(0);
this.toughness = new MageInt(1);
// Backup 1
BackupAbility backupAbility = new BackupAbility(this, 1);
this.addAbility(backupAbility);
// When this creature dies, put its counters on target creature you control.
Ability ability = new DiesSourceTriggeredAbility(new PutSourceCountersOnTargetEffect()).setTriggerPhrase("When this creature dies, ");
ability.addTarget(new TargetControlledCreaturePermanent());
backupAbility.addAbility(ability);
}
private EnduringBondwarden(final EnduringBondwarden card) {
super(card);
}
@Override
public EnduringBondwarden copy() {
return new EnduringBondwarden(this);
}
}

View file

@ -3,15 +3,12 @@ package mage.cards.p;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesSourceTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.PutSourceCountersOnTargetEffect;
import mage.abilities.keyword.TrainingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetControlledCreaturePermanent;
import java.util.UUID;
@ -33,7 +30,7 @@ public final class ParishBladeTrainee extends CardImpl {
this.addAbility(new TrainingAbility());
// When Parish-Blade Trainee dies, put its counters on target creature you control.
Ability ability = new DiesSourceTriggeredAbility(new ParishBladeTraineeEffect());
Ability ability = new DiesSourceTriggeredAbility(new PutSourceCountersOnTargetEffect());
ability.addTarget(new TargetControlledCreaturePermanent());
this.addAbility(ability);
}
@ -47,35 +44,3 @@ public final class ParishBladeTrainee extends CardImpl {
return new ParishBladeTrainee(this);
}
}
class ParishBladeTraineeEffect extends OneShotEffect {
ParishBladeTraineeEffect() {
super(Outcome.Benefit);
staticText = "put its counters on target creature you control";
}
private ParishBladeTraineeEffect(final ParishBladeTraineeEffect effect) {
super(effect);
}
@Override
public ParishBladeTraineeEffect copy() {
return new ParishBladeTraineeEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent sourcePermanent = (Permanent) getValue("permanentLeftBattlefield");
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (sourcePermanent == null || permanent == null) {
return false;
}
sourcePermanent
.getCounters(game)
.values()
.stream()
.forEach(counter -> permanent.addCounters(counter, source.getControllerId(), source, game));
return true;
}
}

View file

@ -4,17 +4,14 @@ import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesSourceTriggeredAbility;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.PutSourceCountersOnTargetEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.DeathtouchAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetControlledCreaturePermanent;
import java.util.UUID;
@ -42,7 +39,7 @@ public final class SpitefulSquad extends CardImpl {
));
// When Spiteful Squad dies, put its counters on target creature you control.
Ability ability = new DiesSourceTriggeredAbility(new SpitefulSquadEffect());
Ability ability = new DiesSourceTriggeredAbility(new PutSourceCountersOnTargetEffect());
ability.addTarget(new TargetControlledCreaturePermanent());
this.addAbility(ability);
}
@ -56,35 +53,3 @@ public final class SpitefulSquad extends CardImpl {
return new SpitefulSquad(this);
}
}
class SpitefulSquadEffect extends OneShotEffect {
SpitefulSquadEffect() {
super(Outcome.Benefit);
staticText = "put its counters on target creature you control";
}
private SpitefulSquadEffect(final SpitefulSquadEffect effect) {
super(effect);
}
@Override
public SpitefulSquadEffect copy() {
return new SpitefulSquadEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent sourcePermanent = (Permanent) getValue("permanentLeftBattlefield");
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (sourcePermanent == null || permanent == null) {
return false;
}
sourcePermanent
.getCounters(game)
.values()
.stream()
.forEach(counter -> permanent.addCounters(counter, source.getControllerId(), source, game));
return true;
}
}

View file

@ -4,16 +4,13 @@ import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesSourceTriggeredAbility;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.PutSourceCountersOnTargetEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetControlledCreaturePermanent;
import java.util.UUID;
@ -38,7 +35,7 @@ public final class StarPupil extends CardImpl {
));
// When Star Pupil dies, put its counters on target creature you control.
Ability ability = new DiesSourceTriggeredAbility(new StarPupilEffect());
Ability ability = new DiesSourceTriggeredAbility(new PutSourceCountersOnTargetEffect());
ability.addTarget(new TargetControlledCreaturePermanent());
this.addAbility(ability);
}
@ -52,35 +49,3 @@ public final class StarPupil extends CardImpl {
return new StarPupil(this);
}
}
class StarPupilEffect extends OneShotEffect {
StarPupilEffect() {
super(Outcome.Benefit);
staticText = "put its counters on target creature you control";
}
private StarPupilEffect(final StarPupilEffect effect) {
super(effect);
}
@Override
public StarPupilEffect copy() {
return new StarPupilEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent sourcePermanent = (Permanent) getValue("permanentLeftBattlefield");
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (sourcePermanent == null || permanent == null) {
return false;
}
sourcePermanent
.getCounters(game)
.values()
.stream()
.forEach(counter -> permanent.addCounters(counter, source.getControllerId(), source, game));
return true;
}
}

View file

@ -54,6 +54,7 @@ public final class MarchOfTheMachine extends ExpansionSet {
cards.add(new SetCardInfo("Dusk Legion Duelist", 11, Rarity.RARE, mage.cards.d.DuskLegionDuelist.class));
cards.add(new SetCardInfo("Elspeth's Smite", 13, Rarity.UNCOMMON, mage.cards.e.ElspethsSmite.class));
cards.add(new SetCardInfo("Elvish Vatkeeper", 223, Rarity.UNCOMMON, mage.cards.e.ElvishVatkeeper.class));
cards.add(new SetCardInfo("Enduring Bondwarden", 14, Rarity.COMMON, mage.cards.e.EnduringBondwarden.class));
cards.add(new SetCardInfo("Errant and Giada", 224, Rarity.RARE, mage.cards.e.ErrantAndGiada.class));
cards.add(new SetCardInfo("Essence of Orthodoxy", 323, Rarity.RARE, mage.cards.e.EssenceOfOrthodoxy.class));
cards.add(new SetCardInfo("Faerie Mastermind", 58, Rarity.RARE, mage.cards.f.FaerieMastermind.class));

View file

@ -0,0 +1,50 @@
package mage.abilities.effects.common;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
* @author TheElk801
*/
public class PutSourceCountersOnTargetEffect extends OneShotEffect {
public PutSourceCountersOnTargetEffect() {
super(Outcome.Benefit);
}
private PutSourceCountersOnTargetEffect(final PutSourceCountersOnTargetEffect effect) {
super(effect);
}
@Override
public PutSourceCountersOnTargetEffect copy() {
return new PutSourceCountersOnTargetEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent sourcePermanent = (Permanent) getValue("permanentLeftBattlefield");
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (sourcePermanent == null || permanent == null) {
return false;
}
sourcePermanent
.getCounters(game)
.values()
.stream()
.forEach(counter -> permanent.addCounters(counter, source.getControllerId(), source, game));
return true;
}
@Override
public String getText(Mode mode) {
if (staticText != null && !staticText.isEmpty()) {
return staticText;
}
return "put its counters on target " + mode.getTargets().get(0).getTargetName();
}
}