forked from External/mage
[EOE] Implement Unravel
This commit is contained in:
parent
018b43633b
commit
9c8bb2473a
2 changed files with 78 additions and 0 deletions
77
Mage.Sets/src/mage/cards/u/Unravel.java
Normal file
77
Mage.Sets/src/mage/cards/u/Unravel.java
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
package mage.cards.u;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Controllable;
|
||||
import mage.game.Game;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.target.TargetSpell;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class Unravel extends CardImpl {
|
||||
|
||||
public Unravel(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}{U}");
|
||||
|
||||
// Counter target spell. If the amount of mana spent to cast that spell was less than its mana value, you draw a card.
|
||||
this.getSpellAbility().addEffect(new UnravelEffect());
|
||||
this.getSpellAbility().addTarget(new TargetSpell());
|
||||
}
|
||||
|
||||
private Unravel(final Unravel card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Unravel copy() {
|
||||
return new Unravel(this);
|
||||
}
|
||||
}
|
||||
|
||||
class UnravelEffect extends OneShotEffect {
|
||||
|
||||
UnravelEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "counter target spell. If the amount of mana spent to cast that spell was less than its mana value, you draw a card";
|
||||
}
|
||||
|
||||
private UnravelEffect(final UnravelEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UnravelEffect copy() {
|
||||
return new UnravelEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Spell spell = game.getSpell(getTargetPointer().getFirst(game, source));
|
||||
if (spell == null) {
|
||||
return false;
|
||||
}
|
||||
boolean flag = spell
|
||||
.getStackAbility()
|
||||
.getManaCostsToPay()
|
||||
.getUsedManaToPay()
|
||||
.count() < spell.getManaValue();
|
||||
game.getStack().counter(spell.getId(), source, game);
|
||||
if (!flag) {
|
||||
return true;
|
||||
}
|
||||
Optional.ofNullable(source)
|
||||
.map(Controllable::getControllerId)
|
||||
.map(game::getPlayer)
|
||||
.ifPresent(player -> player.drawCards(1, source, game));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -110,6 +110,7 @@ public final class EdgeOfEternities extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Thrumming Hivepool", 247, Rarity.RARE, mage.cards.t.ThrummingHivepool.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Thrumming Hivepool", 356, Rarity.RARE, mage.cards.t.ThrummingHivepool.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Tragic Trajectory", 122, Rarity.UNCOMMON, mage.cards.t.TragicTrajectory.class));
|
||||
cards.add(new SetCardInfo("Unravel", 83, Rarity.UNCOMMON, mage.cards.u.Unravel.class));
|
||||
cards.add(new SetCardInfo("Uthros, Titanic Godcore", 260, Rarity.MYTHIC, mage.cards.u.UthrosTitanicGodcore.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Uthros, Titanic Godcore", 285, Rarity.MYTHIC, mage.cards.u.UthrosTitanicGodcore.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Uthros, Titanic Godcore", 380, Rarity.MYTHIC, mage.cards.u.UthrosTitanicGodcore.class, NON_FULL_USE_VARIOUS));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue