mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
[CMR] Implemented Court of Ambition
This commit is contained in:
parent
323f9f0e02
commit
8b96c1d945
2 changed files with 96 additions and 0 deletions
95
Mage.Sets/src/mage/cards/c/CourtOfAmbition.java
Normal file
95
Mage.Sets/src/mage/cards/c/CourtOfAmbition.java
Normal file
|
@ -0,0 +1,95 @@
|
|||
package mage.cards.c;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.BecomesMonarchSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.TargetController;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetDiscard;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class CourtOfAmbition extends CardImpl {
|
||||
|
||||
public CourtOfAmbition(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{B}{B}");
|
||||
|
||||
// When Court of Ambition enters the battlefield, you become the monarch.
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new BecomesMonarchSourceEffect()));
|
||||
|
||||
// At the beginning of your upkeep, each opponent loses 3 life unless they discard a card. If you're the monarch, instead each opponent loses 6 life unless they discard two cards.
|
||||
this.addAbility(new BeginningOfUpkeepTriggeredAbility(
|
||||
new CourtOfAmbitionEffect(), TargetController.YOU, false
|
||||
));
|
||||
}
|
||||
|
||||
private CourtOfAmbition(final CourtOfAmbition card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CourtOfAmbition copy() {
|
||||
return new CourtOfAmbition(this);
|
||||
}
|
||||
}
|
||||
|
||||
class CourtOfAmbitionEffect extends OneShotEffect {
|
||||
|
||||
CourtOfAmbitionEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "each opponent loses 3 life unless they discard a card. " +
|
||||
"If you're the monarch, instead each opponent loses 6 life unless they discard two cards";
|
||||
}
|
||||
|
||||
private CourtOfAmbitionEffect(final CourtOfAmbitionEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CourtOfAmbitionEffect copy() {
|
||||
return new CourtOfAmbitionEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
int discardCount = source.isControlledBy(game.getMonarchId()) ? 2 : 1;
|
||||
String message = "Discard " + CardUtil.numberToText(discardCount, "a")
|
||||
+ "card" + (discardCount > 1 ? 's' : "") + "? If not you lose " + (discardCount * 3) + " life";
|
||||
Map<UUID, Cards> discardMap = new HashMap<>();
|
||||
for (UUID playerId : game.getOpponents(source.getControllerId())) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player == null) {
|
||||
continue;
|
||||
}
|
||||
if (player.getHand().size() < discardCount || !player.chooseUse(outcome, message, source, game)) {
|
||||
player.loseLife(discardCount * 3, game, false);
|
||||
}
|
||||
TargetDiscard target = new TargetDiscard(discardCount, StaticFilters.FILTER_CARD, playerId);
|
||||
player.choose(outcome, target, source.getSourceId(), game);
|
||||
discardMap.put(playerId, new CardsImpl(target.getTargets()));
|
||||
}
|
||||
for (Map.Entry<UUID, Cards> entry : discardMap.entrySet()) {
|
||||
Player player = game.getPlayer(entry.getKey());
|
||||
if (player != null) {
|
||||
player.discard(entry.getValue(), source, game);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -70,6 +70,7 @@ public final class CommanderLegends extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Commander's Sphere", 306, Rarity.COMMON, mage.cards.c.CommandersSphere.class));
|
||||
cards.add(new SetCardInfo("Confiscate", 62, Rarity.UNCOMMON, mage.cards.c.Confiscate.class));
|
||||
cards.add(new SetCardInfo("Court Street Denizen", 17, Rarity.COMMON, mage.cards.c.CourtStreetDenizen.class));
|
||||
cards.add(new SetCardInfo("Court of Ambition", 114, Rarity.RARE, mage.cards.c.CourtOfAmbition.class));
|
||||
cards.add(new SetCardInfo("Court of Bounty", 220, Rarity.RARE, mage.cards.c.CourtOfBounty.class));
|
||||
cards.add(new SetCardInfo("Court of Cunning", 63, Rarity.RARE, mage.cards.c.CourtOfCunning.class));
|
||||
cards.add(new SetCardInfo("Court of Grace", 16, Rarity.RARE, mage.cards.c.CourtOfGrace.class));
|
||||
|
|
Loading…
Reference in a new issue