- Added Dream Thief, Idle Thoughts, Dream Fracture, Hallowed Burial, Kithkin Zealot, Endless Horizons.

This commit is contained in:
Jeff 2013-10-09 14:44:45 -05:00
parent 45c875384c
commit a4bb20bb9c
6 changed files with 702 additions and 0 deletions

View file

@ -0,0 +1,106 @@
/*
* 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.eventide;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DrawCardControllerEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetSpell;
/**
*
* @author jeffwadsworth
*/
public class DreamFracture extends CardImpl<DreamFracture> {
public DreamFracture(UUID ownerId) {
super(ownerId, 19, "Dream Fracture", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{1}{U}{U}");
this.expansionSetCode = "EVE";
this.color.setBlue(true);
// Counter target spell. Its controller draws a card.
this.getSpellAbility().addEffect(new DreamFractureEffect());
this.getSpellAbility().addTarget(new TargetSpell());
// Draw a card.
this.getSpellAbility().addEffect(new DrawCardControllerEffect(1));
}
public DreamFracture(final DreamFracture card) {
super(card);
}
@Override
public DreamFracture copy() {
return new DreamFracture(this);
}
}
class DreamFractureEffect extends OneShotEffect<DreamFractureEffect> {
public DreamFractureEffect() {
super(Outcome.Neutral);
this.staticText = "Counter target spell. Its controller draws a card";
}
public DreamFractureEffect(final DreamFractureEffect effect) {
super(effect);
}
@Override
public DreamFractureEffect copy() {
return new DreamFractureEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
UUID targetId = source.getFirstTarget();
Player controller = null;
boolean countered = false;
if (targetId != null) {
controller = game.getPlayer(game.getControllerId(targetId));
}
if (targetId != null
&& game.getStack().counter(targetId, source.getId(), game)) {
countered = true;
}
if (controller != null) {
controller.drawCards(1, game);
}
return countered;
}
}

View file

@ -0,0 +1,137 @@
/*
* 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.eventide;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.effects.common.DrawCardControllerEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.WatcherScope;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.stack.Spell;
import mage.watchers.WatcherImpl;
/**
*
* @author jeffwadsworth
*/
public class DreamThief extends CardImpl<DreamThief> {
private static final String rule = "draw a card if you've cast another blue spell this turn";
public DreamThief(UUID ownerId) {
super(ownerId, 20, "Dream Thief", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{U}");
this.expansionSetCode = "EVE";
this.subtype.add("Faerie");
this.subtype.add("Rogue");
this.color.setBlue(true);
this.power = new MageInt(2);
this.toughness = new MageInt(1);
// Flying
this.addAbility(FlyingAbility.getInstance());
// When Dream Thief enters the battlefield, draw a card if you've cast another blue spell this turn.
this.addAbility(new EntersBattlefieldTriggeredAbility(new ConditionalOneShotEffect(new DrawCardControllerEffect(1), new CastBlueSpellThisTurnCondition(), rule)));
this.addWatcher(new DreamThiefWatcher(this.getId()));
}
public DreamThief(final DreamThief card) {
super(card);
}
@Override
public DreamThief copy() {
return new DreamThief(this);
}
}
class CastBlueSpellThisTurnCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
DreamThiefWatcher watcher = (DreamThiefWatcher) game.getState().getWatchers().get("DreamThiefWatcher", source.getControllerId());
if (watcher != null) {
return watcher.conditionMet();
}
return false;
}
}
class DreamThiefWatcher extends WatcherImpl<DreamThiefWatcher> {
UUID cardId;
public DreamThiefWatcher(UUID cardId) {
super("DreamThiefWatcher", WatcherScope.PLAYER);
this.cardId = cardId;
}
public DreamThiefWatcher(final DreamThiefWatcher watcher) {
super(watcher);
this.cardId = watcher.cardId;
}
@Override
public DreamThiefWatcher copy() {
return new DreamThiefWatcher(this);
}
@Override
public void watch(GameEvent event, Game game) {
if (condition == true) //no need to check - condition has already occured
{
return;
}
if (event.getType() == EventType.SPELL_CAST
&& controllerId == event.getPlayerId()) {
Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell.getColor().isBlue()
&& spell.getSourceId() != cardId) {
condition = true;
}
}
}
@Override
public void reset() {
super.reset();
condition = false;
}
}

View file

@ -0,0 +1,154 @@
/*
* 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.eventide;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.SearchEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.common.FilterLandCard;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.ExileZone;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInLibrary;
import mage.util.CardUtil;
/**
*
* @author jeffwadsworth
*/
public class EndlessHorizons extends CardImpl<EndlessHorizons> {
public EndlessHorizons(UUID ownerId) {
super(ownerId, 4, "Endless Horizons", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{W}");
this.expansionSetCode = "EVE";
this.color.setWhite(true);
// When Endless Horizons enters the battlefield, search your library for any number of Plains cards and exile them. Then shuffle your library.
this.addAbility(new EntersBattlefieldTriggeredAbility(new EndlessHorizonsEffect(), false));
// At the beginning of your upkeep, you may put a card you own exiled with Endless Horizons into your hand.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new EndlessHorizonsEffect2(), TargetController.YOU, true));
}
public EndlessHorizons(final EndlessHorizons card) {
super(card);
}
@Override
public EndlessHorizons copy() {
return new EndlessHorizons(this);
}
}
class EndlessHorizonsEffect extends SearchEffect<EndlessHorizonsEffect> {
private static final FilterLandCard filter = new FilterLandCard("Plains card");
static {
filter.add(new SubtypePredicate("Plains"));
}
public EndlessHorizonsEffect() {
super(new TargetCardInLibrary(0, Integer.MAX_VALUE, filter), Outcome.Neutral);
this.staticText = "search your library for any number of Plains cards and exile them. Then shuffle your library";
}
public EndlessHorizonsEffect(final EndlessHorizonsEffect effect) {
super(effect);
}
@Override
public EndlessHorizonsEffect copy() {
return new EndlessHorizonsEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player you = game.getPlayer(source.getControllerId());
if (you != null && you.searchLibrary(target, game)) {
if (target.getTargets().size() > 0) {
for (UUID cardId : target.getTargets()) {
Card card = you.getLibrary().remove(cardId, game);
if (card != null) {
card.moveToExile(CardUtil.getCardExileZoneId(game, source), "Endless Horizons", source.getSourceId(), game);
}
}
you.shuffleLibrary(game);
return true;
}
}
return false;
}
}
class EndlessHorizonsEffect2 extends OneShotEffect<EndlessHorizonsEffect2> {
public EndlessHorizonsEffect2() {
super(Outcome.ReturnToHand);
this.staticText = "you may put a card you own exiled with {this} into your hand";
}
public EndlessHorizonsEffect2(final EndlessHorizonsEffect2 effect) {
super(effect);
}
@Override
public EndlessHorizonsEffect2 copy() {
return new EndlessHorizonsEffect2(this);
}
@Override
public boolean apply(Game game, Ability source) {
ExileZone exZone = game.getExile().getExileZone(CardUtil.getCardExileZoneId(game, source));
if (exZone != null) {
for (Card card : exZone.getCards(game)) {
if (card != null
&& card.getOwnerId() == source.getControllerId()) {
if (card.moveToZone(Zone.HAND, source.getId(), game, false)) {
return true;
}
}
}
}
return false;
}
}

View file

@ -0,0 +1,93 @@
/*
* 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.eventide;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author jeffwadsworth
*/
public class HallowedBurial extends CardImpl<HallowedBurial> {
public HallowedBurial(UUID ownerId) {
super(ownerId, 7, "Hallowed Burial", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{3}{W}{W}");
this.expansionSetCode = "EVE";
this.color.setWhite(true);
// Put all creatures on the bottom of their owners' libraries.
this.getSpellAbility().addEffect(new HallowedBurialEffect());
}
public HallowedBurial(final HallowedBurial card) {
super(card);
}
@Override
public HallowedBurial copy() {
return new HallowedBurial(this);
}
}
class HallowedBurialEffect extends OneShotEffect<HallowedBurialEffect> {
public HallowedBurialEffect() {
super(Outcome.Neutral);
this.staticText = "Put all creatures on the bottom of their owner's libraries";
}
public HallowedBurialEffect(final HallowedBurialEffect effect) {
super(effect);
}
@Override
public HallowedBurialEffect copy() {
return new HallowedBurialEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
for (Permanent creature : game.getBattlefield().getAllActivePermanents(CardType.CREATURE)) {
if (creature != null) {
creature.moveToZone(Zone.LIBRARY, source.getId(), game, false);
}
}
return false;
}
}

View file

@ -0,0 +1,98 @@
/*
* 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.eventide;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.CardsInHandCondition;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.players.Player;
/**
*
* @author jeffwadsworth
*/
public class IdleThoughts extends CardImpl<IdleThoughts> {
public IdleThoughts(UUID ownerId) {
super(ownerId, 23, "Idle Thoughts", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{3}{U}");
this.expansionSetCode = "EVE";
this.color.setBlue(true);
// {2}: Draw a card if you have no cards in hand.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new IdleThoughtsEffect(), new ManaCostsImpl("{2}")));
}
public IdleThoughts(final IdleThoughts card) {
super(card);
}
@Override
public IdleThoughts copy() {
return new IdleThoughts(this);
}
}
class IdleThoughtsEffect extends OneShotEffect<IdleThoughtsEffect> {
public IdleThoughtsEffect() {
super(Outcome.Benefit);
this.staticText = "Draw a card if you have no cards in hand";
}
public IdleThoughtsEffect(final IdleThoughtsEffect effect) {
super(effect);
}
@Override
public IdleThoughtsEffect copy() {
return new IdleThoughtsEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Condition condition = new CardsInHandCondition();
Player you = game.getPlayer(source.getControllerId());
if (condition.apply(game, source)
&& you != null) {
you.drawCards(1, game);
return true;
}
return false;
}
}

View file

@ -0,0 +1,114 @@
/*
* 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.eventide;
import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetOpponent;
/**
*
* @author jeffwadsworth
*/
public class KithkinZealot extends CardImpl<KithkinZealot> {
public KithkinZealot(UUID ownerId) {
super(ownerId, 9, "Kithkin Zealot", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{W}");
this.expansionSetCode = "EVE";
this.subtype.add("Kithkin");
this.subtype.add("Cleric");
this.color.setWhite(true);
this.power = new MageInt(1);
this.toughness = new MageInt(3);
// When Kithkin Zealot enters the battlefield, you gain 1 life for each black and/or red permanent target opponent controls.
Ability ability = new EntersBattlefieldTriggeredAbility(new KithkinZealotEffect(), false);
ability.addTarget(new TargetOpponent());
this.addAbility(ability);
}
public KithkinZealot(final KithkinZealot card) {
super(card);
}
@Override
public KithkinZealot copy() {
return new KithkinZealot(this);
}
}
class KithkinZealotEffect extends OneShotEffect<KithkinZealotEffect> {
public KithkinZealotEffect() {
super(Outcome.Neutral);
this.staticText = "you gain 1 life for each black and/or red permanent target opponent controls";
}
public KithkinZealotEffect(final KithkinZealotEffect effect) {
super(effect);
}
@Override
public KithkinZealotEffect copy() {
return new KithkinZealotEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player you = game.getPlayer(source.getControllerId());
Player opponent = game.getPlayer(source.getFirstTarget());
FilterPermanent filter = new FilterPermanent();
filter.add(Predicates.or(
new ColorPredicate(ObjectColor.BLACK),
new ColorPredicate(ObjectColor.RED)));
if (opponent != null) {
int amount = game.getBattlefield().countAll(filter, opponent.getId(), game);
if (you != null) {
you.gainLife(amount, game);
return true;
}
}
return false;
}
}