mirror of
https://github.com/correl/mage.git
synced 2025-01-13 11:01:58 +00:00
Implemented Apathy
This commit is contained in:
parent
517e92ec71
commit
7abbddd085
2 changed files with 94 additions and 0 deletions
93
Mage.Sets/src/mage/cards/a/Apathy.java
Normal file
93
Mage.Sets/src/mage/cards/a/Apathy.java
Normal file
|
@ -0,0 +1,93 @@
|
|||
package mage.cards.a;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.DontUntapInControllersUntapStepEnchantedEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.TargetController;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class Apathy extends CardImpl {
|
||||
|
||||
public Apathy(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{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);
|
||||
|
||||
// Enchanted creature doesn't untap during its controller's untap step.
|
||||
this.addAbility(new SimpleStaticAbility(new DontUntapInControllersUntapStepEnchantedEffect()));
|
||||
|
||||
// At the beginning of the upkeep of enchanted creature’s controller, that player may discard a card at random. If the player does, untap that creature.
|
||||
this.addAbility(new BeginningOfUpkeepTriggeredAbility(
|
||||
new ApathyEffect(), TargetController.CONTROLLER_ATTACHED_TO, false
|
||||
));
|
||||
}
|
||||
|
||||
private Apathy(final Apathy card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Apathy copy() {
|
||||
return new Apathy(this);
|
||||
}
|
||||
}
|
||||
|
||||
class ApathyEffect extends OneShotEffect {
|
||||
|
||||
ApathyEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "that player may discard a card at random. If the player does, untap that creature";
|
||||
}
|
||||
|
||||
private ApathyEffect(final ApathyEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApathyEffect copy() {
|
||||
return new ApathyEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(game.getActivePlayerId());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
if (!player.chooseUse(outcome, "Discard a card at random to untap enchanted creature?", source, game)
|
||||
|| player.discardOne(true, source, game) == null) {
|
||||
return false;
|
||||
}
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent == null) {
|
||||
return false;
|
||||
}
|
||||
permanent = game.getPermanent(permanent.getAttachedTo());
|
||||
return permanent != null && permanent.untap(game);
|
||||
}
|
||||
}
|
|
@ -38,6 +38,7 @@ public final class Weatherlight extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Alms", 3, Rarity.COMMON, mage.cards.a.Alms.class));
|
||||
cards.add(new SetCardInfo("Ancestral Knowledge", 32, Rarity.RARE, mage.cards.a.AncestralKnowledge.class));
|
||||
cards.add(new SetCardInfo("Angelic Renewal", 4, Rarity.COMMON, mage.cards.a.AngelicRenewal.class));
|
||||
cards.add(new SetCardInfo("Apathy", 33, Rarity.COMMON, mage.cards.a.Apathy.class));
|
||||
cards.add(new SetCardInfo("Arctic Wolves", 118, Rarity.UNCOMMON, mage.cards.a.ArcticWolves.class));
|
||||
cards.add(new SetCardInfo("Ardent Militia", 5, Rarity.COMMON, mage.cards.a.ArdentMilitia.class));
|
||||
cards.add(new SetCardInfo("Argivian Find", 6, Rarity.UNCOMMON, mage.cards.a.ArgivianFind.class));
|
||||
|
|
Loading…
Reference in a new issue