This commit is contained in:
jeffwadsworth 2020-08-10 09:11:30 -05:00
parent 82e560f2ff
commit 3f4475a136

View file

@ -1,4 +1,3 @@
package mage.cards.u;
import java.util.UUID;
@ -30,7 +29,7 @@ import mage.target.TargetPlayer;
public final class UrzasBauble extends CardImpl {
public UrzasBauble(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{0}");
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{0}");
// {tap}, Sacrifice Urza's Bauble: Look at a card at random in target player's hand. You draw a card at the beginning of the next turn's upkeep.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new LookAtRandomCardEffect(), new TapSourceCost());
@ -39,7 +38,6 @@ public final class UrzasBauble extends CardImpl {
ability.addEffect(new CreateDelayedTriggeredAbilityEffect(new AtTheBeginOfNextUpkeepDelayedTriggeredAbility(new DrawCardSourceControllerEffect(1)), false));
this.addAbility(ability);
}
public UrzasBauble(final UrzasBauble card) {
super(card);
@ -57,7 +55,7 @@ class LookAtRandomCardEffect extends OneShotEffect {
super(Outcome.Benefit);
this.staticText = "Look at a card at random in target player's hand";
}
public LookAtRandomCardEffect(final LookAtRandomCardEffect effect) {
super(effect);
}
@ -66,23 +64,25 @@ class LookAtRandomCardEffect extends OneShotEffect {
public LookAtRandomCardEffect copy() {
return new LookAtRandomCardEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player you = game.getPlayer(source.getControllerId());
Player controller = game.getPlayer(source.getControllerId());
Player targetPlayer = game.getPlayer(source.getFirstTarget());
MageObject sourceObject = game.getObject(source.getSourceId());
if (you != null && targetPlayer != null && sourceObject != null) {
if(!targetPlayer.getHand().isEmpty())
{
if (controller != null
&& targetPlayer != null
&& sourceObject != null) {
if (!targetPlayer.getHand().isEmpty()) {
Cards randomCard = new CardsImpl();
Card card = targetPlayer.getHand().getRandom(game);
randomCard.add(card);
you.lookAtCards(sourceObject.getName(), randomCard, game);
controller.lookAtCards(sourceObject.getName(), randomCard, game);
game.informPlayer(targetPlayer, "The random card from your hand shown to " + controller.getName() + " is " + card.getName());
}
return true;
}
return false;
}
}