[GTC] Nimbus Swimmer, Psychic Strike, Mystic Genesis, Shamleshark, Master Biomancer, Thrull Parasite

This commit is contained in:
LevelX2 2013-01-26 00:51:18 +01:00
parent fc34c2e426
commit b7d0017385
6 changed files with 690 additions and 0 deletions

View file

@ -0,0 +1,129 @@
/*
* 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.gatecrash;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.continious.AddCardSubTypeTargetEffect;
import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author LevelX2
*/
public class MasterBiomancer extends CardImpl<MasterBiomancer> {
public MasterBiomancer(UUID ownerId) {
super(ownerId, 176, "Master Biomancer", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "{2}{G}{U}");
this.expansionSetCode = "GTC";
this.subtype.add("Elf");
this.subtype.add("Wizard");
this.color.setBlue(true);
this.color.setGreen(true);
this.power = new MageInt(2);
this.toughness = new MageInt(4);
// Each other creature you control enters the battlefield with a number of additional +1/+1 counters on it equal to Master Biomancer's power and as a Mutant in addition to its other types.
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new MasterBiomancerEntersBattlefieldEffect()));
}
public MasterBiomancer(final MasterBiomancer card) {
super(card);
}
@Override
public MasterBiomancer copy() {
return new MasterBiomancer(this);
}
}
class MasterBiomancerEntersBattlefieldEffect extends ReplacementEffectImpl<MasterBiomancerEntersBattlefieldEffect> {
public MasterBiomancerEntersBattlefieldEffect() {
super(Duration.WhileOnBattlefield, Outcome.BoostCreature);
staticText = "Each other creature you control enters the battlefield with a number of additional +1/+1 counters on it equal to Master Biomancer's power and as a Mutant in addition to its other types";
}
public MasterBiomancerEntersBattlefieldEffect(MasterBiomancerEntersBattlefieldEffect effect) {
super(effect);
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD) {
Permanent creature = game.getPermanent(event.getTargetId());
if (creature != null && creature.getControllerId().equals(source.getControllerId()) && !event.getTargetId().equals(source.getSourceId())) {
return true;
}
}
return false;
}
@Override
public boolean apply(Game game, Ability source) {
return false;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent sourceCreature = game.getPermanent(source.getSourceId());
Permanent creature = game.getPermanent(event.getTargetId());
if (sourceCreature != null && creature != null) {
int power = sourceCreature.getPower().getValue();
if (power > 0) {
creature.addCounters(CounterType.P1P1.createInstance(power), game);
}
ContinuousEffect effect = new AddCardSubTypeTargetEffect("Mutant", Duration.WhileOnBattlefield);
effect.setTargetPointer(new FixedTarget(creature.getId()));
game.addEffect(effect, source);
}
return false;
}
@Override
public MasterBiomancerEntersBattlefieldEffect copy() {
return new MasterBiomancerEntersBattlefieldEffect(this);
}
}

View file

@ -0,0 +1,119 @@
/*
* 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.gatecrash;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.filter.FilterSpell;
import mage.game.Game;
import mage.game.permanent.token.Token;
import mage.game.stack.StackObject;
import mage.players.Player;
import mage.target.TargetSpell;
/**
*
* @author LevelX2
*/
public class MysticGenesis extends CardImpl<MysticGenesis> {
public MysticGenesis(UUID ownerId) {
super(ownerId, 180, "Mystic Genesis", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{2}{G}{U}{U}");
this.expansionSetCode = "GTC";
this.color.setBlue(true);
this.color.setGreen(true);
// Counter target spell. Put an X/X green Ooze creature token onto the battlefield, where X is that spell's converted mana cost.
this.getSpellAbility().addTarget(new TargetSpell(new FilterSpell()));
this.getSpellAbility().addEffect(new MysticGenesisEffect());
}
public MysticGenesis(final MysticGenesis card) {
super(card);
}
@Override
public MysticGenesis copy() {
return new MysticGenesis(this);
}
}
class MysticGenesisEffect extends OneShotEffect<MysticGenesisEffect> {
public MysticGenesisEffect() {
super(Outcome.Detriment);
staticText = " Counter target spell. Put an X/X green Ooze creature token onto the battlefield, where X is that spell's converted mana cost";
}
public MysticGenesisEffect(final MysticGenesisEffect effect) {
super(effect);
}
@Override
public MysticGenesisEffect copy() {
return new MysticGenesisEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
StackObject stackObject = game.getStack().getStackObject(targetPointer.getFirst(game, source));
if (stackObject != null && game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game)) {
if ( stackObject != null ) {
int cmc = stackObject.getManaCost().convertedManaCost();
if ( cmc > 0 ) {
MysticGenesisOozeToken oozeToken = new MysticGenesisOozeToken();
oozeToken.getPower().setValue(cmc);
oozeToken.getToughness().setValue(cmc);
oozeToken.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
}
return true;
}
}
return false;
}
}
class MysticGenesisOozeToken extends Token {
public MysticGenesisOozeToken() {
super("Ooze", "X/X green Ooze creature token");
cardType.add(CardType.CREATURE);
subtype.add("Ooze");
power = new MageInt(0);
toughness = new MageInt(0);
}
}

View file

@ -0,0 +1,107 @@
/*
* 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.gatecrash;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author LevelX2
*/
public class NimbusSwimmer extends CardImpl<NimbusSwimmer> {
public NimbusSwimmer(UUID ownerId) {
super(ownerId, 181, "Nimbus Swimmer", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{X}{G}{U}");
this.expansionSetCode = "GTC";
this.subtype.add("Leviathan");
this.color.setBlue(true);
this.color.setGreen(true);
this.power = new MageInt(0);
this.toughness = new MageInt(0);
// Flying
this.addAbility(FlyingAbility.getInstance());
// Nimbus Swimmer enters the battlefield with X +1/+1 counters on it.
this.addAbility(new EntersBattlefieldAbility(new NimbusSwimmerEffect(), true));
}
public NimbusSwimmer(final NimbusSwimmer card) {
super(card);
}
@Override
public NimbusSwimmer copy() {
return new NimbusSwimmer(this);
}
}
class NimbusSwimmerEffect extends OneShotEffect<NimbusSwimmerEffect> {
public NimbusSwimmerEffect() {
super(Constants.Outcome.BoostCreature);
staticText = "{this} enters the battlefield with X +1/+1 counters on it";
}
public NimbusSwimmerEffect(final NimbusSwimmerEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
Object obj = getValue(mage.abilities.effects.EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
if (obj != null && obj instanceof SpellAbility) {
int amount = ((SpellAbility)obj).getManaCostsToPay().getX();
if (amount > 0) {
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
}
}
}
return true;
}
@Override
public NimbusSwimmerEffect copy() {
return new NimbusSwimmerEffect(this);
}
}

View 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.gatecrash;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.filter.FilterSpell;
import mage.game.Game;
import mage.game.stack.StackObject;
import mage.players.Player;
import mage.target.TargetSpell;
/**
*
* @author LevelX2
*/
public class PsychicStrike extends CardImpl<PsychicStrike> {
public PsychicStrike(UUID ownerId) {
super(ownerId, 189, "Psychic Strike", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{U}{B}");
this.expansionSetCode = "GTC";
this.color.setBlue(true);
this.color.setBlack(true);
// Counter target spell. Its controller puts the top two cards of his or her library into his or her graveyard.
this.getSpellAbility().addTarget(new TargetSpell(new FilterSpell()));
this.getSpellAbility().addEffect(new PsychicStrikeEffect());
}
public PsychicStrike(final PsychicStrike card) {
super(card);
}
@Override
public PsychicStrike copy() {
return new PsychicStrike(this);
}
}
class PsychicStrikeEffect extends OneShotEffect<PsychicStrikeEffect> {
public PsychicStrikeEffect() {
super(Outcome.Detriment);
staticText = "Counter target spell. Its controller puts the top two cards of his or her library into his or her graveyard";
}
public PsychicStrikeEffect(final PsychicStrikeEffect effect) {
super(effect);
}
@Override
public PsychicStrikeEffect copy() {
return new PsychicStrikeEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
StackObject stackObject = game.getStack().getStackObject(targetPointer.getFirst(game, source));
if (stackObject != null && game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game)) {
Player controller = game.getPlayer(stackObject.getControllerId());
if (controller == null) {
return false;
}
int cardsCount = Math.min(2, controller.getLibrary().size());
for (int i = 0; i < cardsCount; i++) {
Card card = controller.getLibrary().removeFromTop(game);
if (card != null) {
card.moveToZone(Zone.GRAVEYARD, source.getId(), game, false);
}
}
return true;
}
return false;
}
}

View file

@ -0,0 +1,69 @@
/*
* 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.gatecrash;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.MageInt;
import mage.abilities.keyword.EvolveAbility;
import mage.abilities.keyword.FlashAbility;
import mage.cards.CardImpl;
/**
*
* @author LevelX2
*/
public class Shambleshark extends CardImpl<Shambleshark> {
public Shambleshark(UUID ownerId) {
super(ownerId, 193, "Shambleshark", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{G}{U}");
this.expansionSetCode = "GTC";
this.subtype.add("Fish");
this.subtype.add("Crab");
this.color.setBlue(true);
this.color.setGreen(true);
this.power = new MageInt(2);
this.toughness = new MageInt(1);
// Flash
this.addAbility(FlashAbility.getInstance());
// Evolve
this.addAbility(new EvolveAbility());
}
public Shambleshark(final Shambleshark card) {
super(card);
}
@Override
public Shambleshark copy() {
return new Shambleshark(this);
}
}

View file

@ -0,0 +1,158 @@
/*
* 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.gatecrash;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.PayLifeCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.ExtortAbility;
import mage.cards.CardImpl;
import mage.choices.Choice;
import mage.choices.ChoiceImpl;
import mage.counters.Counter;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetNonlandPermanent;
/**
*
* @author LevelX2
*/
public class ThrullParasite extends CardImpl<ThrullParasite> {
public ThrullParasite(UUID ownerId) {
super(ownerId, 81, "Thrull Parasite", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{B}");
this.expansionSetCode = "GTC";
this.subtype.add("Thrull");
this.color.setBlack(true);
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// Extort
this.addAbility(new ExtortAbility());
// {tap}, Pay 2 life: Remove a counter from target nonland permanent.
Ability ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new RemoveCounterTargetEffect(),new TapSourceCost());
ability.addTarget(new TargetNonlandPermanent());
ability.addCost(new PayLifeCost(2));
this.addAbility(ability);
}
public ThrullParasite(final ThrullParasite card) {
super(card);
}
@Override
public ThrullParasite copy() {
return new ThrullParasite(this);
}
}
class RemoveCounterTargetEffect extends OneShotEffect<RemoveCounterTargetEffect> {
private CounterType counterTypeToRemove;
public RemoveCounterTargetEffect() {
super(Outcome.Detriment);
this.staticText = "Remove a counter from target nonland permanent";
}
public RemoveCounterTargetEffect(CounterType counterTypeToRemove) {
super(Outcome.Detriment);
this.staticText = "Remove a " + counterTypeToRemove.getName() + " counter from target nonland permanent";
this.counterTypeToRemove = counterTypeToRemove;
}
public RemoveCounterTargetEffect(final RemoveCounterTargetEffect effect) {
super(effect);
this.counterTypeToRemove = effect.counterTypeToRemove;
}
@Override
public RemoveCounterTargetEffect copy() {
return new RemoveCounterTargetEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
boolean result = false;
Player controller = game.getPlayer(source.getControllerId());
for (UUID targetId: getTargetPointer().getTargets(game, source)) {
Permanent permanent = game.getPermanent(targetId);
if (permanent != null) {
if (permanent.getCounters().size() > 0 && (counterTypeToRemove == null || permanent.getCounters().containsKey(counterTypeToRemove))) {
String counterName = null;
if (counterTypeToRemove != null) {
counterName = counterTypeToRemove.getName();
} else {
if (permanent.getCounters().size() > 1 && counterTypeToRemove == null) {
Choice choice = new ChoiceImpl(true);
Set<String> choices = new HashSet<String>();
for (Counter counter : permanent.getCounters().values()) {
if (permanent.getCounters().getCount(counter.getName()) > 0) {
choices.add(counter.getName());
}
}
choice.setChoices(choices);
choice.setMessage("Choose a counter type to remove from " + permanent.getName());
controller.choose(Outcome.Detriment, choice, game);
counterName = choice.getChoice();
} else {
for (Counter counter : permanent.getCounters().values()) {
if (counter.getCount() > 0) {
counterName = counter.getName();
}
}
}
}
if (counterName != null) {
permanent.removeCounters(counterName, 1, game);
if (permanent.getCounters().getCount(counterName) == 0 ){
permanent.getCounters().removeCounter(counterName);
}
result |= true;
game.informPlayers(new StringBuilder(controller.getName()).append(" removes a ").append(counterName).append(" counter from ").append(permanent.getName()).toString());
}
}
}
}
return result;
}
}