mirror of
https://github.com/correl/mage.git
synced 2024-12-27 11:07:39 +00:00
Implement Thought Dissector
This commit is contained in:
parent
0d6015bbb9
commit
1adcdd3b62
2 changed files with 107 additions and 0 deletions
106
Mage.Sets/src/mage/cards/t/ThoughtDissector.java
Normal file
106
Mage.Sets/src/mage/cards/t/ThoughtDissector.java
Normal file
|
@ -0,0 +1,106 @@
|
|||
package mage.cards.t;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.costs.mana.VariableManaCost;
|
||||
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetOpponent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author noahg
|
||||
*/
|
||||
public final class ThoughtDissector extends CardImpl {
|
||||
|
||||
public ThoughtDissector(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{4}");
|
||||
|
||||
|
||||
// {X}, {tap}: Target opponent reveals cards from the top of his or her library until an artifact card or X cards are revealed, whichever comes first. If an artifact card is revealed this way, put it onto the battlefield under your control and sacrifice Thought Dissector. Put the rest of the revealed cards into that player's graveyard.
|
||||
SimpleActivatedAbility abilitiy = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ThoughtDissectorEffect(), new VariableManaCost());
|
||||
abilitiy.addCost(new TapSourceCost());
|
||||
abilitiy.addTarget(new TargetOpponent());
|
||||
this.addAbility(abilitiy);
|
||||
}
|
||||
|
||||
public ThoughtDissector(final ThoughtDissector card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThoughtDissector copy() {
|
||||
return new ThoughtDissector(this);
|
||||
}
|
||||
}
|
||||
|
||||
class ThoughtDissectorEffect extends OneShotEffect {
|
||||
|
||||
private static final ManacostVariableValue amount = new ManacostVariableValue();
|
||||
|
||||
public ThoughtDissectorEffect() {
|
||||
super(Outcome.Detriment);
|
||||
staticText = "Target opponent reveals cards from the top of his or her library until an artifact card or X cards are revealed, whichever comes first. If an artifact card is revealed this way, put it onto the battlefield under your control and sacrifice {this}. Put the rest of the revealed cards into that player's graveyard.";
|
||||
}
|
||||
|
||||
public ThoughtDissectorEffect(final ThoughtDissectorEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThoughtDissectorEffect copy() {
|
||||
return new ThoughtDissectorEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Player targetOpponent = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
int max = amount.calculate(game, source, this);
|
||||
if (targetOpponent != null && controller != null && max > 0) {
|
||||
int numberOfCard = 0;
|
||||
Card artifact = null;
|
||||
CardsImpl nonArtifacts = new CardsImpl();
|
||||
CardsImpl reveal = new CardsImpl();
|
||||
for (Card card : targetOpponent.getLibrary().getCards(game)) {
|
||||
reveal.add(card);
|
||||
if (card.isArtifact()) {
|
||||
artifact = card;
|
||||
break;
|
||||
} else {
|
||||
numberOfCard++;
|
||||
if (numberOfCard > max){
|
||||
break;
|
||||
}
|
||||
nonArtifacts.add(card);
|
||||
}
|
||||
}
|
||||
targetOpponent.revealCards(source, reveal, game);
|
||||
if (artifact != null) {
|
||||
game.applyEffects();
|
||||
controller.moveCards(artifact, Zone.BATTLEFIELD, source, game);
|
||||
Permanent sourcePermanent = source.getSourcePermanentIfItStillExists(game);
|
||||
if (sourcePermanent != null) {
|
||||
sourcePermanent.sacrifice(source.getSourceId(), game);
|
||||
}
|
||||
}
|
||||
targetOpponent.moveCards(nonArtifacts, Zone.GRAVEYARD, source, game);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -169,6 +169,7 @@ public final class Darksteel extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Tel-Jilad Outrider", 87, Rarity.COMMON, mage.cards.t.TelJiladOutrider.class));
|
||||
cards.add(new SetCardInfo("Tel-Jilad Wolf", 88, Rarity.COMMON, mage.cards.t.TelJiladWolf.class));
|
||||
cards.add(new SetCardInfo("Test of Faith", 17, Rarity.UNCOMMON, mage.cards.t.TestOfFaith.class));
|
||||
cards.add(new SetCardInfo("Thought Dissector", 152, Rarity.RARE, mage.cards.t.ThoughtDissector.class));
|
||||
cards.add(new SetCardInfo("Thunderstaff", 153, Rarity.UNCOMMON, mage.cards.t.Thunderstaff.class));
|
||||
cards.add(new SetCardInfo("Trinisphere", 154, Rarity.RARE, mage.cards.t.Trinisphere.class));
|
||||
cards.add(new SetCardInfo("Turn the Tables", 18, Rarity.RARE, mage.cards.t.TurnTheTables.class));
|
||||
|
|
Loading…
Reference in a new issue