mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
Havengul Laboratory // Havengul Mystery - fixed that it doesn't transform back on creature leaves
This commit is contained in:
parent
7de35db2e4
commit
a970dc46c7
4 changed files with 73 additions and 5 deletions
|
|
@ -42,7 +42,7 @@ public final class HavengulLaboratory extends CardImpl {
|
||||||
ability.addCost(new TapSourceCost());
|
ability.addCost(new TapSourceCost());
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
|
|
||||||
// At the beginning of your end step, if you sacrificed three or more Clues this turn, transform Hawkins National Laboratory.
|
// At the beginning of your end step, if you sacrificed three or more Clues this turn, transform Havengul Laboratory.
|
||||||
this.addAbility(new TransformAbility());
|
this.addAbility(new TransformAbility());
|
||||||
this.addAbility(new BeginningOfEndStepTriggeredAbility(
|
this.addAbility(new BeginningOfEndStepTriggeredAbility(
|
||||||
TargetController.YOU, new TransformSourceEffect(),
|
TargetController.YOU, new TransformSourceEffect(),
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ import mage.game.events.ZoneChangeEvent;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.common.TargetCardInYourGraveyard;
|
import mage.target.common.TargetCardInYourGraveyard;
|
||||||
|
import mage.util.CardUtil;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
@ -35,7 +36,6 @@ public final class HavengulMystery extends CardImpl {
|
||||||
public HavengulMystery(UUID ownerId, CardSetInfo setInfo) {
|
public HavengulMystery(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");
|
super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");
|
||||||
this.supertype.add(SuperType.LEGENDARY);
|
this.supertype.add(SuperType.LEGENDARY);
|
||||||
|
|
||||||
this.nightCard = true;
|
this.nightCard = true;
|
||||||
|
|
||||||
// When this land transforms into Havengul Mystery, return target creature card from your graveyard to the battlefield.
|
// When this land transforms into Havengul Mystery, return target creature card from your graveyard to the battlefield.
|
||||||
|
|
@ -63,7 +63,7 @@ public final class HavengulMystery extends CardImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
static String makeKey(Ability source, Game game) {
|
static String makeKey(Ability source, Game game) {
|
||||||
return "HavengulMystery_" + source.getSourceId() + '_' + source.getSourceObjectZoneChangeCounter();
|
return "HavengulMystery_" + source.getSourceId() + '_' + CardUtil.getActualSourceObjectZoneChangeCounter(game, source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -112,6 +112,7 @@ class HavengulMysteryLeavesAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
HavengulMysteryLeavesAbility() {
|
HavengulMysteryLeavesAbility() {
|
||||||
super(Zone.BATTLEFIELD, new TransformSourceEffect());
|
super(Zone.BATTLEFIELD, new TransformSourceEffect());
|
||||||
|
setLeavesTheBattlefieldTrigger(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private HavengulMysteryLeavesAbility(final HavengulMysteryLeavesAbility ability) {
|
private HavengulMysteryLeavesAbility(final HavengulMysteryLeavesAbility ability) {
|
||||||
|
|
@ -131,7 +132,12 @@ class HavengulMysteryLeavesAbility extends TriggeredAbilityImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||||
Set<MageObjectReference> morSet = (Set<MageObjectReference>) game.getState().getValue(HavengulMystery.makeKey(this, game));
|
if (zEvent.getFromZone() != Zone.BATTLEFIELD) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
String key = HavengulMystery.makeKey(this, game);
|
||||||
|
Set<MageObjectReference> morSet = (Set<MageObjectReference>) game.getState().getValue(key);
|
||||||
return morSet != null
|
return morSet != null
|
||||||
&& !morSet.isEmpty()
|
&& !morSet.isEmpty()
|
||||||
&& morSet.stream().anyMatch(mor -> mor.refersTo(zEvent.getTarget(), game));
|
&& morSet.stream().anyMatch(mor -> mor.refersTo(zEvent.getTarget(), game));
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@ public final class UniversesWithin extends ExpansionSet {
|
||||||
}
|
}
|
||||||
|
|
||||||
private UniversesWithin() {
|
private UniversesWithin() {
|
||||||
// The set name is a placeholder and will likely change
|
|
||||||
super("Universes Within", "SLX", ExpansionSet.buildDate(2022, 3, 3), SetType.SUPPLEMENTAL);
|
super("Universes Within", "SLX", ExpansionSet.buildDate(2022, 3, 3), SetType.SUPPLEMENTAL);
|
||||||
this.hasBasicLands = false;
|
this.hasBasicLands = false;
|
||||||
this.hasBoosters = false;
|
this.hasBoosters = false;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,63 @@
|
||||||
|
package org.mage.test.cards.single.slx;
|
||||||
|
|
||||||
|
import mage.constants.PhaseStep;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author JayDi85
|
||||||
|
*/
|
||||||
|
public class HavengulLaboratoryTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_LeavesAndTransform() {
|
||||||
|
addCustomEffect_TargetDestroy(playerA);
|
||||||
|
|
||||||
|
// Havengul Laboratory
|
||||||
|
// At the beginning of your end step, if you sacrificed three or more Clues this turn, transform Havengul Laboratory.
|
||||||
|
// Havengul Mystery
|
||||||
|
// When this land transforms into Havengul Mystery, return target creature card from your graveyard to the battlefield.
|
||||||
|
// When the creature put onto the battlefield with Havengul Mystery leaves the battlefield, transform Havengul Mystery.
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Havengul Laboratory");
|
||||||
|
addCard(Zone.GRAVEYARD, playerA, "Grizzly Bears");
|
||||||
|
//
|
||||||
|
// Draw a card. Investigate.
|
||||||
|
addCard(Zone.HAND, playerA, "Deduce", 3); // instant {1}{U}
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Island", 3 * 2);
|
||||||
|
//
|
||||||
|
// Clue Token
|
||||||
|
// {2}, Sacrifice this artifact: Draw a card.
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Island", 3 * 2);
|
||||||
|
|
||||||
|
// prepare x3 clues
|
||||||
|
checkPermanentCount("before", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Havengul Laboratory", 1);
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Deduce");
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Deduce");
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Deduce");
|
||||||
|
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN, playerA);
|
||||||
|
checkPermanentCount("on prepare", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Clue Token", 3);
|
||||||
|
|
||||||
|
// use all clues and transform
|
||||||
|
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{2}, Sacrifice");
|
||||||
|
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{2}, Sacrifice");
|
||||||
|
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{2}, Sacrifice");
|
||||||
|
addTarget(playerA, "Grizzly Bears"); // return to battlefield on transform
|
||||||
|
waitStackResolved(1, PhaseStep.END_TURN);
|
||||||
|
checkPermanentCount("on transform", 1, PhaseStep.END_TURN, playerA, "Havengul Laboratory", 0);
|
||||||
|
checkPermanentCount("on transform", 1, PhaseStep.END_TURN, playerA, "Havengul Mystery", 1);
|
||||||
|
checkPermanentCount("on transform", 1, PhaseStep.END_TURN, playerA, "Grizzly Bears", 1);
|
||||||
|
|
||||||
|
// destroy and transform back to Havengul Laboratory
|
||||||
|
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerA, "target destroy", "Grizzly Bears");
|
||||||
|
waitStackResolved(2, PhaseStep.PRECOMBAT_MAIN);
|
||||||
|
checkPermanentCount("on leaves", 2, PhaseStep.PRECOMBAT_MAIN, playerA, "Havengul Laboratory", 1);
|
||||||
|
checkPermanentCount("on leaves", 2, PhaseStep.PRECOMBAT_MAIN, playerA, "Havengul Mystery", 0);
|
||||||
|
checkPermanentCount("on leaves", 2, PhaseStep.PRECOMBAT_MAIN, playerA, "Grizzly Bears", 0);
|
||||||
|
checkGraveyardCount("on leaves", 2, PhaseStep.PRECOMBAT_MAIN, playerA, "Grizzly Bears", 1);
|
||||||
|
|
||||||
|
setStrictChooseMode(true);
|
||||||
|
setStopAt(2, PhaseStep.END_TURN);
|
||||||
|
execute();
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue