merge - Took aryat's Divine Offering.

This commit is contained in:
maurer.it 2011-03-07 10:16:53 -05:00
commit d0de07e93b
8 changed files with 546 additions and 118 deletions

View file

@ -287,11 +287,14 @@ public class ComputerPlayer<T extends ComputerPlayer<T>> extends PlayerImpl<T> i
targets = threats(opponentId, ((FilterCreatureOrPlayer)t.getFilter()).getCreatureFilter(), game);
}
for (Permanent permanent: targets) {
List<UUID> alreadyTargetted = target.getTargets();
if (t.canTarget(playerId, permanent.getId(), source, game)) {
if ( alreadyTargetted != null && !alreadyTargetted.contains(permanent.getId()) ) {
target.addTarget(permanent.getId(), source, game);
return true;
}
}
}
if (outcome.isGood()) {
if (target.canTarget(playerId, source, game)) {
target.addTarget(playerId, source, game);

View file

@ -25,49 +25,50 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.mirrodinbesieged;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.filter.Filter;
import mage.filter.FilterPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.Target;
import mage.target.TargetPermanent;
/**
*
* @author ayratn
* @author matt.maurer
*/
public class DivineOffering extends CardImpl<DivineOffering> {
private static FilterPermanent filter = new FilterPermanent("artifact");
private static final FilterPermanent filter = new FilterPermanent();
static {
filter.getCardType().add(CardType.ARTIFACT);
filter.setScopeCardType(Filter.ComparisonScope.Any);
}
public DivineOffering (UUID ownerId) {
public DivineOffering(UUID ownerId) {
super(ownerId, 5, "Divine Offering", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{W}");
this.expansionSetCode = "MBS";
this.color.setWhite(true);
this.getSpellAbility().addTarget(new TargetPermanent(filter));
this.getColor().setWhite(true);
Target target = new TargetPermanent(filter);
target.setTargetName("artifact");
target.setRequired(true);
this.getSpellAbility().addTarget(target);
this.getSpellAbility().addEffect(new DestroyTargetEffect());
this.getSpellAbility().addEffect(new DivineOfferingEffect());
this.getSpellAbility().addEffect(new DivineOfferingGainLifeEffect());
}
public DivineOffering (final DivineOffering card) {
public DivineOffering(final DivineOffering card) {
super(card);
}
@ -75,38 +76,40 @@ public class DivineOffering extends CardImpl<DivineOffering> {
public DivineOffering copy() {
return new DivineOffering(this);
}
}
private class DivineOfferingEffect extends OneShotEffect<DivineOfferingEffect> {
class DivineOfferingGainLifeEffect extends OneShotEffect<DivineOfferingGainLifeEffect> {
public DivineOfferingEffect() {
super(Constants.Outcome.DestroyPermanent);
DivineOfferingGainLifeEffect() {
super(Outcome.DestroyPermanent);
}
public DivineOfferingEffect(DivineOfferingEffect effect) {
DivineOfferingGainLifeEffect ( final DivineOfferingGainLifeEffect effect ) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Card card = game.getLastKnownInformation(source.getFirstTarget(), Constants.Zone.BATTLEFIELD);
if (card != null) {
int cost = card.getManaCost().get(0).convertedManaCost();
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
player.gainLife(cost, game);
Card card = player.getGraveyard().get(source.getFirstTarget(), game);
if (card == null) {
card = game.getLastKnownInformation(source.getFirstTarget(), Zone.GRAVEYARD);
}
if (card != null) {
player.gainLife(card.getManaCost().convertedManaCost(), game);
}
}
return true;
}
@Override
public DivineOfferingEffect copy() {
return new DivineOfferingEffect(this);
public String getText(Ability source) {
return "You gain life equal to it's converted mana cost.";
}
@Override
public String getText(Ability source) {
return "You gain life equal to its converted mana cost";
}
public DivineOfferingGainLifeEffect copy() {
return new DivineOfferingGainLifeEffect(this);
}
}

View file

@ -0,0 +1,71 @@
/*
* 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.mirrodinbesieged;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.target.Target;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author Loki
*/
public class GofortheThroat extends CardImpl<GofortheThroat> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
static {
filter.getCardType().add(CardType.ARTIFACT);
filter.setNotCardType(true);
}
public GofortheThroat(UUID ownerId) {
super(ownerId, 43, "Go for the Throat", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{1}{B}");
this.expansionSetCode = "MBS";
this.color.setBlack(true);
Target target = new TargetCreaturePermanent(filter);
target.setTargetName("nonartifact creature");
this.getSpellAbility().addTarget(target);
this.getSpellAbility().addEffect(new DestroyTargetEffect());
}
public GofortheThroat(final GofortheThroat card) {
super(card);
}
@Override
public GofortheThroat copy() {
return new GofortheThroat(this);
}
}

View file

@ -0,0 +1,110 @@
/*
* 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.riseoftheeldrazi;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Mana;
import mage.abilities.effects.common.ManaEffect;
import mage.abilities.mana.BasicManaAbility;
import mage.abilities.mana.ColorlessManaAbility;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.stack.Spell;
import mage.game.stack.SpellStack;
import mage.game.stack.StackObject;
/**
*
* @author Loki
*/
public class EldraziTemple extends CardImpl<EldraziTemple> {
public EldraziTemple(UUID ownerId) {
super(ownerId, 227, "Eldrazi Temple", Rarity.RARE, new CardType[]{ CardType.LAND }, null);
this.expansionSetCode = "ROE";
this.addAbility(new ColorlessManaAbility());
this.addAbility(new EldraziTempleManaAbility());
}
public EldraziTemple(final EldraziTemple card) {
super(card);
}
@Override
public EldraziTemple copy() {
return new EldraziTemple(this);
}
}
class EldraziTempleManaAbility extends BasicManaAbility<EldraziTempleManaAbility> {
private static final String abilityText = "Spend this mana only to cast colorless Eldrazi spells or activate abilities of colorless Eldrazi. "
+ "<b>(Mage Tip: This ability can only be activated when an Eldrazi spell or ability is on the stack.)</b>";
EldraziTempleManaAbility ( ) {
super(new ManaEffect(Mana.ColorlessMana(2)));
this.netMana.setColorless(2);
}
EldraziTempleManaAbility ( EldraziTempleManaAbility ability ) {
super(ability);
}
@Override
public boolean canActivate(UUID playerId, Game game) {
boolean eldraziSpellBeingCast = false;
SpellStack stack = game.getStack();
for ( int idx = 0; idx < stack.size(); idx++ ) {
StackObject stackObject = stack.get(idx);
if ( stackObject.getControllerId().equals(playerId) ) {
eldraziSpellBeingCast |= stackObject.getSubtype().contains("Eldrazi");
}
}
return super.canActivate(playerId, game) && eldraziSpellBeingCast;
}
@Override
public String getRule() {
return super.getRule() + " " + abilityText;
}
@Override
public String getRule(String source) {
return super.getRule(source);
}
@Override
public EldraziTempleManaAbility copy ( ) {
return new EldraziTempleManaAbility(this);
}
}

View file

@ -0,0 +1,114 @@
/*
* 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.worldwake;
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.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
/**
*
* @author Loki
*/
public class AbyssalPersecutor extends CardImpl<AbyssalPersecutor> {
public AbyssalPersecutor(UUID ownerId) {
super(ownerId, 47, "Abyssal Persecutor", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "{2}{B}{B}");
this.expansionSetCode = "WWK";
this.subtype.add("Demon");
this.color.setBlack(true);
this.power = new MageInt(6);
this.toughness = new MageInt(6);
this.addAbility(FlyingAbility.getInstance());
this.addAbility(TrampleAbility.getInstance());
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new AbyssalPersecutorCannotWinEffect()));
}
public AbyssalPersecutor(final AbyssalPersecutor card) {
super(card);
}
@Override
public AbyssalPersecutor copy() {
return new AbyssalPersecutor(this);
}
}
class AbyssalPersecutorCannotWinEffect extends ReplacementEffectImpl<AbyssalPersecutorCannotWinEffect> {
AbyssalPersecutorCannotWinEffect() {
super(Duration.WhileOnBattlefield, Outcome.Detriment);
}
AbyssalPersecutorCannotWinEffect ( final AbyssalPersecutorCannotWinEffect effect ) {
super(effect);
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if ((event.getType() == EventType.LOSES && game.getOpponents(source.getControllerId()).contains(event.getPlayerId()))
|| (event.getType() == EventType.WINS && event.getPlayerId().equals(source.getControllerId()))) {
return true;
}
return false;
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
return true;
}
@Override
public String getText(Ability source) {
return "You can't win the game and your opponents can't lose the game";
}
@Override
public AbyssalPersecutorCannotWinEffect copy() {
return new AbyssalPersecutorCannotWinEffect(this);
}
}

View file

@ -0,0 +1,66 @@
/*
* 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.worldwake;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.effects.common.CounterTargetEffect;
import mage.cards.CardImpl;
import mage.filter.FilterSpell;
import mage.target.TargetSpell;
/**
*
* @author Loki
*/
public class Dispel extends CardImpl<Dispel> {
private static FilterSpell filter = new FilterSpell("instant spell");
static {
filter.getCardType().add(CardType.INSTANT);
}
public Dispel(UUID ownerId) {
super(ownerId, 26, "Dispel", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{U}");
this.expansionSetCode = "WWK";
this.color.setBlue(true);
this.getSpellAbility().addTarget(new TargetSpell(filter));
this.getSpellAbility().addEffect(new CounterTargetEffect());
}
public Dispel(final Dispel card) {
super(card);
}
@Override
public Dispel copy() {
return new Dispel(this);
}
}

View file

@ -0,0 +1,61 @@
/*
* 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.CardType;
import mage.Constants.Duration;
import mage.Constants.Rarity;
import mage.abilities.effects.common.continious.BoostTargetEffect;
import mage.cards.CardImpl;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author Loki
*/
public class Disfigure extends CardImpl<Disfigure> {
public Disfigure(UUID ownerId) {
super(ownerId, 87, "Disfigure", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{B}");
this.expansionSetCode = "ZEN";
this.color.setBlack(true);
this.getSpellAbility().addEffect(new BoostTargetEffect(-2, -2, Duration.EndOfTurn));
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
}
public Disfigure(final Disfigure card) {
super(card);
}
@Override
public Disfigure copy() {
return new Disfigure(this);
}
}

View file

@ -37,12 +37,12 @@ import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
/**
*
@ -98,9 +98,9 @@ class NissasChosenEffect extends ReplacementEffectImpl<NissasChosenEffect> {
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent permanent = game.getPermanent(event.getTargetId());
if ( permanent != null && event.getTargetId().equals(source.getSourceId()) ) {
return permanent.moveToZone(Zone.LIBRARY, source.getId(), game, onTop);
Card card = game.getCard(event.getTargetId());
if ( card != null && event.getTargetId().equals(source.getSourceId()) ) {
return card.moveToZone(Zone.LIBRARY, source.getId(), game, onTop);
}
return false;
}