[BNG] Added 9 cards. Some fixes to other BNS cards. Some framework changes.

This commit is contained in:
LevelX2 2014-01-19 02:55:08 +01:00
parent 6c64e9baf7
commit 3167fc0896
21 changed files with 965 additions and 40 deletions

View file

@ -0,0 +1,147 @@
/*
* 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.bornofthegods;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.Condition;
import mage.abilities.decorator.ConditionalTriggeredAbility;
import mage.abilities.dynamicvalue.common.DevotionCount;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DrawCardControllerEffect;
import mage.abilities.effects.common.continious.LoseCreatureTypeSourceEffect;
import mage.abilities.keyword.IndestructibleAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.WatcherScope;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.watchers.Watcher;
import mage.watchers.WatcherImpl;
/**
*
* @author LevelX2
*/
public class EpharaGodOfThePolis extends CardImpl<EpharaGodOfThePolis> {
public EpharaGodOfThePolis(UUID ownerId) {
super(ownerId, 145, "Ephara, God of the Polis", Rarity.MYTHIC, new CardType[]{CardType.ENCHANTMENT, CardType.CREATURE}, "{2}{W}{U}");
this.expansionSetCode = "BNG";
this.supertype.add("Legendary");
this.subtype.add("God");
this.color.setBlue(true);
this.color.setWhite(true);
this.power = new MageInt(6);
this.toughness = new MageInt(5);
// Indestructible
this.addAbility(IndestructibleAbility.getInstance());
// As long as your devotion to white and blue is less than seven, Ephara isn't a creature.
Effect effect = new LoseCreatureTypeSourceEffect(new DevotionCount(ColoredManaSymbol.W, ColoredManaSymbol.U), 7);
effect.setText("As long as your devotion to white and blue is less than seven, Ephara isn't a creature");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
// At the beginning of each upkeep, if you had another creature enter the battlefield under your control last turn, draw a card.
this.addAbility(new ConditionalTriggeredAbility(
new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new DrawCardControllerEffect(1), TargetController.ANY, false),
HadAnotherCreatureEnterTheBattlefieldCondition.getInstance(),
"At the beginning of each upkeep, if you had another creature enter the battlefield under your control last turn, draw a card."));
this.addWatcher(new CreatureEnteredBattlefieldLastTurnWatcher());
}
public EpharaGodOfThePolis(final EpharaGodOfThePolis card) {
super(card);
}
@Override
public EpharaGodOfThePolis copy() {
return new EpharaGodOfThePolis(this);
}
}
class HadAnotherCreatureEnterTheBattlefieldCondition implements Condition {
private static HadAnotherCreatureEnterTheBattlefieldCondition fInstance = new HadAnotherCreatureEnterTheBattlefieldCondition();
public static HadAnotherCreatureEnterTheBattlefieldCondition getInstance() {
return fInstance;
}
@Override
public boolean apply(Game game, Ability source) {
Watcher watcher = game.getState().getWatchers().get("CreatureEnteredBattlefieldLastTurnWatcher", source.getSourceId());
return watcher != null && watcher.conditionMet();
}
}
class CreatureEnteredBattlefieldLastTurnWatcher extends WatcherImpl<CreatureEnteredBattlefieldLastTurnWatcher> {
private boolean anotherCreatureEntered = false;
public CreatureEnteredBattlefieldLastTurnWatcher() {
super("CreatureEnteredBattlefieldLastTurnWatcher", WatcherScope.CARD);
}
public CreatureEnteredBattlefieldLastTurnWatcher(final CreatureEnteredBattlefieldLastTurnWatcher watcher) {
super(watcher);
this.anotherCreatureEntered = watcher.anotherCreatureEntered;
}
@Override
public void watch(GameEvent event, Game game) {
if (!anotherCreatureEntered && event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
if (!event.getTargetId().equals(this.getSourceId()) && event.getPlayerId().equals(this.getControllerId())) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.getCardType().contains(CardType.CREATURE)) {
anotherCreatureEntered = true;
}
}
}
}
@Override
public void reset() {
condition = anotherCreatureEntered;
anotherCreatureEntered = false;
}
@Override
public CreatureEnteredBattlefieldLastTurnWatcher copy() {
return new CreatureEnteredBattlefieldLastTurnWatcher(this);
}
}

View file

@ -0,0 +1,92 @@
/*
* 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.bornofthegods;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.ReturnToHandSourceEffect;
import mage.abilities.effects.common.continious.GainAbilityAttachedEffect;
import mage.abilities.effects.common.counter.AddCountersAttachedEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.constants.AttachmentType;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.common.FilterCreaturePermanent;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author LevelX2
*/
public class EpharasEnlightenment extends CardImpl<EpharasEnlightenment> {
public EpharasEnlightenment(UUID ownerId) {
super(ownerId, 146, "Ephara's Enlightenment", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}{U}");
this.expansionSetCode = "BNG";
this.subtype.add("Aura");
this.color.setBlue(true);
this.color.setWhite(true);
// Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// When Ephara's Enlightenment enters the battlefield, put a +1/+1 counter on enchanted creature.
this.addAbility(new EntersBattlefieldTriggeredAbility(new AddCountersAttachedEffect(CounterType.P1P1.createInstance(), "enchanted creature"), false));
// Enchanted creature has flying.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(FlyingAbility.getInstance(), AttachmentType.AURA)));
// Whenever a creature enters the battlefield under your control, you may return Ephara's Enlightenment to its owner's hand.
this.addAbility(new EntersBattlefieldControlledTriggeredAbility(Zone.BATTLEFIELD,
new ReturnToHandSourceEffect(true),
new FilterCreaturePermanent("a creature"),
true));
}
public EpharasEnlightenment(final EpharasEnlightenment card) {
super(card);
}
@Override
public EpharasEnlightenment copy() {
return new EpharasEnlightenment(this);
}
}

View file

@ -0,0 +1,82 @@
/*
* 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.bornofthegods;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.TributeNotPaidCondition;
import mage.abilities.decorator.ConditionalTriggeredAbility;
import mage.abilities.effects.common.continious.BoostSourceEffect;
import mage.abilities.effects.common.continious.GainAbilitySourceEffect;
import mage.abilities.keyword.HasteAbility;
import mage.abilities.keyword.TrampleAbility;
import mage.abilities.keyword.TributeAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
/**
*
* @author LevelX2
*/
public class FanaticOfXenagos extends CardImpl<FanaticOfXenagos> {
public FanaticOfXenagos(UUID ownerId) {
super(ownerId, 147, "Fanatic of Xenagos", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{R}{G}");
this.expansionSetCode = "BNG";
this.subtype.add("Centaur");
this.subtype.add("Warrior");
this.color.setRed(true);
this.color.setGreen(true);
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// Trample
this.addAbility(TrampleAbility.getInstance());
// Tribute 1
this.addAbility(new TributeAbility(1));
// When Fanatic of Xenagos enters the battlefield, if its tribute wasn't paid, it gets +1/+1 and gains haste until end of turn.
TriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new BoostSourceEffect(1,1, Duration.EndOfTurn));
ability.addEffect( new GainAbilitySourceEffect(new GainAbilitySourceEffect(HasteAbility.getInstance(), Duration.EndOfTurn)));
this.addAbility(new ConditionalTriggeredAbility(ability, TributeNotPaidCondition.getInstance(),
"When {this} enters the battlefield, if its tribute wasn't paid, it gets +1/+1 and gains haste until end of turn."));
}
public FanaticOfXenagos(final FanaticOfXenagos card) {
super(card);
}
@Override
public FanaticOfXenagos copy() {
return new FanaticOfXenagos(this);
}
}

View file

@ -66,7 +66,6 @@ public class FlameWreathedPhoenix extends CardImpl<FlameWreathedPhoenix> {
this.addAbility(new TributeAbility(2));
// When Flame-Wreathed Phoenix enters the battlefield, if its tribute wasn't paid, it gains haste and "When this creature dies, return it to its owner's hand."
TriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new GainAbilitySourceEffect(HasteAbility.getInstance(), Duration.WhileOnBattlefield));
Effect effect = new GainAbilitySourceEffect(new DiesTriggeredAbility(new ReturnToHandSourceEffect()));
ability.addEffect(effect);
this.addAbility(new ConditionalTriggeredAbility(ability, TributeNotPaidCondition.getInstance(),

View file

@ -0,0 +1,92 @@
/*
* 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.bornofthegods;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.dynamicvalue.common.DevotionCount;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continious.LoseCreatureTypeSourceEffect;
import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect;
import mage.abilities.keyword.IndestructibleAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.common.FilterCreatureSpell;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.target.common.TargetCardInLibrary;
/**
*
* @author LevelX2
*/
public class KarametraGodOfHarvests extends CardImpl<KarametraGodOfHarvests> {
private static final FilterCard filter = new FilterCard("a Forest or Plains card");
static {
filter.add(Predicates.or(
new SubtypePredicate("Forest"),
new SubtypePredicate("Plains")));
}
public KarametraGodOfHarvests(UUID ownerId) {
super(ownerId, 148, "Karametra, God of Harvests", Rarity.MYTHIC, new CardType[]{CardType.ENCHANTMENT, CardType.CREATURE}, "{3}{G}{W}");
this.expansionSetCode = "BNG";
this.supertype.add("Legendary");
this.subtype.add("God");
this.color.setGreen(true);
this.color.setWhite(true);
this.power = new MageInt(6);
this.toughness = new MageInt(7);
// Indestructible
this.addAbility(IndestructibleAbility.getInstance());
// As long as your devotion to green and white is less than seven, Karametra isn't a creature.
Effect effect = new LoseCreatureTypeSourceEffect(new DevotionCount(ColoredManaSymbol.G, ColoredManaSymbol.W), 7);
effect.setText("As long as your devotion to green and white is less than seven, Karametra isn't a creature");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
// Whenever you cast a creature spell, you may search your library for a Forest or Plains card, put it onto the battlefield tapped, then shuffle your library.
this.addAbility(new SpellCastControllerTriggeredAbility(
new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)), new FilterCreatureSpell("a creature spell"), true));
}
public KarametraGodOfHarvests(final KarametraGodOfHarvests card) {
super(card);
}
@Override
public KarametraGodOfHarvests copy() {
return new KarametraGodOfHarvests(this);
}
}

View file

@ -0,0 +1,202 @@
/*
* 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.bornofthegods;
import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.effects.PreventionEffectImpl;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.DrawCardControllerEffect;
import mage.abilities.effects.common.GetEmblemEffect;
import mage.abilities.effects.common.continious.PlayAdditionalLandsControllerEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.PhaseStep;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.FilterPermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.command.Emblem;
import mage.game.events.DamageEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.Token;
import mage.game.turn.Step;
import mage.target.TargetPermanent;
/**
*
* @author LevelX2
*/
public class KioraTheCrashingWave extends CardImpl<KioraTheCrashingWave> {
private static final FilterPermanent filter = new FilterPermanent("permanent an opponent control");
static {
filter.add(new ControllerPredicate(TargetController.OPPONENT));
}
public KioraTheCrashingWave(UUID ownerId) {
super(ownerId, 149, "Kiora, the Crashing Wave", Rarity.MYTHIC, new CardType[]{CardType.PLANESWALKER}, "{2}{G}{U}");
this.expansionSetCode = "BNG";
this.subtype.add("Kiora");
this.color.setBlue(true);
this.color.setGreen(true);
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(2)), false));
// +1: Until your next turn, prevent all damage that would be dealt to and dealt by target permanent an opponent controls.
LoyaltyAbility ability = new LoyaltyAbility(new KioraPreventionEffect(), 1);
ability.addTarget(new TargetPermanent(filter, true));
this.addAbility(ability);
// -1: Draw a card. You may play an additional land this turn.
ability = new LoyaltyAbility(new DrawCardControllerEffect(1), -1);
ability.addEffect(new PlayAdditionalLandsControllerEffect(1, Duration.EndOfTurn));
this.addAbility(ability);
// -5: You get an emblem with "At the beginning of your end step, put a 9/9 blue Kraken creature token onto the battlefield."
this.addAbility(new LoyaltyAbility(new GetEmblemEffect(new KioraEmblem()), -5));
}
public KioraTheCrashingWave(final KioraTheCrashingWave card) {
super(card);
}
@Override
public KioraTheCrashingWave copy() {
return new KioraTheCrashingWave(this);
}
}
class KioraPreventionEffect extends PreventionEffectImpl<KioraPreventionEffect> {
public KioraPreventionEffect() {
super(Duration.Custom);
staticText = "Until your next turn, prevent all damage that would be dealt to and dealt by target permanent an opponent controls";
}
public KioraPreventionEffect(final KioraPreventionEffect effect) {
super(effect);
}
@Override
public KioraPreventionEffect copy() {
return new KioraPreventionEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public void init(Ability source, Game game) {
super.init(source, game);
for(UUID targetId :this.getTargetPointer().getTargets(game, source)) {
Permanent permanent = game.getPermanent(targetId);
if (permanent != null) {
permanent.addInfo(new StringBuilder("kioraPrevention").append(getId()).toString(),"[All damage that would be dealt to and dealt by this permanent is prevented.]");
}
}
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
GameEvent preventEvent = new GameEvent(GameEvent.EventType.PREVENT_DAMAGE, source.getFirstTarget(), source.getId(), source.getControllerId(), event.getAmount(), false);
if (!game.replaceEvent(preventEvent)) {
int damage = event.getAmount();
event.setAmount(0);
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, source.getFirstTarget(), source.getId(), source.getControllerId(), damage));
}
return false;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (super.applies(event, source, game) && event instanceof DamageEvent) {
Permanent targetPermanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (event.getSourceId().equals(targetPermanent.getId()) || event.getTargetId().equals(targetPermanent.getId())) {
return true;
}
}
return false;
}
@Override
public boolean isInactive(Ability source, Game game) {
if (game.getPhase().getStep().getType() == PhaseStep.UNTAP && game.getStep().getStepPart() == Step.StepPart.PRE)
{
if (game.getActivePlayerId().equals(source.getControllerId()) || game.getPlayer(source.getControllerId()).hasReachedNextTurnAfterLeaving()) {
for(UUID targetId :this.getTargetPointer().getTargets(game, source)) {
Permanent permanent = game.getPermanent(targetId);
if (permanent != null) {
permanent.addInfo(new StringBuilder("kioraPrevention").append(getId()).toString(),"");
}
}
return true;
}
}
return false;
}
}
/**
* Emblem: "At the beginning of your end step, put a 9/9 blue Kraken creature token onto the battlefield."
*/
class KioraEmblem extends Emblem {
public KioraEmblem() {
Ability ability = new BeginningOfEndStepTriggeredAbility(Zone.COMMAND, new CreateTokenEffect(new KioraKrakenToken()), TargetController.YOU, null, false);
this.getAbilities().add(ability);
}
}
class KioraKrakenToken extends Token {
public KioraKrakenToken() {
super("Kraken", "9/9 blue Kraken creature token");
cardType.add(CardType.CREATURE);
color = ObjectColor.BLUE;
subtype.add("Kraken");
power = new MageInt(9);
toughness = new MageInt(9);
this.setOriginalExpansionSetCode("BNG");
}
}

View file

@ -0,0 +1,76 @@
/*
* 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.bornofthegods;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.cost.SpellsCostReductionEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterSpell;
import mage.filter.predicate.mageobject.SubtypePredicate;
/**
*
* @author LevelX2
*/
public class Ragemonger extends CardImpl<Ragemonger> {
private static final FilterSpell filter = new FilterSpell("Minotaur spells");
static {
filter.add(new SubtypePredicate("Minotaur"));
}
public Ragemonger(UUID ownerId) {
super(ownerId, 153, "Ragemonger", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{B}{R}");
this.expansionSetCode = "BNG";
this.subtype.add("Minotaur");
this.subtype.add("Shaman");
this.color.setRed(true);
this.color.setBlack(true);
this.power = new MageInt(2);
this.toughness = new MageInt(3);
// Minotaur spells you cast cost {B}{R} less to cast. This effect reduces only the amount of colored mana you pay.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostReductionEffect(filter, new ManaCostsImpl("{B}{R}"))));
}
public Ragemonger(final Ragemonger card) {
super(card);
}
@Override
public Ragemonger copy() {
return new Ragemonger(this);
}
}

View file

@ -32,14 +32,14 @@ import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect;
import mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.filter.Filter;
import mage.constants.TargetController;
import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.other.OwnerPredicate;
import mage.target.common.TargetCardInGraveyard;
/**
@ -48,9 +48,10 @@ import mage.target.common.TargetCardInGraveyard;
*/
public class SilentSentinel extends CardImpl<SilentSentinel> {
private static final FilterCard filter = new FilterCard("enchantment card");
private static final FilterCard filter = new FilterCard("enchantment card from your graveyard");
static {
filter.add(new CardTypePredicate(CardType.ENCHANTMENT));
filter.add(new OwnerPredicate(TargetController.YOU));
}
public SilentSentinel(UUID ownerId) {

View file

@ -0,0 +1,67 @@
/*
* 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.bornofthegods;
import java.util.UUID;
import mage.abilities.common.EntersBattlefieldTappedAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.common.ScryEffect;
import mage.abilities.mana.BlueManaAbility;
import mage.abilities.mana.WhiteManaAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
/**
*
* @author LevelX2
*/
public class TempleOfEnlightenment extends CardImpl<TempleOfEnlightenment> {
public TempleOfEnlightenment(UUID ownerId) {
super(ownerId, 163, "Temple of Enlightenment", Rarity.RARE, new CardType[]{CardType.LAND}, "");
this.expansionSetCode = "BNG";
// Temple of Enlightenment enters the battlefield tapped.
this.addAbility(new EntersBattlefieldTappedAbility());
// When Temple of Enlightenment enters the battlefield, scry 1.
this.addAbility(new EntersBattlefieldTriggeredAbility(new ScryEffect(1)));
// {T}: Add {W} or {U} to your mana pool.
this.addAbility(new WhiteManaAbility());
this.addAbility(new BlueManaAbility());
}
public TempleOfEnlightenment(final TempleOfEnlightenment card) {
super(card);
}
@Override
public TempleOfEnlightenment copy() {
return new TempleOfEnlightenment(this);
}
}

View file

@ -0,0 +1,67 @@
/*
* 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.bornofthegods;
import java.util.UUID;
import mage.abilities.common.EntersBattlefieldTappedAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.common.ScryEffect;
import mage.abilities.mana.BlackManaAbility;
import mage.abilities.mana.RedManaAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
/**
*
* @author LevelX2
*/
public class TempleOfMalice extends CardImpl<TempleOfMalice> {
public TempleOfMalice(UUID ownerId) {
super(ownerId, 164, "Temple of Malice", Rarity.RARE, new CardType[]{CardType.LAND}, "");
this.expansionSetCode = "BNG";
// Temple of Malice enters the battlefield tapped.
this.addAbility(new EntersBattlefieldTappedAbility());
// When Temple of Malice enters the battlefield, scry 1.
this.addAbility(new EntersBattlefieldTriggeredAbility(new ScryEffect(1)));
// {T}: Add {B} or {R} to your mana pool.
this.addAbility(new BlackManaAbility());
this.addAbility(new RedManaAbility());
}
public TempleOfMalice(final TempleOfMalice card) {
super(card);
}
@Override
public TempleOfMalice copy() {
return new TempleOfMalice(this);
}
}

View file

@ -0,0 +1,67 @@
/*
* 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.bornofthegods;
import java.util.UUID;
import mage.abilities.common.EntersBattlefieldTappedAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.common.ScryEffect;
import mage.abilities.mana.GreenManaAbility;
import mage.abilities.mana.WhiteManaAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
/**
*
* @author LevelX2
*/
public class TempleOfPlenty extends CardImpl<TempleOfPlenty> {
public TempleOfPlenty(UUID ownerId) {
super(ownerId, 165, "Temple of Plenty", Rarity.RARE, new CardType[]{CardType.LAND}, "");
this.expansionSetCode = "BNG";
// Temple of Plenty enters the battlefield tapped.
this.addAbility(new EntersBattlefieldTappedAbility());
// When Temple of Plenty enters the battlefield, scry 1.
this.addAbility(new EntersBattlefieldTriggeredAbility(new ScryEffect(1)));
// {T}: Add {G} or {W} to your mana pool.
this.addAbility(new GreenManaAbility());
this.addAbility(new WhiteManaAbility());
}
public TempleOfPlenty(final TempleOfPlenty card) {
super(card);
}
@Override
public TempleOfPlenty copy() {
return new TempleOfPlenty(this);
}
}

View file

@ -116,8 +116,7 @@ class OrderOfSuccessionEffect extends OneShotEffect<OrderOfSuccessionEffect> {
firstNextPlayer = nextPlayer.getId();
}
// if player is in range he chooses an creature to control
if (controller.getInRange().contains(currentPlayer.getId())) {
if (currentPlayer != null && nextPlayer != null) {
if (currentPlayer != null && controller.getInRange().contains(currentPlayer.getId())) {
FilterCreaturePermanent filter = new FilterCreaturePermanent(new StringBuilder("creature controlled by ").append(nextPlayer.getName()).toString());
filter.add(new ControllerIdPredicate(nextPlayer.getId()));
Target target = new TargetCreaturePermanent(filter, true);
@ -127,8 +126,6 @@ class OrderOfSuccessionEffect extends OneShotEffect<OrderOfSuccessionEffect> {
playerCreature.put(currentPlayer.getId(), target.getFirstTarget());
}
}
}
}
currentPlayer = nextPlayer;
}

View file

@ -106,7 +106,7 @@ class RiftsweeperEffect extends OneShotEffect<RiftsweeperEffect> {
card.getCounters().clear();
// move to exile
card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true);
game.getState().getPlayer(card.getOwnerId()).getLibrary().shuffle();
game.getPlayer(card.getOwnerId()).getLibrary().shuffle();
game.informPlayers(new StringBuilder("Riftsweeper: Choosen card was ").append(card.getName()).toString());
return true;
}

View file

@ -99,7 +99,7 @@ class DeglamerShuffleIntoLibraryEffect extends OneShotEffect<DeglamerShuffleInto
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
if (permanent != null) {
if (permanent.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true) ) {
game.getState().getPlayer(permanent.getOwnerId()).getLibrary().shuffle();
game.getPlayer(permanent.getOwnerId()).getLibrary().shuffle();
return true;
}
}

View file

@ -82,7 +82,7 @@ class LocketOfYesterdaysCostReductionEffect extends CostModificationEffectImpl<L
MageObject sourceObject = game.getObject(abilityToModify.getSourceId());
if (sourceObject != null) {
int amount = 0;
for (UUID cardId :game.getState().getPlayer(source.getControllerId()).getGraveyard()) {
for (UUID cardId :game.getPlayer(source.getControllerId()).getGraveyard()) {
Card card = game.getCard(cardId);
if (card != null && card.getName().equals(sourceObject.getName())) {
amount++;

View file

@ -49,7 +49,7 @@ public class ReturnToHandSourceEffect extends OneShotEffect<ReturnToHandSourceEf
public ReturnToHandSourceEffect(boolean fromBattlefieldOnly) {
super(Outcome.ReturnToHand);
this.fromBattlefieldOnly = fromBattlefieldOnly;
staticText = "Return {this} to it's owner's hand";
staticText = "return {this} to it's owner's hand";
}
public ReturnToHandSourceEffect(final ReturnToHandSourceEffect effect) {

View file

@ -27,14 +27,14 @@
*/
package mage.abilities.effects.common.cost;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.costs.mana.ManaCost;
import mage.abilities.costs.mana.ManaCosts;
import mage.abilities.effects.CostModificationEffectImpl;
import mage.abilities.keyword.FlashbackAbility;
import mage.cards.Card;
import mage.constants.CostModificationType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.filter.FilterSpell;
import mage.game.Game;
import mage.game.stack.Spell;
@ -48,6 +48,24 @@ public class SpellsCostReductionEffect extends CostModificationEffectImpl<Spells
private FilterSpell filter;
private int amount;
private ManaCosts<ManaCost> manaCostsToReduce = null;
public SpellsCostReductionEffect(FilterSpell filter, ManaCosts<ManaCost> manaCostsToReduce) {
super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.REDUCE_COST);
this.filter = filter;
this.amount = 0;
this.manaCostsToReduce = manaCostsToReduce;
StringBuilder sb = new StringBuilder();
sb.append(filter.getMessage()).append(" you cast cost ");
for (String manaSymbol :manaCostsToReduce.getSymbols()) {
sb.append(manaSymbol);
}
sb.append(" less to cast. This effect reduces only the amount of colored mana you pay.");
this.staticText = sb.toString();
}
public SpellsCostReductionEffect(FilterSpell filter, int amount) {
super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.REDUCE_COST);
@ -67,7 +85,11 @@ public class SpellsCostReductionEffect extends CostModificationEffectImpl<Spells
@Override
public boolean apply(Game game, Ability source, Ability abilityToModify) {
if (manaCostsToReduce != null){
CardUtil.adjustCost((SpellAbility) abilityToModify, manaCostsToReduce, false);
} else {
CardUtil.reduceCost(abilityToModify, this.amount);
}
return true;
}

View file

@ -108,7 +108,7 @@ public class SearchLibraryPutInPlayEffect extends SearchEffect<SearchLibraryPutI
private void setText() {
StringBuilder sb = new StringBuilder();
sb.append("Search your library for ");
sb.append("search your library for ");
if (target.getNumberOfTargets() == 0 && target.getMaxNumberOfTargets() > 0) {
if ( target.getMaxNumberOfTargets() == Integer.MAX_VALUE ) {
sb.append("any number of ").append(" ");

View file

@ -124,6 +124,17 @@ public class CardUtil {
adjustAlternativeCosts(ability, reduceCount);
}
/**
* Adjusts spell or ability cost to be paid.
*
* @param spellAbility
* @param reduceCount
*/
public static void adjustCost(SpellAbility spellAbility, int reduceCount) {
CardUtil.adjustCost((Ability) spellAbility, reduceCount);
adjustAlternativeCosts(spellAbility, reduceCount);
}
private static void adjustAlternativeCosts(Ability ability, int reduceCount) {
for (AlternativeCost alternativeCost : ability.getAlternativeCosts()) {
if (alternativeCost instanceof AlternativeCostImpl) {
@ -158,16 +169,7 @@ public class CardUtil {
}
}
/**
* Adjusts spell or ability cost to be paid.
*
* @param spellAbility
* @param reduceCount
*/
public static void adjustCost(SpellAbility spellAbility, int reduceCount) {
CardUtil.adjustCost((Ability) spellAbility, reduceCount);
adjustAlternativeCosts(spellAbility, reduceCount);
}
/**
* Adjusts ability cost to be paid.
@ -202,13 +204,18 @@ public class CardUtil {
ability.getManaCostsToPay().addAll(adjustedCost);
}
public static void adjustCost(SpellAbility spellAbility, ManaCosts<ManaCost> manaCostsToReduce) {
adjustCost(spellAbility, manaCostsToReduce, true);
}
/**
* Adjusts spell or ability cost to be paid by colored and generic mana.
*
* @param spellAbility
* @param manaCostsToReduce costs to reduce
* @param convertToGeneric colored mana does reduce generic mana if no appropriate colored mana is in the costs included
*/
public static void adjustCost(SpellAbility spellAbility, ManaCosts<ManaCost> manaCostsToReduce) {
public static void adjustCost(SpellAbility spellAbility, ManaCosts<ManaCost> manaCostsToReduce, boolean convertToGeneric) {
ManaCosts<ManaCost> previousCost = spellAbility.getManaCostsToPay();
ManaCosts<ManaCost> adjustedCost = new ManaCostsImpl<ManaCost>();
// save X value (e.g. convoke ability)
@ -279,7 +286,12 @@ public class CardUtil {
}
}
// subtract colorless mana, use all mana that is left
int reduceAmount = reduceMana.count();
int reduceAmount;
if (convertToGeneric) {
reduceAmount = reduceMana.count();
} else {
reduceAmount = reduceMana.getColorless();
}
for (ManaCost newManaCost : previousCost) {
Mana mana = newManaCost.getMana();
if (mana.getColorless() == 0) {
@ -302,6 +314,7 @@ public class CardUtil {
spellAbility.getManaCostsToPay().clear();
spellAbility.getManaCostsToPay().addAll(adjustedCost);
}
/**
* Returns function that copies params\abilities from one card to another.
*

View file

@ -53,8 +53,9 @@ public class MorbidWatcher extends WatcherImpl<MorbidWatcher> {
@Override
public void watch(GameEvent event, Game game) {
if (condition == true) //no need to check - condition has already occured
if (condition == true) {
return;
}
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent)event).isDiesEvent()) {
Permanent p = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD);
if (p != null && p.getCardType().contains(CardType.CREATURE)) {