mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
[GTC] Sepulchral Primorial, Sylvan Primordial, Molten Primordial, Diluvian Primordial
This commit is contained in:
parent
d87ef78000
commit
3b27eabdd3
4 changed files with 602 additions and 0 deletions
189
Mage.Sets/src/mage/sets/gatecrash/DiluvianPrimordial.java
Normal file
189
Mage.Sets/src/mage/sets/gatecrash/DiluvianPrimordial.java
Normal file
|
@ -0,0 +1,189 @@
|
|||
/*
|
||||
* 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.Duration;
|
||||
import mage.Constants.Outcome;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.Constants.Zone;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.filter.predicate.other.OwnerIdPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.game.stack.StackObject;
|
||||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.common.TargetCardInOpponentsGraveyard;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class DiluvianPrimordial extends CardImpl<DiluvianPrimordial> {
|
||||
|
||||
public DiluvianPrimordial(UUID ownerId) {
|
||||
super(ownerId, 33, "Diluvian Primordial", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{5}{U}{U}");
|
||||
this.expansionSetCode = "GTC";
|
||||
this.subtype.add("Avatar");
|
||||
|
||||
this.color.setBlue(true);
|
||||
this.power = new MageInt(5);
|
||||
this.toughness = new MageInt(5);
|
||||
|
||||
// Flying
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
||||
// When Diluvian Primordial enters the battlefield, for each opponent, you may cast up to one target instant or sorcery card from that player's graveyard without paying its mana cost. If a card cast this way would be put into a graveyard this turn, exile it instead.
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new DiluvianPrimordialEffect(),false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof EntersBattlefieldTriggeredAbility) {
|
||||
for(UUID opponentId : game.getOpponents(ability.getControllerId())) {
|
||||
Player opponent = game.getPlayer(opponentId);
|
||||
if (opponent != null) {
|
||||
ability.getTargets().clear();
|
||||
FilterCard filter = new FilterCard(new StringBuilder("instant or sorcery card from ").append(opponent.getName()).append("'s graveyard").toString());
|
||||
filter.add(new OwnerIdPredicate(opponentId));
|
||||
filter.add(Predicates.or(new CardTypePredicate(CardType.INSTANT),new CardTypePredicate(CardType.SORCERY)));
|
||||
TargetCardInOpponentsGraveyard target = new TargetCardInOpponentsGraveyard(0,1, filter);
|
||||
ability.addTarget(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public DiluvianPrimordial(final DiluvianPrimordial card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DiluvianPrimordial copy() {
|
||||
return new DiluvianPrimordial(this);
|
||||
}
|
||||
}
|
||||
|
||||
class DiluvianPrimordialEffect extends OneShotEffect<DiluvianPrimordialEffect> {
|
||||
|
||||
public DiluvianPrimordialEffect() {
|
||||
super(Outcome.PlayForFree);
|
||||
this.staticText = "for each opponent, you may cast up to one target instant or sorcery card from that player's graveyard without paying its mana cost. If a card cast this way would be put into a graveyard this turn, exile it instead";
|
||||
}
|
||||
|
||||
public DiluvianPrimordialEffect(final DiluvianPrimordialEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DiluvianPrimordialEffect copy() {
|
||||
return new DiluvianPrimordialEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
for (Target target: source.getTargets()) {
|
||||
if (target instanceof TargetCardInOpponentsGraveyard) {
|
||||
Card targetCard = game.getCard(target.getFirstTarget());
|
||||
if (player != null && targetCard != null) {
|
||||
player.cast(targetCard.getSpellAbility(), game, true);
|
||||
game.addEffect(new DiluvianPrimordialReplacementEffect(targetCard.getId()), source);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class DiluvianPrimordialReplacementEffect extends ReplacementEffectImpl<DiluvianPrimordialReplacementEffect> {
|
||||
|
||||
private UUID cardid;
|
||||
|
||||
public DiluvianPrimordialReplacementEffect(UUID cardid) {
|
||||
super(Duration.EndOfTurn, Outcome.Exile);
|
||||
this.cardid = cardid;
|
||||
}
|
||||
|
||||
public DiluvianPrimordialReplacementEffect(final DiluvianPrimordialReplacementEffect effect) {
|
||||
super(effect);
|
||||
this.cardid = effect.cardid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DiluvianPrimordialReplacementEffect copy() {
|
||||
return new DiluvianPrimordialReplacementEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
UUID eventObject = ((ZoneChangeEvent) event).getTargetId();
|
||||
StackObject card = game.getStack().getStackObject(eventObject);
|
||||
if (card instanceof Spell) {
|
||||
game.rememberLKI(card.getId(), Zone.STACK, (Spell) card);
|
||||
}
|
||||
if (card instanceof Card && card != null && eventObject == cardid) {
|
||||
((Card) card).moveToExile(id, "Diluvian Primordial", id, game);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getType() == EventType.ZONE_CHANGE) {
|
||||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||
if (zEvent.getToZone() == Zone.GRAVEYARD
|
||||
&& ((ZoneChangeEvent) event).getTargetId() == cardid) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
140
Mage.Sets/src/mage/sets/gatecrash/MoltenPrimordial.java
Normal file
140
Mage.Sets/src/mage/sets/gatecrash/MoltenPrimordial.java
Normal file
|
@ -0,0 +1,140 @@
|
|||
/*
|
||||
* 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.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continious.GainAbilityTargetEffect;
|
||||
import mage.abilities.effects.common.continious.GainControlTargetEffect;
|
||||
import mage.abilities.keyword.HasteAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.ControllerIdPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class MoltenPrimordial extends CardImpl<MoltenPrimordial> {
|
||||
|
||||
public MoltenPrimordial(UUID ownerId) {
|
||||
super(ownerId, 101, "Molten Primordial", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{5}{R}{R}");
|
||||
this.expansionSetCode = "GTC";
|
||||
this.subtype.add("Avatar");
|
||||
|
||||
this.color.setRed(true);
|
||||
this.power = new MageInt(6);
|
||||
this.toughness = new MageInt(4);
|
||||
|
||||
// Haste
|
||||
this.addAbility(HasteAbility.getInstance());
|
||||
|
||||
// When Molten Primordial enters the battlefield, for each opponent, take control of up to one target creature that player controls until end of turn. Untap those creatures. They have haste until end of turn.
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new MoltenPrimordialEffect(),false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof EntersBattlefieldTriggeredAbility) {
|
||||
for(UUID opponentId : game.getOpponents(ability.getControllerId())) {
|
||||
Player opponent = game.getPlayer(opponentId);
|
||||
if (opponent != null) {
|
||||
ability.getTargets().clear();
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent(new StringBuilder("creature from opponent ").append(opponent.getName()).toString());
|
||||
filter.add(new ControllerIdPredicate(opponentId));
|
||||
TargetCreaturePermanent target = new TargetCreaturePermanent(0,1, filter,false);
|
||||
ability.addTarget(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public MoltenPrimordial(final MoltenPrimordial card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MoltenPrimordial copy() {
|
||||
return new MoltenPrimordial(this);
|
||||
}
|
||||
}
|
||||
|
||||
class MoltenPrimordialEffect extends OneShotEffect<MoltenPrimordialEffect> {
|
||||
|
||||
public MoltenPrimordialEffect() {
|
||||
super(Outcome.GainControl);
|
||||
this.staticText = "for each opponent, take control of up to one target creature that player controls until end of turn. Untap those creatures. They have haste until end of turn";
|
||||
}
|
||||
|
||||
public MoltenPrimordialEffect(final MoltenPrimordialEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MoltenPrimordialEffect copy() {
|
||||
return new MoltenPrimordialEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
boolean result = false;
|
||||
for (Target target: source.getTargets()) {
|
||||
if (target instanceof TargetCreaturePermanent) {
|
||||
Permanent targetCreature = game.getPermanent(target.getFirstTarget());
|
||||
if (targetCreature != null) {
|
||||
ContinuousEffect effect1 = new GainControlTargetEffect(Duration.EndOfTurn);
|
||||
effect1.setTargetPointer(new FixedTarget(targetCreature.getId()));
|
||||
game.addEffect(effect1, source);
|
||||
|
||||
ContinuousEffect effect2 = new GainAbilityTargetEffect(HasteAbility.getInstance(), Constants.Duration.EndOfTurn);
|
||||
effect2.setTargetPointer(new FixedTarget(targetCreature.getId()));
|
||||
game.addEffect(effect2, source);
|
||||
|
||||
targetCreature.untap(game);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
129
Mage.Sets/src/mage/sets/gatecrash/SepulchralPrimordial.java
Normal file
129
Mage.Sets/src/mage/sets/gatecrash/SepulchralPrimordial.java
Normal 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.CardType;
|
||||
import mage.Constants.Outcome;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.Constants.Zone;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.keyword.IntimidateAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.filter.predicate.other.OwnerIdPredicate;
|
||||
import mage.filter.predicate.permanent.ControllerIdPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.common.TargetCardInOpponentsGraveyard;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class SepulchralPrimordial extends CardImpl<SepulchralPrimordial> {
|
||||
|
||||
public SepulchralPrimordial(UUID ownerId) {
|
||||
super(ownerId, 79, "Sepulchral Primordial", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{5}{B}{B}");
|
||||
this.expansionSetCode = "GTC";
|
||||
this.subtype.add("Avatar");
|
||||
|
||||
this.color.setBlack(true);
|
||||
this.power = new MageInt(5);
|
||||
this.toughness = new MageInt(4);
|
||||
|
||||
//Vigilance
|
||||
this.addAbility(IntimidateAbility.getInstance());
|
||||
|
||||
// When Sepulchral Primordial enters the battlefield, for each opponent, you may put up to one
|
||||
// target creature card from that player's graveyard onto the battlefield under your control.
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new SepulchralPrimordialEffect(),false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof EntersBattlefieldTriggeredAbility) {
|
||||
for(UUID opponentId : game.getOpponents(ability.getControllerId())) {
|
||||
Player opponent = game.getPlayer(opponentId);
|
||||
if (opponent != null) {
|
||||
ability.getTargets().clear();
|
||||
FilterCard filter = new FilterCreatureCard(new StringBuilder("creature card from ").append(opponent.getName()).append("'s graveyard").toString());
|
||||
filter.add(new OwnerIdPredicate(opponentId));
|
||||
TargetCardInOpponentsGraveyard target = new TargetCardInOpponentsGraveyard(0,1, filter);
|
||||
ability.addTarget(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public SepulchralPrimordial(final SepulchralPrimordial card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SepulchralPrimordial copy() {
|
||||
return new SepulchralPrimordial(this);
|
||||
}
|
||||
}
|
||||
|
||||
class SepulchralPrimordialEffect extends OneShotEffect<SepulchralPrimordialEffect> {
|
||||
|
||||
public SepulchralPrimordialEffect() {
|
||||
super(Outcome.PutCreatureInPlay);
|
||||
this.staticText = "for each opponent, you may put up to one target creature card from that player's graveyard onto the battlefield under your control";
|
||||
}
|
||||
|
||||
public SepulchralPrimordialEffect(final SepulchralPrimordialEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SepulchralPrimordialEffect copy() {
|
||||
return new SepulchralPrimordialEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
for (Target target: source.getTargets()) {
|
||||
if (target instanceof TargetCardInOpponentsGraveyard) {
|
||||
Card targetCard = game.getCard(target.getFirstTarget());
|
||||
if (player != null && targetCard != null) {
|
||||
targetCard.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), source.getControllerId());
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
144
Mage.Sets/src/mage/sets/gatecrash/SylvanPrimordial.java
Normal file
144
Mage.Sets/src/mage/sets/gatecrash/SylvanPrimordial.java
Normal file
|
@ -0,0 +1,144 @@
|
|||
/*
|
||||
* 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.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect;
|
||||
import mage.abilities.keyword.ReachAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterLandCard;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||
import mage.filter.predicate.permanent.ControllerIdPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class SylvanPrimordial extends CardImpl<SylvanPrimordial> {
|
||||
|
||||
public SylvanPrimordial(UUID ownerId) {
|
||||
super(ownerId, 136, "Sylvan Primordial", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{5}{G}{G}");
|
||||
this.expansionSetCode = "GTC";
|
||||
this.subtype.add("Avatar");
|
||||
|
||||
this.color.setGreen(true);
|
||||
this.power = new MageInt(6);
|
||||
this.toughness = new MageInt(8);
|
||||
|
||||
// Reach
|
||||
this.addAbility(ReachAbility.getInstance());
|
||||
|
||||
// When Sylvan Primordial enters the battlefield, for each opponent, destroy target noncreature permanent that player controls. For each permanent destroyed this way, search your library for a Forest card and put that card onto the battlefield tapped. Then shuffle your library.
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new SylvanPrimordialEffect(),false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof EntersBattlefieldTriggeredAbility) {
|
||||
for(UUID opponentId : game.getOpponents(ability.getControllerId())) {
|
||||
Player opponent = game.getPlayer(opponentId);
|
||||
if (opponent != null) {
|
||||
ability.getTargets().clear();
|
||||
FilterPermanent filter = new FilterPermanent(new StringBuilder("noncreature permanent from opponent ").append(opponent.getName()).toString());
|
||||
filter.add(new ControllerIdPredicate(opponentId));
|
||||
filter.add(Predicates.not(new CardTypePredicate(CardType.CREATURE)));
|
||||
TargetPermanent target = new TargetPermanent(0,1, filter,false);
|
||||
ability.addTarget(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public SylvanPrimordial(final SylvanPrimordial card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SylvanPrimordial copy() {
|
||||
return new SylvanPrimordial(this);
|
||||
}
|
||||
}
|
||||
|
||||
class SylvanPrimordialEffect extends OneShotEffect<SylvanPrimordialEffect> {
|
||||
|
||||
private static final FilterLandCard filterForest = new FilterLandCard("Forest");
|
||||
static{
|
||||
filterForest.add(new SubtypePredicate("Forest"));
|
||||
}
|
||||
|
||||
public SylvanPrimordialEffect() {
|
||||
super(Outcome.DestroyPermanent);
|
||||
this.staticText = "for each opponent, destroy target noncreature permanent that player controls. For each permanent destroyed this way, search your library for a Forest card and put that card onto the battlefield tapped. Then shuffle your library";
|
||||
}
|
||||
|
||||
public SylvanPrimordialEffect(final SylvanPrimordialEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SylvanPrimordialEffect copy() {
|
||||
return new SylvanPrimordialEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
boolean result = false;
|
||||
int destroyedCreatures = 0;
|
||||
for (Target target: source.getTargets()) {
|
||||
if (target instanceof TargetPermanent) {
|
||||
Permanent targetPermanent = game.getPermanent(target.getFirstTarget());
|
||||
if (targetPermanent != null) {
|
||||
if (targetPermanent.destroy(source.getSourceId(), game, false)) {
|
||||
destroyedCreatures++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (destroyedCreatures > 0) {
|
||||
new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(destroyedCreatures,filterForest), true, true).apply(game, source);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in a new issue