mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
[DTK] Added Orator of Ojutai and Scale Blessing.
This commit is contained in:
parent
227052f108
commit
cb8d19906a
6 changed files with 302 additions and 44 deletions
|
@ -35,6 +35,7 @@ import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.DamageTargetEffect;
|
import mage.abilities.effects.common.DamageTargetEffect;
|
||||||
import mage.abilities.effects.common.InfoEffect;
|
import mage.abilities.effects.common.InfoEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.AbilityType;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
|
@ -75,10 +76,12 @@ public class DraconicRoar extends CardImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void adjustCosts(Ability ability, Game game) {
|
public void adjustCosts(Ability ability, Game game) {
|
||||||
Player controller = game.getPlayer(ability.getControllerId());
|
if (ability.getAbilityType().equals(AbilityType.SPELL)) {
|
||||||
if (controller != null) {
|
Player controller = game.getPlayer(ability.getControllerId());
|
||||||
if (controller.getHand().count(filter, game) > 0) {
|
if (controller != null) {
|
||||||
ability.addCost(new RevealTargetFromHandCost(new TargetCardInHand(0,1, filter)));
|
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());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher = (DragonOnTheBattlefieldWhileSpellWasCastWatcher) game.getState().getWatchers().get("DragonOnTheBattlefieldWhileSpellWasCastWatcher");
|
DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher = (DragonOnTheBattlefieldWhileSpellWasCastWatcher) game.getState().getWatchers().get("DragonOnTheBattlefieldWhileSpellWasCastWatcher");
|
||||||
boolean condition = watcher != null && watcher.castWithConditionTrue(source.getId());
|
if (watcher != null && watcher.castWithConditionTrue(source.getId())) {
|
||||||
if (!condition) {
|
|
||||||
for (Cost cost: source.getCosts()) {
|
|
||||||
if (cost instanceof RevealTargetFromHandCost) {
|
|
||||||
condition = ((RevealTargetFromHandCost)cost).getNumberRevealedCards() > 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (condition) {
|
|
||||||
Permanent permanent = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source));
|
Permanent permanent = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source));
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
Player player = game.getPlayer(permanent.getControllerId());
|
Player player = game.getPlayer(permanent.getControllerId());
|
||||||
|
|
|
@ -29,12 +29,12 @@ package mage.sets.dragonsoftarkir;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.costs.Cost;
|
|
||||||
import mage.abilities.costs.common.RevealTargetFromHandCost;
|
import mage.abilities.costs.common.RevealTargetFromHandCost;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.InfoEffect;
|
import mage.abilities.effects.common.InfoEffect;
|
||||||
import mage.abilities.effects.common.SacrificeEffect;
|
import mage.abilities.effects.common.SacrificeEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.AbilityType;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
|
@ -44,6 +44,7 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.TargetPlayer;
|
import mage.target.TargetPlayer;
|
||||||
|
import mage.target.common.TargetCardInHand;
|
||||||
import mage.watchers.common.DragonOnTheBattlefieldWhileSpellWasCastWatcher;
|
import mage.watchers.common.DragonOnTheBattlefieldWhileSpellWasCastWatcher;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -73,6 +74,18 @@ public class FoulTongueInvocation extends CardImpl {
|
||||||
this.getSpellAbility().addWatcher(new DragonOnTheBattlefieldWhileSpellWasCastWatcher());
|
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) {
|
public FoulTongueInvocation(final FoulTongueInvocation card) {
|
||||||
super(card);
|
super(card);
|
||||||
}
|
}
|
||||||
|
@ -104,15 +117,7 @@ class FoulTongueInvocationEffect extends OneShotEffect {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher = (DragonOnTheBattlefieldWhileSpellWasCastWatcher) game.getState().getWatchers().get("DragonOnTheBattlefieldWhileSpellWasCastWatcher");
|
DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher = (DragonOnTheBattlefieldWhileSpellWasCastWatcher) game.getState().getWatchers().get("DragonOnTheBattlefieldWhileSpellWasCastWatcher");
|
||||||
boolean condition = watcher != null && watcher.castWithConditionTrue(source.getId());
|
if (watcher != null && watcher.castWithConditionTrue(source.getId())) {
|
||||||
if (!condition) {
|
|
||||||
for (Cost cost: source.getCosts()) {
|
|
||||||
if (cost instanceof RevealTargetFromHandCost) {
|
|
||||||
condition = ((RevealTargetFromHandCost)cost).getNumberRevealedCards() > 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (condition) {
|
|
||||||
controller.gainLife(4, game);
|
controller.gainLife(4, game);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
135
Mage.Sets/src/mage/sets/dragonsoftarkir/OratorOfOjutai.java
Normal file
135
Mage.Sets/src/mage/sets/dragonsoftarkir/OratorOfOjutai.java
Normal file
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
108
Mage.Sets/src/mage/sets/dragonsoftarkir/ScaleBlessing.java
Normal file
108
Mage.Sets/src/mage/sets/dragonsoftarkir/ScaleBlessing.java
Normal file
|
@ -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. <i.(To bolster 1, choose a creature with the least toughness among creatures you control and put +1/+1 counter on it.)</i>
|
||||||
|
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. <i.(To bolster 1, choose a creature with the least toughness among creatures you control and put +1/+1 counter on it.)</i>";
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -35,6 +35,7 @@ import mage.abilities.costs.mana.GenericManaCost;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.InfoEffect;
|
import mage.abilities.effects.common.InfoEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.AbilityType;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
|
@ -76,10 +77,12 @@ public class SilumgarsScorn extends CardImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void adjustCosts(Ability ability, Game game) {
|
public void adjustCosts(Ability ability, Game game) {
|
||||||
Player controller = game.getPlayer(ability.getControllerId());
|
if (ability.getAbilityType().equals(AbilityType.SPELL)) {
|
||||||
if (controller != null) {
|
Player controller = game.getPlayer(ability.getControllerId());
|
||||||
if (controller.getHand().count(filter, game) > 0) {
|
if (controller != null) {
|
||||||
ability.addCost(new RevealTargetFromHandCost(new TargetCardInHand(0,1, filter)));
|
if (controller.getHand().count(filter, game) > 0) {
|
||||||
|
ability.addCost(new RevealTargetFromHandCost(new TargetCardInHand(0,1, filter)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,8 @@ package mage.watchers.common;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.abilities.costs.Cost;
|
||||||
|
import mage.abilities.costs.common.RevealTargetFromHandCost;
|
||||||
import mage.constants.WatcherScope;
|
import mage.constants.WatcherScope;
|
||||||
import mage.filter.common.FilterCreaturePermanent;
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
@ -41,7 +43,6 @@ import mage.watchers.Watcher;
|
||||||
*
|
*
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class DragonOnTheBattlefieldWhileSpellWasCastWatcher extends Watcher {
|
public class DragonOnTheBattlefieldWhileSpellWasCastWatcher extends Watcher {
|
||||||
|
|
||||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Dragon", "Dragons");
|
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Dragon", "Dragons");
|
||||||
|
@ -49,39 +50,50 @@ public class DragonOnTheBattlefieldWhileSpellWasCastWatcher extends Watcher {
|
||||||
private final Set<UUID> castWithDragonOnTheBattlefield = new HashSet<>();
|
private final Set<UUID> castWithDragonOnTheBattlefield = new HashSet<>();
|
||||||
|
|
||||||
public DragonOnTheBattlefieldWhileSpellWasCastWatcher() {
|
public DragonOnTheBattlefieldWhileSpellWasCastWatcher() {
|
||||||
super("DragonOnTheBattlefieldWhileSpellWasCastWatcher", WatcherScope.GAME);
|
super("DragonOnTheBattlefieldWhileSpellWasCastWatcher", WatcherScope.GAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DragonOnTheBattlefieldWhileSpellWasCastWatcher(final DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher) {
|
public DragonOnTheBattlefieldWhileSpellWasCastWatcher(final DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher) {
|
||||||
super(watcher);
|
super(watcher);
|
||||||
this.castWithDragonOnTheBattlefield.addAll(watcher.castWithDragonOnTheBattlefield);
|
this.castWithDragonOnTheBattlefield.addAll(watcher.castWithDragonOnTheBattlefield);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void watch(GameEvent event, Game game) {
|
public void watch(GameEvent event, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.SPELL_CAST) {
|
if (event.getType() == GameEvent.EventType.SPELL_CAST) {
|
||||||
// targetId is the unique ID of the spell
|
// targetId is the unique ID of the spell
|
||||||
Spell spell = game.getState().getStack().getSpell(event.getTargetId());
|
Spell spell = game.getState().getStack().getSpell(event.getTargetId());
|
||||||
if (spell != null) {
|
// revealed a Dragon card or controlled a Dragon as you cast the spell
|
||||||
if (game.getBattlefield().countAll(filter, spell.getControllerId(), game) > 0) {
|
if (spell != null) {
|
||||||
castWithDragonOnTheBattlefield.add(spell.getId());
|
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
|
@Override
|
||||||
public void reset() {
|
public void reset() {
|
||||||
castWithDragonOnTheBattlefield.clear();
|
castWithDragonOnTheBattlefield.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean castWithConditionTrue(UUID spellId) {
|
public boolean castWithConditionTrue(UUID spellId) {
|
||||||
return castWithDragonOnTheBattlefield.contains(spellId);
|
return castWithDragonOnTheBattlefield.contains(spellId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DragonOnTheBattlefieldWhileSpellWasCastWatcher copy() {
|
public DragonOnTheBattlefieldWhileSpellWasCastWatcher copy() {
|
||||||
return new DragonOnTheBattlefieldWhileSpellWasCastWatcher(this);
|
return new DragonOnTheBattlefieldWhileSpellWasCastWatcher(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue