Merge origin/master

This commit is contained in:
LevelX2 2014-09-25 23:53:59 +02:00
commit 212dbc83e8
7 changed files with 529 additions and 4 deletions

View file

@ -0,0 +1,131 @@
/*
* 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.dissension;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.ManaWasSpentCondition;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.SacrificeSourceUnlessConditionEffect;
import mage.abilities.keyword.DoubleStrikeAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.Filter.ComparisonType;
import mage.filter.FilterCard;
import mage.filter.common.FilterCreatureCard;
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
import mage.filter.predicate.other.OwnerIdPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.Target;
import mage.target.common.TargetCardInGraveyard;
import mage.watchers.common.ManaSpentToCastWatcher;
/**
*
* @author emerald000
*/
public class CryptChampion extends CardImpl {
public CryptChampion(UUID ownerId) {
super(ownerId, 40, "Crypt Champion", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{3}{B}");
this.expansionSetCode = "DIS";
this.subtype.add("Zombie");
this.color.setBlack(true);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Double strike
this.addAbility(DoubleStrikeAbility.getInstance());
// When Crypt Champion enters the battlefield, each player puts a creature card with converted mana cost 3 or less from his or her graveyard onto the battlefield.
this.addAbility(new EntersBattlefieldTriggeredAbility(new CryptChampionEffect()));
// When Crypt Champion enters the battlefield, sacrifice it unless {R} was spent to cast it.
this.addAbility(new EntersBattlefieldTriggeredAbility(new SacrificeSourceUnlessConditionEffect(new ManaWasSpentCondition(ColoredManaSymbol.R)), false));
this.addWatcher(new ManaSpentToCastWatcher());
}
public CryptChampion(final CryptChampion card) {
super(card);
}
@Override
public CryptChampion copy() {
return new CryptChampion(this);
}
}
class CryptChampionEffect extends OneShotEffect {
CryptChampionEffect() {
super(Outcome.PutCreatureInPlay);
this.staticText = "each player puts a creature card with converted mana cost 3 or less from his or her graveyard onto the battlefield";
}
CryptChampionEffect(final CryptChampionEffect effect) {
super(effect);
}
@Override
public CryptChampionEffect copy() {
return new CryptChampionEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
for (UUID playerId : controller.getInRange()) {
Player player = game.getPlayer(playerId);
if (player != null) {
FilterCard filter = new FilterCreatureCard("creature card with converted mana cost 3 or less from your graveyard");
filter.add(new OwnerIdPredicate(playerId));
filter.add(new ConvertedManaCostPredicate(ComparisonType.LessThan, 4));
Target target = new TargetCardInGraveyard(filter);
if (target.canChoose(playerId, game) && player.chooseTarget(outcome, target, source, game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
player.putOntoBattlefieldWithInfo(card, game, Zone.GRAVEYARD, source.getSourceId());
}
}
}
}
return true;
}
return false;
}
}

View file

@ -0,0 +1,80 @@
/*
* 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.fifthdawn;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.DamageAsThoughNotBlockedAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DamageAllEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
/**
*
* @author emerald000
*/
public class TornadoElemental extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
static {
filter.add(new AbilityPredicate(FlyingAbility.class));
}
public TornadoElemental(UUID ownerId) {
super(ownerId, 97, "Tornado Elemental", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{5}{G}{G}");
this.expansionSetCode = "5DN";
this.subtype.add("Elemental");
this.color.setGreen(true);
this.power = new MageInt(6);
this.toughness = new MageInt(6);
// When Tornado Elemental enters the battlefield, it deals 6 damage to each creature with flying.
Effect effect = new DamageAllEffect(6, filter);
effect.setText("it deals 6 damage to each creature with flying");
this.addAbility(new EntersBattlefieldTriggeredAbility(effect));
// You may have Tornado Elemental assign its combat damage as though it weren't blocked.
this.addAbility(DamageAsThoughNotBlockedAbility.getInstance());
}
public TornadoElemental(final TornadoElemental card) {
super(card);
}
@Override
public TornadoElemental copy() {
return new TornadoElemental(this);
}
}

View file

@ -0,0 +1,118 @@
/*
* 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.futuresight;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.HellbentCondition;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.decorator.ConditionalContinuousRuleModifyingEffect;
import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.LoseLifeTargetEffect;
import mage.abilities.effects.common.discard.DiscardTargetEffect;
import mage.abilities.keyword.MadnessAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
/**
*
* @author emerald000
*/
public class GibberingDescent extends CardImpl {
public GibberingDescent(UUID ownerId) {
super(ownerId, 66, "Gibbering Descent", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{4}{B}{B}");
this.expansionSetCode = "FUT";
this.color.setBlack(true);
// At the beginning of each player's upkeep, that player loses 1 life and discards a card.
Effect effect = new LoseLifeTargetEffect(1);
effect.setText("that player loses 1 life");
Ability ability = new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, effect, TargetController.ANY, false, true);
effect = new DiscardTargetEffect(1);
effect.setText("and discards a card");
ability.addEffect(effect);
this.addAbility(ability);
// Hellbent - Skip your upkeep step if you have no cards in hand.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousRuleModifyingEffect(
new GibberingDescentSkipUpkeepEffect(),
HellbentCondition.getInstance())));
// Madness {2}{B}{B}
this.addAbility(new MadnessAbility(this, new ManaCostsImpl<>("{2}{B}{B}")));
}
public GibberingDescent(final GibberingDescent card) {
super(card);
}
@Override
public GibberingDescent copy() {
return new GibberingDescent(this);
}
}
class GibberingDescentSkipUpkeepEffect extends ContinuousRuleModifiyingEffectImpl {
GibberingDescentSkipUpkeepEffect() {
super(Duration.WhileOnBattlefield, Outcome.Neutral);
this.staticText = "Hellbent - Skip your upkeep step if you have no cards in hand";
}
GibberingDescentSkipUpkeepEffect(final GibberingDescentSkipUpkeepEffect effect) {
super(effect);
}
@Override
public GibberingDescentSkipUpkeepEffect copy() {
return new GibberingDescentSkipUpkeepEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return event.getType() == EventType.UPKEEP_STEP && (event.getPlayerId().equals(source.getControllerId()));
}
}

View file

@ -0,0 +1,52 @@
/*
* 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.planechase;
import java.util.UUID;
/**
*
* @author emerald000
*/
public class TornadoElemental extends mage.sets.fifthdawn.TornadoElemental {
public TornadoElemental(UUID ownerId) {
super(ownerId);
this.cardNumber = 79;
this.expansionSetCode = "HOP";
}
public TornadoElemental(final TornadoElemental card) {
super(card);
}
@Override
public TornadoElemental copy() {
return new TornadoElemental(this);
}
}

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.planeshift;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.costs.Cost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.Effect;
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.events.GameEvent;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author emerald000
*/
public class PhyrexianTyranny extends CardImpl {
public PhyrexianTyranny(UUID ownerId) {
super(ownerId, 118, "Phyrexian Tyranny", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{U}{B}{R}");
this.expansionSetCode = "PLS";
this.color.setBlue(true);
this.color.setRed(true);
this.color.setBlack(true);
// Whenever a player draws a card, that player loses 2 life unless he or she pays {2}.
this.addAbility(new PhyrexianTyrannyTriggeredAbility());
}
public PhyrexianTyranny(final PhyrexianTyranny card) {
super(card);
}
@Override
public PhyrexianTyranny copy() {
return new PhyrexianTyranny(this);
}
}
class PhyrexianTyrannyTriggeredAbility extends TriggeredAbilityImpl {
PhyrexianTyrannyTriggeredAbility() {
super(Zone.BATTLEFIELD, new PhyrexianTyrannyEffect(), false);
}
PhyrexianTyrannyTriggeredAbility(final PhyrexianTyrannyTriggeredAbility ability) {
super(ability);
}
@Override
public PhyrexianTyrannyTriggeredAbility copy() {
return new PhyrexianTyrannyTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.DREW_CARD) {
for (Effect effect : this.getEffects()) {
if (effect instanceof PhyrexianTyrannyEffect) {
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
}
}
return true;
}
return false;
}
@Override
public String getRule() {
return "Whenever a player draws a card, that player loses 2 life unless he or she pays {2}";
}
}
class PhyrexianTyrannyEffect extends OneShotEffect {
PhyrexianTyrannyEffect() {
super(Outcome.Neutral);
this.staticText = "that player loses 2 life unless he or she pays {2}";
}
PhyrexianTyrannyEffect(final PhyrexianTyrannyEffect effect) {
super(effect);
}
@Override
public PhyrexianTyrannyEffect copy() {
return new PhyrexianTyrannyEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(targetPointer.getFirst(game, source));
if (player != null) {
Cost cost = new GenericManaCost(2);
if (!cost.pay(source, game, player.getId(), player.getId(), false)) {
player.damage(2, source.getSourceId(), game, false, true);
}
return true;
}
return false;
}
}

View file

@ -27,7 +27,6 @@
*/
package mage.abilities.effects.common.discard;
import mage.constants.Outcome;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.dynamicvalue.DynamicValue;
@ -35,6 +34,7 @@ import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.constants.Outcome;
import mage.game.Game;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
@ -115,6 +115,9 @@ public class DiscardTargetEffect extends OneShotEffect {
@Override
public String getText(Mode mode) {
if (staticText != null && !staticText.isEmpty()) {
return staticText;
}
StringBuilder sb = new StringBuilder();
if(mode.getTargets().isEmpty()){
sb.append("that player");

View file

@ -1,5 +1,6 @@
package mage.abilities.keyword;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.Mode;
@ -11,14 +12,16 @@ import mage.abilities.costs.mana.ManaCost;
import mage.abilities.effects.AsThoughEffectImpl;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.constants.*;
import mage.constants.AsThoughEffectType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.WatcherScope;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.players.Player;
import mage.watchers.Watcher;
import java.util.UUID;
/**
* 702.33. Madness
*
@ -136,6 +139,7 @@ class MadnessTriggeredAbility extends TriggeredAbilityImpl {
MadnessTriggeredAbility() {
super(Zone.GRAVEYARD, new MadnessExileEffect(), true);
this.setRuleVisible(false);
}
MadnessTriggeredAbility(final MadnessTriggeredAbility ability) {