diff --git a/Mage.Sets/src/mage/sets/journeyintonyx/DictateOfHeliod.java b/Mage.Sets/src/mage/sets/journeyintonyx/DictateOfHeliod.java new file mode 100644 index 00000000000..e7a117e57de --- /dev/null +++ b/Mage.Sets/src/mage/sets/journeyintonyx/DictateOfHeliod.java @@ -0,0 +1,66 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.journeyintonyx; + +import java.util.UUID; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.continious.BoostControlledEffect; +import mage.abilities.keyword.FlashAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; + +/** + * + * @author LevelX2 + */ +public class DictateOfHeliod extends CardImpl { + + public DictateOfHeliod(UUID ownerId) { + super(ownerId, 8, "Dictate of Heliod", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{W}{W}"); + this.expansionSetCode = "JOU"; + + this.color.setWhite(true); + + // Flash + this.addAbility(FlashAbility.getInstance()); + // Creatures you control get +2/+2. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(2,2,Duration.WhileOnBattlefield))); + } + + public DictateOfHeliod(final DictateOfHeliod card) { + super(card); + } + + @Override + public DictateOfHeliod copy() { + return new DictateOfHeliod(this); + } +} diff --git a/Mage.Sets/src/mage/sets/journeyintonyx/EidolonOfRhetoric.java b/Mage.Sets/src/mage/sets/journeyintonyx/EidolonOfRhetoric.java index 1fd348c97bc..b6a766758e3 100644 --- a/Mage.Sets/src/mage/sets/journeyintonyx/EidolonOfRhetoric.java +++ b/Mage.Sets/src/mage/sets/journeyintonyx/EidolonOfRhetoric.java @@ -27,6 +27,8 @@ */ package mage.sets.journeyintonyx; +import java.util.HashSet; +import java.util.Set; import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; @@ -42,6 +44,7 @@ import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.permanent.Permanent; +import mage.game.stack.Spell; import mage.players.Player; import mage.watchers.Watcher; import mage.watchers.WatcherImpl; @@ -78,8 +81,10 @@ public class EidolonOfRhetoric extends CardImpl { class EidolonOfRhetoricWatcher extends WatcherImpl { + private final Set players = new HashSet<>(); + public EidolonOfRhetoricWatcher() { - super("SpellCast", WatcherScope.PLAYER); + super("SpellCast", WatcherScope.GAME); } public EidolonOfRhetoricWatcher(final EidolonOfRhetoricWatcher watcher) { @@ -93,20 +98,24 @@ class EidolonOfRhetoricWatcher extends WatcherImpl { @Override public void watch(GameEvent event, Game game) { - if (condition == true) {//no need to check - condition has already occured - return; - } if (event.getType() == GameEvent.EventType.SPELL_CAST ) { - Permanent enchantment = game.getPermanent(this.sourceId); - if (enchantment != null && enchantment.getAttachedTo() != null) { - Player player = game.getPlayer(enchantment.getAttachedTo()); - if (player != null && event.getPlayerId().equals(player.getId())) { - condition = true; - } + Spell spell = game.getStack().getSpell(event.getTargetId()); + if (spell != null) { + players.add(spell.getControllerId()); } } } + @Override + public void reset() { + super.reset(); + players.clear(); + } + + + public boolean playerCastSpellThisTurn(UUID playerId) { + return players.contains(playerId); + } } class EidolonOfRhetoricEffect extends ReplacementEffectImpl { @@ -138,8 +147,8 @@ class EidolonOfRhetoricEffect extends ReplacementEffectImpl { + + private static final FilterPermanent filter = new FilterPermanent("an enchantment or an enchanted permanent"); + + static { + filter.add(Predicates.or( + new CardTypePredicate(CardType.ENCHANTMENT), + new EnchantedPredicate())); + } + + public GodhunterOctopus(UUID ownerId) { + super(ownerId, 39, "Godhunter Octopus", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{5}{U}"); + this.expansionSetCode = "JOU"; + this.subtype.add("Octopus"); + + this.color.setBlue(true); + this.power = new MageInt(5); + this.toughness = new MageInt(5); + + // Godhunter Octopus can't attack unless defending player controls an enchantment or an enchanted permanent. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackUnlessDefenderControllsPermanent(filter))); + } + + public GodhunterOctopus(final GodhunterOctopus card) { + super(card); + } + + @Override + public GodhunterOctopus copy() { + return new GodhunterOctopus(this); + } +} diff --git a/Mage.Sets/src/mage/sets/journeyintonyx/InterpretTheSigns.java b/Mage.Sets/src/mage/sets/journeyintonyx/InterpretTheSigns.java index a9f6828d4b7..e66dc552536 100644 --- a/Mage.Sets/src/mage/sets/journeyintonyx/InterpretTheSigns.java +++ b/Mage.Sets/src/mage/sets/journeyintonyx/InterpretTheSigns.java @@ -33,6 +33,7 @@ import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.ScryEffect; import mage.cards.Card; import mage.cards.CardImpl; +import mage.cards.CardsImpl; import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.Rarity; @@ -86,9 +87,11 @@ class InterpretTheSignsEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); - if (controller != null) { + Card sourceCard = game.getCard(source.getSourceId()); + if (controller != null && sourceCard != null) { Card card = controller.getLibrary().getFromTop(game); if (card != null) { + controller.revealCards(sourceCard.getName(), new CardsImpl(card), game); controller.drawCards(card.getManaCost().convertedManaCost(), game); } return true; diff --git a/Mage.Sets/src/mage/sets/journeyintonyx/SetessanTactics.java b/Mage.Sets/src/mage/sets/journeyintonyx/SetessanTactics.java index d34914c0ab2..8edf8c4c6b3 100644 --- a/Mage.Sets/src/mage/sets/journeyintonyx/SetessanTactics.java +++ b/Mage.Sets/src/mage/sets/journeyintonyx/SetessanTactics.java @@ -28,6 +28,7 @@ package mage.sets.journeyintonyx; import java.util.UUID; +import mage.abilities.Ability; import mage.abilities.abilityword.StriveAbility; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.TapSourceCost; @@ -40,6 +41,8 @@ import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Rarity; import mage.constants.Zone; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.permanent.AnotherPredicate; import mage.target.common.TargetCreaturePermanent; /** @@ -48,6 +51,12 @@ import mage.target.common.TargetCreaturePermanent; */ public class SetessanTactics extends CardImpl { + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("another target creature"); + + static { + filter.add(new AnotherPredicate()); + } + public SetessanTactics(UUID ownerId) { super(ownerId, 140, "Setessan Tactics", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{1}{G}"); this.expansionSetCode = "JOU"; @@ -61,7 +70,9 @@ public class SetessanTactics extends CardImpl { Effect effect = new BoostTargetEffect(1,1, Duration.EndOfTurn); effect.setText("Until end of turn, any number of target creatures each get +1/+1"); this.getSpellAbility().addEffect(effect); - this.getSpellAbility().addEffect(new GainAbilityTargetEffect(new SimpleActivatedAbility(Zone.BATTLEFIELD, new FightTargetSourceEffect(), new TapSourceCost()), Duration.EndOfTurn, + Ability gainedAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD, new FightTargetSourceEffect(), new TapSourceCost()); + gainedAbility.addTarget(new TargetCreaturePermanent(filter, true)); + this.getSpellAbility().addEffect(new GainAbilityTargetEffect(gainedAbility, Duration.EndOfTurn, "and gain \"T: This creature fights another target creature")); } diff --git a/Mage/src/mage/abilities/effects/RestrictionEffect.java b/Mage/src/mage/abilities/effects/RestrictionEffect.java index 53e0053c361..c1a77cc9d4c 100644 --- a/Mage/src/mage/abilities/effects/RestrictionEffect.java +++ b/Mage/src/mage/abilities/effects/RestrictionEffect.java @@ -43,7 +43,11 @@ import mage.game.permanent.Permanent; public abstract class RestrictionEffect> extends ContinuousEffectImpl { public RestrictionEffect(Duration duration) { - super(duration, Outcome.Detriment); + this(duration, Outcome.Detriment); + } + + public RestrictionEffect(Duration duration, Outcome outcome) { + super(duration, outcome); this.effectType = EffectType.RESTRICTION; } diff --git a/Mage/src/mage/abilities/effects/common/combat/CantBeBlockedTargetEffect.java b/Mage/src/mage/abilities/effects/common/combat/CantBeBlockedTargetEffect.java index d104412a630..871b9480fe2 100644 --- a/Mage/src/mage/abilities/effects/common/combat/CantBeBlockedTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/combat/CantBeBlockedTargetEffect.java @@ -31,6 +31,7 @@ import mage.abilities.Ability; import mage.abilities.Mode; import mage.abilities.effects.RestrictionEffect; import mage.constants.Duration; +import mage.constants.Outcome; import mage.game.Game; import mage.game.permanent.Permanent; import mage.target.Target; @@ -43,7 +44,7 @@ import mage.target.Target; public class CantBeBlockedTargetEffect extends RestrictionEffect { public CantBeBlockedTargetEffect(Duration duration) { - super(duration); + super(duration, Outcome.Benefit); } public CantBeBlockedTargetEffect(final CantBeBlockedTargetEffect effect) { @@ -52,10 +53,7 @@ public class CantBeBlockedTargetEffect extends RestrictionEffect