Merge origin/master

This commit is contained in:
fireshoes 2015-08-16 23:17:16 -05:00
commit 6d4c112164
22 changed files with 390 additions and 223 deletions

View file

@ -152,6 +152,9 @@ public class CardsView extends LinkedHashMap<UUID, CardView> {
for (UUID uuid : abilityTargets) {
MageObject mageObject = game.getObject(uuid);
if (mageObject != null) {
if ((mageObject instanceof Card) && ((Card) mageObject).isFaceDown(game)) {
continue;
}
names.add(GameLog.getColoredObjectIdNameForTooltip(mageObject));
}
}

View file

@ -74,6 +74,7 @@ import mage.abilities.mana.ManaAbility;
import mage.abilities.mana.ManaOptions;
import mage.cards.Card;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.cards.decks.Deck;
import mage.cards.repository.CardCriteria;
import mage.cards.repository.CardInfo;
@ -161,7 +162,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
private transient final static Logger log = Logger.getLogger(ComputerPlayer.class);
protected int PASSIVITY_PENALTY = 5; // Penalty value for doing nothing if some actions are availble
protected boolean ALLOW_INTERRUPT = true; // change this for test / debugging purposes to false to switch off interrupts while debugging
protected boolean ALLOW_INTERRUPT = true; // change this for test / debugging purposes to false to switch off interrupts while debugging
private transient Map<Mana, Card> unplayable = new TreeMap<>();
private transient List<Card> playableNonInstant = new ArrayList<>();
@ -522,8 +523,11 @@ public class ComputerPlayer extends PlayerImpl implements Player {
}
if (target instanceof TargetDiscard || target instanceof TargetCardInHand) {
if (outcome.isGood()) {
ArrayList<Card> cardsInHand = new ArrayList<>(hand.getCards(game));
while (!target.isChosen() && !cardsInHand.isEmpty() && target.getMaxNumberOfTargets() > target.getTargets().size()) {
Cards cards = new CardsImpl(target.possibleTargets(source.getSourceId(), getId(), game));
ArrayList<Card> cardsInHand = new ArrayList<>(cards.getCards(game));
while (!target.isChosen()
&& target.possibleTargets(source.getSourceId(), getId(), game).size() > 0
&& target.getMaxNumberOfTargets() > target.getTargets().size()) {
Card card = pickBestCard(cardsInHand, null, target, source, game);
if (card != null) {
if (target.canTarget(getId(), card.getId(), source, game)) {
@ -684,17 +688,6 @@ public class ComputerPlayer extends PlayerImpl implements Player {
}
return target.isChosen();
}
if (target instanceof TargetCardInHand) {
List<Card> cards = new ArrayList<>();
cards.addAll(this.hand.getCards(game));
while (!target.isChosen() && !cards.isEmpty()) {
Card pick = pickTarget(cards, outcome, target, source, game);
if (pick != null) {
target.addTarget(pick.getId(), source, game);
}
}
return target.isChosen();
}
if (target instanceof TargetSpell) {
if (game.getStack().size() > 0) {
Iterator<StackObject> it = game.getStack().iterator();

View file

@ -8,6 +8,7 @@ package mage.sets.antiquities;
import java.util.UUID;
import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.ActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
@ -32,48 +33,46 @@ import mage.util.CardUtil;
* @author nick.myers
*/
public class PowerArtifact extends CardImpl {
public PowerArtifact(UUID ownerId) {
super(ownerId, 55, "Power Artifact", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{U}{U}");
this.expansionSetCode = "ATQ";
this.subtype.add("Aura");
// Enchant artifact
TargetPermanent auraTarget = new TargetArtifactPermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.Benefit));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// The activation cost of target artifact is reduced by {2}. If this would reduce target
// artifact's activation cost below {1}, target artifact's activation cost becomes {1}.
// Power Artifact has no effect on artifacts that have no activation cost or whose activation
// cost is {0}.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PowerArtifactCostModificationEffect()));
// Enchanted artifact's activated abilities cost less to activate.
// This effect can't reduce the amount of mana an ability costs to activate to less than one mana.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PowerArtifactCostModificationEffect()));
}
public PowerArtifact(final PowerArtifact card) {
super(card);
}
@Override
public PowerArtifact copy() {
return new PowerArtifact(this);
}
}
}
class PowerArtifactCostModificationEffect extends CostModificationEffectImpl {
PowerArtifactCostModificationEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.REDUCE_COST);
staticText = "The activation cost of target artifact is reduced by {2}. If this would reduce target artifact's activation cost below {1}, target artifact's activation cost becomes {1}. Power artifact has no effect on artifacts that have no activation cost or whose activation cost is {0}.";
}
PowerArtifactCostModificationEffect(PowerArtifactCostModificationEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source, Ability abilityToModify) {
Player controller = game.getPlayer(abilityToModify.getControllerId());
@ -90,21 +89,22 @@ class PowerArtifactCostModificationEffect extends CostModificationEffectImpl {
}
return true;
}
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
Permanent artifact = game.getPermanent(abilityToModify.getSourceId());
if (artifact != null && artifact.getAttachments().contains(source.getSourceId())) {
if (abilityToModify.getAbilityType().equals(AbilityType.ACTIVATED)) {
if (abilityToModify.getAbilityType().equals(AbilityType.ACTIVATED)
|| (abilityToModify.getAbilityType().equals(AbilityType.MANA) && (abilityToModify instanceof ActivatedAbility))) {
return true;
}
}
return false;
}
@Override
@Override
public PowerArtifactCostModificationEffect copy() {
return new PowerArtifactCostModificationEffect(this);
}
}

View file

@ -29,19 +29,22 @@ package mage.sets.bornofthegods;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.SourceHasSubtypeCondition;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.BoostEnchantedEffect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.keyword.BestowAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
@ -60,12 +63,7 @@ public class EverflameEidolon extends CardImpl {
// Bestow {2}{R}
this.addAbility(new BestowAbility(this, "{2}{R}"));
// {R}: Everflame Eidolon gets +1/+0 until end of turn. If it's an Aura, enchanted creature gets +1/+0 until end of turn instead.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(
new BoostEnchantedEffect(1, 0, Duration.EndOfTurn),
new BoostSourceEffect(1, 0, Duration.EndOfTurn),
new SourceHasSubtypeCondition("Aura"),
"{this} gets +1/+0 until end of turn. If it's an Aura, enchanted creature gets +1/+0 until end of turn instead"),
new ManaCostsImpl("{R}")));
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new EverflameEidolonEffect(), new ManaCostsImpl("{R}")));
// Enchanted creature gets +1/+1.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(1, 1, Duration.WhileOnBattlefield)));
}
@ -79,3 +77,34 @@ public class EverflameEidolon extends CardImpl {
return new EverflameEidolon(this);
}
}
class EverflameEidolonEffect extends OneShotEffect {
public EverflameEidolonEffect() {
super(Outcome.BoostCreature);
this.staticText = "{this} gets +1/+0 until end of turn. If it's an Aura, enchanted creature gets +1/+0 until end of turn instead";
}
public EverflameEidolonEffect(final EverflameEidolonEffect effect) {
super(effect);
}
@Override
public EverflameEidolonEffect copy() {
return new EverflameEidolonEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent sourceObject = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (sourceObject != null) {
if (sourceObject.getSubtype().contains("Aura")) {
new BoostEnchantedEffect(1, 0, Duration.EndOfTurn).apply(game, source);
} else {
game.addEffect(new BoostSourceEffect(1, 0, Duration.EndOfTurn), source);
}
return true;
}
return false;
}
}

