mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
[LTR] Implement Bewitching Leechcraft (#10615)
This commit is contained in:
parent
72ebe2b1f1
commit
189dff86ea
2 changed files with 107 additions and 0 deletions
106
Mage.Sets/src/mage/cards/b/BewitchingLeechcraft.java
Normal file
106
Mage.Sets/src/mage/cards/b/BewitchingLeechcraft.java
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
package mage.cards.b;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.TapEnchantedEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Susucr
|
||||
*/
|
||||
public final class BewitchingLeechcraft extends CardImpl {
|
||||
|
||||
public BewitchingLeechcraft(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}");
|
||||
|
||||
this.subtype.add(SubType.AURA);
|
||||
|
||||
// Enchant creature
|
||||
TargetPermanent auraTarget = new TargetCreaturePermanent();
|
||||
this.getSpellAbility().addTarget(auraTarget);
|
||||
this.getSpellAbility().addEffect(new AttachEffect(Outcome.Tap));
|
||||
this.addAbility(new EnchantAbility(auraTarget));
|
||||
|
||||
// When Bewitching Leechcraft enters the battlefield, tap enchanted creature.
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new TapEnchantedEffect()));
|
||||
|
||||
// Enchanted creature has "If this creature would untap during your untap step, remove a +1/+1 counter from it instead. If you do, untap it."
|
||||
this.addAbility(new SimpleStaticAbility(
|
||||
new GainAbilityAttachedEffect(
|
||||
new SimpleStaticAbility(new BewitchingLeechcraftReplacementEffect()),
|
||||
AttachmentType.AURA
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
private BewitchingLeechcraft(final BewitchingLeechcraft card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BewitchingLeechcraft copy() {
|
||||
return new BewitchingLeechcraft(this);
|
||||
}
|
||||
}
|
||||
|
||||
class BewitchingLeechcraftReplacementEffect extends ReplacementEffectImpl {
|
||||
|
||||
BewitchingLeechcraftReplacementEffect() {
|
||||
super(Duration.EndOfGame, Outcome.Detriment);
|
||||
staticText = "If this creature would untap during your untap step, " +
|
||||
"remove a +1/+1 counter from it instead. If you do, untap it.";
|
||||
}
|
||||
|
||||
private BewitchingLeechcraftReplacementEffect(final BewitchingLeechcraftReplacementEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BewitchingLeechcraftReplacementEffect copy() {
|
||||
return new BewitchingLeechcraftReplacementEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.UNTAP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Permanent permanentUntapping = game.getPermanent(source.getSourceId());
|
||||
if(!applies(event,source,game)){
|
||||
return false;
|
||||
}
|
||||
|
||||
// If we could not remove a counter, we are replacing the UNTAP event.
|
||||
// If we could remove a counter, we are not replacing the UNTAP, just adding to it.
|
||||
return !permanentUntapping.getCounters(game).removeCounter(CounterType.P1P1, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
return game.getTurnStepType() == PhaseStep.UNTAP
|
||||
&& event.getTargetId().equals(source.getSourceId());
|
||||
}
|
||||
}
|
||||
|
|
@ -31,6 +31,7 @@ public final class TheLordOfTheRingsTalesOfMiddleEarth extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Barad-dur", 253, Rarity.RARE, mage.cards.b.BaradDur.class));
|
||||
cards.add(new SetCardInfo("Barrow-Blade", 237, Rarity.UNCOMMON, mage.cards.b.BarrowBlade.class));
|
||||
cards.add(new SetCardInfo("Battle-Scarred Goblin", 115, Rarity.COMMON, mage.cards.b.BattleScarredGoblin.class));
|
||||
cards.add(new SetCardInfo("Bewitching Leechcraft", 41, Rarity.COMMON, mage.cards.b.BewitchingLeechcraft.class));
|
||||
cards.add(new SetCardInfo("Bilbo's Ring", 298, Rarity.RARE, mage.cards.b.BilbosRing.class));
|
||||
cards.add(new SetCardInfo("Bilbo, Retired Burglar", 196, Rarity.UNCOMMON, mage.cards.b.BilboRetiredBurglar.class));
|
||||
cards.add(new SetCardInfo("Bill Ferny, Bree Swindler", 42, Rarity.UNCOMMON, mage.cards.b.BillFernyBreeSwindler.class));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue