mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 03:22:00 -08:00
fix casting from opponent's graveyard
This commit is contained in:
parent
437f2ba231
commit
69e9f3de8a
2 changed files with 7 additions and 1 deletions
|
|
@ -18,6 +18,7 @@ public class CastFromGraveyardOnceTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
private static final String bonesplitter = "Bonesplitter"; // 1 mana equip 1 for +2/+0
|
private static final String bonesplitter = "Bonesplitter"; // 1 mana equip 1 for +2/+0
|
||||||
private static final String kitesail = "Kitesail"; // 2 mana equip 2 for +1/+0 and flying
|
private static final String kitesail = "Kitesail"; // 2 mana equip 2 for +1/+0 and flying
|
||||||
|
private static final String machete = "Trusty Machete"; // 1 mana equip 2 for +2/+1
|
||||||
private static final String creature = "Field Creeper"; // 2 mana 2/1
|
private static final String creature = "Field Creeper"; // 2 mana 2/1
|
||||||
private static final String halvar = "Halvar, God of Battle"; // MDFC front side - creature 2WW
|
private static final String halvar = "Halvar, God of Battle"; // MDFC front side - creature 2WW
|
||||||
private static final String sword = "Sword of the Realms"; // MDFC back side - equipment 1W
|
private static final String sword = "Sword of the Realms"; // MDFC back side - equipment 1W
|
||||||
|
|
@ -34,12 +35,14 @@ public class CastFromGraveyardOnceTest extends CardTestPlayerBase {
|
||||||
addCard(Zone.BATTLEFIELD, playerA, danitha);
|
addCard(Zone.BATTLEFIELD, playerA, danitha);
|
||||||
addCard(Zone.GRAVEYARD, playerA, bonesplitter);
|
addCard(Zone.GRAVEYARD, playerA, bonesplitter);
|
||||||
addCard(Zone.GRAVEYARD, playerA, kitesail);
|
addCard(Zone.GRAVEYARD, playerA, kitesail);
|
||||||
|
addCard(Zone.GRAVEYARD, playerB, machete);
|
||||||
addCard(Zone.GRAVEYARD, playerA, creature);
|
addCard(Zone.GRAVEYARD, playerA, creature);
|
||||||
addCard(Zone.BATTLEFIELD, playerA, "Wastes", 3);
|
addCard(Zone.BATTLEFIELD, playerA, "Wastes", 3);
|
||||||
addCard(Zone.BATTLEFIELD, playerA, "Raff Capashen, Ship's Mage"); // historic spells have flash
|
addCard(Zone.BATTLEFIELD, playerA, "Raff Capashen, Ship's Mage"); // historic spells have flash
|
||||||
|
|
||||||
checkPlayableAbility("bonesplitter your turn", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast " + bonesplitter, true);
|
checkPlayableAbility("bonesplitter your turn", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast " + bonesplitter, true);
|
||||||
checkPlayableAbility("kitesail your turn", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast " + kitesail, true);
|
checkPlayableAbility("kitesail your turn", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast " + kitesail, true);
|
||||||
|
checkPlayableAbility("only your graveyard", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast " + machete, false);
|
||||||
checkPlayableAbility("creature not permitted", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast " + creature, false);
|
checkPlayableAbility("creature not permitted", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast " + creature, false);
|
||||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, kitesail);
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, kitesail);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package mage.abilities.common;
|
package mage.abilities.common;
|
||||||
|
|
||||||
import mage.MageIdentifier;
|
import mage.MageIdentifier;
|
||||||
|
import mage.MageObject;
|
||||||
import mage.MageObjectReference;
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.SpellAbility;
|
import mage.abilities.SpellAbility;
|
||||||
|
|
@ -79,12 +80,14 @@ class CastFromGraveyardOnceEffect extends AsThoughEffectImpl {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
Permanent sourcePermanent = source.getSourcePermanentIfItStillExists(game);
|
Permanent sourcePermanent = source.getSourcePermanentIfItStillExists(game);
|
||||||
CastFromGraveyardOnceWatcher watcher = game.getState().getWatcher(CastFromGraveyardOnceWatcher.class);
|
CastFromGraveyardOnceWatcher watcher = game.getState().getWatcher(CastFromGraveyardOnceWatcher.class);
|
||||||
if (controller == null || sourcePermanent == null || watcher == null) {
|
Card cardToCast = game.getCard(objectId);
|
||||||
|
if (controller == null || sourcePermanent == null || watcher == null || cardToCast == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (game.isActivePlayer(playerId) // only during your turn
|
if (game.isActivePlayer(playerId) // only during your turn
|
||||||
&& source.isControlledBy(playerId) // only you may cast
|
&& source.isControlledBy(playerId) // only you may cast
|
||||||
&& Zone.GRAVEYARD.equals(game.getState().getZone(objectId)) // from graveyard
|
&& Zone.GRAVEYARD.equals(game.getState().getZone(objectId)) // from graveyard
|
||||||
|
&& cardToCast.getOwnerId().equals(playerId) // only your graveyard
|
||||||
&& affectedAbility instanceof SpellAbility // characteristics to check
|
&& affectedAbility instanceof SpellAbility // characteristics to check
|
||||||
&& watcher.abilityNotUsed(new MageObjectReference(sourcePermanent, game)) // once per turn
|
&& watcher.abilityNotUsed(new MageObjectReference(sourcePermanent, game)) // once per turn
|
||||||
) {
|
) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue