Updated implementation of Unpredictable Cyclone (#6423)

* updated implementation of Unpredictable Cyclone, refactored drawCard method

* fixed another small implementation error

* added test for Unpredictable Cyclone

* updated Unpredictable Cyclone test
This commit is contained in:
Evan Kranzler 2020-04-16 08:04:21 -04:00 committed by GitHub
parent 80b7f8493b
commit 378dfbf89a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
279 changed files with 465 additions and 378 deletions

View file

@ -80,7 +80,7 @@ class AkoumFlameseekerEffect extends OneShotEffect {
if (controller != null) {
Cards cards = controller.discard(1, false, source, game);
if (!cards.isEmpty()) {
controller.drawCards(1, game);
controller.drawCards(1, source.getSourceId(), game);
}
return true;
}

View file

@ -75,7 +75,7 @@ class AladdinsLampEffect extends ReplacementEffectImpl {
}
controller.putCardsOnBottomOfLibrary(cards, game, source, false);
game.applyEffects();
controller.drawCards(1, game, event.getAppliedEffects());
controller.drawCards(1, event.getSourceId(), game, event.getAppliedEffects());
discard();
return true;
}

View file

@ -98,7 +98,7 @@ class AlhammarretsArchiveReplacementEffect extends ReplacementEffectImpl {
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
controller.drawCards(2, game, event.getAppliedEffects());
controller.drawCards(2, event.getSourceId(), game, event.getAppliedEffects());
}
return true;
}

View file

@ -74,8 +74,8 @@ class AlmsCollectorReplacementEffect extends ReplacementEffectImpl {
Player controller = game.getPlayer(source.getControllerId());
Player opponent = game.getPlayer(event.getPlayerId());
if (controller != null && opponent != null) {
controller.drawCards(1, game, event.getAppliedEffects());
opponent.drawCards(1, game, event.getAppliedEffects());
controller.drawCards(1, source.getSourceId(), game, event.getAppliedEffects());
opponent.drawCards(1, source.getSourceId(), game, event.getAppliedEffects());
return true;
}
return false;

View file

@ -63,7 +63,7 @@ class AmassTheComponentsEffect extends OneShotEffect {
return false;
}
player.drawCards(3, game);
player.drawCards(3, source.getSourceId(), game);
if (!player.getHand().isEmpty()) {
FilterCard filter = new FilterCard("card from your hand to put on the bottom of your library");
TargetCard target = new TargetCard(Zone.HAND, filter);

View file

@ -98,7 +98,7 @@ class AminatouPlusEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
player.drawCards(1, game);
player.drawCards(1, source.getSourceId(), game);
putOnLibrary(player, source, game);
return true;
}

View file

@ -63,7 +63,7 @@ class AncientExcavationEffect extends OneShotEffect {
if (player != null) {
DynamicValue numCards = CardsInControllerHandCount.instance;
int amount = numCards.calculate(game, source, this);
player.drawCards(amount, game);
player.drawCards(amount, source.getSourceId(), game);
player.discard(amount, false, source, game);
return true;
}

View file

@ -57,7 +57,7 @@ class AnvilOfBogardanEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source));
if (targetPlayer != null) {
targetPlayer.drawCards(1, game);
targetPlayer.drawCards(1, source.getSourceId(), game);
targetPlayer.discard(1, false, source, game);
return true;
}

View file

@ -90,7 +90,7 @@ class ArcaneArtisanCreateTokenEffect extends OneShotEffect {
if (player == null) {
return false;
}
player.drawCards(1, game);
player.drawCards(1, source.getSourceId(), game);
TargetCard target = new TargetCardInHand(1, StaticFilters.FILTER_CARD);
if (!player.chooseTarget(Outcome.Exile, player.getHand(), target, source, game)) {
return false;

View file

@ -64,7 +64,7 @@ class ArjunTheShiftingFlameEffect extends OneShotEffect {
if (you != null) {
int count = you.getHand().size();
you.putCardsOnBottomOfLibrary(you.getHand(), game, source, true);
you.drawCards(count, game);
you.drawCards(count, source.getSourceId(), game);
}
return true;
}

View file

@ -168,7 +168,7 @@ class AzorTheLawbringerAttacksEffect extends OneShotEffect {
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) {
controller.resetStoredBookmark(game); // otherwise you can undo the payment
controller.gainLife(costX, game, source);
controller.drawCards(costX, game);
controller.drawCards(costX, source.getSourceId(), game);
return true;
}
}

View file

@ -78,7 +78,7 @@ class AzorsGatewayEffect extends OneShotEffect {
UUID exileId = CardUtil.getCardExileZoneId(game, source);
MageObject sourceObject = source.getSourceObject(game);
if (controller != null && exileId != null && sourceObject != null) {
controller.drawCards(1, game);
controller.drawCards(1, source.getSourceId(), game);
TargetCardInHand target = new TargetCardInHand();
controller.choose(outcome, target, source.getSourceId(), game);
Card cardToExile = game.getCard(target.getFirstTarget());

View file

@ -84,7 +84,7 @@ class AzraBladeseekerEffect extends OneShotEffect {
}
for (PlayerCard playerCard : playerCardList) {
if (playerCard.getPlayer().discard(playerCard.getCard(), source, game)) {
playerCard.getPlayer().drawCards(1, game);
playerCard.getPlayer().drawCards(1, source.getSourceId(), game);
}
}
return true;

View file

@ -59,7 +59,7 @@ class BalanceOfPowerEffect extends OneShotEffect {
Player opponent = game.getPlayer(source.getFirstTarget());
if (opponent != null && player != null && opponent.getHand().size() > player.getHand().size()) {
player.drawCards(opponent.getHand().size() - player.getHand().size(), game);
player.drawCards(opponent.getHand().size() - player.getHand().size(), source.getSourceId(), game);
return true;
}

View file

@ -70,7 +70,7 @@ class BalefulStareEffect extends OneShotEffect {
count++;
}
}
controller.drawCards(count, game);
controller.drawCards(count, source.getSourceId(), game);
return true;
}
return false;

View file

@ -106,7 +106,7 @@ class BaneAlleyBrokerDrawExileEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
controller.drawCards(1, game);
controller.drawCards(1, source.getSourceId(), game);
Target target = new TargetCardInHand(new FilterCard("card to exile"));
if (controller.chooseTarget(outcome, target, source, game)) {
Card card = game.getCard(target.getFirstTarget());

View file

@ -70,7 +70,7 @@ class BarbedShockerEffect extends OneShotEffect {
for (Card card : targetPlayer.getHand().getCards(game)) {
targetPlayer.discard(card, source, game);
}
targetPlayer.drawCards(count, game);
targetPlayer.drawCards(count, source.getSourceId(), game);
return false;
}
return true;

View file

@ -63,7 +63,7 @@ class BiomanticMasteryEffect extends OneShotEffect {
Player player = game.getPlayer(playerId);
if (player != null) {
int creatures = game.getBattlefield().countAll(StaticFilters.FILTER_PERMANENT_CREATURE, playerId, game);
controller.drawCards(creatures, game);
controller.drawCards(creatures, source.getSourceId(), game);
}
}
return true;

View file

@ -59,7 +59,7 @@ class BlastOfGeniusEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
player.drawCards(3, game);
player.drawCards(3, source.getSourceId(), game);
TargetDiscard target = new TargetDiscard(player.getId());
if (target.canChoose(source.getSourceId(), player.getId(), game)) {
player.choose(Outcome.Discard, target, source.getSourceId(), game);

View file

@ -70,7 +70,7 @@ class BloodScrivenerReplacementEffect extends ReplacementEffectImpl {
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Player player = game.getPlayer(event.getPlayerId());
if (player != null) {
player.drawCards(2, game, event.getAppliedEffects());
player.drawCards(2, event.getSourceId(), game, event.getAppliedEffects());
player.loseLife(1, game, false);
}
return true;

View file

@ -73,7 +73,7 @@ class BondersOrnamentEffect extends OneShotEffect {
.noneMatch("Bonder's Ornament"::equals)) {
continue;
}
player.drawCards(1, game);
player.drawCards(1, source.getSourceId(), game);
}
return true;
}

View file

@ -80,7 +80,7 @@ class BountyOfTheLuxaEffect extends OneShotEffect {
if (bountyOfLuxa != null) {
new AddCountersSourceEffect(CounterType.FLOOD.createInstance()).apply(game, source);
}
controller.drawCards(1, game);
controller.drawCards(1, source.getSourceId(), game);
}
return true;
}

View file

@ -67,7 +67,7 @@ class BrainPryEffect extends OneShotEffect {
}
}
if (!hasDiscarded) {
controller.drawCards(1, game);
controller.drawCards(1, source.getSourceId(), game);
}
controller.lookAtCards(sourceObject.getName() + " Hand", targetPlayer.getHand(), game);
}

View file

@ -68,7 +68,7 @@ class BreathstealersCryptEffect extends ReplacementEffectImpl {
Player player = game.getPlayer(event.getPlayerId());
if (player != null) {
Cards oldHand = player.getHand().copy();
if (player.drawCards(1, game, event.getAppliedEffects()) > 0) {
if (player.drawCards(1, event.getSourceId(), game, event.getAppliedEffects()) > 0) {
Cards drawnCards = player.getHand().copy();
drawnCards.removeAll(oldHand);
player.revealCards(source, "The card drawn from " + player.getName() + "'s library.", drawnCards, game);

View file

@ -80,7 +80,7 @@ class BrowbeatDrawEffect extends OneShotEffect {
if (targetPlayer != null) {
Player player = game.getPlayer(targetPlayer);
if (player != null) {
player.drawCards(3, game);
player.drawCards(3, source.getSourceId(), game);
}
}
}

View file

@ -98,6 +98,6 @@ class BushmeatPoacherEffect extends OneShotEffect {
if (amount > 0) {
player.gainLife(amount, game, source);
}
return player.drawCards(1, game) > 0;
return player.drawCards(1, source.getSourceId(), game) > 0;
}
}

View file

@ -67,7 +67,7 @@ class CallToHeelEffect extends OneShotEffect {
if (permanent != null) {
Player controller = game.getPlayer(permanent.getControllerId());
if (controller != null) {
controller.drawCards(1, game);
controller.drawCards(1, source.getSourceId(), game);
return true;
}
}

View file

@ -67,7 +67,7 @@ class CamaraderieEffect extends OneShotEffect {
source.getSourceId(), source.getControllerId(), game
);
player.gainLife(xValue, game, source);
player.drawCards(xValue, game);
player.drawCards(xValue, source.getSourceId(), game);
game.addEffect(new BoostControlledEffect(1, 1, Duration.EndOfTurn), source);
return true;
}

View file

@ -109,7 +109,7 @@ class CavalierOfFlameEffect extends OneShotEffect {
.map(uuid -> game.getCard(uuid))
.mapToInt(card -> card != null && player.discard(card, source, game) ? 1 : 0)
.sum();
player.drawCards(counter, game);
player.drawCards(counter, source.getSourceId(), game);
}
return true;
}

View file

@ -64,7 +64,7 @@ class CemeteryRecruitmentEffect extends OneShotEffect {
if (card != null) {
if (controller.moveCards(card, Zone.HAND, source, game)
&& card.hasSubtype(SubType.ZOMBIE, game)) {
controller.drawCards(1, game);
controller.drawCards(1, source.getSourceId(), game);
}
}
return true;

View file

@ -112,7 +112,7 @@ class ChandraDrawEffect extends OneShotEffect {
for (Card card : cardsInHand) {
player.discard(card, source, game);
}
player.drawCards(amount + 1, game);
player.drawCards(amount + 1, source.getSourceId(), game);
return true;
}
return false;

View file

@ -84,7 +84,7 @@ class ChandrasDefeatEffect extends OneShotEffect {
if (filter.match(permanent, game) && controller != null
&& controller.chooseUse(outcome, "Discard a card and draw a card?", source, game)) {
controller.discard(1, false, source, game);
controller.drawCards(1, game);
controller.drawCards(1, source.getSourceId(), game);
}
return true;
}

View file

@ -67,7 +67,7 @@ class ChanneledForceEffect extends OneShotEffect {
}
Player player = game.getPlayer(source.getTargets().get(0).getFirstTarget());
if (player != null) {
player.drawCards(xValue, game);
player.drawCards(xValue, source.getSourceId(), game);
}
game.damagePlayerOrPlaneswalker(
source.getTargets().get(1).getFirstTarget(), xValue,

View file

@ -75,7 +75,7 @@ class ChroniclerOfHeroesEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
if (new PermanentsOnTheBattlefieldCondition(filter).apply(game, source)) {
controller.drawCards(1, game);
controller.drawCards(1, source.getSourceId(), game);
}
return true;
}

View file

@ -16,13 +16,10 @@ import mage.cards.h.HomicidalBruteWatcher;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Outcome;
import mage.constants.WatcherScope;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.watchers.Watcher;
/**
* @author nantuko
@ -77,7 +74,7 @@ class CivilizedScholarEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
player.drawCards(1, game);
player.drawCards(1, source.getSourceId(), game);
Card card = player.discardOne(false, source, game);
if (card != null && card.isCreature()) {
Permanent permanent = game.getPermanent(source.getSourceId());

View file

@ -114,7 +114,7 @@ class ClackbridgeTrollEffect extends OneShotEffect {
sourcePerm.tap(game);
}
controller.gainLife(3, game, source);
controller.drawCards(1, game);
controller.drawCards(1, source.getSourceId(), game);
}
return true;
}

View file

@ -72,7 +72,7 @@ class ClingToDustEffect extends OneShotEffect {
if (isCreature) {
player.gainLife(3, game, source);
} else {
player.drawCards(1, game);
player.drawCards(1, source.getSourceId(), game);
}
return true;
}

View file

@ -69,7 +69,7 @@ class CoercedConfessionMillEffect extends OneShotEffect {
if (foundCreatures > 0) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
controller.drawCards(foundCreatures, game);
controller.drawCards(foundCreatures, source.getSourceId(), game);
}
}
return true;

View file

@ -77,7 +77,7 @@ class CoercivePortalEffect extends OneShotEffect {
new SacrificeSourceEffect().apply(game, source);
new DestroyAllEffect(new FilterNonlandPermanent()).apply(game, source);
} else {
controller.drawCards(1, game);
controller.drawCards(1, source.getSourceId(), game);
}
return true;
}

View file

@ -68,7 +68,7 @@ class ColdEyeSelkieEffect extends OneShotEffect {
if (amount > 0) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
controller.drawCards(amount, game);
controller.drawCards(amount, source.getSourceId(), game);
return true;
}
}

View file

@ -95,7 +95,7 @@ class CollectiveDefianceEffect extends OneShotEffect {
for (Card card : targetPlayer.getHand().getCards(game)) {
targetPlayer.discard(card, source, game);
}
targetPlayer.drawCards(count, game);
targetPlayer.drawCards(count, source.getSourceId(), game);
return true;
}
return false;

View file

@ -60,7 +60,7 @@ class CommenceTheEndgameEffect extends OneShotEffect {
if (player == null) {
return false;
}
player.drawCards(2, game);
player.drawCards(2, source.getSourceId(), game);
return new AmassEffect(player.getHand().size()).apply(game, source);
}
}

View file

@ -64,7 +64,7 @@ class ConchHornEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
player.drawCards(2, game);
player.drawCards(2, source.getSourceId(), game);
putOnLibrary(player, source, game);
return true;
}

View file

@ -74,12 +74,12 @@ class CovenantOfMindsEffect extends OneShotEffect {
player.moveCards(cards, Zone.HAND, source, game);
} else {
player.moveCards(cards, Zone.GRAVEYARD, source, game);
player.drawCards(5, game);
player.drawCards(5, source.getSourceId(), game);
}
} else {
if (!opponent.chooseUse(Outcome.Benefit, player.getLogName() + "'s library is empty? Do you want them to draw five cards?", source, game)) {
player.drawCards(5, game);
player.drawCards(5, source.getSourceId(), game);
}
}

View file

@ -71,7 +71,7 @@ class CranialArchiveEffect extends OneShotEffect {
}
targetPlayer.shuffleLibrary(source, game);
}
controller.drawCards(1, game);
controller.drawCards(1, source.getSourceId(), game);
return true;
}
return false;

View file

@ -79,7 +79,7 @@ class CreditVoucherEffect extends OneShotEffect {
}
controller.shuffleLibrary(source, game);
if (amountShuffled > 0) {
controller.drawCards(amountShuffled, game);
controller.drawCards(amountShuffled, source.getSourceId(), game);
}
return true;
}

View file

@ -66,7 +66,7 @@ class CullingDaisEffect extends OneShotEffect {
Player player = game.getPlayer(source.getControllerId());
if (p != null && player != null) {
int count = p.getCounters(game).getCount(CounterType.CHARGE);
player.drawCards(count, game);
player.drawCards(count, source.getSourceId(), game);
return true;
}
return false;

View file

@ -115,7 +115,7 @@ class CurseOfChaosEffect extends OneShotEffect {
if (attacker != null) {
if (!attacker.getHand().isEmpty() && attacker.chooseUse(outcome, "Discard a card and draw a card?", source, game)) {
attacker.discard(1, false, source, game);
attacker.drawCards(1, game);
attacker.drawCards(1, source.getSourceId(), game);
}
return true;
}

View file

@ -157,7 +157,7 @@ class CurseOfVengeanceDrawLifeEffect extends OneShotEffect {
Permanent sourceObject = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (sourceObject != null && controller != null) {
if (sourceObject.getCounters(game).containsKey(CounterType.SPITE)) {
controller.drawCards(sourceObject.getCounters(game).getCount(CounterType.SPITE), game);
controller.drawCards(sourceObject.getCounters(game).getCount(CounterType.SPITE), source.getSourceId(), game);
controller.gainLife(sourceObject.getCounters(game).getCount(CounterType.SPITE), game, source);
}
return true;

View file

@ -52,7 +52,7 @@ class DamnablePactEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source));
if (targetPlayer != null) {
targetPlayer.drawCards(source.getManaCostsToPay().getX(), game);
targetPlayer.drawCards(source.getManaCostsToPay().getX(), source.getSourceId(), game);
targetPlayer.loseLife(source.getManaCostsToPay().getX(), game, false);
return true;
}

View file

@ -79,7 +79,7 @@ class DaredevilDragsterEffect extends OneShotEffect {
permanent.addCounters(CounterType.VELOCITY.createInstance(), source, game);
if (permanent.getCounters(game).getCount(CounterType.VELOCITY) >= 2) {
permanent.sacrifice(source.getSourceId(), game);
controller.drawCards(2, game);
controller.drawCards(2, source.getSourceId(), game);
}
return true;
}

View file

@ -101,7 +101,7 @@ class DarettiDiscardDrawEffect extends OneShotEffect {
count++;
}
}
controller.drawCards(count, game);
controller.drawCards(count, source.getSourceId(), game);
return true;
}
return false;

View file

@ -5,7 +5,6 @@ import java.util.LinkedHashMap;
import java.util.Map;
import java.util.UUID;
import com.j256.ormlite.stmt.query.In;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
@ -72,7 +71,7 @@ class DarkDealEffect extends OneShotEffect {
for (Map.Entry<UUID, Integer> toDrawByPlayer : cardsToDraw.entrySet()) {
Player player = game.getPlayer(toDrawByPlayer.getKey());
if (player != null) {
player.drawCards(toDrawByPlayer.getValue(), game);
player.drawCards(toDrawByPlayer.getValue(), source.getSourceId(), game);
}
}
return true;

View file

@ -128,7 +128,7 @@ class DarkIntimationsEffect extends OneShotEffect {
}
controller.moveCards(card, Zone.HAND, source, game);
}
controller.drawCards(1, game);
controller.drawCards(1, source.getSourceId(), game);
return true;
}
}

View file

@ -73,7 +73,7 @@ class DecreeOfPainEffect extends OneShotEffect {
}
}
if (destroyedCreature > 0) {
controller.drawCards(destroyedCreature, game);
controller.drawCards(destroyedCreature, source.getSourceId(), game);
}
return true;
}

View file

@ -62,7 +62,7 @@ class DesperateRavingsEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
player.drawCards(2, game);
player.drawCards(2, source.getSourceId(), game);
Cards hand = player.getHand();
Card card = hand.getRandom(game);
player.discard(card, source, game);

View file

@ -72,7 +72,7 @@ class DiminishingReturnsEffect extends OneShotEffect {
Player player = game.getPlayer(playerId);
if (player != null) {
int cardsToDrawCount = player.getAmount(0, 7, "How many cards to draw (up to 7)?", game);
player.drawCards(cardsToDrawCount, game);
player.drawCards(cardsToDrawCount, source.getSourceId(), game);
}
}
}

View file

@ -59,7 +59,7 @@ class DimirCutpurseEffect extends OneShotEffect {
damagedPlayer.discard(1, false,source, game);
}
if (you != null) {
you.drawCards(1, game);
you.drawCards(1, source.getSourceId(), game);
}
return true;
}

View file

@ -75,7 +75,7 @@ class DiscipleOfBolasEffect extends OneShotEffect {
sacrificed.sacrifice(source.getSourceId(), game);
int power = sacrificed.getPower().getValue();
controller.gainLife(power, game, source);
controller.drawCards(power, game);
controller.drawCards(power, source.getSourceId(), game);
}
}
return true;

View file

@ -85,7 +85,7 @@ class DistantMemoriesEffect extends OneShotEffect {
if (putInHand) {
controller.moveCards(card, Zone.HAND, source, game);
} else {
controller.drawCards(3, game);
controller.drawCards(3, source.getSourceId(), game);
}
return true;
}

View file

@ -64,8 +64,8 @@ class DivinerSpiritEffect extends OneShotEffect {
if (sourceController != null && damagedPlayer != null) {
int amount = (Integer) getValue("damage");
if (amount > 0) {
sourceController.drawCards(amount, game);
damagedPlayer.drawCards(amount, game);
sourceController.drawCards(amount, source.getSourceId(), game);
damagedPlayer.drawCards(amount, source.getSourceId(), game);
return true;
}
}

View file

@ -84,7 +84,7 @@ class DivinersLockboxEffect extends OneShotEffect {
player.revealCards(source, new CardsImpl(card), game);
if (choice.getChoice().equals(card.getName())) {
sacEffect.apply(game, source);
player.drawCards(3, game);
player.drawCards(3, source.getSourceId(), game);
}
return true;
}

View file

@ -96,7 +96,7 @@ class DoomForetoldEffect extends OneShotEffect {
}
player.discard(1, false, source, game);
player.loseLife(2, game, false);
controller.drawCards(1, game);
controller.drawCards(1, source.getSourceId(), game);
controller.gainLife(2, game, source);
effect1.apply(game, source);
effect2.apply(game, source);

View file

@ -51,7 +51,7 @@ class DrasticRevelationEffect extends OneShotEffect {
Player you = game.getPlayer(source.getControllerId());
if (you != null) {
you.discard(you.getHand().size(), false, source, game);
you.drawCards(7, game);
you.drawCards(7, source.getSourceId(), game);
Cards hand = you.getHand();
for (int i = 0; i < 3; i++) {
Card card = hand.getRandom(game);

View file

@ -58,7 +58,7 @@ class DreamCacheEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
controller.drawCards(3, game);
controller.drawCards(3, source.getSourceId(), game);
boolean putOnTop = controller.chooseUse(Outcome.Neutral, "Put cards on top?", source, game);
TargetCardInHand target = new TargetCardInHand(2, 2, new FilterCard());
controller.chooseTarget(Outcome.Detriment, target, source, game);

View file

@ -70,7 +70,7 @@ class DreamFractureEffect extends OneShotEffect {
countered = true;
}
if (controller != null) {
controller.drawCards(1, game);
controller.drawCards(1, source.getSourceId(), game);
}
return countered;
}

View file

@ -3,7 +3,6 @@ package mage.cards.d;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
@ -97,7 +96,7 @@ class DreamSalvageEffect extends OneShotEffect {
&& controller != null
&& watcher != null
&& watcher.getAmountCardsDiscarded(targetOpponent.getId()) > 0) {
controller.drawCards(watcher.getAmountCardsDiscarded(targetOpponent.getId()), game);
controller.drawCards(watcher.getAmountCardsDiscarded(targetOpponent.getId()), source.getSourceId(), game);
return true;
}
return false;

View file

@ -67,7 +67,7 @@ class ExcavationEffect extends OneShotEffect {
if (source instanceof ActivatedAbilityImpl) {
Player activator = game.getPlayer(((ActivatedAbilityImpl) source).getActivatorId());
if (activator != null) {
activator.drawCards(1, game);
activator.drawCards(1, source.getSourceId(), game);
return true;
}

View file

@ -85,7 +85,7 @@ class ExplosionEffect extends OneShotEffect {
effect.apply(game, source);
Player player = game.getPlayer(source.getTargets().get(1).getFirstTarget());
if (player != null) {
player.drawCards(xValue, game);
player.drawCards(xValue, source.getSourceId(), game);
}
return true;
}

View file

@ -71,7 +71,7 @@ class FaadiyahSeerEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Card card = controller.getLibrary().getFromTop(game);
controller.drawCards(1, game);
controller.drawCards(1, source.getSourceId(), game);
controller.revealCards("Fa'adiyah Seer", new CardsImpl(card), game);
if (!filter.match(card, game)) {
controller.discard(card, source, game);

View file

@ -67,7 +67,7 @@ class FatalLoreEffect extends OneShotEffect {
if (controller != null
&& chosenOpponent != null) {
if (chosenOpponent.chooseUse(Outcome.Neutral, "If you choose Yes, the controller draws three cards. If no, the controller gets to destroy up to two target creatures that you control and you get to draw up to 3 cards. Those creatures can't be regenerated.", source, game)) {
controller.drawCards(3, game);
controller.drawCards(3, source.getSourceId(), game);
} else {
FilterCreaturePermanent filter = new FilterCreaturePermanent("chosen opponent's creature");
filter.add(new ControllerIdPredicate(chosenOpponent.getId()));

View file

@ -60,7 +60,7 @@ class FecundityEffect extends OneShotEffect {
Player controller = game.getPlayer(permanent.getControllerId());
if (controller != null) {
if (controller.chooseUse(outcome, "Draw a card?", source, game)) {
controller.drawCards(1, game);
controller.drawCards(1, source.getSourceId(), game);
}
return true;
}

View file

@ -54,7 +54,7 @@ class FeveredVisionsEffect extends OneShotEffect {
UUID activePlayerId = game.getActivePlayerId();
Player player = game.getPlayer(activePlayerId);
if (controller != null && player != null) {
player.drawCards(1, game);
player.drawCards(1, source.getSourceId(), game);
Set<UUID> opponents = game.getOpponents(source.getControllerId());
if (opponents.contains(player.getId()) && player.getHand().size() > 3) {
player.damage(2, source.getSourceId(), game);

View file

@ -81,7 +81,7 @@ class FieryGambitEffect extends OneShotEffect {
new DamagePlayersEffect(6, TargetController.OPPONENT).apply(game, source);
}
if (flipsWon > 2) {
controller.drawCards(9, game);
controller.drawCards(9, source.getSourceId(), game);
new UntapAllLandsControllerEffect().apply(game, source);
}
} else {

View file

@ -63,7 +63,7 @@ class FiligreeFractureEffect extends OneShotEffect {
permanent.destroy(source.getSourceId(), game, true);
game.applyEffects();
if (permanent.getColor(game).isBlack() || permanent.getColor(game).isBlue()) {
player.drawCards(1, game);
player.drawCards(1, source.getSourceId(), game);
}
return true;
}

View file

@ -66,11 +66,11 @@ class FinaleOfRevelationEffect extends OneShotEffect {
int xValue = source.getManaCostsToPay().getX();
if (xValue < 10) {
player.drawCards(xValue, game);
player.drawCards(xValue, source.getSourceId(), game);
} else {
player.putCardsOnTopOfLibrary(player.getGraveyard(), game, source, false);
player.shuffleLibrary(source, game);
player.drawCards(xValue, game);
player.drawCards(xValue, source.getSourceId(), game);
new UntapLandsEffect(5).apply(game, source);
game.addEffect(new MaximumHandSizeControllerEffect(
Integer.MAX_VALUE, Duration.EndOfGame,

View file

@ -74,7 +74,7 @@ class FireProphecyEffect extends OneShotEffect {
return false;
}
player.getLibrary().putOnBottom(card, game);
player.drawCards(1, game);
player.drawCards(1, source.getSourceId(), game);
return true;
}
}

View file

@ -61,7 +61,7 @@ class FluxEffect extends OneShotEffect {
if (player != null) {
int numToDiscard = player.getAmount(0, player.getHand().size(), "Discard how many cards?", game);
player.discard(numToDiscard, false, source, game);
player.drawCards(numToDiscard, game);
player.drawCards(numToDiscard, source.getSourceId(), game);
}
}
return true;

View file

@ -73,7 +73,7 @@ class ForeshadowEffect extends OneShotEffect {
if (card != null) {
controller.moveCards(card, Zone.GRAVEYARD, source, game);
if (CardUtil.haveSameNames(card.getName(), cardName)) {
controller.drawCards(1, game);
controller.drawCards(1, source.getSourceId(), game);
}
}
return true;

View file

@ -57,7 +57,7 @@ class ForgetEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player targetPlayer = game.getPlayer(source.getFirstTarget());
if (targetPlayer != null) {
targetPlayer.drawCards(targetPlayer.discard(2, false, source, game).size(), game);
targetPlayer.drawCards(targetPlayer.discard(2, false, source, game).size(), source.getSourceId(), game);
return true;
}
return false;

View file

@ -67,7 +67,7 @@ class ForgottenCreationEffect extends OneShotEffect {
if (controller != null) {
int cardsInHand = controller.getHand().size();
controller.discard(cardsInHand, false, source, game);
controller.drawCards(cardsInHand, game);
controller.drawCards(cardsInHand, source.getSourceId(), game);
return true;
}
return false;

View file

@ -71,7 +71,7 @@ class FruitOfTheFirstTreeEffect extends OneShotEffect {
Permanent creature = (Permanent) getValue("attachedTo");
if (controller != null && creature != null) {
controller.gainLife(creature.getToughness().getValue(), game, source);
controller.drawCards(creature.getToughness().getValue(), game);
controller.drawCards(creature.getToughness().getValue(), source.getSourceId(), game);
return true;
}
return false;

View file

@ -80,7 +80,7 @@ class GarrukPrimalHunterEffect extends OneShotEffect {
amount = p.getPower().getValue();
}
}
player.drawCards(amount, game);
player.drawCards(amount, source.getSourceId(), game);
return true;
}
return false;

View file

@ -58,7 +58,7 @@ class GhastlyDiscoveryEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
controller.drawCards(2, game);
controller.drawCards(2, source.getSourceId(), game);
controller.discard(1, false, source, game);
return true;
}

View file

@ -72,7 +72,7 @@ class TakeEffect extends OneShotEffect {
creature.removeCounters(CounterType.P1P1.getName(), numberCounters, game);
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
controller.drawCards(numberCounters, game);
controller.drawCards(numberCounters, source.getSourceId(), game);
} else {
throw new UnsupportedOperationException("Controller missing");
}

View file

@ -74,7 +74,7 @@ class GlintEyeNephilimEffect extends OneShotEffect {
if (amount > 0) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
controller.drawCards(amount, game);
controller.drawCards(amount, source.getSourceId(), game);
return true;
}
}

View file

@ -79,7 +79,7 @@ class GoblinArtisansEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
if (controller.flipCoin(source, game, true)) {
controller.drawCards(1, game);
controller.drawCards(1, source.getSourceId(), game);
} else {
List<Permanent> artifacts = game.getBattlefield().getActivePermanents(new FilterControlledArtifactPermanent(), source.getControllerId(), game);
if (artifacts.isEmpty()) {//Don't even bother if there is no artifact to 'counter'/sacrifice

View file

@ -96,6 +96,6 @@ class GodEternalBontuEffect extends OneShotEffect {
counter++;
}
}
return player.drawCards(counter, game) > 0;
return player.drawCards(counter, source.getSourceId(), game) > 0;
}
}

View file

@ -137,7 +137,7 @@ class GrandMoffTarkinEffect extends OneShotEffect {
game.informPlayers(player.getLogName() + " pays 2 life to prevent " + targetCreature.getName() + " being destroyed");
Player sourceController = game.getPlayer(source.getControllerId());
if (sourceController != null) {
sourceController.drawCards(1, game);
sourceController.drawCards(1, source.getSourceId(), game);
}
return true;

View file

@ -79,7 +79,7 @@ class GravestormEffect extends OneShotEffect {
if (!opponentExilesACard) {
if (you.chooseUse(Outcome.DrawCard, "Draw a card?", source, game)) {
you.drawCards(1, game);
you.drawCards(1, source.getSourceId(), game);
}
}
return true;

View file

@ -124,7 +124,7 @@ class GrevenPredatorCaptainEffect extends OneShotEffect {
if (!permanent.sacrifice(source.getSourceId(), game)) {
return false;
}
player.drawCards(power, game);
player.drawCards(power, source.getSourceId(), game);
player.loseLife(toughness, game, false);
return true;
}

View file

@ -158,7 +158,7 @@ class GrothamaAllDevouringDrawCardsEffect extends OneShotEffect {
if (player != null) {
int toDraw = damageMap.getOrDefault(player.getId(), 0);
if (toDraw > 0) {
player.drawCards(toDraw, game);
player.drawCards(toDraw, source.getSourceId(), game);
}
}
}

View file

@ -21,7 +21,6 @@ import mage.filter.predicate.permanent.TokenPredicate;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -145,7 +144,7 @@ class GuardianProjectEffect extends OneShotEffect {
if (GuardianProjectTriggeredAbility.checkCondition(
mor.getPermanentOrLKIBattlefield(game), source.getControllerId(), game)
) {
player.drawCards(1, game);
player.drawCards(1, source.getSourceId(), game);
return true;
}
return false;

View file

@ -90,7 +90,7 @@ class GuildSummitEffect extends OneShotEffect {
}
}
if (tappedAmount > 0) {
you.drawCards(tappedAmount, game);
you.drawCards(tappedAmount, source.getSourceId(), game);
return true;
}
return false;

View file

@ -79,7 +79,7 @@ class GwafaHazidProfiteerEffect1 extends OneShotEffect {
Player controller = game.getPlayer(targetCreature.getControllerId());
targetCreature.addCounters(CounterType.BRIBERY.createInstance(), source, game);
if (controller != null) {
controller.drawCards(1, game);
controller.drawCards(1, source.getSourceId(), game);
}
return true;
}

View file

@ -80,7 +80,7 @@ class HappilyEverAfterEffect extends OneShotEffect {
.filter(Objects::nonNull)
.forEachOrdered(player -> {
player.gainLife(5, game, source);
player.drawCards(1, game);
player.drawCards(1, source.getSourceId(), game);
});
return true;
}

View file

@ -67,7 +67,7 @@ class HarborGuardianEffect extends OneShotEffect {
Player defender = game.getPlayer(defenderId);
if (defender != null) {
if (defender.chooseUse(outcome, "Draw a card?", source, game)) {
defender.drawCards(1, game);
defender.drawCards(1, source.getSourceId(), game);
}
}
return false;

View file

@ -57,7 +57,7 @@ class HeartwarmingRedemptionEffect extends OneShotEffect {
return false;
}
int discarded = player.discard(player.getHand().size(), false, source, game).size();
player.drawCards(discarded + 1, game);
player.drawCards(discarded + 1, source.getSourceId(), game);
player.gainLife(player.getHand().size(), game, source);
return true;
}

View file

@ -106,7 +106,7 @@ class HeartwoodStorytellerEffect extends OneShotEffect {
Player player = game.getPlayer(playerId);
if (player != null) {
if (player.chooseUse(outcome, "Draw a card?", source, game)) {
player.drawCards(1, game);
player.drawCards(1, source.getSourceId(), game);
}
}
}

View file

@ -57,7 +57,7 @@ public final class HeedTheMists extends CardImpl {
if (card != null) {
int cmc = card.getConvertedManaCost();
controller.moveCards(card, Zone.GRAVEYARD, source, game);
controller.drawCards(cmc, game);
controller.drawCards(cmc, source.getSourceId(), game);
}
}
return result;

Some files were not shown because too many files have changed in this diff Show more