mirror of
https://github.com/correl/mage.git
synced 2025-04-01 01:05:52 -09:00
* Augur of Bolas - Fixed that the effect to reveal and put a card to hand was not optional.
This commit is contained in:
parent
fe7dbcb5c2
commit
4c0473a3c9
2 changed files with 77 additions and 15 deletions
Mage.Sets/src/mage/sets/magic2013
Mage/src/mage/abilities/effects/common/continuous
|
@ -28,16 +28,27 @@
|
|||
package mage.sets.magic2013;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.common.FilterInstantOrSorceryCard;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.TargetCard;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -46,6 +57,7 @@ import mage.filter.predicate.mageobject.CardTypePredicate;
|
|||
public class AugurOfBolas extends CardImpl {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("an instant or sorcery card");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.or(new CardTypePredicate(CardType.INSTANT), new CardTypePredicate(CardType.SORCERY)));
|
||||
}
|
||||
|
@ -60,7 +72,7 @@ public class AugurOfBolas extends CardImpl {
|
|||
this.toughness = new MageInt(3);
|
||||
|
||||
// When Augur of Bolas enters the battlefield, look at the top three cards of your library. You may reveal an instant or sorcery card from among them and put it into your hand. Put the rest on the bottom of your library in any order.
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new LookLibraryAndPickControllerEffect(new StaticValue(3), false, new StaticValue(1), filter, false, true)));
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new AugurOfBolasEffect()));
|
||||
}
|
||||
|
||||
public AugurOfBolas(final AugurOfBolas card) {
|
||||
|
@ -72,3 +84,54 @@ public class AugurOfBolas extends CardImpl {
|
|||
return new AugurOfBolas(this);
|
||||
}
|
||||
}
|
||||
|
||||
class AugurOfBolasEffect extends OneShotEffect {
|
||||
|
||||
public AugurOfBolasEffect() {
|
||||
super(Outcome.DrawCard);
|
||||
this.staticText = "look at the top three cards of your library. You may reveal an instant or sorcery card from among them and put it into your hand. Put the rest on the bottom of your library in any order";
|
||||
}
|
||||
|
||||
public AugurOfBolasEffect(final AugurOfBolasEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AugurOfBolasEffect copy() {
|
||||
return new AugurOfBolasEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if (controller != null && sourceObject != null) {
|
||||
Cards topCards = new CardsImpl();
|
||||
topCards.addAll(controller.getLibrary().getTopCards(game, 3));
|
||||
if (!topCards.isEmpty()) {
|
||||
controller.lookAtCards(sourceObject.getIdName(), topCards, game);
|
||||
int number = topCards.count(new FilterInstantOrSorceryCard(), source.getSourceId(), source.getControllerId(), game);
|
||||
if (number > 0) {
|
||||
if (controller.chooseUse(outcome, "Reveal an instant or sorcery card from the looked at cards and put it into your hand?", source, game)) {
|
||||
Card card = null;
|
||||
if (number == 1) {
|
||||
card = topCards.getCards(new FilterInstantOrSorceryCard(), source.getSourceId(), source.getControllerId(), game).iterator().next();
|
||||
} else {
|
||||
Target target = new TargetCard(Zone.LIBRARY, new FilterInstantOrSorceryCard());
|
||||
controller.chooseTarget(outcome, target, source, game);
|
||||
card = topCards.get(target.getFirstTarget(), game);
|
||||
}
|
||||
if (card != null) {
|
||||
controller.moveCards(card, null, Zone.HAND, source, game);
|
||||
controller.revealCards(sourceObject.getIdName(), new CardsImpl(card), game);
|
||||
topCards.remove(card);
|
||||
}
|
||||
}
|
||||
controller.putCardsOnBottomOfLibrary(topCards, game, source, true);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.abilities.effects.common.continuous;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -53,8 +52,6 @@ import mage.players.Player;
|
|||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
||||
|
||||
public class BecomesBasicLandTargetEffect extends ContinuousEffectImpl {
|
||||
|
||||
protected boolean chooseLandType;
|
||||
|
@ -98,6 +95,7 @@ public class BecomesBasicLandTargetEffect extends ContinuousEffectImpl {
|
|||
public BecomesBasicLandTargetEffect copy() {
|
||||
return new BecomesBasicLandTargetEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Ability source, Game game) {
|
||||
super.init(source, game);
|
||||
|
@ -113,12 +111,12 @@ public class BecomesBasicLandTargetEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
}
|
||||
|
||||
if(!loseOther) {
|
||||
if (!loseOther) {
|
||||
for (UUID targetPermanent : targetPointer.getTargets(game, source)) {
|
||||
Permanent land = game.getPermanent(targetPermanent);
|
||||
if (land != null) {
|
||||
for(String type : land.getSubtype()) {
|
||||
if(!landTypes.contains(type)) {
|
||||
for (String type : land.getSubtype()) {
|
||||
if (!landTypes.contains(type)) {
|
||||
landTypes.add(type);
|
||||
}
|
||||
}
|
||||
|
@ -135,7 +133,7 @@ public class BecomesBasicLandTargetEffect extends ContinuousEffectImpl {
|
|||
switch (layer) {
|
||||
case AbilityAddingRemovingEffects_6:
|
||||
land.removeAllAbilities(source.getSourceId(), game);
|
||||
for (String landType : landTypes) {
|
||||
for (String landType : landTypes) {
|
||||
switch (landType) {
|
||||
case "Swamp":
|
||||
land.addAbility(new BlackManaAbility(), source.getSourceId(), game);
|
||||
|
@ -156,6 +154,7 @@ public class BecomesBasicLandTargetEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
break;
|
||||
case TypeChangingEffects_4:
|
||||
// Attention: Cards like Unstable Frontier that use this class do not give the "Basic" supertype to the target
|
||||
if (!land.getCardType().contains(CardType.LAND)) {
|
||||
land.getCardType().add(CardType.LAND);
|
||||
}
|
||||
|
@ -180,8 +179,8 @@ public class BecomesBasicLandTargetEffect extends ContinuousEffectImpl {
|
|||
} else {
|
||||
sb.append("Target land becomes a ");
|
||||
int i = 1;
|
||||
for (String landType : landTypes) {
|
||||
if (i >1) {
|
||||
for (String landType : landTypes) {
|
||||
if (i > 1) {
|
||||
if (i == landTypes.size()) {
|
||||
sb.append(" and ");
|
||||
} else {
|
||||
|
@ -193,7 +192,7 @@ public class BecomesBasicLandTargetEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
}
|
||||
if (!duration.toString().isEmpty() && !duration.equals(Duration.EndOfGame)) {
|
||||
sb.append(" ").append(duration.toString());
|
||||
sb.append(" ").append(duration.toString());
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue