use of mage.cards.AdventureCard in project mage by magefree.
the class CopySpellTest method test_SimpleCopy_AdventureCard.
@Test
public void test_SimpleCopy_AdventureCard() {
AdventureCard sourceCard = (AdventureCard) CardRepository.instance.findCard("Animating Faerie").getCard();
AdventureCard originalCard = (AdventureCard) CardRepository.instance.findCard("Animating Faerie").getCard();
prepareZoneAndZCC(originalCard);
AdventureCard copiedCard = (AdventureCard) currentGame.copyCard(originalCard, null, playerA.getId());
// main
Assert.assertNotEquals("main - id must be different", originalCard.getId(), copiedCard.getId());
Assert.assertEquals("main - rules must be same", originalCard.getRules(), copiedCard.getRules());
abilitySourceMustBeSame(sourceCard, "main source");
abilitySourceMustBeSame(originalCard, "main original");
abilitySourceMustBeSame(copiedCard, "main copied");
// cardsMustHaveSameZoneAndZCC(originalCard, copiedCard, "main");
// right (spell)
Assert.assertNotEquals("right - id must be different", originalCard.getSpellCard().getId(), copiedCard.getSpellCard().getId());
Assert.assertEquals("right - rules must be same", originalCard.getSpellCard().getRules(), copiedCard.getSpellCard().getRules());
Assert.assertEquals("right - parent ref", copiedCard.getSpellCard().getParentCard().getId(), copiedCard.getId());
abilitySourceMustBeSame(originalCard.getSpellCard(), "right original");
abilitySourceMustBeSame(copiedCard.getSpellCard(), "right copied");
// cardsMustHaveSameZoneAndZCC(originalCard.getSpellCard(), copiedCard.getSpellCard(), "right");
}
use of mage.cards.AdventureCard in project mage by magefree.
the class WrennAndSixEmblemEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
for (UUID cardId : controller.getGraveyard()) {
Card card = game.getCard(cardId);
if (card == null) {
continue;
}
if (card instanceof SplitCard) {
SplitCardHalf leftHalfCard = ((SplitCard) card).getLeftHalfCard();
SplitCardHalf rightHalfCard = ((SplitCard) card).getRightHalfCard();
if (leftHalfCard.isInstantOrSorcery(game)) {
Ability ability = new RetraceAbility(leftHalfCard);
ability.setSourceId(cardId);
ability.setControllerId(leftHalfCard.getOwnerId());
game.getState().addOtherAbility(leftHalfCard, ability);
}
if (rightHalfCard.isInstantOrSorcery(game)) {
Ability ability = new RetraceAbility(rightHalfCard);
ability.setSourceId(cardId);
ability.setControllerId(rightHalfCard.getOwnerId());
game.getState().addOtherAbility(rightHalfCard, ability);
}
}
if (card instanceof ModalDoubleFacesCard) {
ModalDoubleFacesCardHalf leftHalfCard = ((ModalDoubleFacesCard) card).getLeftHalfCard();
ModalDoubleFacesCardHalf rightHalfCard = ((ModalDoubleFacesCard) card).getRightHalfCard();
if (leftHalfCard.isInstantOrSorcery(game)) {
Ability ability = new RetraceAbility(leftHalfCard);
ability.setSourceId(cardId);
ability.setControllerId(leftHalfCard.getOwnerId());
game.getState().addOtherAbility(leftHalfCard, ability);
}
if (rightHalfCard.isInstantOrSorcery(game)) {
Ability ability = new RetraceAbility(rightHalfCard);
ability.setSourceId(cardId);
ability.setControllerId(rightHalfCard.getOwnerId());
game.getState().addOtherAbility(rightHalfCard, ability);
}
}
if (card instanceof AdventureCard) {
// Adventure cards are castable per https://twitter.com/elishffrn/status/1179047911729946624
card = ((AdventureCard) card).getSpellCard();
}
if (!card.isInstantOrSorcery(game)) {
continue;
}
Ability ability = new RetraceAbility(card);
ability.setSourceId(cardId);
ability.setControllerId(card.getOwnerId());
game.getState().addOtherAbility(card, ability);
}
return true;
}
Aggregations