forked from External/mage
[TLA] Implement Spirit Water Revival
This commit is contained in:
parent
1ae2ba93a7
commit
5c8a185411
4 changed files with 179 additions and 0 deletions
52
Mage.Sets/src/mage/cards/s/SpiritWaterRevival.java
Normal file
52
Mage.Sets/src/mage/cards/s/SpiritWaterRevival.java
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
package mage.cards.s;
|
||||
|
||||
import mage.abilities.condition.common.WaterbendedCondition;
|
||||
import mage.abilities.decorator.ConditionalOneShotEffect;
|
||||
import mage.abilities.effects.common.AddContinuousEffectToGame;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.effects.common.ExileSpellEffect;
|
||||
import mage.abilities.effects.common.ShuffleYourGraveyardIntoLibraryEffect;
|
||||
import mage.abilities.effects.common.continuous.MaximumHandSizeControllerEffect;
|
||||
import mage.abilities.keyword.WaterbendAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class SpiritWaterRevival extends CardImpl {
|
||||
|
||||
public SpiritWaterRevival(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{U}{U}");
|
||||
|
||||
// As an additional cost to cast this spell, you may waterbend {6}.
|
||||
this.addAbility(new WaterbendAbility(6));
|
||||
|
||||
// Draw two cards. If this spell's additional cost was paid, instead shuffle your graveyard into your library, draw seven cards, and you have no maximum hand size for the rest of the game.
|
||||
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(
|
||||
new ShuffleYourGraveyardIntoLibraryEffect(), new DrawCardSourceControllerEffect(2),
|
||||
WaterbendedCondition.instance, "draw two cards. If this spell's additional cost was paid, " +
|
||||
"instead shuffle your graveyard into your library, draw seven cards, " +
|
||||
"and you have no maximum hand size for the rest of the game"
|
||||
).addEffect(new DrawCardSourceControllerEffect(7))
|
||||
.addEffect(new AddContinuousEffectToGame(new MaximumHandSizeControllerEffect(
|
||||
Integer.MAX_VALUE, Duration.EndOfGame, MaximumHandSizeControllerEffect.HandSizeModification.SET
|
||||
))));
|
||||
|
||||
// Exile Spirit Water Revival.
|
||||
this.getSpellAbility().addEffect(new ExileSpellEffect().concatBy("<br>"));
|
||||
}
|
||||
|
||||
private SpiritWaterRevival(final SpiritWaterRevival card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpiritWaterRevival copy() {
|
||||
return new SpiritWaterRevival(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -320,6 +320,8 @@ public final class AvatarTheLastAirbender extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Sozin's Comet", 309, Rarity.MYTHIC, mage.cards.s.SozinsComet.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Sozin's Comet", 332, Rarity.MYTHIC, mage.cards.s.SozinsComet.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Sparring Dummy", 197, Rarity.UNCOMMON, mage.cards.s.SparringDummy.class));
|
||||
cards.add(new SetCardInfo("Spirit Water Revival", 370, Rarity.RARE, mage.cards.s.SpiritWaterRevival.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Spirit Water Revival", 73, Rarity.RARE, mage.cards.s.SpiritWaterRevival.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Suki, Courageous Rescuer", 368, Rarity.RARE, mage.cards.s.SukiCourageousRescuer.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Suki, Courageous Rescuer", 37, Rarity.RARE, mage.cards.s.SukiCourageousRescuer.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Suki, Kyoshi Warrior", 243, Rarity.UNCOMMON, mage.cards.s.SukiKyoshiWarrior.class));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
package mage.abilities.condition.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.keyword.WaterbendAbility;
|
||||
import mage.game.Game;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
* Checks if the spell was cast with the alternate waterbend cost
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public enum WaterbendedCondition implements Condition {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return CardUtil.checkSourceCostsTagExists(game, source, WaterbendAbility.WATERBEND_ACTIVATION_VALUE_KEY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "the additional cost was paid";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
package mage.abilities.keyword;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.StaticAbility;
|
||||
import mage.abilities.costs.*;
|
||||
import mage.abilities.costs.common.WaterbendCost;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class WaterbendAbility extends StaticAbility implements OptionalAdditionalSourceCosts {
|
||||
|
||||
private static final String promptString = "Waterbend {";
|
||||
private static final String keywordText = "As an additional cost to cast this spell, you may waterbend {";
|
||||
private static final String reminderText = "While paying a waterbend cost, you can tap your artifacts and creatures to help. Each one pays for {1}.";
|
||||
private final String rule;
|
||||
private final int amount;
|
||||
|
||||
public static final String WATERBEND_ACTIVATION_VALUE_KEY = "waterbendActivation";
|
||||
|
||||
protected OptionalAdditionalCost additionalCost;
|
||||
|
||||
public static OptionalAdditionalCost makeCost(int amount) {
|
||||
OptionalAdditionalCost cost = new OptionalAdditionalCostImpl(
|
||||
keywordText + amount + '}', reminderText, new WaterbendCost(amount)
|
||||
);
|
||||
cost.setRepeatable(false);
|
||||
return cost;
|
||||
}
|
||||
|
||||
public WaterbendAbility(int amount) {
|
||||
this(amount, null);
|
||||
}
|
||||
|
||||
public WaterbendAbility(int amount, String extraInfoText) {
|
||||
super(Zone.STACK, null);
|
||||
this.additionalCost = makeCost(amount);
|
||||
this.rule = additionalCost.getName() + ". " + (extraInfoText == null ? "" : extraInfoText + ". ") + additionalCost.getReminderText();
|
||||
this.setRuleAtTheTop(true);
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
private WaterbendAbility(final WaterbendAbility ability) {
|
||||
super(ability);
|
||||
this.rule = ability.rule;
|
||||
this.additionalCost = ability.additionalCost.copy();
|
||||
this.amount = ability.amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WaterbendAbility copy() {
|
||||
return new WaterbendAbility(this);
|
||||
}
|
||||
|
||||
public void resetCost() {
|
||||
if (additionalCost != null) {
|
||||
additionalCost.reset();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addOptionalAdditionalCosts(Ability ability, Game game) {
|
||||
if (!(ability instanceof SpellAbility)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = game.getPlayer(ability.getControllerId());
|
||||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.resetCost();
|
||||
boolean canPay = additionalCost.canPay(ability, this, ability.getControllerId(), game);
|
||||
if (!canPay || !player.chooseUse(Outcome.Exile, promptString + amount + "}?", ability, game)) {
|
||||
return;
|
||||
}
|
||||
|
||||
additionalCost.activate();
|
||||
for (Cost cost : ((Costs<Cost>) additionalCost)) {
|
||||
ability.getCosts().add(cost.copy());
|
||||
}
|
||||
ability.setCostsTag(WATERBEND_ACTIVATION_VALUE_KEY, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCastMessageSuffix() {
|
||||
return additionalCost.getCastSuffixMessage(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return rule;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue