mirror of
https://github.com/correl/mage.git
synced 2025-01-11 19:13:02 +00:00
* Eye of the Storm - Fixed that the exiled spells could only always be cast by the controller of the Eye of the Storm.
This commit is contained in:
parent
47fb2c1ac5
commit
c84180b0f7
2 changed files with 23 additions and 24 deletions
|
@ -47,7 +47,6 @@ import mage.constants.Rarity;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.Library;
|
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.targetpointer.FixedTarget;
|
import mage.target.targetpointer.FixedTarget;
|
||||||
|
|
||||||
|
@ -106,14 +105,14 @@ class StromkirkOccultistExileEffect extends OneShotEffect {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||||
if (sourcePermanent != null && controller != null && controller.getLibrary().size() > 0) {
|
if (sourcePermanent != null && controller != null && controller.getLibrary().size() > 0) {
|
||||||
Library library = controller.getLibrary();
|
Card card = controller.getLibrary().getFromTop(game);
|
||||||
Card card = library.removeFromTop(game);
|
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
String exileName = new StringBuilder(sourcePermanent.getIdName()).append(" <this card may be played the turn it was exiled>").toString();
|
String exileName = new StringBuilder(sourcePermanent.getIdName()).append(" <this card may be played the turn it was exiled>").toString();
|
||||||
controller.moveCardToExileWithInfo(card, source.getSourceId(), exileName, source.getSourceId(), game, Zone.LIBRARY, true);
|
if (controller.moveCardToExileWithInfo(card, source.getSourceId(), exileName, source.getSourceId(), game, Zone.LIBRARY, true)) {
|
||||||
ContinuousEffect effect = new StromkirkOccultistPlayFromExileEffect();
|
ContinuousEffect effect = new StromkirkOccultistPlayFromExileEffect();
|
||||||
effect.setTargetPointer(new FixedTarget(card.getId()));
|
effect.setTargetPointer(new FixedTarget(card.getId()));
|
||||||
game.addEffect(effect, source);
|
game.addEffect(effect, source);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -144,7 +143,7 @@ class StromkirkOccultistPlayFromExileEffect extends AsThoughEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
||||||
return source.getControllerId().equals(affectedControllerId) &&
|
return source.getControllerId().equals(affectedControllerId)
|
||||||
objectId.equals(getTargetPointer().getFirst(game, source));
|
&& objectId.equals(getTargetPointer().getFirst(game, source));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,7 +103,8 @@ class EyeOfTheStormAbility extends TriggeredAbilityImpl {
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
if (event.getZone() == Zone.HAND) {
|
if (event.getZone() == Zone.HAND) {
|
||||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||||
if (spell != null && (spell.getCardType().contains(CardType.INSTANT) || spell.getCardType().contains(CardType.SORCERY))) {
|
if (spell != null && !spell.isCopy()
|
||||||
|
&& (spell.getCardType().contains(CardType.INSTANT) || spell.getCardType().contains(CardType.SORCERY))) {
|
||||||
for (Effect effect : this.getEffects()) {
|
for (Effect effect : this.getEffects()) {
|
||||||
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||||
}
|
}
|
||||||
|
@ -139,22 +140,21 @@ 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));
|
||||||
Permanent EyeOfTheStorm = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
Permanent eyeOfTheStorm = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
if (spell != null && eyeOfTheStorm != null) {
|
||||||
|
Player spellController = game.getPlayer(spell.getControllerId());
|
||||||
if (controller != null && spell != null && EyeOfTheStorm != null) {
|
|
||||||
Card card = spell.getCard();
|
Card card = spell.getCard();
|
||||||
if (card == null || !instantOrSorceryfilter.match(card, game)) {
|
if (spellController == null || card == null || !instantOrSorceryfilter.match(card, game)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
UUID exileZoneId = CardUtil.getExileZoneId(game, source.getSourceId(), EyeOfTheStorm.getZoneChangeCounter(game));
|
UUID exileZoneId = CardUtil.getExileZoneId(game, source.getSourceId(), eyeOfTheStorm.getZoneChangeCounter(game));
|
||||||
if (controller.moveCardsToExile(spell, source, game, true, exileZoneId, EyeOfTheStorm.getIdName())) {
|
if (spellController.moveCardsToExile(spell, source, game, true, exileZoneId, eyeOfTheStorm.getIdName())) {
|
||||||
EyeOfTheStorm.imprint(card.getId(), game);
|
eyeOfTheStorm.imprint(card.getId(), game);
|
||||||
|
|
||||||
if (EyeOfTheStorm != null && EyeOfTheStorm.getImprinted() != null && EyeOfTheStorm.getImprinted().size() > 0 && controller != null) {
|
if (eyeOfTheStorm.getImprinted() != null && eyeOfTheStorm.getImprinted().size() > 0) {
|
||||||
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
|
||||||
|
@ -170,21 +170,21 @@ class EyeOfTheStormEffect1 extends OneShotEffect {
|
||||||
|
|
||||||
boolean continueCasting = true;
|
boolean continueCasting = true;
|
||||||
while (continueCasting) {
|
while (continueCasting) {
|
||||||
continueCasting = copiedCards.size() > 1 && controller.chooseUse(outcome, "Cast one of the copied cards without paying its mana cost?", source, game);
|
continueCasting = copiedCards.size() > 1 && spellController.chooseUse(outcome, "Cast one of the copied cards without paying its mana cost?", source, game);
|
||||||
|
|
||||||
Card cardToCopy;
|
Card cardToCopy;
|
||||||
if (copiedCards.size() == 1) {
|
if (copiedCards.size() == 1) {
|
||||||
cardToCopy = copiedCards.getCards(game).iterator().next();
|
cardToCopy = copiedCards.getCards(game).iterator().next();
|
||||||
} else {
|
} else {
|
||||||
TargetCard target = new TargetCard(1, Zone.EXILED, new FilterCard("card to copy"));
|
TargetCard target = new TargetCard(1, Zone.EXILED, new FilterCard("card to copy"));
|
||||||
controller.choose(Outcome.Copy, copiedCards, target, game);
|
spellController.choose(Outcome.Copy, copiedCards, target, game);
|
||||||
cardToCopy = copiedCards.get(target.getFirstTarget(), game);
|
cardToCopy = copiedCards.get(target.getFirstTarget(), game);
|
||||||
copiedCards.remove(cardToCopy);
|
copiedCards.remove(cardToCopy);
|
||||||
}
|
}
|
||||||
if (cardToCopy != null) {
|
if (cardToCopy != null) {
|
||||||
Card copy = game.copyCard(cardToCopy, source, source.getControllerId());
|
Card copy = game.copyCard(cardToCopy, source, source.getControllerId());
|
||||||
if (controller.chooseUse(outcome, "Cast the copied card without paying mana cost?", source, game)) {
|
if (spellController.chooseUse(outcome, "Cast the copied card without paying mana cost?", source, game)) {
|
||||||
controller.cast(copy.getSpellAbility(), game, true);
|
spellController.cast(copy.getSpellAbility(), game, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue