mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
added replace event to putOntoBattlefield call - moved logic for moving cards to putOntoBattlefield
This commit is contained in:
parent
11a64a1c6a
commit
82f8a7cdee
35 changed files with 50 additions and 75 deletions
|
@ -94,7 +94,7 @@ class PathToExileEffect extends OneShotEffect {
|
|||
if (player.chooseUse(Outcome.PutCardInPlay, "Use Path to Exile effect?", game)) {
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(new FilterBasicLandCard());
|
||||
player.searchLibrary(target, game);
|
||||
Card card = player.getLibrary().remove(target.getFirstTarget(), game);
|
||||
Card card = player.getLibrary().getCard(target.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
if (card.putOntoBattlefield(game, Zone.LIBRARY, source.getId(), permanent.getControllerId())) {
|
||||
Permanent land = game.getPermanent(card.getId());
|
||||
|
|
|
@ -153,11 +153,7 @@ class SorinLordOfInnistradEffect extends OneShotEffect<SorinLordOfInnistradEffec
|
|||
if (game.getState().getZone(targetId) == Zone.GRAVEYARD) {
|
||||
Card card = game.getCard(targetId);
|
||||
if (card != null) {
|
||||
Player owner = game.getPlayer(card.getOwnerId());
|
||||
if (owner != null) {
|
||||
owner.removeFromGraveyard(card, game);
|
||||
card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getId(), player.getId());
|
||||
}
|
||||
card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getId(), player.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,7 +105,6 @@ class ZombieApocalypseEffect extends OneShotEffect<ZombieApocalypseEffect> {
|
|||
Player player = game.getPlayer(source.getControllerId());
|
||||
|
||||
for (Card card : player.getGraveyard().getCards(filterZombie, game)) {
|
||||
player.getGraveyard().remove(card);
|
||||
card.putOntoBattlefield(game, Constants.Zone.GRAVEYARD, source.getId(), source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(card.getId());
|
||||
if (permanent != null) {
|
||||
|
|
|
@ -100,7 +100,6 @@ class FoldIntoAEtherEffect extends OneShotEffect<FoldIntoAEtherEffect> {
|
|||
&& player.choose(Outcome.PutCreatureInPlay, target, source.getSourceId(), game)) {
|
||||
Card card = game.getCard(target.getFirstTarget());
|
||||
if (card != null) {
|
||||
player.removeFromHand(card, game);
|
||||
card.putOntoBattlefield(game, Zone.HAND, source.getId(), source.getControllerId());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,7 +110,6 @@ class BitterheartWitchEffect extends OneShotEffect<BitterheartWitchEffect> {
|
|||
player.chooseTarget(Outcome.Detriment, target, source, game);
|
||||
Player targetPlayer = game.getPlayer(target.getFirstTarget());
|
||||
if (targetPlayer != null) {
|
||||
player.removeFromLibrary(card, game);
|
||||
player.shuffleLibrary(game);
|
||||
card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), source.getControllerId());
|
||||
return targetPlayer.addAttachment(card.getId(), game);
|
||||
|
|
|
@ -95,7 +95,7 @@ class CaravanVigilEffect extends OneShotEffect<CaravanVigilEffect> {
|
|||
TargetCardInLibrary target = new TargetCardInLibrary(new FilterBasicLandCard());
|
||||
if (player.searchLibrary(target, game)) {
|
||||
Cards cards = new CardsImpl();
|
||||
Card card = player.getLibrary().remove(target.getFirstTarget(), game);
|
||||
Card card = player.getLibrary().getCard(target.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
cards.add(card);
|
||||
if (MorbidCondition.getInstance().apply(game, source)
|
||||
|
|
|
@ -102,7 +102,7 @@ class GhostQuarterEffect extends OneShotEffect<GhostQuarterEffect> {
|
|||
if (player.chooseUse(Outcome.PutLandInPlay, "Do you wish to search for a basic land, put it onto the battlefield and then shuffle your library?", game)) {
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(new FilterBasicLandCard());
|
||||
if (player.searchLibrary(target, game)) {
|
||||
Card card = player.getLibrary().remove(target.getFirstTarget(), game);
|
||||
Card card = player.getLibrary().getCard(target.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
card.putOntoBattlefield(game, Zone.HAND, source.getId(), player.getId());
|
||||
}
|
||||
|
|
|
@ -104,7 +104,6 @@ class GrimoireOfTheDeadEffect extends OneShotEffect<GrimoireOfTheDeadEffect> {
|
|||
for (Player player: game.getPlayers().values()) {
|
||||
for (Card card: player.getGraveyard().getCards(game)) {
|
||||
if (card.getCardType().contains(CardType.CREATURE)) {
|
||||
player.getGraveyard().remove(card);
|
||||
card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getId(), source.getControllerId());
|
||||
game.addEffect(new GrimoireOfTheDeadEffect2(card.getId()), source);
|
||||
}
|
||||
|
|
|
@ -101,7 +101,6 @@ class PutCreatureOnBattlefieldEffect extends OneShotEffect<PutCreatureOnBattlefi
|
|||
Card card = game.getCard(source.getFirstTarget());
|
||||
Player player = game.getPlayer(card.getOwnerId());
|
||||
if (card != null && player != null) {
|
||||
player.removeFromHand(card, game);
|
||||
card.putOntoBattlefield(game, Zone.HAND, source.getId(), source.getControllerId());
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -98,7 +98,6 @@ class LilianaVessEffect extends OneShotEffect<LilianaVessEffect> {
|
|||
for (Player player: game.getPlayers().values()) {
|
||||
for (Card card: player.getGraveyard().getCards(game)) {
|
||||
if (card.getCardType().contains(CardType.CREATURE)) {
|
||||
player.getGraveyard().remove(card);
|
||||
card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getId(), source.getControllerId());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -130,10 +130,8 @@ class LurkingPredatorsEffect extends OneShotEffect<LurkingPredatorsEffect> {
|
|||
|
||||
if (card != null) {
|
||||
if (card.getCardType().contains(CardType.CREATURE)) {
|
||||
player.getLibrary().remove(card.getId(), game);
|
||||
card.putOntoBattlefield(game, Zone.HAND, source.getId(), source.getControllerId());
|
||||
} else if (player.chooseUse(Outcome.Neutral, "Put " + card.getName() + " on the bottom of your library?", game)) {
|
||||
player.getLibrary().remove(card.getId(), game);
|
||||
card.moveToZone(Zone.LIBRARY, source.getId(), game, false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ class CultivateEffect extends OneShotEffect<CultivateEffect> {
|
|||
if (target.getTargets().size() > 0) {
|
||||
Cards revealed = new CardsImpl();
|
||||
for (UUID cardId: (List<UUID>)target.getTargets()) {
|
||||
Card card = player.getLibrary().remove(cardId, game);
|
||||
Card card = player.getLibrary().getCard(cardId, game);
|
||||
revealed.add(card);
|
||||
}
|
||||
player.revealCards("Cultivate", revealed, game);
|
||||
|
|
|
@ -124,7 +124,6 @@ class ArachnusSpinnerEffect extends OneShotEffect<ArachnusSpinnerEffect> {
|
|||
if (player.choose(Outcome.PutCardInPlay, player.getGraveyard(), target, game)) {
|
||||
card = game.getCard(target.getFirstTarget());
|
||||
if (card != null) {
|
||||
player.removeFromGraveyard(card, game);
|
||||
zone = Zone.GRAVEYARD;
|
||||
}
|
||||
}
|
||||
|
@ -134,7 +133,6 @@ class ArachnusSpinnerEffect extends OneShotEffect<ArachnusSpinnerEffect> {
|
|||
if (player.searchLibrary(target, game)) {
|
||||
card = game.getCard(target.getFirstTarget());
|
||||
if (card != null) {
|
||||
player.removeFromLibrary(card, game);
|
||||
player.shuffleLibrary(game);
|
||||
zone = Zone.LIBRARY;
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ class DoublingChantEffect extends OneShotEffect<DoublingChantEffect> {
|
|||
TargetCardInLibrary target = new TargetCardInLibrary(filter);
|
||||
|
||||
if (player.searchLibrary(target, game)) {
|
||||
Card card = player.getLibrary().remove(target.getFirstTarget(), game);
|
||||
Card card = player.getLibrary().getCard(target.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
chosenCards.add(card);
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ class DruidicSatchelEffect extends OneShotEffect<DruidicSatchelEffect> {
|
|||
token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
|
||||
}
|
||||
if (card.getCardType().contains(CardType.LAND)) {
|
||||
player.getLibrary().remove(card.getId(), game);
|
||||
player.getLibrary().getCard(card.getId(), game);
|
||||
card.putOntoBattlefield(game, Zone.LIBRARY, source.getId(), source.getControllerId());
|
||||
}
|
||||
if (!card.getCardType().contains(CardType.CREATURE) && !card.getCardType().contains(CardType.LAND)) {
|
||||
|
|
|
@ -101,7 +101,6 @@ class PutCreatureOnBattlefieldEffect extends OneShotEffect<PutCreatureOnBattlefi
|
|||
if (player.choose(Outcome.PutCreatureInPlay, target, source.getSourceId(), game)) {
|
||||
Card card = game.getCard(target.getFirstTarget());
|
||||
if (card != null) {
|
||||
player.removeFromHand(card, game);
|
||||
card.putOntoBattlefield(game, Zone.HAND, source.getId(), source.getControllerId());
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ class GreenSunsZenithSearchEffect extends OneShotEffect<GreenSunsZenithSearchEff
|
|||
if (player.searchLibrary(target, game)) {
|
||||
if (target.getTargets().size() > 0) {
|
||||
for (UUID cardId : (List<UUID>) target.getTargets()) {
|
||||
Card card = player.getLibrary().remove(cardId, game);
|
||||
Card card = player.getLibrary().getCard(cardId, game);
|
||||
card.putOntoBattlefield(game, Constants.Zone.HAND, source.getId(), source.getControllerId());
|
||||
}
|
||||
player.shuffleLibrary(game);
|
||||
|
|
|
@ -99,20 +99,17 @@ class GruesomeEncoreEffect extends OneShotEffect<GruesomeEncoreEffect> {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Card card = game.getCard(source.getFirstTarget());
|
||||
if (card != null) {
|
||||
Player opponent = game.getPlayer(card.getOwnerId());
|
||||
if (opponent != null && opponent.removeFromGraveyard(card, game)) {
|
||||
card.addAbility(HasteAbility.getInstance());
|
||||
card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getId(), source.getControllerId());
|
||||
card.addAbility(HasteAbility.getInstance());
|
||||
card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getId(), source.getControllerId());
|
||||
|
||||
ExileTargetEffect exileEffect = new ExileTargetEffect();
|
||||
exileEffect.setTargetPointer(new FixedTarget(card.getId()));
|
||||
DelayedTriggeredAbility delayedAbility = new AtEndOfTurnDelayedTriggeredAbility(exileEffect);
|
||||
delayedAbility.setSourceId(source.getSourceId());
|
||||
delayedAbility.setControllerId(source.getControllerId());
|
||||
game.addDelayedTriggeredAbility(delayedAbility);
|
||||
ExileTargetEffect exileEffect = new ExileTargetEffect();
|
||||
exileEffect.setTargetPointer(new FixedTarget(card.getId()));
|
||||
DelayedTriggeredAbility delayedAbility = new AtEndOfTurnDelayedTriggeredAbility(exileEffect);
|
||||
delayedAbility.setSourceId(source.getSourceId());
|
||||
delayedAbility.setControllerId(source.getControllerId());
|
||||
game.addDelayedTriggeredAbility(delayedAbility);
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -101,7 +101,6 @@ class PreeminentCaptainEffect extends OneShotEffect<PreeminentCaptainEffect> {
|
|||
UUID cardId = target.getFirstTarget();
|
||||
Card card = player.getHand().get(cardId, game);
|
||||
if (card != null) {
|
||||
player.getHand().remove(card);
|
||||
if (card.putOntoBattlefield(game, Zone.HAND,
|
||||
source.getId(), source.getControllerId())) {
|
||||
Permanent permanent = game.getPermanent(card.getId());
|
||||
|
|
|
@ -110,7 +110,7 @@ class BirthingPodEffect extends OneShotEffect<BirthingPodEffect> {
|
|||
TargetCardInLibrary target = new TargetCardInLibrary(filter);
|
||||
if (player.searchLibrary(target, game)) {
|
||||
for (UUID cardId : target.getTargets()) {
|
||||
Card card = player.getLibrary().remove(cardId, game);
|
||||
Card card = player.getLibrary().getCard(cardId, game);
|
||||
if (card != null) {
|
||||
card.putOntoBattlefield(game, Constants.Zone.HAND, source.getId(), source.getControllerId());
|
||||
}
|
||||
|
|
|
@ -159,7 +159,6 @@ class OmenMachineEffect2 extends OneShotEffect<OmenMachineEffect2> {
|
|||
card.moveToExile(source.getSourceId(), "Omen Machine Exile", source.getId(), game);
|
||||
if (card.getCardType().contains(CardType.LAND)) {
|
||||
card.putOntoBattlefield(game, Zone.EXILED, source.getId(), player.getId());
|
||||
game.getExile().removeCard(card, game);
|
||||
}
|
||||
else {
|
||||
player.cast(card.getSpellAbility(), game, true);
|
||||
|
|
|
@ -110,7 +110,7 @@ class PostmortemLungeEffect extends OneShotEffect<PostmortemLungeEffect> {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Card card = game.getCard(source.getFirstTarget());
|
||||
Player player = game.getPlayer(card.getOwnerId());
|
||||
if (card != null && player != null && player.removeFromGraveyard(card, game)) {
|
||||
if (card != null && player != null) {
|
||||
card.addAbility(HasteAbility.getInstance());
|
||||
card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getId(), source.getControllerId());
|
||||
|
||||
|
|
|
@ -125,7 +125,6 @@ class GethLordOfTheVaultEffect extends OneShotEffect<GethLordOfTheVaultEffect> {
|
|||
if (game.getState().getZone(card.getId()).equals(Zone.GRAVEYARD)) {
|
||||
Player player = game.getPlayer(card.getOwnerId());
|
||||
if (card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getId(), source.getControllerId())) {
|
||||
player.getGraveyard().remove(card);
|
||||
|
||||
Permanent permanent = game.getPermanent(card.getId());
|
||||
if (permanent != null) {
|
||||
|
|
|
@ -167,7 +167,6 @@ class NimDeathmantleEffect extends OneShotEffect<NimDeathmantleEffect> {
|
|||
if (card != null && game.getState().getZone(card.getId()).equals(Constants.Zone.GRAVEYARD)) {
|
||||
Player owner = game.getPlayer(card.getOwnerId());
|
||||
if (card.putOntoBattlefield(game, Constants.Zone.GRAVEYARD, source.getId(), source.getControllerId())) {
|
||||
owner.getGraveyard().remove(card);
|
||||
Permanent permanent = game.getPermanent(card.getId());
|
||||
if (permanent != null) {
|
||||
permanent.addAttachment(equipment.getId(), game);
|
||||
|
|
|
@ -118,7 +118,7 @@ class ClarionUltimatumEffect extends OneShotEffect<ClarionUltimatumEffect> {
|
|||
TargetCardInLibrary target = new TargetCardInLibrary(filter);
|
||||
|
||||
if (player.searchLibrary(target, game)) {
|
||||
Card card = player.getLibrary().remove(target.getFirstTarget(), game);
|
||||
Card card = player.getLibrary().getCard(target.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
chosenCards.add(card);
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ class TezzeretTheSeekerEffect2 extends OneShotEffect<TezzeretTheSeekerEffect2> {
|
|||
TargetCardInLibrary target = new TargetCardInLibrary(filter);
|
||||
|
||||
if (player.searchLibrary(target, game)) {
|
||||
Card card = player.getLibrary().remove(target.getFirstTarget(), game);
|
||||
Card card = player.getLibrary().getCard(target.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
card.putOntoBattlefield(game, Zone.HAND, source.getId(), source.getControllerId());
|
||||
}
|
||||
|
|
|
@ -134,7 +134,6 @@ class ExplorersScopeEffect extends OneShotEffect<ExplorersScopeEffect> {
|
|||
if (card.getCardType().contains(CardType.LAND)) {
|
||||
String message = "Put " + card.getName() + " onto the battlefield tapped?";
|
||||
if (player.chooseUse(Outcome.PutLandInPlay, message, game)) {
|
||||
player.getLibrary().remove(card.getId(), game);
|
||||
if (card.putOntoBattlefield(game, Zone.LIBRARY, source.getId(), source.getControllerId())) {
|
||||
Permanent permanent = game.getPermanent(card.getId());
|
||||
if (permanent != null) {
|
||||
|
|
|
@ -110,7 +110,7 @@ class QuestForTheHolyRelicEffect extends OneShotEffect<QuestForTheHolyRelicEffec
|
|||
filter.getSubtype().add("Equipment");
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(filter);
|
||||
if (player.searchLibrary(target, game)) {
|
||||
Card card = player.getLibrary().remove(target.getFirstTarget(), game);
|
||||
Card card = player.getLibrary().getCard(target.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
card.putOntoBattlefield(game, Zone.LIBRARY, source.getId(), source.getControllerId());
|
||||
Permanent equipment = game.getPermanent(card.getId());
|
||||
|
|
|
@ -134,7 +134,6 @@ class WarrenInstigatorEffect extends OneShotEffect<WarrenInstigatorEffect> {
|
|||
if (player.choose(Outcome.PutCreatureInPlay, target, source.getSourceId(), game)) {
|
||||
Card card = game.getCard(target.getFirstTarget());
|
||||
if (card != null) {
|
||||
player.removeFromHand(card, game);
|
||||
card.putOntoBattlefield(game, Zone.HAND, source.getId(), source.getControllerId());
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -71,7 +71,6 @@ public class ReturnFromGraveyardToBattlefieldTargetEffect extends OneShotEffect<
|
|||
if (card != null) {
|
||||
Player player = game.getPlayer(card.getOwnerId());
|
||||
if (player != null) {
|
||||
player.removeFromGraveyard(card, game);
|
||||
if (card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getId(), source.getControllerId())) {
|
||||
if (tapped) {
|
||||
Permanent permanent = game.getPermanent(card.getId());
|
||||
|
|
|
@ -70,7 +70,6 @@ public class ReturnSourceFromGraveyardToBattlefieldEffect extends OneShotEffect<
|
|||
Player player = game.getPlayer(source.getControllerId());
|
||||
Card card = player.getGraveyard().get(source.getSourceId(), game);
|
||||
if (card != null) {
|
||||
player.removeFromGraveyard(card, game);
|
||||
if (card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getId(), source.getControllerId())) {
|
||||
if (tapped) {
|
||||
Permanent permanent = game.getPermanent(card.getId());
|
||||
|
|
|
@ -78,7 +78,7 @@ public class SearchLibraryPutInPlayEffect extends SearchEffect<SearchLibraryPutI
|
|||
if (player.searchLibrary(target, game)) {
|
||||
if (target.getTargets().size() > 0) {
|
||||
for (UUID cardId: (List<UUID>)target.getTargets()) {
|
||||
Card card = player.getLibrary().remove(cardId, game);
|
||||
Card card = player.getLibrary().getCard(cardId, game);
|
||||
if (card != null) {
|
||||
if (card.putOntoBattlefield(game, Zone.HAND, source.getId(), source.getControllerId())) {
|
||||
if (tapped) {
|
||||
|
|
|
@ -348,13 +348,33 @@ public abstract class CardImpl<T extends CardImpl<T>> extends MageObjectImpl<T>
|
|||
|
||||
@Override
|
||||
public boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId) {
|
||||
PermanentCard permanent = new PermanentCard(this, controllerId);
|
||||
game.getBattlefield().addPermanent(permanent);
|
||||
game.setZone(objectId, Zone.BATTLEFIELD);
|
||||
game.applyEffects();
|
||||
permanent.entersBattlefield(sourceId, game);
|
||||
game.fireEvent(new ZoneChangeEvent(permanent, controllerId, fromZone, Zone.BATTLEFIELD));
|
||||
return true;
|
||||
ZoneChangeEvent event = new ZoneChangeEvent(this.objectId, sourceId, controllerId, fromZone, Zone.BATTLEFIELD);
|
||||
if (!game.replaceEvent(event)) {
|
||||
if (fromZone != null) {
|
||||
switch (fromZone) {
|
||||
case GRAVEYARD:
|
||||
game.getPlayer(ownerId).removeFromGraveyard(this, game);
|
||||
break;
|
||||
case HAND:
|
||||
game.getPlayer(ownerId).removeFromHand(this, game);
|
||||
break;
|
||||
case LIBRARY:
|
||||
game.getPlayer(ownerId).removeFromLibrary(this, game);
|
||||
break;
|
||||
default:
|
||||
//logger.warning("putOntoBattlefield, not fully implemented: from="+fromZone);
|
||||
}
|
||||
game.rememberLKI(objectId, event.getFromZone(), this);
|
||||
}
|
||||
PermanentCard permanent = new PermanentCard(this, controllerId);
|
||||
game.getBattlefield().addPermanent(permanent);
|
||||
game.setZone(objectId, Zone.BATTLEFIELD);
|
||||
game.applyEffects();
|
||||
permanent.entersBattlefield(sourceId, game);
|
||||
game.fireEvent(new ZoneChangeEvent(permanent, controllerId, fromZone, Zone.BATTLEFIELD));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -505,7 +505,6 @@ public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializa
|
|||
for (Card card: player.getHand().getCards(this)) {
|
||||
if (card.getAbilities().containsKey(LeylineAbility.getInstance().getId())) {
|
||||
if (player.chooseUse(Outcome.PutCardInPlay, "Do you wish to put " + card.getName() + " on the battlefield?", this)) {
|
||||
player.getHand().remove(card.getId());
|
||||
card.putOntoBattlefield(this, Zone.HAND, null, player.getId());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -512,24 +512,6 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
|
|||
if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.PLAY_LAND, card.getId(), playerId))) {
|
||||
int bookmark = game.bookmarkState();
|
||||
Zone zone = game.getState().getZone(card.getId());
|
||||
switch (zone) {
|
||||
case HAND:
|
||||
removeFromHand(card, game);
|
||||
break;
|
||||
case LIBRARY:
|
||||
removeFromLibrary(card, game);
|
||||
break;
|
||||
case GRAVEYARD:
|
||||
removeFromGraveyard(card, game);
|
||||
break;
|
||||
case EXILED:
|
||||
game.getExile().removeCard(card, game);
|
||||
break;
|
||||
default:
|
||||
// invalid zone for play land
|
||||
return false;
|
||||
}
|
||||
|
||||
if (card.putOntoBattlefield(game, zone, null, playerId)) {
|
||||
landsPlayed++;
|
||||
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.LAND_PLAYED, card.getId(), playerId));
|
||||
|
|
Loading…
Reference in a new issue