Added "tapped" option for putOntoBattlefield. Fixed amulet of vigor

This commit is contained in:
Plopman 2013-07-03 21:24:47 +02:00
parent ba09f43f56
commit f43b3d1ee2
6 changed files with 20 additions and 20 deletions

View file

@ -75,13 +75,8 @@ public class ReturnFromGraveyardToBattlefieldTargetEffect extends OneShotEffect<
if (card != null) { if (card != null) {
Player player = game.getPlayer(card.getOwnerId()); Player player = game.getPlayer(card.getOwnerId());
if (player != null) { if (player != null) {
if (card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), source.getControllerId())) { if(card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), source.getControllerId(), true)){
if (tapped) { return true;
Permanent permanent = game.getPermanent(card.getId());
if (permanent != null) {
permanent.setTapped(true);
}
}
} }
} }
} }

View file

@ -70,12 +70,8 @@ public class ReturnSourceFromGraveyardToBattlefieldEffect extends OneShotEffect<
Player player = game.getPlayer(source.getControllerId()); Player player = game.getPlayer(source.getControllerId());
Card card = player.getGraveyard().get(source.getSourceId(), game); Card card = player.getGraveyard().get(source.getSourceId(), game);
if (card != null) { if (card != null) {
if (card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getId(), source.getControllerId())) { if(card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getId(), source.getControllerId(), true))
if (tapped) { {
Permanent permanent = game.getPermanent(card.getId());
if (permanent != null)
permanent.setTapped(true);
}
return true; return true;
} }
} }

View file

@ -94,13 +94,7 @@ public class SearchLibraryPutInPlayEffect extends SearchEffect<SearchLibraryPutI
for (UUID cardId: (List<UUID>)target.getTargets()) { for (UUID cardId: (List<UUID>)target.getTargets()) {
Card card = player.getLibrary().getCard(cardId, game); Card card = player.getLibrary().getCard(cardId, game);
if (card != null) { if (card != null) {
if (card.putOntoBattlefield(game, Zone.LIBRARY, source.getId(), source.getControllerId())) { card.putOntoBattlefield(game, Zone.LIBRARY, source.getId(), source.getControllerId(), tapped);
if (tapped) {
Permanent permanent = game.getPermanent(card.getId());
if (permanent != null)
permanent.setTapped(true);
}
}
} }
} }
} }

View file

@ -108,6 +108,7 @@ public interface Card extends MageObject {
boolean cast(Game game, Zone fromZone, SpellAbility ability, UUID controllerId); boolean cast(Game game, Zone fromZone, SpellAbility ability, UUID controllerId);
boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId); boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId);
boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId, boolean tapped);
List<Mana> getMana(); List<Mana> getMana();
void build(); void build();

View file

@ -426,6 +426,12 @@ public abstract class CardImpl<T extends CardImpl<T>> extends MageObjectImpl<T>
@Override @Override
public boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId) { public boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId) {
return putOntoBattlefield(game, fromZone, sourceId, controllerId, false);
}
@Override
public boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId, boolean tapped){
ZoneChangeEvent event = new ZoneChangeEvent(this.objectId, sourceId, controllerId, fromZone, Zone.BATTLEFIELD); ZoneChangeEvent event = new ZoneChangeEvent(this.objectId, sourceId, controllerId, fromZone, Zone.BATTLEFIELD);
if (!game.replaceEvent(event)) { if (!game.replaceEvent(event)) {
if (fromZone != null) { if (fromZone != null) {
@ -462,6 +468,7 @@ public abstract class CardImpl<T extends CardImpl<T>> extends MageObjectImpl<T>
game.setZone(objectId, Zone.BATTLEFIELD); game.setZone(objectId, Zone.BATTLEFIELD);
game.setScopeRelevant(true); game.setScopeRelevant(true);
game.applyEffects(); // magenoxx: this causes bugs - LevelX2: but it's neccessary for casting e.g. Kird Ape which must trigger evolve game.applyEffects(); // magenoxx: this causes bugs - LevelX2: but it's neccessary for casting e.g. Kird Ape which must trigger evolve
permanent.setTapped(tapped);
permanent.entersBattlefield(sourceId, game, event.getFromZone(), true); permanent.entersBattlefield(sourceId, game, event.getFromZone(), true);
game.setScopeRelevant(false); game.setScopeRelevant(false);
game.applyEffects(); game.applyEffects();

View file

@ -508,6 +508,12 @@ public class Spell<T extends Spell<T>> implements StackObject, Card {
return false; return false;
} }
@Override
public boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId, boolean tapped) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override @Override
public boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId) { public boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId) {
throw new UnsupportedOperationException("Unsupported operation"); throw new UnsupportedOperationException("Unsupported operation");
@ -614,4 +620,5 @@ public class Spell<T extends Spell<T>> implements StackObject, Card {
public Card getCard() { public Card getCard() {
return card; return card;
} }
} }