diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/DraconicRoar.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/DraconicRoar.java index 44f9721138..d37e9c3da5 100644 --- a/Mage.Sets/src/mage/sets/dragonsoftarkir/DraconicRoar.java +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/DraconicRoar.java @@ -35,6 +35,7 @@ import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.effects.common.InfoEffect; import mage.cards.CardImpl; +import mage.constants.AbilityType; import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.Rarity; @@ -75,10 +76,12 @@ public class DraconicRoar extends CardImpl { @Override public void adjustCosts(Ability ability, Game game) { - Player controller = game.getPlayer(ability.getControllerId()); - if (controller != null) { - if (controller.getHand().count(filter, game) > 0) { - ability.addCost(new RevealTargetFromHandCost(new TargetCardInHand(0,1, filter))); + if (ability.getAbilityType().equals(AbilityType.SPELL)) { + Player controller = game.getPlayer(ability.getControllerId()); + if (controller != null) { + if (controller.getHand().count(filter, game) > 0) { + ability.addCost(new RevealTargetFromHandCost(new TargetCardInHand(0,1, filter))); + } } } } @@ -115,15 +118,7 @@ class DraconicRoarEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher = (DragonOnTheBattlefieldWhileSpellWasCastWatcher) game.getState().getWatchers().get("DragonOnTheBattlefieldWhileSpellWasCastWatcher"); - boolean condition = watcher != null && watcher.castWithConditionTrue(source.getId()); - if (!condition) { - for (Cost cost: source.getCosts()) { - if (cost instanceof RevealTargetFromHandCost) { - condition = ((RevealTargetFromHandCost)cost).getNumberRevealedCards() > 0; - } - } - } - if (condition) { + if (watcher != null && watcher.castWithConditionTrue(source.getId())) { Permanent permanent = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source)); if (permanent != null) { Player player = game.getPlayer(permanent.getControllerId()); diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/FoulTongueInvocation.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/FoulTongueInvocation.java index 5820d2ba07..502f541dbe 100644 --- a/Mage.Sets/src/mage/sets/dragonsoftarkir/FoulTongueInvocation.java +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/FoulTongueInvocation.java @@ -29,12 +29,12 @@ package mage.sets.dragonsoftarkir; import java.util.UUID; import mage.abilities.Ability; -import mage.abilities.costs.Cost; import mage.abilities.costs.common.RevealTargetFromHandCost; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.InfoEffect; import mage.abilities.effects.common.SacrificeEffect; import mage.cards.CardImpl; +import mage.constants.AbilityType; import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.Rarity; @@ -44,6 +44,7 @@ import mage.filter.predicate.mageobject.SubtypePredicate; import mage.game.Game; import mage.players.Player; import mage.target.TargetPlayer; +import mage.target.common.TargetCardInHand; import mage.watchers.common.DragonOnTheBattlefieldWhileSpellWasCastWatcher; /** @@ -73,6 +74,18 @@ public class FoulTongueInvocation extends CardImpl { this.getSpellAbility().addWatcher(new DragonOnTheBattlefieldWhileSpellWasCastWatcher()); } + @Override + public void adjustCosts(Ability ability, Game game) { + if (ability.getAbilityType().equals(AbilityType.SPELL)) { + Player controller = game.getPlayer(ability.getControllerId()); + if (controller != null) { + if (controller.getHand().count(filter, game) > 0) { + ability.addCost(new RevealTargetFromHandCost(new TargetCardInHand(0,1, filter))); + } + } + } + } + public FoulTongueInvocation(final FoulTongueInvocation card) { super(card); } @@ -104,15 +117,7 @@ class FoulTongueInvocationEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher = (DragonOnTheBattlefieldWhileSpellWasCastWatcher) game.getState().getWatchers().get("DragonOnTheBattlefieldWhileSpellWasCastWatcher"); - boolean condition = watcher != null && watcher.castWithConditionTrue(source.getId()); - if (!condition) { - for (Cost cost: source.getCosts()) { - if (cost instanceof RevealTargetFromHandCost) { - condition = ((RevealTargetFromHandCost)cost).getNumberRevealedCards() > 0; - } - } - } - if (condition) { + if (watcher != null && watcher.castWithConditionTrue(source.getId())) { controller.gainLife(4, game); } return true; diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/OratorOfOjutai.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/OratorOfOjutai.java new file mode 100644 index 0000000000..21fa8899da --- /dev/null +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/OratorOfOjutai.java @@ -0,0 +1,135 @@ +/* + * 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.dragonsoftarkir; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.Cost; +import mage.abilities.costs.common.RevealTargetFromHandCost; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.InfoEffect; +import mage.abilities.keyword.DefenderAbility; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.constants.AbilityType; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.common.FilterCreatureCard; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetCardInHand; +import mage.watchers.common.DragonOnTheBattlefieldWhileSpellWasCastWatcher; + +/** + * + * @author LevelX2 + */ +public class OratorOfOjutai extends CardImpl { + + private static final FilterCreatureCard filter = new FilterCreatureCard("a Dragon card from your hand (you don't have to)"); + + static { + filter.add(new SubtypePredicate("Dragon")); + } + + public OratorOfOjutai(UUID ownerId) { + super(ownerId, 28, "Orator of Ojutai", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{W}"); + this.expansionSetCode = "DTK"; + this.subtype.add("Bird"); + this.subtype.add("Monk"); + this.power = new MageInt(0); + this.toughness = new MageInt(4); + + // Defender, flying + this.addAbility(DefenderAbility.getInstance()); + this.addAbility(FlyingAbility.getInstance()); + + // As an additional cost to cast Orator of Ojutai, you may reveal a Dragon card from your hand. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new InfoEffect("As an additional cost to cast {this}, you may reveal a Dragon card from your hand"))); + + // When Orator of Ojutai enters the battlefield, if you revealed a Dragon card or controlled a Dragon as you cast Orator of Ojutai, draw a card. + this.addAbility(new EntersBattlefieldTriggeredAbility(new OratorOfOjutaiEffect())); + } + + @Override + public void adjustCosts(Ability ability, Game game) { + if (ability.getAbilityType().equals(AbilityType.SPELL)) { + Player controller = game.getPlayer(ability.getControllerId()); + if (controller != null) { + if (controller.getHand().count(filter, game) > 0) { + ability.addCost(new RevealTargetFromHandCost(new TargetCardInHand(0,1, filter))); + } + } + } + } + + public OratorOfOjutai(final OratorOfOjutai card) { + super(card); + } + + @Override + public OratorOfOjutai copy() { + return new OratorOfOjutai(this); + } +} + +class OratorOfOjutaiEffect extends OneShotEffect { + + public OratorOfOjutaiEffect() { + super(Outcome.Benefit); + this.staticText = "If you revealed a Dragon card or controlled a Dragon as you cast {this}, draw a card"; + } + + public OratorOfOjutaiEffect(final OratorOfOjutaiEffect effect) { + super(effect); + } + + @Override + public OratorOfOjutaiEffect copy() { + return new OratorOfOjutaiEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher = (DragonOnTheBattlefieldWhileSpellWasCastWatcher) game.getState().getWatchers().get("DragonOnTheBattlefieldWhileSpellWasCastWatcher"); + if (watcher != null && watcher.castWithConditionTrue(source.getId())) { + controller.drawCards(1, game); + } + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/ScaleBlessing.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/ScaleBlessing.java new file mode 100644 index 0000000000..75a0dc3edd --- /dev/null +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/ScaleBlessing.java @@ -0,0 +1,108 @@ +/* + * 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.dragonsoftarkir; + +import java.util.UUID; +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.keyword.BolsterEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.counters.CounterType; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.permanent.CounterPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; + +/** + * + * @author LevelX2 + */ +public class ScaleBlessing extends CardImpl { + + public ScaleBlessing(UUID ownerId) { + super(ownerId, 35, "Scale Blessing", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{3}{W}"); + this.expansionSetCode = "DTK"; + + // Bolster 1, then put a +1/+1 counter on each creature you control with a +1/+1 counter on it. + Effect effect = new BolsterEffect(1); + effect.setText("Bolster 1"); + this.getSpellAbility().addEffect(effect); + + } + + public ScaleBlessing(final ScaleBlessing card) { + super(card); + } + + @Override + public ScaleBlessing copy() { + return new ScaleBlessing(this); + } +} + +class ScaleBlessingEffect extends OneShotEffect { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent(); + + static { + filter.add(new CounterPredicate(CounterType.P1P1)); + } + + public ScaleBlessingEffect() { + super(Outcome.Benefit); + this.staticText = ", then put a +1/+1 counter on each creature you control with a +1/+1 counter on it. "; + } + + public ScaleBlessingEffect(final ScaleBlessingEffect effect) { + super(effect); + } + + @Override + public ScaleBlessingEffect copy() { + return new ScaleBlessingEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + MageObject sourceObject = source.getSourceObject(game); + if (controller != null && sourceObject != null) { + for(Permanent permanent: game.getState().getBattlefield().getAllActivePermanents(filter , controller.getId(), game)) { + permanent.addCounters(CounterType.P1P1.createInstance(), game); + game.informPlayers(sourceObject.getName() + ": Put a +1/+1 counter on " + permanent.getLogName()); + } + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/SilumgarsScorn.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/SilumgarsScorn.java index 90f96207fa..025081a2b8 100644 --- a/Mage.Sets/src/mage/sets/dragonsoftarkir/SilumgarsScorn.java +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/SilumgarsScorn.java @@ -35,6 +35,7 @@ import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.InfoEffect; import mage.cards.CardImpl; +import mage.constants.AbilityType; import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.Rarity; @@ -76,10 +77,12 @@ public class SilumgarsScorn extends CardImpl { @Override public void adjustCosts(Ability ability, Game game) { - Player controller = game.getPlayer(ability.getControllerId()); - if (controller != null) { - if (controller.getHand().count(filter, game) > 0) { - ability.addCost(new RevealTargetFromHandCost(new TargetCardInHand(0,1, filter))); + if (ability.getAbilityType().equals(AbilityType.SPELL)) { + Player controller = game.getPlayer(ability.getControllerId()); + if (controller != null) { + if (controller.getHand().count(filter, game) > 0) { + ability.addCost(new RevealTargetFromHandCost(new TargetCardInHand(0,1, filter))); + } } } } diff --git a/Mage/src/mage/watchers/common/DragonOnTheBattlefieldWhileSpellWasCastWatcher.java b/Mage/src/mage/watchers/common/DragonOnTheBattlefieldWhileSpellWasCastWatcher.java index d7c3bd50b0..2267b30f7b 100644 --- a/Mage/src/mage/watchers/common/DragonOnTheBattlefieldWhileSpellWasCastWatcher.java +++ b/Mage/src/mage/watchers/common/DragonOnTheBattlefieldWhileSpellWasCastWatcher.java @@ -30,6 +30,8 @@ package mage.watchers.common; import java.util.HashSet; import java.util.Set; import java.util.UUID; +import mage.abilities.costs.Cost; +import mage.abilities.costs.common.RevealTargetFromHandCost; import mage.constants.WatcherScope; import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; @@ -41,7 +43,6 @@ import mage.watchers.Watcher; * * @author LevelX2 */ - public class DragonOnTheBattlefieldWhileSpellWasCastWatcher extends Watcher { private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Dragon", "Dragons"); @@ -49,39 +50,50 @@ public class DragonOnTheBattlefieldWhileSpellWasCastWatcher extends Watcher { private final Set castWithDragonOnTheBattlefield = new HashSet<>(); public DragonOnTheBattlefieldWhileSpellWasCastWatcher() { - super("DragonOnTheBattlefieldWhileSpellWasCastWatcher", WatcherScope.GAME); + super("DragonOnTheBattlefieldWhileSpellWasCastWatcher", WatcherScope.GAME); } public DragonOnTheBattlefieldWhileSpellWasCastWatcher(final DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher) { - super(watcher); - this.castWithDragonOnTheBattlefield.addAll(watcher.castWithDragonOnTheBattlefield); + super(watcher); + this.castWithDragonOnTheBattlefield.addAll(watcher.castWithDragonOnTheBattlefield); } @Override public void watch(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SPELL_CAST) { - // targetId is the unique ID of the spell - Spell spell = game.getState().getStack().getSpell(event.getTargetId()); - if (spell != null) { - if (game.getBattlefield().countAll(filter, spell.getControllerId(), game) > 0) { - castWithDragonOnTheBattlefield.add(spell.getId()); - } - - } - } + if (event.getType() == GameEvent.EventType.SPELL_CAST) { + // targetId is the unique ID of the spell + Spell spell = game.getState().getStack().getSpell(event.getTargetId()); + // revealed a Dragon card or controlled a Dragon as you cast the spell + if (spell != null) { + boolean revealedOrOnBattlefield = false; + for (Cost cost : spell.getSpellAbility().getCosts()) { + if (cost instanceof RevealTargetFromHandCost) { + revealedOrOnBattlefield = ((RevealTargetFromHandCost) cost).getNumberRevealedCards() > 0; + break; + } + } + if (!revealedOrOnBattlefield) { + revealedOrOnBattlefield = game.getBattlefield().countAll(filter, spell.getControllerId(), game) > 0; + } + if (revealedOrOnBattlefield){ + castWithDragonOnTheBattlefield.add(spell.getId()); + } + + } + } } @Override public void reset() { - castWithDragonOnTheBattlefield.clear(); + castWithDragonOnTheBattlefield.clear(); } public boolean castWithConditionTrue(UUID spellId) { - return castWithDragonOnTheBattlefield.contains(spellId); + return castWithDragonOnTheBattlefield.contains(spellId); } @Override public DragonOnTheBattlefieldWhileSpellWasCastWatcher copy() { - return new DragonOnTheBattlefieldWhileSpellWasCastWatcher(this); + return new DragonOnTheBattlefieldWhileSpellWasCastWatcher(this); } }