mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
parent
92b722d3ca
commit
11373fd75d
3 changed files with 39 additions and 8 deletions
|
|
@ -163,12 +163,19 @@ class XanatharPlayFromTopOfTargetLibraryEffect extends AsThoughEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean applies(UUID objectId, Ability affectedAbility, Ability source, Game game, UUID playerId) {
|
||||
if (!(affectedAbility instanceof SpellAbility) || !playerId.equals(source.getControllerId())) {
|
||||
Card cardToCheck = game.getCard(objectId);
|
||||
if (cardToCheck == null) {
|
||||
return false;
|
||||
}
|
||||
SpellAbility spell = (SpellAbility) affectedAbility;
|
||||
Card cardToCheck = spell.getCharacteristics(game);
|
||||
if (spell.getManaCosts().isEmpty()) {
|
||||
if (affectedAbility instanceof SpellAbility) {
|
||||
SpellAbility spell = (SpellAbility) affectedAbility;
|
||||
cardToCheck = spell.getCharacteristics(game);
|
||||
if (spell.getManaCosts().isEmpty()) {
|
||||
return false; // prevent casting cards without mana cost?
|
||||
}
|
||||
}
|
||||
// only permits you to cast
|
||||
if (!playerId.equals(source.getControllerId())) {
|
||||
return false;
|
||||
}
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
|
|
@ -176,7 +183,7 @@ class XanatharPlayFromTopOfTargetLibraryEffect extends AsThoughEffectImpl {
|
|||
if (controller == null || opponent == null) {
|
||||
return false;
|
||||
}
|
||||
// main card of spell must be on top of the opponent's library
|
||||
// main card of spell/land must be on top of the opponent's library
|
||||
Card topCard = opponent.getLibrary().getFromTop(game);
|
||||
return topCard != null && topCard.getId().equals(cardToCheck.getMainCard().getId());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,4 +57,28 @@ public class XanatharGuildKingpinTest extends CardTestPlayerBase {
|
|||
setStopAt(2, PhaseStep.END_TURN);
|
||||
execute();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_PlayLand() {
|
||||
setStrictChooseMode(true);
|
||||
skipInitShuffling();
|
||||
|
||||
// At the beginning of your upkeep, choose target opponent.
|
||||
// Until end of turn, that player can’t cast spells, you may look at the top card of their library any time,
|
||||
// you may play the top card of their library, and you may spend mana as though it were mana of any color
|
||||
// to cast spells this way.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Xanathar, Guild Kingpin");
|
||||
addCard(Zone.LIBRARY, playerB, "Taiga");
|
||||
|
||||
// activate on opponent
|
||||
addTarget(playerA, playerB);
|
||||
|
||||
// play from B
|
||||
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Taiga");
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "Taiga", 1);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,15 +68,15 @@ public class PlayFromTopOfLibraryEffect extends AsThoughEffectImpl {
|
|||
public boolean applies(UUID objectId, Ability affectedAbility, Ability source, Game game, UUID playerId) {
|
||||
// can play lands/spells (must check specific part and allows specific part)
|
||||
|
||||
Card cardToCheck = game.getCard(objectId); // maybe this should be removed and only check SpellAbility characteristics
|
||||
Card cardToCheck = game.getCard(objectId); // maybe this should be removed and only check SpellAbility characteristics -- No! don't forget PlayLandAbility
|
||||
if (cardToCheck == null) {
|
||||
return false;
|
||||
}
|
||||
if (affectedAbility instanceof SpellAbility) {
|
||||
SpellAbility spell = (SpellAbility) affectedAbility;
|
||||
cardToCheck = spell.getCharacteristics(game);
|
||||
if (spell.getManaCosts().isEmpty()){
|
||||
return false;
|
||||
if (spell.getManaCosts().isEmpty()) {
|
||||
return false; // prevent casting cards without mana cost?
|
||||
}
|
||||
}
|
||||
// only permits you to cast
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue