Merge origin/master

This commit is contained in:
emerald000 2014-07-14 01:01:39 -04:00
commit 7ca60078a0
36 changed files with 740 additions and 489 deletions

View file

@ -87,7 +87,7 @@ public class AthreosGodOfPassage extends CardImpl {
effect.setText("As long as your devotion to white and black is less than seven, Athreos isn't a creature");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
// Whenever another creature you own dies, return it to your hand unless target opponent pays 3 life.
Ability ability = new AthreosDiesCreatureTriggeredAbility(new AthreosGodOfPassageReturnEffect(), false, filter, true);
Ability ability = new AthreosDiesCreatureTriggeredAbility(new AthreosGodOfPassageReturnEffect(), false, filter);
ability.addTarget(new TargetOpponent());
this.addAbility(ability);
@ -152,12 +152,10 @@ class AthreosGodOfPassageReturnEffect extends OneShotEffect {
class AthreosDiesCreatureTriggeredAbility extends TriggeredAbilityImpl {
protected FilterCreaturePermanent filter;
private boolean setTargetPointer;
public AthreosDiesCreatureTriggeredAbility(Effect effect, boolean optional, FilterCreaturePermanent filter, boolean setTargetPointer) {
public AthreosDiesCreatureTriggeredAbility(Effect effect, boolean optional, FilterCreaturePermanent filter) {
super(Zone.BATTLEFIELD, effect, optional);
this.filter = filter;
this.setTargetPointer = setTargetPointer;
}
public AthreosDiesCreatureTriggeredAbility(AthreosDiesCreatureTriggeredAbility ability) {
@ -177,10 +175,8 @@ class AthreosDiesCreatureTriggeredAbility extends TriggeredAbilityImpl {
if (zEvent.getFromZone().equals(Zone.BATTLEFIELD) && zEvent.getToZone().equals(Zone.GRAVEYARD)) {
Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD);
if (permanent != null && filter.match(permanent, sourceId, controllerId, game)) {
if (setTargetPointer) {
for (Effect effect : this.getEffects()) {
effect.setValue("creatureId", event.getTargetId());
}
for (Effect effect : this.getEffects()) {
effect.setValue("creatureId", event.getTargetId());
}
return true;
}

View file

@ -68,18 +68,19 @@ public class AvariceAmulet extends CardImpl {
// Equipped creature gets +2/+0
Effect effect = new BoostEquippedEffect(2, 0);
effect.setText("Equipped creature gets +2/+0");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, effect);
// and has vigilance
effect = new GainAbilityAttachedEffect(VigilanceAbility.getInstance(), AttachmentType.EQUIPMENT);
effect.setText("and has vigilance");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
ability.addEffect(effect);
//and "At the beginning of your upkeep, draw a card."
effect = new GainAbilityAttachedEffect(new BeginningOfUpkeepTriggeredAbility(new DrawCardSourceControllerEffect(1), TargetController.YOU, false), AttachmentType.EQUIPMENT);
effect.setText("and \"At the beginning of your upkeep, draw a card.\"");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
ability.addEffect(effect);
this.addAbility(ability);
// When equipped creature dies, target opponent gains control of Avarice Amulet.
Ability ability = new DiesAttachedTriggeredAbility(new AvariceAmuletChangeControlEffect(), "equipped creature", false);
ability = new DiesAttachedTriggeredAbility(new AvariceAmuletChangeControlEffect(), "equipped creature", false);
ability.addTarget(new TargetOpponent());
this.addAbility(ability);

View file

@ -29,9 +29,11 @@ package mage.sets.magic2015;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.combat.CantBeBlockedByOneAllEffect;
import mage.abilities.effects.common.combat.CantBeBlockedByOneEffect;
import mage.abilities.effects.common.continious.GainAbilityAllEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
@ -65,7 +67,8 @@ public class BelligerentSliver extends CardImpl {
this.toughness = new MageInt(2);
// Sliver creatures you control have "This creature can't be blocked except by two or more creatures."
Effect effect = new CantBeBlockedByOneAllEffect(2, filter, Duration.WhileOnBattlefield);
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new CantBeBlockedByOneEffect(2, Duration.WhileOnBattlefield));
Effect effect = new GainAbilityAllEffect(ability, Duration.WhileOnBattlefield, filter);
effect.setText("Sliver creatures you control have \"This creature can't be blocked except by two or more creatures.\"");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
}

View file

@ -32,6 +32,7 @@ import mage.MageInt;
import mage.abilities.common.AuraAttachedTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.continious.BoostSourceEffect;
import mage.abilities.keyword.FlyingAbility;
@ -60,7 +61,9 @@ public class BroodKeeper extends CardImpl {
// Whenever an Aura becomes attached to Brood Keeper, put a 2/2 red Dragon creature token with flying onto the battlefield.
// It has "{R}: This creature gets +1/+0 until end of turn."
this.addAbility(new AuraAttachedTriggeredAbility(new CreateTokenEffect(new BroodKeeperDragonToken()), false));
Effect effect = new CreateTokenEffect(new BroodKeeperDragonToken());
effect.setText("put a 2/2 red Dragon creature token with flying onto the battlefield. It has \"{R}: This creature gets +1/+0 until end of turn.\"");
this.addAbility(new AuraAttachedTriggeredAbility(effect, false));
}
public BroodKeeper(final BroodKeeper card) {

View file

@ -96,6 +96,12 @@ public class SiegeDragon extends CardImpl {
class SiegeDragonAttacksTriggeredAbility extends TriggeredAbilityImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("wall");
static {
filter.add(new SubtypePredicate("Wall"));
}
public SiegeDragonAttacksTriggeredAbility() {
super(Zone.BATTLEFIELD, new SiegeDragonDamageEffect());
}
@ -111,14 +117,13 @@ class SiegeDragonAttacksTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) {
FilterCreaturePermanent filter = new FilterCreaturePermanent();
filter.add(new ControllerIdPredicate(event.getTargetId()));
filter.add(new SubtypePredicate("Wall"));
List<Permanent> permanents = game.getBattlefield().getActivePermanents(filter, this.getControllerId(), this.getSourceId(), game);
return permanents.isEmpty();
}
return false;
return GameEvent.EventType.ATTACKER_DECLARED.equals(event.getType()) && event.getSourceId().equals(this.getSourceId());
}
@Override
public boolean checkInterveningIfClause(Game game) {
UUID defendingPlayerId = game.getCombat().getDefendingPlayerId(getSourceId(), game);
return defendingPlayerId != null && game.getBattlefield().countAll(filter, defendingPlayerId, game) < 1;
}
@Override
@ -144,10 +149,10 @@ class SiegeDragonDamageEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
UUID defenderId = game.getCombat().getDefenderId(source.getSourceId());
if (defenderId != null) {
UUID defendingPlayerId = game.getCombat().getDefendingPlayerId(source.getSourceId(), game);
if (defendingPlayerId != null) {
FilterCreaturePermanent filter = new FilterCreaturePermanent();
filter.add(new ControllerIdPredicate(defenderId));
filter.add(new ControllerIdPredicate(defendingPlayerId));
filter.add(Predicates.not(new AbilityPredicate(FlyingAbility.class)));
List<Permanent> permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game);
for (Permanent permanent : permanents) {

View file

@ -106,7 +106,7 @@ class TangleWireEffect extends OneShotEffect {
int counterCount = permanent.getCounters().getCount(CounterType.FADE);
int amount = Math.min(counterCount, targetCount);
Target target = new TargetControlledPermanent(amount, amount, filter, false);
Target target = new TargetControlledPermanent(amount, amount, filter, true);
target.setNotTarget(true);
if (amount > 0 && player.chooseTarget(Outcome.Tap, target, source, game)) {

View file

@ -62,9 +62,9 @@ public class CephalidColiseum extends CardImpl {
// Threshold - {U}, {tap}, Sacrifice Cephalid Coliseum: Target player draws three cards, then discards three cards. Activate this ability only if seven or more cards are in your graveyard.
Ability thresholdAbility = new ConditionalGainActivatedAbility(Zone.BATTLEFIELD,
new DrawCardTargetEffect(3),
new ManaCostsImpl("{G}"),
new ManaCostsImpl("{U}"),
new CardsInControllerGraveCondition(7),
"<i>Threshold</i> - {G}, {T}, Sacrifice {this}: Target player draws three cards, then discards three cards. Activate this ability only if seven or more cards are in your graveyard.");
"<i>Threshold</i> - {U}, {T}, Sacrifice {this}: Target player draws three cards, then discards three cards. Activate this ability only if seven or more cards are in your graveyard.");
thresholdAbility.addEffect(new DiscardTargetEffect(3));
thresholdAbility.addCost(new TapSourceCost());
thresholdAbility.addCost(new SacrificeSourceCost());

View file

@ -28,6 +28,7 @@
package mage.sets.onslaught;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.CycleAllTriggeredAbility;
import mage.abilities.common.delayed.AtEndOfTurnDelayedTriggeredAbility;
@ -86,12 +87,14 @@ class AstralSlideEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller != null && sourceObject != null) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) {
if (controller.moveCardToExileWithInfo(permanent, null, "", source.getSourceId(), game, Zone.BATTLEFIELD)) {
UUID exileId = UUID.randomUUID();
if (controller.moveCardToExileWithInfo(permanent, exileId, sourceObject.getLogName(), source.getSourceId(), game, Zone.BATTLEFIELD)) {
//create delayed triggered ability
AtEndOfTurnDelayedTriggeredAbility delayedAbility = new AtEndOfTurnDelayedTriggeredAbility(new ReturnFromExileEffect(source.getSourceId(), Zone.BATTLEFIELD, false));
AtEndOfTurnDelayedTriggeredAbility delayedAbility = new AtEndOfTurnDelayedTriggeredAbility(new ReturnFromExileEffect(exileId, Zone.BATTLEFIELD, false));
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
game.addDelayedTriggeredAbility(delayedAbility);

View file

@ -89,31 +89,34 @@ class ChainOfVaporEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) {
if(!permanent.moveToZone(Zone.HAND, source.getId(), game, false)){
if (!controller.moveCardToHandWithInfo(permanent, source.getSourceId(), game, Zone.BATTLEFIELD)){
return false;
}
}
Player player = game.getPlayer(permanent.getControllerId());
if(player.chooseUse(Outcome.ReturnToHand, "Sacrifice a land to copy this spell?", game)){
if (player.chooseUse(Outcome.ReturnToHand, "Sacrifice a land to copy this spell?", game)){
TargetControlledPermanent target = new TargetControlledPermanent(new FilterControlledLandPermanent());
if(player.chooseTarget(Outcome.Sacrifice, target, source, game)){
if (player.chooseTarget(Outcome.Sacrifice, target, source, game)){
Permanent land = game.getPermanent(target.getFirstTarget());
if(land != null){
if(land.sacrifice(source.getId(), game)){
Spell spell = game.getStack().getSpell(source.getId());
Spell spell = game.getStack().getSpell(source.getSourceId());
if (spell != null) {
Spell copy = spell.copySpell();
copy.setControllerId(player.getId());
copy.setCopiedSpell(true);
game.getStack().push(copy);
copy.chooseNewTargets(game, source.getControllerId());
copy.chooseNewTargets(game, player.getId());
String activateMessage = copy.getActivatedMessage(game);
if (activateMessage.startsWith(" casts ")) {
activateMessage = activateMessage.substring(6);
}
game.informPlayers(player.getName() + " copies " + activateMessage);;
game.informPlayers(player.getName() + " copies " + activateMessage);
return true;
}
return false;

View file

@ -34,9 +34,13 @@ import mage.constants.Rarity;
import mage.MageInt;
import mage.Mana;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.mana.SimpleManaAbility;
import mage.cards.CardImpl;
import mage.constants.Zone;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.target.common.TargetControlledCreaturePermanent;
/**
*
@ -44,6 +48,12 @@ import mage.constants.Zone;
*/
public class SkirkProspector extends CardImpl {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("a Goblin");
static {
filter.add(new SubtypePredicate(("Goblin")));
}
public SkirkProspector(UUID ownerId) {
super(ownerId, 230, "Skirk Prospector", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{R}");
this.expansionSetCode = "ONS";
@ -54,7 +64,7 @@ public class SkirkProspector extends CardImpl {
this.toughness = new MageInt(1);
// Sacrifice a Goblin: Add {R} to your mana pool.
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, Mana.RedMana, new SacrificeSourceCost()));
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, Mana.RedMana, new SacrificeTargetCost(new TargetControlledCreaturePermanent(1,1,filter,true))));
}
public SkirkProspector(final SkirkProspector card) {

View file

@ -0,0 +1,70 @@
/*
* 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.effects.common.search.SearchLibraryPutInHandEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.target.common.TargetCardInLibrary;
/**
*
* @author LevelX2
*/
public class EladamrisCall extends CardImpl {
private static final FilterCard filter = new FilterCard("creature card");
static {
filter.add(new CardTypePredicate(CardType.CREATURE));
}
public EladamrisCall(UUID ownerId) {
super(ownerId, 106, "Eladamri's Call", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{G}{W}");
this.expansionSetCode = "PLS";
this.color.setGreen(true);
this.color.setWhite(true);
// Search your library for a creature card, reveal that card, and put it into your hand. Then shuffle your library.
this.getSpellAbility().addEffect(new SearchLibraryPutInHandEffect(new TargetCardInLibrary(filter), true, true));
}
public EladamrisCall(final EladamrisCall card) {
super(card);
}
@Override
public EladamrisCall copy() {
return new EladamrisCall(this);
}
}

View file

@ -36,7 +36,7 @@ import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.SupertypePredicate;
@ -46,7 +46,7 @@ import mage.filter.predicate.mageobject.SupertypePredicate;
*/
public class BackToBasics extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("Nonbasic lands");
private static final FilterLandPermanent filter = new FilterLandPermanent("Nonbasic lands");
static {
filter.add(Predicates.not(new SupertypePredicate("Basic")));

View file

@ -63,7 +63,7 @@ public class DeftbladeElite extends CardImpl {
// {1}{W}: Prevent all combat damage that would be dealt to and dealt by Deftblade Elite this turn.
Effect effect = new PreventCombatDamageToSourceEffect(Duration.EndOfTurn);
effect.setText("Prevent all combat damage that would be dealt to");
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{3}{W}"));
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{1}{W}"));
effect = new PreventCombatDamageBySourceEffect(Duration.EndOfTurn);
effect.setText("and dealt by {this} this turn");
ability.addEffect(effect);