mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Fixed a bug that let cards disappear after moving cards from hand to library (e.g. Teferi's puzzle).
This commit is contained in:
parent
9805f4f9ef
commit
8fb04ddbef
3 changed files with 28 additions and 22 deletions
|
@ -30,11 +30,11 @@ package mage.sets.timespiral;
|
|||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityAllEffect;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityAllEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
|
@ -47,7 +47,8 @@ import mage.target.common.TargetAttackingOrBlockingCreature;
|
|||
*
|
||||
* @author HanClinto
|
||||
*
|
||||
* A relatively straightforward merge between GemhideSliver.java and CrossbowInfantry.java
|
||||
* A relatively straightforward merge between GemhideSliver.java and
|
||||
* CrossbowInfantry.java
|
||||
*/
|
||||
public class QuilledSliver extends CardImpl {
|
||||
|
||||
|
@ -78,4 +79,4 @@ public class QuilledSliver extends CardImpl {
|
|||
public QuilledSliver copy() {
|
||||
return new QuilledSliver(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@ package mage.cards;
|
|||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.*;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.MageObjectImpl;
|
||||
import mage.Mana;
|
||||
|
@ -53,10 +52,8 @@ import mage.game.command.Commander;
|
|||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.PermanentCard;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.game.stack.StackObject;
|
||||
import mage.players.Player;
|
||||
import mage.util.GameLog;
|
||||
import mage.watchers.Watcher;
|
||||
import org.apache.log4j.Logger;
|
||||
|
@ -315,11 +312,11 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
|
|||
public String getTokenSetCode() {
|
||||
return tokenSetCode;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getTokenDescriptor() {
|
||||
return tokenDescriptor;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Mana> getMana() {
|
||||
|
@ -342,22 +339,29 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
|
|||
Zone fromZone = game.getState().getZone(objectId);
|
||||
ZoneChangeEvent event = new ZoneChangeEvent(this.objectId, sourceId, ownerId, fromZone, toZone, appliedEffects);
|
||||
ZoneChangeInfo zoneChangeInfo;
|
||||
if (toZone == Zone.LIBRARY) {
|
||||
zoneChangeInfo = new ZoneChangeInfo.Library(event, flag /* put on top */);
|
||||
} else if (toZone == Zone.BATTLEFIELD) {
|
||||
zoneChangeInfo = new ZoneChangeInfo.Battlefield(event, flag /* comes into play tapped */);
|
||||
} else {
|
||||
zoneChangeInfo = new ZoneChangeInfo(event);
|
||||
if (null != toZone) {
|
||||
switch (toZone) {
|
||||
case LIBRARY:
|
||||
zoneChangeInfo = new ZoneChangeInfo.Library(event, flag /* put on top */);
|
||||
break;
|
||||
case BATTLEFIELD:
|
||||
zoneChangeInfo = new ZoneChangeInfo.Battlefield(event, flag /* comes into play tapped */);
|
||||
break;
|
||||
default:
|
||||
zoneChangeInfo = new ZoneChangeInfo(event);
|
||||
break;
|
||||
}
|
||||
return ZonesHandler.moveCard(zoneChangeInfo, game);
|
||||
}
|
||||
return ZonesHandler.moveCard(zoneChangeInfo, game);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean cast(Game game, Zone fromZone, SpellAbility ability, UUID controllerId) {
|
||||
Card mainCard = getMainCard();
|
||||
ZoneChangeEvent event = new ZoneChangeEvent(mainCard.getId(), ability.getId(), controllerId, fromZone, Zone.STACK);
|
||||
ZoneChangeInfo.Stack info =
|
||||
new ZoneChangeInfo.Stack(event, new Spell(this, ability.copy(), controllerId, event.getFromZone()));
|
||||
ZoneChangeInfo.Stack info
|
||||
= new ZoneChangeInfo.Stack(event, new Spell(this, ability.copy(), controllerId, event.getFromZone()));
|
||||
return ZonesHandler.cast(info, game);
|
||||
}
|
||||
|
||||
|
@ -598,7 +602,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
|
|||
returnCode = false;
|
||||
}
|
||||
}
|
||||
if(finalAmount > 0) {
|
||||
if (finalAmount > 0) {
|
||||
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTERS_ADDED, objectId, getControllerOrOwner(), counter.getName(), amount));
|
||||
}
|
||||
} else {
|
||||
|
@ -656,7 +660,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
|
|||
}
|
||||
return super.getColor(game);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<String> getSubtype(Game game) {
|
||||
if (game != null) {
|
||||
|
|
|
@ -863,8 +863,9 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean putCardsOnBottomOfLibrary(Cards cards, Game game, Ability source, boolean anyOrder) {
|
||||
if (!cards.isEmpty()) {
|
||||
public boolean putCardsOnBottomOfLibrary(Cards cardsToLibrary, Game game, Ability source, boolean anyOrder) {
|
||||
if (!cardsToLibrary.isEmpty()) {
|
||||
Cards cards = new CardsImpl(cardsToLibrary); // prevent possible ConcurrentModificationException
|
||||
if (!anyOrder) {
|
||||
for (UUID objectId : cards) {
|
||||
moveObjectToLibrary(objectId, source == null ? null : source.getSourceId(), game, false, false);
|
||||
|
|
Loading…
Reference in a new issue