[ZEN] Gigantiform, Predatory Urge, Savage Silhouette

This commit is contained in:
North 2012-04-06 21:18:47 +03:00
parent 223d26f9d8
commit e8d5f3763e
3 changed files with 403 additions and 0 deletions

View file

@ -0,0 +1,197 @@
/*
* 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.zendikar;
import java.util.UUID;
import mage.Constants;
import mage.Constants.AttachmentType;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.abilities.Ability;
import mage.abilities.StaticAbility;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.KickedCondition;
import mage.abilities.costs.mana.KickerManaCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.continious.GainAbilityAttachedEffect;
import mage.abilities.effects.common.continious.SetPowerToughnessSourceEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.filter.FilterCard;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPermanent;
import mage.target.common.TargetCardInLibrary;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author North
*/
public class Gigantiform extends CardImpl<Gigantiform> {
public Gigantiform(UUID ownerId) {
super(ownerId, 162, "Gigantiform", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{G}{G}");
this.expansionSetCode = "ZEN";
this.subtype.add("Aura");
this.color.setGreen(true);
// Kicker {4}
this.getSpellAbility().addOptionalCost(new KickerManaCost("{4}"));
// Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Constants.Outcome.BoostCreature));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// Enchanted creature is 8/8 and has trample.
this.addAbility(new GigantiformAbility());
// When Gigantiform enters the battlefield, if it was kicked, you may search your library for a card named Gigantiform, put it onto the battlefield, then shuffle your library.
this.addAbility(new GigantiformTriggeredAbility());
}
public Gigantiform(final Gigantiform card) {
super(card);
}
@Override
public Gigantiform copy() {
return new Gigantiform(this);
}
}
class GigantiformAbility extends StaticAbility<GigantiformAbility> {
public GigantiformAbility() {
super(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(TrampleAbility.getInstance(), AttachmentType.AURA));
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new SetPowerToughnessSourceEffect(8, 8, Duration.WhileOnBattlefield));
this.addEffect(new GainAbilityAttachedEffect(ability, AttachmentType.AURA));
}
public GigantiformAbility(GigantiformAbility ability) {
super(ability);
}
@Override
public GigantiformAbility copy() {
return new GigantiformAbility(this);
}
@Override
public String getRule() {
return "Enchanted creature is 8/8 and has trample.";
}
}
class GigantiformTriggeredAbility extends TriggeredAbilityImpl<GigantiformTriggeredAbility> {
public GigantiformTriggeredAbility() {
super(Zone.BATTLEFIELD, new GigantiformEffect());
}
public GigantiformTriggeredAbility(final GigantiformTriggeredAbility ability) {
super(ability);
}
@Override
public GigantiformTriggeredAbility copy() {
return new GigantiformTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && event.getTargetId().equals(this.getSourceId())
&& ((ZoneChangeEvent) event).getToZone() == Zone.BATTLEFIELD
&& KickedCondition.getInstance().apply(game, this)) {
return true;
}
return false;
}
@Override
public String getRule() {
return "When Gigantiform enters the battlefield, if it was kicked, you may search your library for a card named Gigantiform, put it onto the battlefield, then shuffle your library.";
}
}
class GigantiformEffect extends OneShotEffect<GigantiformEffect> {
private static final String message = "Do you wish to search your library for a card named Gigantiform, put it onto the battlefield, then shuffle your library?";
private static final FilterCard filter = new FilterCard("card named Gigantiform");
static {
filter.getName().add("Gigantiform");
}
public GigantiformEffect() {
super(Outcome.PutCardInPlay);
}
public GigantiformEffect(final GigantiformEffect effect) {
super(effect);
}
@Override
public GigantiformEffect copy() {
return new GigantiformEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
TargetCardInLibrary target = new TargetCardInLibrary(filter);
if (player != null && player.chooseUse(Outcome.PutCardInPlay, message, game) && player.searchLibrary(target, game)) {
Card card = player.getLibrary().getCard(target.getFirstTarget(), game);
TargetCreaturePermanent targetCreature = new TargetCreaturePermanent(new FilterCreaturePermanent("creature to attach Gigantiform to"));
if (card != null && card.putOntoBattlefield(game, Zone.HAND, source.getId(), source.getControllerId())
&& player.chooseTarget(Outcome.BoostCreature, targetCreature, source, game)) {
Permanent aura = game.getPermanent(card.getId());
Permanent creature = game.getPermanent(targetCreature.getFirstTarget());
if (aura != null && creature != null) {
creature.addAttachment(aura.getId(), game);
}
}
player.shuffleLibrary(game);
return true;
}
return false;
}
}

