mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
[STX] Implemented Plumb the Forbidden
This commit is contained in:
parent
298315309b
commit
f37628c5cb
5 changed files with 131 additions and 45 deletions
|
@ -1,30 +1,23 @@
|
|||
|
||||
package mage.cards.m;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.LockedInCondition;
|
||||
import mage.abilities.condition.common.MorbidCondition;
|
||||
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.CastSourceTriggeredAbility;
|
||||
import mage.abilities.effects.common.CopySourceSpellEffect;
|
||||
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.game.stack.StackObject;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class MaliciousAffliction extends CardImpl {
|
||||
|
@ -36,13 +29,14 @@ public final class MaliciousAffliction extends CardImpl {
|
|||
}
|
||||
|
||||
public MaliciousAffliction(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{B}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{B}{B}");
|
||||
|
||||
// <i>Morbid</i> — When you cast Malicious Affliction, if a creature died this turn, you may copy Malicious Affliction and may choose a new target for the copy.
|
||||
Ability ability = new ConditionalInterveningIfTriggeredAbility(
|
||||
new CastSourceTriggeredAbility(new CopySourceSpellEffect(), true),
|
||||
new LockedInCondition(MorbidCondition.instance),
|
||||
"<i>Morbid</i> — When you cast {this}, if a creature died this turn, you may copy {this} and may choose a new target for the copy");
|
||||
MorbidCondition.instance, "<i>Morbid</i> — When you cast {this}, " +
|
||||
"if a creature died this turn, you may copy {this} and may choose a new target for the copy"
|
||||
);
|
||||
ability.setRuleAtTheTop(true);
|
||||
this.addAbility(ability);
|
||||
|
||||
|
@ -60,35 +54,3 @@ public final class MaliciousAffliction extends CardImpl {
|
|||
return new MaliciousAffliction(this);
|
||||
}
|
||||
}
|
||||
|
||||
class CopySourceSpellEffect extends OneShotEffect {
|
||||
|
||||
static final String rule = "copy {this} and may choose a new target for the copy";
|
||||
|
||||
public CopySourceSpellEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = rule;
|
||||
}
|
||||
|
||||
public CopySourceSpellEffect(final CopySourceSpellEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
Spell spell = game.getStack().getSpell(source.getSourceId());
|
||||
if (spell != null) {
|
||||
spell.createCopyOnStack(game, source, source.getControllerId(), true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CopySourceSpellEffect copy() {
|
||||
return new CopySourceSpellEffect(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import mage.abilities.condition.Condition;
|
|||
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
|
||||
import mage.abilities.decorator.ConditionalOneShotEffect;
|
||||
import mage.abilities.effects.common.CastSourceTriggeredAbility;
|
||||
import mage.abilities.effects.common.CopySourceSpellEffect;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.effects.keyword.ScryEffect;
|
||||
import mage.cards.CardImpl;
|
||||
|
|
72
Mage.Sets/src/mage/cards/p/PlumbTheForbidden.java
Normal file
72
Mage.Sets/src/mage/cards/p/PlumbTheForbidden.java
Normal file
|
@ -0,0 +1,72 @@
|
|||
package mage.cards.p;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.delayed.ReflexiveTriggeredAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||
import mage.abilities.effects.common.CopySourceSpellEffect;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.effects.common.LoseLifeSourceControllerEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.target.common.TargetControlledPermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class PlumbTheForbidden extends CardImpl {
|
||||
|
||||
public PlumbTheForbidden(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{B}");
|
||||
|
||||
// As an additional cost to cast this spell, you may sacrifice one or more creatures. When you do, copy this spell for each creature sacrificed this way.
|
||||
this.getSpellAbility().addCost(new PlumbTheForbiddenCost());
|
||||
|
||||
// You draw a card and you lose 1 life.
|
||||
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1).setText("you draw a card"));
|
||||
this.getSpellAbility().addEffect(new LoseLifeSourceControllerEffect(1).concatBy("and"));
|
||||
}
|
||||
|
||||
private PlumbTheForbidden(final PlumbTheForbidden card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlumbTheForbidden copy() {
|
||||
return new PlumbTheForbidden(this);
|
||||
}
|
||||
}
|
||||
|
||||
class PlumbTheForbiddenCost extends SacrificeTargetCost {
|
||||
|
||||
PlumbTheForbiddenCost() {
|
||||
super(new TargetControlledPermanent(0, Integer.MAX_VALUE, StaticFilters.FILTER_CONTROLLED_CREATURES, true));
|
||||
this.text = "you may sacrifice one or more creatures. When you do, " +
|
||||
"copy this spell for each creature sacrificed this way";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
if (!super.pay(ability, game, source, controllerId, noMana, costToPay)) {
|
||||
return false;
|
||||
}
|
||||
int sacrificed = getPermanents().size();
|
||||
if (sacrificed > 0) {
|
||||
game.fireReflexiveTriggeredAbility(new ReflexiveTriggeredAbility(
|
||||
new CopySourceSpellEffect(sacrificed), false, "when you do, " +
|
||||
"copy this spell for each creature sacrificed this way"
|
||||
), source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) {
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -192,6 +192,7 @@ public final class StrixhavenSchoolOfMages extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Pillardrop Warden", 112, Rarity.COMMON, mage.cards.p.PillardropWarden.class));
|
||||
cards.add(new SetCardInfo("Plains", 366, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Plargg, Dean of Chaos", 155, Rarity.RARE, mage.cards.p.PlarggDeanOfChaos.class));
|
||||
cards.add(new SetCardInfo("Plumb the Forbidden", 81, Rarity.UNCOMMON, mage.cards.p.PlumbTheForbidden.class));
|
||||
cards.add(new SetCardInfo("Poet's Quill", 82, Rarity.RARE, mage.cards.p.PoetsQuill.class));
|
||||
cards.add(new SetCardInfo("Pop Quiz", 49, Rarity.COMMON, mage.cards.p.PopQuiz.class));
|
||||
cards.add(new SetCardInfo("Practical Research", 212, Rarity.UNCOMMON, mage.cards.p.PracticalResearch.class));
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class CopySourceSpellEffect extends OneShotEffect {
|
||||
|
||||
private final int amount;
|
||||
|
||||
public CopySourceSpellEffect() {
|
||||
this(1);
|
||||
}
|
||||
|
||||
public CopySourceSpellEffect(int amount) {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "copy {this}";
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
private CopySourceSpellEffect(final CopySourceSpellEffect effect) {
|
||||
super(effect);
|
||||
this.amount = effect.amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Spell spell = (Spell) getValue("spellCast");
|
||||
if (spell == null) {
|
||||
spell = game.getSpellOrLKIStack(source.getSourceId());
|
||||
}
|
||||
if (controller == null || spell == null) {
|
||||
return false;
|
||||
}
|
||||
spell.createCopyOnStack(game, source, source.getControllerId(), true, amount);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CopySourceSpellEffect copy() {
|
||||
return new CopySourceSpellEffect(this);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue