mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
[DMU] Implemented Shanna, Purifying Blade
This commit is contained in:
parent
a24cdb31fc
commit
c745bce734
5 changed files with 99 additions and 15 deletions
|
@ -74,7 +74,7 @@ class KarnLivingLegacyEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
int amount = ManaUtil.playerPaysXGenericMana(
|
||||
true, "Karn, Living Legacy", player, source, game
|
||||
false, "Karn, Living Legacy", player, source, game
|
||||
);
|
||||
if (amount < 1) {
|
||||
return false;
|
||||
|
|
85
Mage.Sets/src/mage/cards/s/ShannaPurifyingBlade.java
Normal file
85
Mage.Sets/src/mage/cards/s/ShannaPurifyingBlade.java
Normal file
|
@ -0,0 +1,85 @@
|
|||
package mage.cards.s;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
|
||||
import mage.abilities.dynamicvalue.common.ControllerGotLifeCount;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.keyword.LifelinkAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.util.ManaUtil;
|
||||
import mage.watchers.common.PlayerGainedLifeWatcher;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class ShannaPurifyingBlade extends CardImpl {
|
||||
|
||||
public ShannaPurifyingBlade(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{G}{W}{U}");
|
||||
|
||||
this.addSuperType(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.WARRIOR);
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(3);
|
||||
|
||||
// Lifelink
|
||||
this.addAbility(LifelinkAbility.getInstance());
|
||||
|
||||
// At the beginning of your end step, you may pay {X}. If you do, draw X cards. X can't be greater than the amount of life you gained this turn.
|
||||
this.addAbility(new BeginningOfEndStepTriggeredAbility(
|
||||
new ShannaPurifyingBladeEffect(), TargetController.YOU, false
|
||||
).addHint(ControllerGotLifeCount.getHint()), new PlayerGainedLifeWatcher());
|
||||
}
|
||||
|
||||
private ShannaPurifyingBlade(final ShannaPurifyingBlade card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ShannaPurifyingBlade copy() {
|
||||
return new ShannaPurifyingBlade(this);
|
||||
}
|
||||
}
|
||||
|
||||
class ShannaPurifyingBladeEffect extends OneShotEffect {
|
||||
|
||||
ShannaPurifyingBladeEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "you may pay {X}. If you do, draw X cards. " +
|
||||
"X can't be greater than the amount of life you gained this turn";
|
||||
}
|
||||
|
||||
private ShannaPurifyingBladeEffect(final ShannaPurifyingBladeEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ShannaPurifyingBladeEffect copy() {
|
||||
return new ShannaPurifyingBladeEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
int lifeGained = ControllerGotLifeCount.instance.calculate(game, source, this);
|
||||
if (lifeGained < 1) {
|
||||
return false;
|
||||
}
|
||||
int count = ManaUtil.playerPaysXGenericMana(
|
||||
true, "Shanna, Purifying Blade",
|
||||
player, source, game, lifeGained
|
||||
);
|
||||
return count > 0 && player.drawCards(count, source, game) > 0;
|
||||
}
|
||||
}
|
|
@ -202,6 +202,7 @@ public final class DominariaUnited extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Shadow Prophecy", 105, Rarity.COMMON, mage.cards.s.ShadowProphecy.class));
|
||||
cards.add(new SetCardInfo("Shadow-Rite Priest", 106, Rarity.RARE, mage.cards.s.ShadowRitePriest.class));
|
||||
cards.add(new SetCardInfo("Shalai's Acolyte", 33, Rarity.UNCOMMON, mage.cards.s.ShalaisAcolyte.class));
|
||||
cards.add(new SetCardInfo("Shanna, Purifying Blade", 218, Rarity.MYTHIC, mage.cards.s.ShannaPurifyingBlade.class));
|
||||
cards.add(new SetCardInfo("Sheoldred's Restoration", 108, Rarity.UNCOMMON, mage.cards.s.SheoldredsRestoration.class));
|
||||
cards.add(new SetCardInfo("Sheoldred, the Apocalypse", 107, Rarity.MYTHIC, mage.cards.s.SheoldredTheApocalypse.class));
|
||||
cards.add(new SetCardInfo("Shield-Wall Sentinel", 238, Rarity.COMMON, mage.cards.s.ShieldWallSentinel.class));
|
||||
|
|
|
@ -8,8 +8,6 @@ import mage.abilities.hint.ValueHint;
|
|||
import mage.game.Game;
|
||||
import mage.watchers.common.PlayerGainedLifeWatcher;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Amount of life the controller got this turn.
|
||||
*
|
||||
|
@ -22,13 +20,9 @@ public enum ControllerGotLifeCount implements DynamicValue {
|
|||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
return this.calculate(game, sourceAbility.getControllerId());
|
||||
}
|
||||
|
||||
public int calculate(Game game, UUID controllerId) {
|
||||
PlayerGainedLifeWatcher watcher = game.getState().getWatcher(PlayerGainedLifeWatcher.class);
|
||||
if (watcher != null) {
|
||||
return watcher.getLifeGained(controllerId);
|
||||
return watcher.getLifeGained(sourceAbility.getControllerId());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -450,13 +450,13 @@ public final class ManaUtil {
|
|||
|
||||
/**
|
||||
* Converts a collection of mana symbols into a single condensed string e.g:
|
||||
* {1}{1}{1}{1}{1}{W} = {5}{W}
|
||||
* {2}{B}{2}{B}{2}{B} = {6}{B}{B}{B}
|
||||
* {1}{2}{R}{U}{1}{1} = {5}{R}{U}
|
||||
* {B}{G}{R} = {B}{G}{R}
|
||||
* {1}{1}{1}{1}{1}{W} = {5}{W}
|
||||
* {2}{B}{2}{B}{2}{B} = {6}{B}{B}{B}
|
||||
* {1}{2}{R}{U}{1}{1} = {5}{R}{U}
|
||||
* {B}{G}{R} = {B}{G}{R}
|
||||
*
|
||||
* @param rawCost the uncondensed version of the mana String.
|
||||
* @return the condensed version of the mana String.
|
||||
* @param rawCost the uncondensed version of the mana String.
|
||||
* @return the condensed version of the mana String.
|
||||
*/
|
||||
public static String condenseManaCostString(String rawCost) {
|
||||
int total = 0;
|
||||
|
@ -674,6 +674,10 @@ public final class ManaUtil {
|
|||
}
|
||||
|
||||
public static int playerPaysXGenericMana(boolean payAsX, String restoreContextName, Player player, Ability source, Game game) {
|
||||
return playerPaysXGenericMana(payAsX, restoreContextName, player, source, game, Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
public static int playerPaysXGenericMana(boolean payAsX, String restoreContextName, Player player, Ability source, Game game, int maxValue) {
|
||||
// payAsX - if your cost is X value (some mana can be used for X cost only)
|
||||
// false: "you may pay any amount of mana"
|
||||
// true: "counter that spell unless that player pays {X}"
|
||||
|
@ -684,7 +688,7 @@ public final class ManaUtil {
|
|||
int bookmark = game.bookmarkState();
|
||||
player.resetStoredBookmark(game);
|
||||
|
||||
wantToPay = player.announceXMana(0, Integer.MAX_VALUE, "How much mana will you pay?", game, source);
|
||||
wantToPay = player.announceXMana(0, maxValue, "Choose how much mana to pay", game, source);
|
||||
if (wantToPay > 0) {
|
||||
Cost cost = ManaUtil.createManaCost(wantToPay, payAsX);
|
||||
payed = cost.pay(source, game, source, player.getId(), false, null);
|
||||
|
|
Loading…
Reference in a new issue