mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
- Refactored Tidehollow Sculler. The cast exception issue.
This commit is contained in:
parent
232781cc1f
commit
fed062fe9a
1 changed files with 19 additions and 10 deletions
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
package mage.cards.t;
|
package mage.cards.t;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -80,23 +79,30 @@ class TidehollowScullerExileEffect extends OneShotEffect {
|
||||||
// 6/7/2013 If Tidehollow Sculler leaves the battlefield before its first ability has resolved,
|
// 6/7/2013 If Tidehollow Sculler leaves the battlefield before its first ability has resolved,
|
||||||
// its second ability will trigger. This ability will do nothing when it resolves.
|
// its second ability will trigger. This ability will do nothing when it resolves.
|
||||||
// Then its first ability will resolve and exile the chosen card forever.
|
// Then its first ability will resolve and exile the chosen card forever.
|
||||||
Permanent sourcePermanent = (Permanent) source.getSourceObject(game);
|
Permanent sourcePermanent = (Permanent) source.getSourcePermanentIfItStillExists(game);
|
||||||
if (controller != null && opponent != null && sourcePermanent != null) {
|
if (controller != null
|
||||||
|
&& opponent != null
|
||||||
|
&& sourcePermanent != null) {
|
||||||
opponent.revealCards(sourcePermanent.getName(), opponent.getHand(), game);
|
opponent.revealCards(sourcePermanent.getName(), opponent.getHand(), game);
|
||||||
|
|
||||||
TargetCard target = new TargetCard(Zone.HAND, new FilterNonlandCard("nonland card to exile"));
|
TargetCard target = new TargetCard(Zone.HAND, new FilterNonlandCard("nonland card to exile"));
|
||||||
if (controller.choose(Outcome.Exile, opponent.getHand(), target, game)) {
|
if (controller.choose(Outcome.Exile, opponent.getHand(), target, game)) {
|
||||||
Card card = opponent.getHand().get(target.getFirstTarget(), game);
|
Card card = opponent.getHand().get(target.getFirstTarget(), game);
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
controller.moveCardToExileWithInfo(card, CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()), sourcePermanent.getIdName(), source.getSourceId(), game, Zone.HAND, true);
|
controller.moveCardsToExile(
|
||||||
|
card,
|
||||||
|
source,
|
||||||
|
game,
|
||||||
|
true,
|
||||||
|
CardUtil.getExileZoneId(game,
|
||||||
|
source.getSourceId(),
|
||||||
|
source.getSourceObjectZoneChangeCounter()),
|
||||||
|
sourcePermanent.getIdName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class TidehollowScullerLeaveEffect extends OneShotEffect {
|
class TidehollowScullerLeaveEffect extends OneShotEffect {
|
||||||
|
@ -120,8 +126,11 @@ class TidehollowScullerLeaveEffect extends OneShotEffect {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
MageObject sourceObject = source.getSourceObject(game);
|
MageObject sourceObject = source.getSourceObject(game);
|
||||||
if (controller != null && sourceObject != null) {
|
if (controller != null && sourceObject != null) {
|
||||||
int zoneChangeCounter = (sourceObject instanceof PermanentToken) ? source.getSourceObjectZoneChangeCounter() : source.getSourceObjectZoneChangeCounter() - 1;
|
int zoneChangeCounter = (sourceObject instanceof PermanentToken)
|
||||||
ExileZone exZone = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source.getSourceId(), zoneChangeCounter));
|
? source.getSourceObjectZoneChangeCounter()
|
||||||
|
: source.getSourceObjectZoneChangeCounter() - 1;
|
||||||
|
ExileZone exZone = game.getExile().getExileZone(
|
||||||
|
CardUtil.getExileZoneId(game, source.getSourceId(), zoneChangeCounter));
|
||||||
if (exZone != null) {
|
if (exZone != null) {
|
||||||
controller.moveCards(exZone, Zone.HAND, source, game);
|
controller.moveCards(exZone, Zone.HAND, source, game);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue