mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
[CLB] Implemented Cut a Deal
This commit is contained in:
parent
74c175765e
commit
0ef537c28b
2 changed files with 70 additions and 0 deletions
69
Mage.Sets/src/mage/cards/c/CutADeal.java
Normal file
69
Mage.Sets/src/mage/cards/c/CutADeal.java
Normal file
|
@ -0,0 +1,69 @@
|
|||
package mage.cards.c;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
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 java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class CutADeal extends CardImpl {
|
||||
|
||||
public CutADeal(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{W}");
|
||||
|
||||
// Each opponent draws a card, then you draw a card for each opponent who drew a card this way.
|
||||
this.getSpellAbility().addEffect(new CutADealEffect());
|
||||
}
|
||||
|
||||
private CutADeal(final CutADeal card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CutADeal copy() {
|
||||
return new CutADeal(this);
|
||||
}
|
||||
}
|
||||
|
||||
class CutADealEffect extends OneShotEffect {
|
||||
|
||||
CutADealEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "each opponent draws a card, then you draw a card for each opponent who drew a card this way";
|
||||
}
|
||||
|
||||
private CutADealEffect(final CutADealEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CutADealEffect copy() {
|
||||
return new CutADealEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
int count = game
|
||||
.getOpponents(source.getControllerId())
|
||||
.stream()
|
||||
.map(game::getPlayer)
|
||||
.filter(Objects::nonNull)
|
||||
.mapToInt(player -> player.drawCards(1, source, game))
|
||||
.sum();
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null && count > 0) {
|
||||
controller.drawCards(count, source, game);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -88,6 +88,7 @@ public final class CommanderLegendsBattleForBaldursGate extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Criminal Past", 122, Rarity.UNCOMMON, mage.cards.c.CriminalPast.class));
|
||||
cards.add(new SetCardInfo("Crystal Dragon", 13, Rarity.UNCOMMON, mage.cards.c.CrystalDragon.class));
|
||||
cards.add(new SetCardInfo("Cultist of the Absolute", 123, Rarity.RARE, mage.cards.c.CultistOfTheAbsolute.class));
|
||||
cards.add(new SetCardInfo("Cut a Deal", 14, Rarity.UNCOMMON, mage.cards.c.CutADeal.class));
|
||||
cards.add(new SetCardInfo("Dawnbringer Cleric", 15, Rarity.COMMON, mage.cards.d.DawnbringerCleric.class));
|
||||
cards.add(new SetCardInfo("Deadly Dispute", 124, Rarity.COMMON, mage.cards.d.DeadlyDispute.class));
|
||||
cards.add(new SetCardInfo("Decanter of Endless Water", 309, Rarity.COMMON, mage.cards.d.DecanterOfEndlessWater.class));
|
||||
|
|
Loading…
Reference in a new issue