mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
[CMR] Implemented Jeska's WIll
This commit is contained in:
parent
9b866802de
commit
fec9da5cfe
3 changed files with 87 additions and 0 deletions
77
Mage.Sets/src/mage/cards/j/JeskasWill.java
Normal file
77
Mage.Sets/src/mage/cards/j/JeskasWill.java
Normal file
|
@ -0,0 +1,77 @@
|
|||
package mage.cards.j;
|
||||
|
||||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.condition.common.ControlACommanderCondition;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.ExileTop3MayPlayUntilEndOfTurnEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetOpponent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class JeskasWill extends CardImpl {
|
||||
|
||||
public JeskasWill(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{R}");
|
||||
|
||||
// Choose one. If you control a commander as you cast this spell, you may choose both.
|
||||
this.getSpellAbility().getModes().setChooseText(
|
||||
"Choose one. If you control a commander as you cast this spell, you may choose both."
|
||||
);
|
||||
this.getSpellAbility().getModes().setMoreCondition(ControlACommanderCondition.instance);
|
||||
|
||||
// • Add {R} for each card in target opponent's hand.
|
||||
this.getSpellAbility().addEffect(new JeskasWillEffect());
|
||||
this.getSpellAbility().addTarget(new TargetOpponent());
|
||||
|
||||
// • Exile the top three cards of your library. You may play them this turn.
|
||||
this.getSpellAbility().addMode(new Mode(new ExileTop3MayPlayUntilEndOfTurnEffect()));
|
||||
}
|
||||
|
||||
private JeskasWill(final JeskasWill card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JeskasWill copy() {
|
||||
return new JeskasWill(this);
|
||||
}
|
||||
}
|
||||
|
||||
class JeskasWillEffect extends OneShotEffect {
|
||||
|
||||
JeskasWillEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "Add {R} for each card in target opponent's hand.";
|
||||
}
|
||||
|
||||
private JeskasWillEffect(final JeskasWillEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JeskasWillEffect copy() {
|
||||
return new JeskasWillEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Player player = game.getPlayer(source.getFirstTarget());
|
||||
if (controller == null || player == null || player.getHand().size() < 1) {
|
||||
return false;
|
||||
}
|
||||
controller.getManaPool().addMana(Mana.RedMana(player.getHand().size()), game, source);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -109,6 +109,7 @@ public final class CommanderLegends extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Inspiring Roar", 23, Rarity.COMMON, mage.cards.i.InspiringRoar.class));
|
||||
cards.add(new SetCardInfo("Intangible Virtue", 24, Rarity.UNCOMMON, mage.cards.i.IntangibleVirtue.class));
|
||||
cards.add(new SetCardInfo("Interpret the Signs", 75, Rarity.UNCOMMON, mage.cards.i.InterpretTheSigns.class));
|
||||
cards.add(new SetCardInfo("Jeska's Will", 187, Rarity.RARE, mage.cards.j.JeskasWill.class));
|
||||
cards.add(new SetCardInfo("Jeska, Thrice Reborn", 186, Rarity.MYTHIC, mage.cards.j.JeskaThriceReborn.class));
|
||||
cards.add(new SetCardInfo("Jeweled Lotus", 319, Rarity.MYTHIC, mage.cards.j.JeweledLotus.class));
|
||||
cards.add(new SetCardInfo("Kamahl, Heart of Krosa", 237, Rarity.MYTHIC, mage.cards.k.KamahlHeartOfKrosa.class));
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package mage.abilities;
|
||||
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.costs.OptionalAdditionalModeSourceCosts;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.Outcome;
|
||||
|
@ -36,6 +37,7 @@ public class Modes extends LinkedHashMap<UUID, Mode> {
|
|||
private boolean isRandom = false;
|
||||
private String chooseText = null;
|
||||
private boolean resetEachTurn = false;
|
||||
private Condition moreCondition;
|
||||
|
||||
public Modes() {
|
||||
this.currentMode = new Mode();
|
||||
|
@ -214,6 +216,10 @@ public class Modes extends LinkedHashMap<UUID, Mode> {
|
|||
this.put(mode.getId(), mode);
|
||||
}
|
||||
|
||||
public void setMoreCondition(Condition moreCondition) {
|
||||
this.moreCondition = moreCondition;
|
||||
}
|
||||
|
||||
public boolean choose(Game game, Ability source) {
|
||||
if (this.isResetEachTurn()) {
|
||||
if (this.getTurnNum(game, source) != game.getTurnNum()) {
|
||||
|
@ -279,6 +285,9 @@ public class Modes extends LinkedHashMap<UUID, Mode> {
|
|||
// player chooses modes manually
|
||||
this.currentMode = null;
|
||||
int currentMaxModes = this.getMaxModes();
|
||||
if (moreCondition != null && moreCondition.apply(game, source)) {
|
||||
currentMaxModes = Integer.MAX_VALUE;
|
||||
}
|
||||
if (getMaxModesFilter() != null) {
|
||||
if (maxModesFilter instanceof FilterPlayer) {
|
||||
currentMaxModes = 0;
|
||||
|
|
Loading…
Reference in a new issue