mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
[MH2] Implemented Dihada's Ploy
This commit is contained in:
parent
54e5214227
commit
390075efd4
3 changed files with 77 additions and 0 deletions
71
Mage.Sets/src/mage/cards/d/DihadasPloy.java
Normal file
71
Mage.Sets/src/mage/cards/d/DihadasPloy.java
Normal file
|
@ -0,0 +1,71 @@
|
|||
package mage.cards.d;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.DrawDiscardControllerEffect;
|
||||
import mage.abilities.effects.common.GainLifeEffect;
|
||||
import mage.abilities.hint.Hint;
|
||||
import mage.abilities.hint.ValueHint;
|
||||
import mage.abilities.keyword.JumpStartAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.game.Game;
|
||||
import mage.watchers.common.DiscardedCardWatcher;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class DihadasPloy extends CardImpl {
|
||||
|
||||
private static final Hint hint = new ValueHint("Cards you've discarded this turn", DihadasPloyValue.instance);
|
||||
|
||||
public DihadasPloy(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}{B}");
|
||||
|
||||
// Draw two cards, then discard a card. You gain life equal to the number of cards you've discarded this turn.
|
||||
this.getSpellAbility().addEffect(new DrawDiscardControllerEffect(2, 1));
|
||||
this.getSpellAbility().addEffect(new GainLifeEffect(DihadasPloyValue.instance));
|
||||
this.getSpellAbility().addHint(hint);
|
||||
this.getSpellAbility().addWatcher(new DiscardedCardWatcher());
|
||||
|
||||
// Jump-start
|
||||
this.addAbility(new JumpStartAbility(this));
|
||||
}
|
||||
|
||||
private DihadasPloy(final DihadasPloy card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DihadasPloy copy() {
|
||||
return new DihadasPloy(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum DihadasPloyValue implements DynamicValue {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
return DiscardedCardWatcher.getDiscarded(sourceAbility.getControllerId(), game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DihadasPloyValue copy() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "1";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "cards you've discarded this turn";
|
||||
}
|
||||
}
|
|
@ -82,6 +82,7 @@ public final class ModernHorizons2 extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Dakkon, Shadow Slayer", 192, Rarity.MYTHIC, mage.cards.d.DakkonShadowSlayer.class));
|
||||
cards.add(new SetCardInfo("Darkmoss Bridge", 245, Rarity.COMMON, mage.cards.d.DarkmossBridge.class));
|
||||
cards.add(new SetCardInfo("Diamond Lion", 225, Rarity.RARE, mage.cards.d.DiamondLion.class));
|
||||
cards.add(new SetCardInfo("Dihada's Ploy", 193, Rarity.COMMON, mage.cards.d.DihadasPloy.class));
|
||||
cards.add(new SetCardInfo("Discerning Taste", 82, Rarity.COMMON, mage.cards.d.DiscerningTaste.class));
|
||||
cards.add(new SetCardInfo("Disciple of the Sun", 11, Rarity.COMMON, mage.cards.d.DiscipleOfTheSun.class));
|
||||
cards.add(new SetCardInfo("Dragon's Rage Channeler", 121, Rarity.UNCOMMON, mage.cards.d.DragonsRageChanneler.class));
|
||||
|
|
|
@ -37,4 +37,9 @@ public class DiscardedCardWatcher extends Watcher {
|
|||
DiscardedCardWatcher watcher = game.getState().getWatcher(DiscardedCardWatcher.class);
|
||||
return watcher != null && watcher.playerMap.getOrDefault(playerId, 0) > 0;
|
||||
}
|
||||
|
||||
public static int getDiscarded(UUID playerId, Game game) {
|
||||
DiscardedCardWatcher watcher = game.getState().getWatcher(DiscardedCardWatcher.class);
|
||||
return watcher == null ? 0 : watcher.playerMap.getOrDefault(playerId, 0);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue