- Added Fatigue and Disappear.

This commit is contained in:
jeffwadsworth 2018-11-25 10:51:27 -06:00
parent 9c0162caad
commit ea4c202a40
3 changed files with 178 additions and 0 deletions

View file

@ -0,0 +1,87 @@
package mage.cards.d;
import java.util.UUID;
import mage.constants.SubType;
import mage.target.common.TargetCreaturePermanent;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.AttachEffect;
import mage.constants.Outcome;
import mage.target.TargetPermanent;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
*
* @author jeffwadsworth
*/
public final class Disappear extends CardImpl {
public Disappear(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}{U}");
this.subtype.add(SubType.AURA);
// Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// {U}: Return enchanted creature and Disappear to their owners' hands.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new DisappearEffect(), new ManaCostsImpl("{U}")));
}
public Disappear(final Disappear card) {
super(card);
}
@Override
public Disappear copy() {
return new Disappear(this);
}
}
class DisappearEffect extends OneShotEffect {
public DisappearEffect() {
super(Outcome.ReturnToHand);
staticText = "Return enchanted creature and {this} to their owners' hands";
}
public DisappearEffect(final DisappearEffect effect) {
super(effect);
}
@Override
public DisappearEffect copy() {
return new DisappearEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent aura = (Permanent) game.getPermanentOrLKIBattlefield(source.getSourceId());
Player controller = game.getPlayer(source.getControllerId());
if (controller != null
&& aura != null
&& aura.getAttachedTo() != null) {
Permanent enchantedCreature = game.getPermanent(aura.getAttachedTo());
controller.moveCards(aura, Zone.HAND, source, game);
if (enchantedCreature != null) {
controller.moveCards(enchantedCreature, Zone.HAND, source, game);
}
return true;
}
return false;
}
}

View file

@ -0,0 +1,36 @@
package mage.cards.f;
import java.util.UUID;
import mage.abilities.effects.common.SkipNextDrawStepTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.target.TargetPlayer;
/**
*
* @author jeffwadsworth
*/
public final class Fatigue extends CardImpl {
private static final String rule = "Target player skips his or her next draw step.";
public Fatigue(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{U}");
// Target player skips his or her next draw step.
this.getSpellAbility().addEffect(new SkipNextDrawStepTargetEffect().setText(rule));
this.getSpellAbility().addTarget(new TargetPlayer());
}
public Fatigue(final Fatigue card) {
super(card);
}
@Override
public Fatigue copy() {
return new Fatigue(this);
}
}

View file

@ -0,0 +1,55 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package mage.abilities.effects.common;
import mage.abilities.Ability;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.events.GameEvent;
/**
*
* @author jeffwadsworth
*/
public class SkipNextDrawStepTargetEffect extends ReplacementEffectImpl {
public SkipNextDrawStepTargetEffect() {
super(Duration.OneUse, Outcome.Detriment);
staticText = "Target player skips his or her next draw step";
}
public SkipNextDrawStepTargetEffect(final SkipNextDrawStepTargetEffect effect) {
super(effect);
}
@Override
public SkipNextDrawStepTargetEffect copy() {
return new SkipNextDrawStepTargetEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
return true;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DRAW_STEP;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return event.getPlayerId().equals(source.getFirstTarget());
}
}