View file

@ -60,7 +60,7 @@ import mage.watchers.Watcher;
*
*/
public class GroundlingPouncer extends CardImpl {
private String rule = "{this} gets +1/+3 and gains flying until end of turn. Activate this ability only once each turn and only if an opponent controls a creature with flying.";
public GroundlingPouncer(UUID ownerId) {
@ -118,7 +118,7 @@ class GroundingPouncerCondition implements Condition {
class ActivatedAbilityUsedThisTurnWatcher extends Watcher {
public Set<UUID> activatedThisTurn = new HashSet<UUID>();
public Set<UUID> activatedThisTurn = new HashSet<>();
public ActivatedAbilityUsedThisTurnWatcher() {
super("ActivatedAbilityUsedThisTurn", WatcherScope.GAME);
@ -156,4 +156,4 @@ class ActivatedAbilityUsedThisTurnWatcher extends Watcher {
super.reset();
this.activatedThisTurn.clear();
}
}
}

View file

@ -143,10 +143,10 @@ class NecropotenceEffect extends OneShotEffect {
Card card = controller.getLibrary().removeFromTop(game);
if (controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.LIBRARY, false)) {
card.setFaceDown(true, game);
Effect returnToHandeffect = new ReturnToHandTargetEffect(false);
returnToHandeffect.setText("put that face down card into your hand");
returnToHandeffect.setTargetPointer(new FixedTarget(card.getId(), card.getZoneChangeCounter(game)));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(returnToHandeffect, TargetController.YOU);
Effect returnToHandEffect = new ReturnToHandTargetEffect(false);
returnToHandEffect.setText("put that face down card into your hand");
returnToHandEffect.setTargetPointer(new FixedTarget(card.getId(), card.getZoneChangeCounter(game)));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(returnToHandEffect, TargetController.YOU);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);

View file

@ -103,7 +103,7 @@ class VillainousWealthEffect extends OneShotEffect {
if (player != null) {
Cards cardsToExile = new CardsImpl();
cardsToExile.addAll(player.getLibrary().getTopCards(game, source.getManaCostsToPay().getX()));
controller.moveCards(cardsToExile, null, Zone.EXILED, source, game, true);
controller.moveCards(cardsToExile, null, Zone.EXILED, source, game);
if (controller.chooseUse(Outcome.PlayForFree, "Cast cards exiled with " + mageObject.getLogName() + " without paying its mana cost?", source, game)) {
OuterLoop:
while (cardsToExile.count(filter, game) > 0) {

View file

@ -25,12 +25,9 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.magic2012;
import java.util.UUID;
import mage.constants.*;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ColoredManaCost;
@ -38,6 +35,12 @@ import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.continuous.BoostEnchantedEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
@ -47,20 +50,23 @@ import mage.target.common.TargetCreaturePermanent;
*/
public class Firebreathing extends CardImpl {
public Firebreathing (UUID ownerId) {
public Firebreathing(UUID ownerId) {
super(ownerId, 132, "Firebreathing", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{R}");
this.expansionSetCode = "M12";
this.subtype.add("Aura");
// Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.AddAbility));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// {R}: Enchanted creature gets +1/+0 until end of turn.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(1, 0, Duration.EndOfTurn), new ColoredManaCost(ColoredManaSymbol.R)));
}
public Firebreathing (final Firebreathing card) {
public Firebreathing(final Firebreathing card) {
super(card);
}

View file

@ -29,11 +29,8 @@ package mage.sets.ravnica;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.ActivatedAbility;
import mage.abilities.SpellAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.abilities.mana.ManaAbility;
import mage.cards.CardImpl;
import mage.constants.AbilityType;
import mage.constants.CardType;
@ -55,9 +52,8 @@ public class SuppressionField extends CardImpl {
super(ownerId, 31, "Suppression Field", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}");
this.expansionSetCode = "RAV";
// Activated abilities cost {2} more to activate unless they're mana abilities.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SuppressionFieldCostReductionEffect() ));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SuppressionFieldCostReductionEffect()));
}
public SuppressionField(final SuppressionField card) {
@ -72,7 +68,7 @@ public class SuppressionField extends CardImpl {
class SuppressionFieldCostReductionEffect extends CostModificationEffectImpl {
SuppressionFieldCostReductionEffect ( ) {
SuppressionFieldCostReductionEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.INCREASE_COST);
staticText = "Activated abilities cost {2} more to activate unless they're mana abilities";
}
@ -89,10 +85,7 @@ class SuppressionFieldCostReductionEffect extends CostModificationEffectImpl {
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
if (abilityToModify.getAbilityType().equals(AbilityType.ACTIVATED)) {
return true;
}
return false;
return abilityToModify.getAbilityType().equals(AbilityType.ACTIVATED);
}
@Override

View file

@ -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.sets.riseoftheeldrazi;
import java.util.LinkedHashSet;
@ -33,6 +32,7 @@ import java.util.Set;
import java.util.UUID;
import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.ActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.cards.CardImpl;
@ -56,14 +56,14 @@ import mage.util.CardUtil;
*/
public class TrainingGrounds extends CardImpl {
public TrainingGrounds (UUID ownerId) {
public TrainingGrounds(UUID ownerId) {
super(ownerId, 91, "Training Grounds", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{U}");
this.expansionSetCode = "ROE";
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new TrainingGroundsEffect()));
}
public TrainingGrounds (final TrainingGrounds card) {
public TrainingGrounds(final TrainingGrounds card) {
super(card);
}
@ -74,7 +74,7 @@ public class TrainingGrounds extends CardImpl {
}
class TrainingGroundsEffect extends CostModificationEffectImpl {
private static final String effectText = "Activated abilities of creatures you control cost up to {2} less to activate. This effect can't reduce the amount of mana an ability costs to activate to less than one mana";
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent();
@ -90,41 +90,42 @@ class TrainingGroundsEffect extends CostModificationEffectImpl {
@Override
public boolean apply(Game game, Ability source, Ability abilityToModify) {
Player controller = game.getPlayer(abilityToModify.getControllerId());
if (controller != null){
if (controller != null) {
Mana mana = abilityToModify.getManaCostsToPay().getMana();
int reduceMax = mana.getColorless();
if (reduceMax > 0 && mana.count() == mana.getColorless()){
if (reduceMax > 0 && mana.count() == mana.getColorless()) {
reduceMax--;
}
if (reduceMax > 2){
if (reduceMax > 2) {
reduceMax = 2;
}
if (reduceMax > 0) {
ChoiceImpl choice = new ChoiceImpl(true);
Set<String> set = new LinkedHashSet<>();
for(int i = 0; i <= reduceMax; i++){
for (int i = 0; i <= reduceMax; i++) {
set.add(String.valueOf(i));
}
choice.setChoices(set);
choice.setMessage("Reduce ability cost");
if(controller.choose(Outcome.Benefit, choice, game)){
if (controller.choose(Outcome.Benefit, choice, game)) {
int reduce = Integer.parseInt(choice.getChoice());
CardUtil.reduceCost(abilityToModify, reduce);
}
}
return true;
}
return false;
return false;
}
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
if (abilityToModify.getAbilityType().equals(AbilityType.ACTIVATED)) {
if (abilityToModify.getAbilityType().equals(AbilityType.ACTIVATED)
|| (abilityToModify.getAbilityType().equals(AbilityType.MANA) && (abilityToModify instanceof ActivatedAbility))) {
//Activated abilities of creatures you control
Permanent permanent = game.getPermanent(abilityToModify.getSourceId());
if (permanent != null && filter.match(permanent, source.getSourceId(), source.getControllerId(), game)) {
return true;
return true;
}
}
return false;

View file

@ -34,11 +34,9 @@ import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.CardImpl;
import mage.constants.AbilityType;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.Filter;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.BlockingAttackerIdPredicate;
import mage.filter.predicate.permanent.BlockingPredicate;
@ -53,10 +51,13 @@ import mage.target.common.TargetCreaturePermanent;
public class GodosIrregulars extends CardImpl {
private static final FilterCreaturePermanent basicFilter = new FilterCreaturePermanent("creature blocking it");
static {
basicFilter.add(new BlockingPredicate());
}
public UUID originalAbilityIdToAdjust;
public GodosIrregulars(UUID ownerId) {
super(ownerId, 101, "Godo's Irregulars", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{R}");
this.expansionSetCode = "SOK";
@ -69,12 +70,13 @@ public class GodosIrregulars extends CardImpl {
// {R}: Godo's Irregulars deals 1 damage to target creature blocking it.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(1), new ManaCostsImpl("{R"));
ability.addTarget(new TargetCreaturePermanent());
originalAbilityIdToAdjust = ability.getOriginalId();
this.addAbility(ability);
}
@Override
public void adjustTargets(Ability ability, Game game) {
if (ability.getAbilityType().equals(AbilityType.ACTIVATED)) {
if (originalAbilityIdToAdjust.equals(ability.getOriginalId())) {
ability.getTargets().clear();
FilterCreaturePermanent filter = basicFilter.copy();
filter.add(new BlockingAttackerIdPredicate(this.getId()));
@ -85,6 +87,7 @@ public class GodosIrregulars extends CardImpl {
public GodosIrregulars(final GodosIrregulars card) {
super(card);
this.originalAbilityIdToAdjust = card.originalAbilityIdToAdjust;
}
@Override

View file

@ -30,6 +30,7 @@ package mage.sets.stronghold;
import java.util.UUID;
import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.ActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.cards.CardImpl;
@ -99,7 +100,8 @@ class HeartstoneEffect extends CostModificationEffectImpl {
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
if (abilityToModify.getAbilityType().equals(AbilityType.ACTIVATED)) {
if (abilityToModify.getAbilityType().equals(AbilityType.ACTIVATED)
|| (abilityToModify.getAbilityType().equals(AbilityType.MANA) && (abilityToModify instanceof ActivatedAbility))) {
// Activated abilities of creatures
Permanent permanent = game.getPermanent(abilityToModify.getSourceId());
if (permanent != null && filter.match(permanent, source.getSourceId(), source.getControllerId(), game)) {

View file

@ -46,8 +46,8 @@ import mage.filter.predicate.mageobject.NamePredicate;
import mage.filter.predicate.mageobject.SupertypePredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
import mage.target.TargetPlayer;
import mage.target.common.TargetCardInHand;
import mage.target.common.TargetCardInLibrary;
/**
@ -100,13 +100,13 @@ class LobotomyEffect extends OneShotEffect {
if (targetPlayer != null && sourceObject != null && controller != null) {
// reveal hand of target player
targetPlayer.revealCards(sourceObject.getName(), targetPlayer.getHand(), game);
targetPlayer.revealCards(sourceObject.getIdName(), targetPlayer.getHand(), game);
// You choose card other than a basic land card
TargetCardInHand target = new TargetCardInHand(filter);
TargetCard target = new TargetCard(Zone.HAND, filter);
target.setNotTarget(true);
Card chosenCard = null;
if (controller.choose(Outcome.Benefit, targetPlayer.getHand(), target, game)) {
if (controller.chooseTarget(Outcome.Benefit, targetPlayer.getHand(), target, source, game)) {
chosenCard = game.getCard(target.getFirstTarget());
}
@ -115,6 +115,7 @@ class LobotomyEffect extends OneShotEffect {
FilterCard filterNamedCards = new FilterCard();
if (chosenCard != null) {
filterNamedCards.add(new NamePredicate(chosenCard.getName()));
filterNamedCards.setMessage("cards named " + chosenCard.getName());
} else {
filterNamedCards.add(new NamePredicate("----")); // so no card matches
}
@ -129,8 +130,8 @@ class LobotomyEffect extends OneShotEffect {
}
}
// search cards in hand
TargetCardInHand targetCardsHand = new TargetCardInHand(0, Integer.MAX_VALUE, filterNamedCards);
controller.chooseTarget(outcome, targetPlayer.getGraveyard(), targetCardsHand, source, game);
TargetCard targetCardsHand = new TargetCard(0, Integer.MAX_VALUE, Zone.HAND, filterNamedCards);
controller.chooseTarget(outcome, targetPlayer.getHand(), targetCardsHand, source, game);
for (UUID cardId : targetCardsHand.getTargets()) {
Card card = game.getCard(cardId);
if (card != null) {
@ -153,7 +154,7 @@ class LobotomyEffect extends OneShotEffect {
}
if (!cardsToExile.isEmpty()) {
controller.moveCards(cardsToExile, null, Zone.EXILED, source, game, true);
controller.moveCards(cardsToExile, null, Zone.EXILED, source, game);
}
targetPlayer.shuffleLibrary(game);
return true;

View file

@ -27,6 +27,7 @@
*/
package mage.sets.tempest;
import java.util.Set;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
@ -110,7 +111,11 @@ class ScrollRackEffect extends OneShotEffect {
}
// Put that many cards from the top of your library into your hand.
if (amountExiled > 0) {
controller.moveCards(controller.getLibrary().getTopCards(game, amountExiled), null, Zone.HAND, source, game, false);
Set<Card> cards = controller.getLibrary().getTopCards(game, amountExiled);
for (Card card : cards) {
card.setFaceDown(true, game);
}
controller.moveCards(cards, null, Zone.HAND, source, game);
}
// Then look at the exiled cards and put them on top of your library in any order
controller.putCardsOnTopOfLibrary(game.getExile().getExileZone(source.getSourceId()), game, source, true);

View file

@ -0,0 +1,92 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package org.mage.test.cards.continuous;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author LevelX2
*/
public class BoostEnchantedTest extends CardTestPlayerBase {
@Test
public void testFirebreathingNormal() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion", 1);
// {R}: Enchanted creature gets +1/+0 until end of turn.
addCard(Zone.HAND, playerA, "Firebreathing"); // {R} Enchantment - Aura
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Firebreathing", "Silvercoat Lion");
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{R}: Enchanted creature");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerA, "Firebreathing", 1);
assertPowerToughness(playerA, "Silvercoat Lion", 3, 2);
}
/**
* On Ghitu Firebreathing (and probably other similar cards), when you
* activate the ability to give +1/0 to the enchanted creature and the
* return Ghitu Firebreathing to your hand, the +1/0 goes away on the
* creature. If you re-cast Ghitu Firebreathing onto the creature, the boost
* returns.
*
* Gatherer Rulings: 9/25/2006 If you return Ghitu Firebreathing to its
* owner's hand while the +1/+0 ability is on the stack, that ability will
* still give the creature that was last enchanted by Ghitu Firebreathing
* +1/+0.
*
*/
@Test
public void testFirebreathingReturnToHand() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion", 1);
// {R}: Enchanted creature gets +1/+0 until end of turn.
addCard(Zone.HAND, playerA, "Firebreathing"); // {R} Enchantment - Aura
addCard(Zone.BATTLEFIELD, playerB, "Island", 2);
addCard(Zone.HAND, playerB, "Boomerang"); // {U}{U} Instant
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Firebreathing", "Silvercoat Lion");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Boomerang", "Firebreathing");
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{R}: Enchanted creature", NO_TARGET, "Boomerang");
setStopAt(1, PhaseStep.END_COMBAT);
execute();
assertHandCount(playerA, "Firebreathing", 1);
assertGraveyardCount(playerB, "Boomerang", 1);
assertPowerToughness(playerA, "Silvercoat Lion", 3, 2);
}
}

View file

@ -1677,21 +1677,20 @@ public class TestPlayer implements Player {
return computerPlayer.moveCards(cards, fromZone, toZone, source, game);
}
@Override
public boolean moveCards(Cards cards, Zone fromZone, Zone toZone, Ability source, Game game, boolean withName) {
return computerPlayer.moveCards(cards, fromZone, toZone, source, game);
}
@Override
public boolean moveCards(Card card, Zone fromZone, Zone toZone, Ability source, Game game, boolean withName) {
return computerPlayer.moveCards(card, fromZone, toZone, source, game);
}
@Override
public boolean moveCards(Set<Card> cards, Zone fromZone, Zone toZone, Ability source, Game game, boolean withName) {
return computerPlayer.moveCards(cards, fromZone, toZone, source, game);
}
// @Override
// public boolean moveCards(Cards cards, Zone fromZone, Zone toZone, Ability source, Game game, boolean withName) {
// return computerPlayer.moveCards(cards, fromZone, toZone, source, game);
// }
//
// @Override
// public boolean moveCards(Card card, Zone fromZone, Zone toZone, Ability source, Game game, boolean withName) {
// return computerPlayer.moveCards(card, fromZone, toZone, source, game);
// }
//
// @Override
// public boolean moveCards(Set<Card> cards, Zone fromZone, Zone toZone, Ability source, Game game, boolean withName) {
// return computerPlayer.moveCards(cards, fromZone, toZone, source, game);
// }
@Override
public boolean moveCardToHandWithInfo(Card card, UUID sourceId, Game game) {
return computerPlayer.moveCardToHandWithInfo(card, sourceId, game);

View file

@ -1,31 +1,30 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.abilities.effects;
import java.util.ArrayList;
@ -69,7 +68,7 @@ public abstract class ContinuousEffectImpl extends EffectImpl implements Continu
protected boolean affectedObjectsSet = false;
protected List<MageObjectReference> affectedObjectList = new ArrayList<>();
protected boolean temporary = false;
// until your next turn
protected int startingTurn;
protected UUID startingControllerId;
@ -96,7 +95,7 @@ public abstract class ContinuousEffectImpl extends EffectImpl implements Continu
this.used = effect.used;
this.discarded = effect.discarded;
this.affectedObjectsSet = effect.affectedObjectsSet;
this.affectedObjectList.addAll(effect.affectedObjectList);
this.affectedObjectList.addAll(effect.affectedObjectList);
this.temporary = effect.temporary;
this.startingTurn = effect.startingTurn;
this.startingControllerId = effect.startingControllerId;
@ -148,8 +147,8 @@ public abstract class ContinuousEffectImpl extends EffectImpl implements Continu
}
/**
* Sets the discarded state of the effect. So it
* will be removed on next check.
* Sets the discarded state of the effect. So it will be removed on next
* check.
*/
@Override
public void discard() {
@ -160,7 +159,7 @@ public abstract class ContinuousEffectImpl extends EffectImpl implements Continu
public void init(Ability source, Game game) {
targetPointer.init(game, source);
//20100716 - 611.2c
if (AbilityType.ACTIVATED.equals(source.getAbilityType())
if (AbilityType.ACTIVATED.equals(source.getAbilityType())
|| AbilityType.SPELL.equals(source.getAbilityType())
|| AbilityType.TRIGGERED.equals(source.getAbilityType())) {
if (layer != null) {
@ -174,11 +173,10 @@ public abstract class ContinuousEffectImpl extends EffectImpl implements Continu
case PTChangingEffects_7:
this.affectedObjectsSet = true;
}
}
else {
if (hasLayer(Layer.CopyEffects_1) || hasLayer(Layer.ControlChangingEffects_2) || hasLayer(Layer.TextChangingEffects_3) ||
hasLayer(Layer.TypeChangingEffects_4) || hasLayer(Layer.ColorChangingEffects_5) || hasLayer(Layer.AbilityAddingRemovingEffects_6) ||
hasLayer(Layer.PTChangingEffects_7)) {
} else {
if (hasLayer(Layer.CopyEffects_1) || hasLayer(Layer.ControlChangingEffects_2) || hasLayer(Layer.TextChangingEffects_3)
|| hasLayer(Layer.TypeChangingEffects_4) || hasLayer(Layer.ColorChangingEffects_5) || hasLayer(Layer.AbilityAddingRemovingEffects_6)
|| hasLayer(Layer.PTChangingEffects_7)) {
this.affectedObjectsSet = true;
}
}
@ -226,7 +224,7 @@ public abstract class ContinuousEffectImpl extends EffectImpl implements Continu
return true;
}
if (toughness instanceof DomainValue) {
return ((DomainValue)toughness).getAmount() < 0;
return ((DomainValue) toughness).getAmount() < 0;
}
return false;
}
@ -237,8 +235,10 @@ public abstract class ContinuousEffectImpl extends EffectImpl implements Continu
}
/**
* Returns the status if the effect is temporary added to the ContinuousEffects
* @return
* Returns the status if the effect is temporary added to the
* ContinuousEffects
*
* @return
*/
@Override
public boolean isTemporary() {

View file

@ -27,12 +27,13 @@
*/
package mage.abilities.effects.common.combat;
import mage.constants.AttachmentType;
import mage.constants.Duration;
import mage.abilities.Ability;
import mage.abilities.effects.RestrictionEffect;
import mage.constants.AttachmentType;
import mage.constants.Duration;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
/**
*
@ -62,8 +63,22 @@ public class CantBlockAttachedEffect extends RestrictionEffect {
super(effect);
}
@Override
public void init(Ability source, Game game) {
super.init(source, game);
if (affectedObjectsSet) {
Permanent equipment = game.getPermanent(source.getSourceId());
if (equipment != null && equipment.getAttachedTo() != null) {
this.setTargetPointer(new FixedTarget(equipment.getAttachedTo(), game.getState().getZoneChangeCounter(equipment.getAttachedTo())));
}
}
}
@Override
public boolean applies(Permanent permanent, Ability source, Game game) {
if (affectedObjectsSet) {
return targetPointer.getFirst(game, source).equals(permanent.getId());
}
return permanent.getAttachments().contains(source.getSourceId());
}

View file

@ -1,16 +1,16 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
@ -20,24 +20,24 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* The views and conclusions contained in the software and documentation are those of the
* 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 mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Outcome;
import mage.constants.SubLayer;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Outcome;
import mage.constants.SubLayer;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
/**
*
@ -79,15 +79,37 @@ public class BoostEnchantedEffect extends ContinuousEffectImpl {
}
@Override
public boolean apply(Game game, Ability source) {
Permanent enchantment = game.getPermanent(source.getSourceId());
if (enchantment != null && enchantment.getAttachedTo() != null) {
Permanent creature = game.getPermanent(enchantment.getAttachedTo());
if (creature != null) {
creature.addPower(power.calculate(game, source, this));
creature.addToughness(toughness.calculate(game, source, this));
public void init(Ability source, Game game) {
super.init(source, game);
if (affectedObjectsSet) {
// Added boosts of activated or triggered abilities exist independent from the source they are created by
// so a continuous effect for the permanent itself with the attachment is created
Permanent equipment = game.getPermanent(source.getSourceId());
if (equipment != null && equipment.getAttachedTo() != null) {
this.setTargetPointer(new FixedTarget(equipment.getAttachedTo(), game.getState().getZoneChangeCounter(equipment.getAttachedTo())));
}
}
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = null;
if (affectedObjectsSet) {
permanent = game.getPermanent(targetPointer.getFirst(game, source));
if (permanent == null) {
discard();
return true;
}
} else {
Permanent equipment = game.getPermanent(source.getSourceId());
if (equipment != null && equipment.getAttachedTo() != null) {
permanent = game.getPermanent(equipment.getAttachedTo());
}
}
if (permanent != null) {
permanent.addPower(power.calculate(game, source, this));
permanent.addToughness(toughness.calculate(game, source, this));
}
return true;
}
@ -95,16 +117,15 @@ public class BoostEnchantedEffect extends ContinuousEffectImpl {
StringBuilder sb = new StringBuilder();
sb.append("Enchanted creature gets ");
String p = power.toString();
if(!p.startsWith("-")) {
if (!p.startsWith("-")) {
sb.append("+");
}
sb.append(p).append("/");
String t = toughness.toString();
if(!t.startsWith("-")){
if(p.startsWith("-")) {
if (!t.startsWith("-")) {
if (p.startsWith("-")) {
sb.append("-");
}
else {
} else {
sb.append("+");
}
}

View file

@ -45,35 +45,36 @@ public class GainAbilityAttachedEffect extends ContinuousEffectImpl {
protected Ability ability;
protected AttachmentType attachmentType;
protected boolean fixedTarget = false;
protected boolean independentEffect;
public GainAbilityAttachedEffect(Ability ability, AttachmentType attachmentType) {
this(ability, attachmentType, Duration.WhileOnBattlefield);
}
public GainAbilityAttachedEffect(Ability ability, AttachmentType attachmentType, Duration duration) {
this(ability, attachmentType, duration, null);
}
public GainAbilityAttachedEffect(Ability ability, AttachmentType attachmentType, Duration duration, String rule) {
super(duration, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility);
this.ability = ability;
this.attachmentType = attachmentType;
this.duration = duration;
if (duration == Duration.EndOfTurn) {
fixedTarget = true;
switch (duration) {
case WhileOnBattlefield:
case WhileInGraveyard:
case WhileOnStack:
independentEffect = false;
break;
default:
// such effects exist independent from the enchantment that created the effect
independentEffect = true;
}
this.staticText = rule;
}
public GainAbilityAttachedEffect(Ability ability, AttachmentType attachmentType, Duration duration) {
super(duration, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility);
this.ability = ability;
this.attachmentType = attachmentType;
this.duration = duration;
if (duration == Duration.EndOfTurn) {
fixedTarget = true;
if (rule == null) {
setText();
} else {
this.staticText = rule;
}
setText();
}
public GainAbilityAttachedEffect(Ability ability, AttachmentType attachmentType) {
super(Duration.WhileOnBattlefield, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility);
this.ability = ability;
this.attachmentType = attachmentType;
setText();
}
public GainAbilityAttachedEffect(final GainAbilityAttachedEffect effect) {
@ -81,7 +82,7 @@ public class GainAbilityAttachedEffect extends ContinuousEffectImpl {
this.ability = effect.ability.copy();
ability.newId(); // This is needed if the effect is copied e.g. by a clone so the ability can be added multiple times to permanents
this.attachmentType = effect.attachmentType;
this.fixedTarget = effect.fixedTarget;
this.independentEffect = effect.independentEffect;
}
@Override
@ -92,27 +93,31 @@ public class GainAbilityAttachedEffect extends ContinuousEffectImpl {
@Override
public void init(Ability source, Game game) {
super.init(source, game);
if (fixedTarget) {
if (affectedObjectsSet) {
Permanent equipment = game.getPermanent(source.getSourceId());
if (equipment != null && equipment.getAttachedTo() != null) {
this.setTargetPointer(new FixedTarget(equipment.getAttachedTo()));
this.setTargetPointer(new FixedTarget(equipment.getAttachedTo(), game.getState().getZoneChangeCounter(equipment.getAttachedTo())));
}
}
}
@Override
public boolean apply(Game game, Ability source) {
Permanent creature = null;
if (fixedTarget) {
creature = game.getPermanent(targetPointer.getFirst(game, source));
Permanent permanent = null;
if (affectedObjectsSet) {
permanent = game.getPermanent(targetPointer.getFirst(game, source));
if (permanent == null) {
discard();
return true;
}
} else {
Permanent equipment = game.getPermanent(source.getSourceId());
if (equipment != null && equipment.getAttachedTo() != null) {
creature = game.getPermanent(equipment.getAttachedTo());
permanent = game.getPermanent(equipment.getAttachedTo());
}
}
if (creature != null) {
creature.addAbility(ability, source.getSourceId(), game, false);
if (permanent != null) {
permanent.addAbility(ability, source.getSourceId(), game, false);
}
return true;
}

View file

@ -620,16 +620,13 @@ public interface Player extends MageItem, Copyable<Player> {
*/
boolean moveCards(Cards cards, Zone fromZone, Zone toZone, Ability source, Game game);
boolean moveCards(Cards cards, Zone fromZone, Zone toZone, Ability source, Game game, boolean withName);
// boolean moveCards(Cards cards, Zone fromZone, Zone toZone, Ability source, Game game, boolean withName);
boolean moveCards(Card card, Zone fromZone, Zone toZone, Ability source, Game game);
boolean moveCards(Card card, Zone fromZone, Zone toZone, Ability source, Game game, boolean withName);
// boolean moveCards(Card card, Zone fromZone, Zone toZone, Ability source, Game game, boolean withName);
boolean moveCards(Set<Card> cards, Zone fromZone, Zone toZone, Ability source, Game game);
boolean moveCards(Set<Card> cards, Zone fromZone, Zone toZone, Ability source, Game game, boolean withName);
// boolean moveCards(Set<Card> cards, Zone fromZone, Zone toZone, Ability source, Game game, boolean withName);
boolean moveCardsToExile(Set<Card> cards, Ability source, Game game, boolean withName, UUID exileId, String exileZoneName);
/**

View file

@ -2873,14 +2873,14 @@ public abstract class PlayerImpl implements Player, Serializable {
public UUID getCommanderId() {
return this.commanderId;
}
//
// @Override
// public boolean moveCards(Cards cards, Zone fromZone, Zone toZone, Ability source, Game game) {
// return moveCards(cards, fromZone, toZone, source, game, true);
// }
@Override
public boolean moveCards(Cards cards, Zone fromZone, Zone toZone, Ability source, Game game) {
return moveCards(cards, fromZone, toZone, source, game, true);
}
@Override
public boolean moveCards(Cards cards, Zone fromZone, Zone toZone, Ability source, Game game, boolean withName) {
Set<Card> cardList = new HashSet<>();
for (UUID cardId : cards) {
if (fromZone == null) {
@ -2898,30 +2898,28 @@ public abstract class PlayerImpl implements Player, Serializable {
}
}
}
return moveCards(cardList, fromZone, toZone, source, game, withName);
return moveCards(cardList, fromZone, toZone, source, game);
}
// @Override
// public boolean moveCards(Card card, Zone fromZone, Zone toZone, Ability source, Game game) {
// return moveCards(card, fromZone, toZone, source, game, true);
// }
@Override
public boolean moveCards(Card card, Zone fromZone, Zone toZone, Ability source, Game game) {
return moveCards(card, fromZone, toZone, source, game, true);
}
@Override
public boolean moveCards(Card card, Zone fromZone, Zone toZone, Ability source, Game game, boolean withName) {
Set<Card> cardList = new HashSet<>();
if (card != null) {
cardList.add(card);
}
return moveCards(cardList, fromZone, toZone, source, game, withName);
return moveCards(cardList, fromZone, toZone, source, game);
}
// @Override
// public boolean moveCards(Set<Card> cards, Zone fromZone, Zone toZone, Ability source, Game game) {
// return moveCards(cards, fromZone, toZone, source, game, true);
// }
@Override
public boolean moveCards(Set<Card> cards, Zone fromZone, Zone toZone, Ability source, Game game) {
return moveCards(cards, fromZone, toZone, source, game, true);
}
@Override
public boolean moveCards(Set<Card> cards, Zone fromZone, Zone toZone, Ability source, Game game, boolean withName) {
if (cards.isEmpty()) {
return true;
}
@ -2931,6 +2929,7 @@ public abstract class PlayerImpl implements Player, Serializable {
boolean result = false;
for (Card card : cards) {
fromZone = game.getState().getZone(card.getId());
boolean withName = (fromZone.equals(Zone.BATTLEFIELD) || fromZone.equals(Zone.STACK)) || !card.isFaceDown(game);
result |= moveCardToExileWithInfo(card, null, "", source == null ? null : source.getSourceId(), game, fromZone, withName);
}
return result;
@ -2940,20 +2939,23 @@ public abstract class PlayerImpl implements Player, Serializable {
result = false;
for (Card card : cards) {
fromZone = game.getState().getZone(card.getId());
result |= moveCardToHandWithInfo(card, source == null ? null : source.getSourceId(), game, withName);
boolean hideCard = fromZone.equals(Zone.LIBRARY)
|| (card.isFaceDown(game) && !fromZone.equals(Zone.STACK) && !fromZone.equals(Zone.BATTLEFIELD));
result |= moveCardToHandWithInfo(card, source == null ? null : source.getSourceId(), game, !hideCard);
}
return result;
case BATTLEFIELD:
result = false;
for (Card card : cards) {
fromZone = game.getState().getZone(card.getId());
result |= putOntoBattlefieldWithInfo(card, game, fromZone, source == null ? null : source.getSourceId(), false, !withName);
result |= putOntoBattlefieldWithInfo(card, game, fromZone, source == null ? null : source.getSourceId(), false, !card.isFaceDown(game));
}
return result;
case LIBRARY:
result = false;
for (Card card : cards) {
fromZone = game.getState().getZone(card.getId());
boolean withName = fromZone.equals(Zone.BATTLEFIELD) || !card.isFaceDown(game);
result |= moveCardToLibraryWithInfo(card, source == null ? null : source.getSourceId(), game, fromZone, true, withName);
}
return result;