View file

@ -0,0 +1,123 @@
/*
* 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.zendikar;
import java.util.UUID;
import mage.Constants.AttachmentType;
import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.continious.GainAbilityAttachedEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author North
*/
public class PredatoryUrge extends CardImpl<PredatoryUrge> {
public PredatoryUrge(UUID ownerId) {
super(ownerId, 175, "Predatory Urge", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{G}");
this.expansionSetCode = "ZEN";
this.subtype.add("Aura");
this.color.setGreen(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);
// Enchanted creature has "{tap}: This creature deals damage equal to its power to target creature.
// That creature deals damage equal to its power to this creature."
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PredatoryUrgeEffect(), new TapSourceCost());
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(ability, AttachmentType.AURA)));
}
public PredatoryUrge(final PredatoryUrge card) {
super(card);
}
@Override
public PredatoryUrge copy() {
return new PredatoryUrge(this);
}
}
class PredatoryUrgeEffect extends OneShotEffect<PredatoryUrgeEffect> {
public PredatoryUrgeEffect() {
super(Outcome.Damage);
this.staticText = "This creature deals damage equal to its power to target creature. That creature deals damage equal to its power to this creature.";
}
public PredatoryUrgeEffect(final PredatoryUrgeEffect effect) {
super(effect);
}
@Override
public PredatoryUrgeEffect copy() {
return new PredatoryUrgeEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
boolean sourceOnBattlefield = true;
Permanent targetCreature = game.getPermanent(source.getFirstTarget());
Permanent sourceCreature = game.getPermanent(source.getSourceId());
if (sourceCreature == null) {
sourceCreature = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
sourceOnBattlefield = false;
}
if (sourceCreature != null && targetCreature != null
&& sourceCreature.getCardType().contains(CardType.CREATURE)
&& targetCreature.getCardType().contains(CardType.CREATURE)) {
targetCreature.damage(sourceCreature.getPower().getValue(), sourceCreature.getId(), game, true, false);
if (sourceOnBattlefield) {
sourceCreature.damage(targetCreature.getPower().getValue(), targetCreature.getId(), game, true, false);
}
return true;
}
return false;
}
}

View file

@ -0,0 +1,83 @@
/*
* 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.zendikar;
import java.util.UUID;
import mage.Constants.AttachmentType;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.RegenerateSourceEffect;
import mage.abilities.effects.common.continious.BoostEnchantedEffect;
import mage.abilities.effects.common.continious.GainAbilityAttachedEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author North
*/
public class SavageSilhouette extends CardImpl<SavageSilhouette> {
public SavageSilhouette(UUID ownerId) {
super(ownerId, 181, "Savage Silhouette", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}");
this.expansionSetCode = "ZEN";
this.subtype.add("Aura");
this.color.setGreen(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);
// Enchanted creature gets +2/+2 and has "{1}{G}: Regenerate this creature."
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new RegenerateSourceEffect(), new ManaCostsImpl("{1}{G}"));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(2, 2, Duration.WhileOnBattlefield)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(ability, AttachmentType.AURA)));
}
public SavageSilhouette(final SavageSilhouette card) {
super(card);
}
@Override
public SavageSilhouette copy() {
return new SavageSilhouette(this);
}
}