Merge origin/master

This commit is contained in:
LevelX2 2017-03-12 21:00:26 +01:00
commit bfa9d17182

View file

@ -142,25 +142,36 @@ class EyeOfTheStormEffect1 extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source)); Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
boolean noLongerOnStack = false;// spell was exiled already by another effect, for example NivMagus Elemental
if (spell == null) {
spell = ((Spell) game.getLastKnownInformation(targetPointer.getFirst(game, source), Zone.STACK));
noLongerOnStack = true;
}
Permanent eyeOfTheStorm = game.getPermanentOrLKIBattlefield(source.getSourceId()); Permanent eyeOfTheStorm = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (spell != null && eyeOfTheStorm != null) { if (spell != null && eyeOfTheStorm != null) {
Player spellController = game.getPlayer(spell.getControllerId()); Player spellController = game.getPlayer(spell.getControllerId());
Card card = spell.getCard(); Card card = spell.getCard();
if (spellController == null || card == null || !instantOrSorceryfilter.match(card, game)) { if (spellController == null
|| card == null
|| !instantOrSorceryfilter.match(card, game)) {
return false; return false;
} }
if (!noLongerOnStack) {// the spell is still on the stack, so exile it
UUID exileZoneId = CardUtil.getExileZoneId(game, source.getSourceId(), eyeOfTheStorm.getZoneChangeCounter(game)); UUID exileZoneId = CardUtil.getExileZoneId(game, source.getSourceId(), eyeOfTheStorm.getZoneChangeCounter(game));
if (spellController.moveCardsToExile(spell, source, game, true, exileZoneId, eyeOfTheStorm.getIdName())) { spellController.moveCardsToExile(spell, source, game, true, exileZoneId, eyeOfTheStorm.getIdName());
eyeOfTheStorm.imprint(card.getId(), game); }
if (eyeOfTheStorm.getImprinted() != null && !eyeOfTheStorm.getImprinted().isEmpty()) { eyeOfTheStorm.imprint(card.getId(), game);// technically, using the imprint functionality here is not correct.
if (eyeOfTheStorm.getImprinted() != null
&& !eyeOfTheStorm.getImprinted().isEmpty()) {
CardsImpl copiedCards = new CardsImpl(); CardsImpl copiedCards = new CardsImpl();
for (UUID uuid : eyeOfTheStorm.getImprinted()) { for (UUID uuid : eyeOfTheStorm.getImprinted()) {
card = game.getCard(uuid); card = game.getCard(uuid);
// Check if owner of card is still in game // Check if owner of card is still in game
if (card != null && game.getPlayer(card.getOwnerId()) != null) { if (card != null
&& game.getPlayer(card.getOwnerId()) != null) {
if (card.isSplitCard()) { if (card.isSplitCard()) {
copiedCards.add(((SplitCard) card).getLeftHalfCard()); copiedCards.add(((SplitCard) card).getLeftHalfCard());
copiedCards.add(((SplitCard) card).getRightHalfCard()); copiedCards.add(((SplitCard) card).getRightHalfCard());
@ -193,7 +204,6 @@ class EyeOfTheStormEffect1 extends OneShotEffect {
return true; return true;
} }
} }
}
return false; return false;
} }