mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
Merge origin/master
This commit is contained in:
commit
bfa9d17182
1 changed files with 47 additions and 37 deletions
|
@ -142,56 +142,66 @@ 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));
|
||||||
|
spellController.moveCardsToExile(spell, source, game, true, exileZoneId, eyeOfTheStorm.getIdName());
|
||||||
|
}
|
||||||
|
|
||||||
UUID exileZoneId = CardUtil.getExileZoneId(game, source.getSourceId(), eyeOfTheStorm.getZoneChangeCounter(game));
|
eyeOfTheStorm.imprint(card.getId(), game);// technically, using the imprint functionality here is not correct.
|
||||||
if (spellController.moveCardsToExile(spell, source, game, true, exileZoneId, eyeOfTheStorm.getIdName())) {
|
|
||||||
eyeOfTheStorm.imprint(card.getId(), game);
|
|
||||||
|
|
||||||
if (eyeOfTheStorm.getImprinted() != null && !eyeOfTheStorm.getImprinted().isEmpty()) {
|
if (eyeOfTheStorm.getImprinted() != null
|
||||||
CardsImpl copiedCards = new CardsImpl();
|
&& !eyeOfTheStorm.getImprinted().isEmpty()) {
|
||||||
for (UUID uuid : eyeOfTheStorm.getImprinted()) {
|
CardsImpl copiedCards = new CardsImpl();
|
||||||
card = game.getCard(uuid);
|
for (UUID uuid : eyeOfTheStorm.getImprinted()) {
|
||||||
|
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
|
||||||
if (card.isSplitCard()) {
|
&& game.getPlayer(card.getOwnerId()) != null) {
|
||||||
copiedCards.add(((SplitCard) card).getLeftHalfCard());
|
if (card.isSplitCard()) {
|
||||||
copiedCards.add(((SplitCard) card).getRightHalfCard());
|
copiedCards.add(((SplitCard) card).getLeftHalfCard());
|
||||||
} else {
|
copiedCards.add(((SplitCard) card).getRightHalfCard());
|
||||||
copiedCards.add(card);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean continueCasting = true;
|
|
||||||
while (continueCasting) {
|
|
||||||
continueCasting = copiedCards.size() > 1 && spellController.chooseUse(outcome, "Cast one of the copied cards without paying its mana cost?", source, game);
|
|
||||||
|
|
||||||
Card cardToCopy;
|
|
||||||
if (copiedCards.size() == 1) {
|
|
||||||
cardToCopy = copiedCards.getCards(game).iterator().next();
|
|
||||||
} else {
|
} else {
|
||||||
TargetCard target = new TargetCard(1, Zone.EXILED, new FilterCard("card to copy"));
|
copiedCards.add(card);
|
||||||
spellController.choose(Outcome.Copy, copiedCards, target, game);
|
|
||||||
cardToCopy = copiedCards.get(target.getFirstTarget(), game);
|
|
||||||
copiedCards.remove(cardToCopy);
|
|
||||||
}
|
|
||||||
if (cardToCopy != null) {
|
|
||||||
Card copy = game.copyCard(cardToCopy, source, source.getControllerId());
|
|
||||||
if (spellController.chooseUse(outcome, "Cast the copied card without paying mana cost?", source, game)) {
|
|
||||||
spellController.cast(copy.getSpellAbility(), game, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean continueCasting = true;
|
||||||
|
while (continueCasting) {
|
||||||
|
continueCasting = copiedCards.size() > 1 && spellController.chooseUse(outcome, "Cast one of the copied cards without paying its mana cost?", source, game);
|
||||||
|
|
||||||
|
Card cardToCopy;
|
||||||
|
if (copiedCards.size() == 1) {
|
||||||
|
cardToCopy = copiedCards.getCards(game).iterator().next();
|
||||||
|
} else {
|
||||||
|
TargetCard target = new TargetCard(1, Zone.EXILED, new FilterCard("card to copy"));
|
||||||
|
spellController.choose(Outcome.Copy, copiedCards, target, game);
|
||||||
|
cardToCopy = copiedCards.get(target.getFirstTarget(), game);
|
||||||
|
copiedCards.remove(cardToCopy);
|
||||||
|
}
|
||||||
|
if (cardToCopy != null) {
|
||||||
|
Card copy = game.copyCard(cardToCopy, source, source.getControllerId());
|
||||||
|
if (spellController.chooseUse(outcome, "Cast the copied card without paying mana cost?", source, game)) {
|
||||||
|
spellController.cast(copy.getSpellAbility(), game, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue