Merge origin/master

This commit is contained in:
fireshoes 2015-07-20 11:29:24 -05:00
commit a7f893ca25
12 changed files with 438 additions and 62 deletions

View file

@ -0,0 +1,63 @@
/*
* 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.coldsnap;
import java.util.UUID;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.keyword.RecoverAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
/**
*
* @author LevelX2
*/
public class SunsBounty extends CardImpl {
public SunsBounty(UUID ownerId) {
super(ownerId, 18, "Sun's Bounty", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{W}");
this.expansionSetCode = "CSP";
// You gain 4 life.
this.getSpellAbility().addEffect(new GainLifeEffect(4));
// Recover {1}{W}
this.addAbility(new RecoverAbility(new ManaCostsImpl("{1}{W}"), this));
}
public SunsBounty(final SunsBounty card) {
super(card);
}
@Override
public SunsBounty copy() {
return new SunsBounty(this);
}
}

View file

@ -75,7 +75,6 @@ public class DarettiScrapSavant extends CardImpl {
this.expansionSetCode = "C14";
this.subtype.add("Daretti");
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(3)), false));
// +2: Discard up to two cards, then draw that many cards.
@ -126,7 +125,7 @@ class DarettiDiscardDrawEffect extends OneShotEffect {
TargetDiscard target = new TargetDiscard(0, 2, new FilterCard(), controller.getId());
target.choose(outcome, controller.getId(), source.getSourceId(), game);
int count = 0;
for (UUID cardId: target.getTargets()) {
for (UUID cardId : target.getTargets()) {
Card card = game.getCard(cardId);
if (card != null) {
controller.discard(card, source, game);
@ -160,9 +159,9 @@ class DarettiSacrificeEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Target target = new TargetControlledPermanent(1,1,new FilterControlledArtifactPermanent(), true);
if (target.canChoose(source.getSourceId(), controller.getId(), game) &&
controller.chooseTarget(outcome, target, source, game)) {
Target target = new TargetControlledPermanent(1, 1, new FilterControlledArtifactPermanent(), true);
if (target.canChoose(source.getSourceId(), controller.getId(), game)
&& controller.chooseTarget(outcome, target, source, game)) {
Permanent artifact = game.getPermanent(target.getFirstTarget());
if (artifact != null && artifact.sacrifice(source.getSourceId(), game)) {
Card card = game.getCard(getTargetPointer().getFirst(game, source));
@ -178,7 +177,9 @@ class DarettiSacrificeEffect extends OneShotEffect {
}
class DarettiScrapSavantEmblem extends Emblem {
// You get an emblem with "Whenever an artifact is put into your graveyard from the battlefield, return that card to the battlefield at the beginning of the next end step."
public DarettiScrapSavantEmblem() {
this.setName("Emblem - Daretti");
this.getAbilities().add(new DarettiScrapSavantTriggeredAbility());
@ -208,10 +209,10 @@ class DarettiScrapSavantTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getToZone() == Zone.GRAVEYARD &&
zEvent.getFromZone() == Zone.BATTLEFIELD &&
zEvent.getTarget().getCardType().contains(CardType.ARTIFACT) &&
zEvent.getTarget().getOwnerId().equals(this.controllerId)) {
if (zEvent.getToZone() == Zone.GRAVEYARD
&& zEvent.getFromZone() == Zone.BATTLEFIELD
&& zEvent.getTarget().getCardType().contains(CardType.ARTIFACT)
&& zEvent.getTarget().getOwnerId().equals(this.controllerId)) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(zEvent.getTargetId()));
}
@ -245,9 +246,9 @@ class DarettiScrapSavantEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Card card = game.getCard(getTargetPointer().getFirst(game, source));
if (card != null) {
if (card != null && game.getState().getZone(card.getId()).equals(Zone.GRAVEYARD)) {
Effect effect = new ReturnFromGraveyardToBattlefieldTargetEffect();
effect.setTargetPointer(new FixedTarget(card.getId()));
effect.setTargetPointer(new FixedTarget(card.getId(), card.getZoneChangeCounter(game)));
effect.setText("return that card to the battlefield at the beginning of the next end step");
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(Zone.COMMAND, effect, TargetController.ANY);
delayedAbility.setSourceId(source.getSourceId());
@ -258,4 +259,4 @@ class DarettiScrapSavantEffect extends OneShotEffect {
}
return false;
}
}
}

View file

@ -38,8 +38,9 @@ import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterControlledLandPermanent;
import mage.target.Target;
import mage.target.common.TargetLandPermanent;
import mage.target.common.TargetControlledPermanent;
/**
*
@ -55,7 +56,7 @@ public class UnstableFrontier extends CardImpl {
this.addAbility(new ColorlessManaAbility());
// {tap}: Target land you control becomes the basic land type of your choice until end of turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesBasicLandTargetEffect(Duration.EndOfTurn), new TapSourceCost());
Target target = new TargetLandPermanent();
Target target = new TargetControlledPermanent(new FilterControlledLandPermanent());
ability.addTarget(target);
this.addAbility(ability);
}

View file

@ -34,8 +34,8 @@ import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.common.delayed.AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ExileTargetEffect;
import mage.abilities.effects.common.ExileSpellEffect;
import mage.abilities.effects.common.ExileTargetEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
@ -76,21 +76,21 @@ public class RallyTheAncestors extends CardImpl {
}
class RallyTheAncestorsEffect extends OneShotEffect {
RallyTheAncestorsEffect() {
super(Outcome.PutCreatureInPlay);
this.staticText = "Return each creature card with converted mana cost X or less from your graveyard to the battlefield. Exile those creatures at the beginning of your next upkeep";
}
RallyTheAncestorsEffect(final RallyTheAncestorsEffect effect) {
super(effect);
}
@Override
public RallyTheAncestorsEffect copy() {
return new RallyTheAncestorsEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
@ -101,14 +101,15 @@ class RallyTheAncestorsEffect extends OneShotEffect {
Set<Card> cards = player.getGraveyard().getCards(filter, game);
for (Card card : cards) {
if (card != null) {
player.putOntoBattlefieldWithInfo(card, game, Zone.GRAVEYARD, source.getSourceId());
Effect exileEffect = new ExileTargetEffect("Exile those creatures at the beginning of your next upkeep");
exileEffect.setTargetPointer(new FixedTarget(card.getId()));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility(exileEffect);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
if (player.putOntoBattlefieldWithInfo(card, game, Zone.GRAVEYARD, source.getSourceId())) {
Effect exileEffect = new ExileTargetEffect("Exile those creatures at the beginning of your next upkeep");
exileEffect.setTargetPointer(new FixedTarget(card.getId(), card.getZoneChangeCounter(game)));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility(exileEffect);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
game.addDelayedTriggeredAbility(delayedAbility);
}
}
}
return true;

View file

@ -77,13 +77,13 @@ public class HellkiteTyrant extends CardImpl {
// Trample
this.addAbility(TrampleAbility.getInstance());
// Whenever Hellkite Tyrant deals combat damage to a player, gain control of all artifacts that player controls.
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new HellkiteTyrantEffect(),false, true));
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new HellkiteTyrantEffect(), false, true));
// At the beginning of your upkeep, if you control twenty or more artifacts, you win the game.
TriggeredAbility ability = new BeginningOfUpkeepTriggeredAbility(new WinGameSourceControllerEffect(), TargetController.YOU, false);
this.addAbility(new ConditionalTriggeredAbility(
ability,
new PermanentsOnTheBattlefieldCondition(new FilterArtifactPermanent(), PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN,19),
new PermanentsOnTheBattlefieldCondition(new FilterArtifactPermanent(), PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN, 19),
"At the beginning of your upkeep, if you control twenty or more artifacts, you win the game."));
}
@ -123,7 +123,7 @@ class HellkiteTyrantEffect extends OneShotEffect {
FilterPermanent filter = new FilterArtifactPermanent();
filter.add(new ControllerIdPredicate(player.getId()));
List<Permanent> permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId() , game);
List<Permanent> permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game);
for (Permanent permanent : permanents) {
ContinuousEffect effect = new HellkiteTyrantControlEffect(source.getControllerId());
effect.setTargetPointer(new FixedTarget(permanent.getId()));

View file

@ -1,16 +1,16 @@
/*
* 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
@ -20,20 +20,19 @@
* 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.magic2011;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.Mana;
import mage.abilities.effects.common.BasicManaEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
/**
*
@ -45,6 +44,7 @@ public class PyreticRitual extends CardImpl {
super(ownerId, 153, "Pyretic Ritual", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{R}");
this.expansionSetCode = "M11";
// Add {R}{R}{R} to your mana pool.
this.getSpellAbility().addEffect(new BasicManaEffect(Mana.RedMana(3)));
}

View file

@ -81,25 +81,26 @@ class DaysUndoingEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player sourcePlayer = game.getPlayer(source.getControllerId());
for (UUID playerId: sourcePlayer.getInRange()) {
for (UUID playerId : sourcePlayer.getInRange()) {
Player player = game.getPlayer(playerId);
if (player != null) {
for (Card card: player.getHand().getCards(game)) {
for (Card card : player.getHand().getCards(game)) {
card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true);
}
for (Card card: player.getGraveyard().getCards(game)) {
for (Card card : player.getGraveyard().getCards(game)) {
card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true);
}
game.informPlayers(player.getLogName() + " puts his or her hand and graveyard into his or her library");
player.shuffleLibrary(game);
}
}
game.getState().handleSimultaneousEvent(game); // needed here so state based triggered effects
for (UUID playerId: sourcePlayer.getInRange()) {
game.getState().handleSimultaneousEvent(game); // needed here so state based triggered effects
for (UUID playerId : sourcePlayer.getInRange()) {
Player player = game.getPlayer(playerId);
if (player != null) {
player.drawCards(7, game);
}
}
}
return true;
}
@ -109,4 +110,4 @@ class DaysUndoingEffect extends OneShotEffect {
return new DaysUndoingEffect(this);
}
}
}

View file

@ -31,7 +31,6 @@ import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.condition.common.SpellMasteryCondition;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.Cards;
import mage.cards.CardsImpl;
@ -98,10 +97,10 @@ class GatherThePackEffect extends OneShotEffect {
}
TargetCard target = new TargetCard(0, max, Zone.LIBRARY, new FilterCreatureCard("creature card" + (max > 1 ? "s" : "") + " to put into your hand"));
if (controller.choose(Outcome.PutCreatureInPlay, cards, target, game)) {
Card card = cards.get(target.getFirstTarget(), game);
if (card != null) {
cards.remove(card);
controller.moveCards(card, Zone.LIBRARY, Zone.HAND, source, game);
Cards cardsToHand = new CardsImpl(target.getTargets());
if (cardsToHand.size() > 0) {
cards.removeAll(cardsToHand);
controller.moveCards(cardsToHand, Zone.LIBRARY, Zone.HAND, source, game);
}
}
}