mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 04:42:07 -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
|
|
@ -1,6 +1,7 @@
|
|||
package mage.abilities.common;
|
||||
|
||||
import mage.MageIdentifier;
|
||||
import mage.MageObject;
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
|
|
@ -79,12 +80,14 @@ class CastFromGraveyardOnceEffect extends AsThoughEffectImpl {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent sourcePermanent = source.getSourcePermanentIfItStillExists(game);
|
||||
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;
|
||||
}
|
||||
if (game.isActivePlayer(playerId) // only during your turn
|
||||
&& source.isControlledBy(playerId) // only you may cast
|
||||
&& Zone.GRAVEYARD.equals(game.getState().getZone(objectId)) // from graveyard
|
||||
&& cardToCast.getOwnerId().equals(playerId) // only your graveyard
|
||||
&& affectedAbility instanceof SpellAbility // characteristics to check
|
||||
&& watcher.abilityNotUsed(new MageObjectReference(sourcePermanent, game)) // once per turn
|
||||
) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue