mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
- Fixed #8966
This commit is contained in:
parent
b62c569549
commit
fcde81b597
1 changed files with 13 additions and 7 deletions
|
|
@ -89,7 +89,10 @@ class VoltaicVisionaryTriggeredAbility extends TriggeredAbilityImpl {
|
|||
if (!this.isControlledBy(event.getPlayerId())) {
|
||||
return false;
|
||||
}
|
||||
Card card = game.getCard(event.getTargetId());
|
||||
Card card = game.getCard(event.getSourceId());
|
||||
if (card == null) {
|
||||
return false;
|
||||
}
|
||||
return VoltaicVisionaryWatcher.checkCard(card, this, game);
|
||||
}
|
||||
|
||||
|
|
@ -111,14 +114,18 @@ class VoltaicVisionaryWatcher extends Watcher {
|
|||
@Override
|
||||
public void watch(GameEvent event, Game game) {
|
||||
if (event.getType() != GameEvent.EventType.ZONE_CHANGE
|
||||
|| ((ZoneChangeEvent) event).getToZone() != Zone.EXILED) {
|
||||
|| ((ZoneChangeEvent) event).getToZone() != Zone.EXILED
|
||||
|| ((ZoneChangeEvent) event).getFromZone() != Zone.LIBRARY) {
|
||||
return;
|
||||
}
|
||||
Card card = game.getCard(event.getTargetId());
|
||||
if (card == null) {
|
||||
return;
|
||||
}
|
||||
UUID exileId = game
|
||||
.getExile()
|
||||
.getExileZones()
|
||||
.stream().filter(exileZone -> exileZone.contains(card))
|
||||
.stream().filter(exileZone -> exileZone.contains(card.getId()))
|
||||
.map(ExileZone::getId)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
|
@ -137,9 +144,8 @@ class VoltaicVisionaryWatcher extends Watcher {
|
|||
static boolean checkCard(Card card, Ability source, Game game) {
|
||||
return card != null
|
||||
&& game.getState()
|
||||
.getWatcher(VoltaicVisionaryWatcher.class)
|
||||
.map
|
||||
.getOrDefault(CardUtil.getCardExileZoneId(game, source), emptySet)
|
||||
.contains(new MageObjectReference(card, game, -1));
|
||||
.getWatcher(VoltaicVisionaryWatcher.class).map
|
||||
.getOrDefault(CardUtil.getCardExileZoneId(game, source), emptySet)
|
||||
.contains(new MageObjectReference(card, game, -1));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue