spjspj - Clean up code for Eye of the Storm (RAV) - aka EotS shouldn't trigger after every spell is cast, only instants/sorceries and now check if imprinted spells are from players who have been eliminated before copying.

This commit is contained in:
spjspj 2016-06-11 12:40:41 +10:00
parent ee4d23d3aa
commit ac910ca881

View file

@ -103,7 +103,7 @@ 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) { if (spell != null && (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()));
} }
@ -152,12 +152,13 @@ class EyeOfTheStormEffect1 extends OneShotEffect {
if (controller.moveCardsToExile(spell, source, game, true, exileZoneId, EyeOfTheStorm.getIdName())) { if (controller.moveCardsToExile(spell, source, game, true, exileZoneId, EyeOfTheStorm.getIdName())) {
EyeOfTheStorm.imprint(card.getId(), game); EyeOfTheStorm.imprint(card.getId(), game);
Player player = game.getPlayer(spell.getControllerId());
if (EyeOfTheStorm != null && EyeOfTheStorm.getImprinted() != null && EyeOfTheStorm.getImprinted().size() > 0 && controller != null) { if (EyeOfTheStorm != null && EyeOfTheStorm.getImprinted() != null && EyeOfTheStorm.getImprinted().size() > 0 && controller != null) {
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
if (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());
@ -165,6 +166,7 @@ class EyeOfTheStormEffect1 extends OneShotEffect {
copiedCards.add(card); copiedCards.add(card);
} }
} }
}
boolean continueCasting = true; boolean continueCasting = true;
while (continueCasting) { while (continueCasting) {