[M10] Capricious Efreet; Coat of Arms; Guardian Seraph; Panic Attack

[SOK] Michiko Konda, Truth Seeker
[ARB] Retaliator Griffin
[MRD] Farsight Mask
This commit is contained in:
North 2012-01-01 22:50:11 +02:00
parent 9aeacd5cde
commit 97b1b7fde4
8 changed files with 885 additions and 0 deletions

View file

@ -0,0 +1,146 @@
/*
* 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.alarareborn;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.game.stack.StackObject;
/**
*
* @author North
*/
public class RetaliatorGriffin extends CardImpl<RetaliatorGriffin> {
public RetaliatorGriffin(UUID ownerId) {
super(ownerId, 123, "Retaliator Griffin", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{1}{R}{G}{W}");
this.expansionSetCode = "ARB";
this.subtype.add("Griffin");
this.color.setRed(true);
this.color.setGreen(true);
this.color.setWhite(true);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
this.addAbility(FlyingAbility.getInstance());
// Whenever a source an opponent controls deals damage to you, you may put that many +1/+1 counters on Retaliator Griffin.
this.addAbility(new RetaliatorGriffinTriggeredAbility());
}
public RetaliatorGriffin(final RetaliatorGriffin card) {
super(card);
}
@Override
public RetaliatorGriffin copy() {
return new RetaliatorGriffin(this);
}
}
class RetaliatorGriffinTriggeredAbility extends TriggeredAbilityImpl<RetaliatorGriffinTriggeredAbility> {
public RetaliatorGriffinTriggeredAbility() {
super(Zone.BATTLEFIELD, new RetaliatorGriffinEffect(), false);
}
public RetaliatorGriffinTriggeredAbility(final RetaliatorGriffinTriggeredAbility ability) {
super(ability);
}
@Override
public RetaliatorGriffinTriggeredAbility copy() {
return new RetaliatorGriffinTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType().equals(GameEvent.EventType.DAMAGED_PLAYER)) {
UUID sourceControllerId = null;
Permanent permanent = game.getPermanent(event.getSourceId());
if (permanent != null) {
sourceControllerId = permanent.getControllerId();
} else {
StackObject sourceStackObject = game.getStack().getStackObject(event.getSourceId());
if (sourceStackObject != null) {
sourceControllerId = sourceStackObject.getControllerId();
}
}
if (event.getTargetId().equals(controllerId) && game.getOpponents(controllerId).contains(sourceControllerId)) {
getEffects().get(0).setValue("RetaliatorGriffinAmount", event.getAmount());
return true;
}
}
return false;
}
@Override
public String getRule() {
return "Whenever a source an opponent controls deals damage to you, you may put that many +1/+1 counters on {this}.";
}
}
class RetaliatorGriffinEffect extends OneShotEffect<RetaliatorGriffinEffect> {
public RetaliatorGriffinEffect() {
super(Outcome.BoostCreature);
}
public RetaliatorGriffinEffect(final RetaliatorGriffinEffect effect) {
super(effect);
}
@Override
public RetaliatorGriffinEffect copy() {
return new RetaliatorGriffinEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getSourceId());
Integer amount = (Integer) this.getValue("RetaliatorGriffinAmount");
if (permanent != null && amount != null) {
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
return true;
}
return false;
}
}

View file

@ -0,0 +1,125 @@
/*
* 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.magic2010;
import java.util.ArrayList;
import java.util.Random;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.TargetController;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterNonlandPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
/**
*
* @author North
*/
public class CapriciousEfreet extends CardImpl<CapriciousEfreet> {
private static final FilterNonlandPermanent filterControlled = new FilterNonlandPermanent("nonland permanent you control");
private static final FilterNonlandPermanent filterNotControlled = new FilterNonlandPermanent("nonland permanent you don't control");
static {
filterControlled.setTargetController(TargetController.YOU);
filterNotControlled.setTargetController(TargetController.NOT_YOU);
}
public CapriciousEfreet(UUID ownerId) {
super(ownerId, 131, "Capricious Efreet", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{4}{R}{R}");
this.expansionSetCode = "M10";
this.subtype.add("Efreet");
this.color.setRed(true);
this.power = new MageInt(6);
this.toughness = new MageInt(4);
// At the beginning of your upkeep, choose target nonland permanent you control and up to two target nonland permanents you don't control. Destroy one of them at random.
Ability ability = new BeginningOfUpkeepTriggeredAbility(new CapriciousEfreetEffect(), TargetController.YOU, false);
ability.addTarget(new TargetPermanent(filterControlled));
ability.addTarget(new TargetPermanent(0, 2, filterNotControlled, false));
this.addAbility(ability);
}
public CapriciousEfreet(final CapriciousEfreet card) {
super(card);
}
@Override
public CapriciousEfreet copy() {
return new CapriciousEfreet(this);
}
}
class CapriciousEfreetEffect extends OneShotEffect<CapriciousEfreetEffect> {
public CapriciousEfreetEffect() {
super(Outcome.DestroyPermanent);
this.staticText = "choose target nonland permanent you control and up to two target nonland permanents you don't control. Destroy one of them at random";
}
public CapriciousEfreetEffect(final CapriciousEfreetEffect effect) {
super(effect);
}
@Override
public CapriciousEfreetEffect copy() {
return new CapriciousEfreetEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
ArrayList<Permanent> targetPermanents = new ArrayList<Permanent>();
Permanent permanent = game.getPermanent(source.getTargets().get(0).getFirstTarget());
if (permanent != null) {
targetPermanents.add(permanent);
}
for (UUID targetID : source.getTargets().get(1).getTargets()) {
permanent = game.getPermanent(targetID);
if (permanent != null) {
targetPermanents.add(permanent);
}
}
if (!targetPermanents.isEmpty()) {
Random random = new Random();
permanent = targetPermanents.get(random.nextInt(targetPermanents.size()));
permanent.destroy(source.getId(), game, false);
return true;
}
return false;
}
}

View file

@ -0,0 +1,128 @@
/*
* 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.magic2010;
import java.util.List;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Layer;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.SubLayer;
import mage.Constants.Zone;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author North
*/
public class CoatOfArms extends CardImpl<CoatOfArms> {
public CoatOfArms(UUID ownerId) {
super(ownerId, 207, "Coat of Arms", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{5}");
this.expansionSetCode = "M10";
// Each creature gets +1/+1 for each other creature on the battlefield that shares at least one creature type with it.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CoatOfArmsEffect()));
}
public CoatOfArms(final CoatOfArms card) {
super(card);
}
@Override
public CoatOfArms copy() {
return new CoatOfArms(this);
}
}
class CoatOfArmsEffect extends ContinuousEffectImpl<CoatOfArmsEffect> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
public CoatOfArmsEffect() {
super(Duration.WhileOnBattlefield, Layer.PTChangingEffects_7, SubLayer.ModifyPT_7c, Outcome.BoostCreature);
this.staticText = "Each creature gets +1/+1 for each other creature on the battlefield that shares at least one creature type with it";
}
public CoatOfArmsEffect(final CoatOfArmsEffect effect) {
super(effect);
}
@Override
public CoatOfArmsEffect copy() {
return new CoatOfArmsEffect(this);
}
@Override
public void init(Ability source, Game game) {
super.init(source, game);
if (this.affectedObjectsSet) {
List<Permanent> permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game);
for (Permanent permanent : permanents) {
objects.add(permanent.getId());
}
}
}
@Override
public boolean apply(Game game, Ability source) {
List<Permanent> permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game);
for (Permanent permanent : permanents) {
if (!this.affectedObjectsSet || objects.contains(permanent.getId())) {
int amount = getAmount(permanents, permanent);
permanent.addPower(amount);
permanent.addToughness(amount);
}
}
return true;
}
private int getAmount(List<Permanent> permanents, Permanent target) {
int amount = 0;
List<String> targetSubtype = target.getSubtype();
for (Permanent permanent : permanents) {
if (!permanent.getId().equals(target.getId())) {
for (String subtype : targetSubtype) {
if (permanent.hasSubtype(subtype)) {
amount++;
break;
}
}
}
}
return amount;
}
}

View file

@ -0,0 +1,130 @@
/*
* 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.magic2010;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.PreventionEffectImpl;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.game.stack.StackObject;
/**
*
* @author North
*/
public class GuardianSeraph extends CardImpl<GuardianSeraph> {
public GuardianSeraph(UUID ownerId) {
super(ownerId, 13, "Guardian Seraph", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{W}{W}");
this.expansionSetCode = "M10";
this.subtype.add("Angel");
this.color.setWhite(true);
this.power = new MageInt(3);
this.toughness = new MageInt(4);
this.addAbility(FlyingAbility.getInstance());
// If a source an opponent controls would deal damage to you, prevent 1 of that damage.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GuardianSeraphEffect()));
}
public GuardianSeraph(final GuardianSeraph card) {
super(card);
}
@Override
public GuardianSeraph copy() {
return new GuardianSeraph(this);
}
}
class GuardianSeraphEffect extends PreventionEffectImpl<GuardianSeraphEffect> {
public GuardianSeraphEffect() {
super(Duration.WhileOnBattlefield);
this.staticText = "If a source an opponent controls would deal damage to you, prevent 1 of that damage";
}
public GuardianSeraphEffect(GuardianSeraphEffect effect) {
super(effect);
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
GameEvent preventEvent = new GameEvent(GameEvent.EventType.PREVENT_DAMAGE, source.getFirstTarget(), source.getId(), source.getControllerId(), 1, false);
if (!game.replaceEvent(preventEvent)) {
int damage = event.getAmount();
if (damage > 0) {
event.setAmount(damage - 1);
game.informPlayers("1 damage has been prevented.");
}
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, source.getFirstTarget(), source.getId(), source.getControllerId(), 1));
}
return false;
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType().equals(GameEvent.EventType.DAMAGE_PLAYER)) {
UUID sourceControllerId = null;
Permanent permanent = game.getPermanent(event.getSourceId());
if (permanent != null) {
sourceControllerId = permanent.getControllerId();
} else {
StackObject sourceStackObject = game.getStack().getStackObject(event.getSourceId());
if (sourceStackObject != null) {
sourceControllerId = sourceStackObject.getControllerId();
}
}
if (event.getTargetId().equals(source.getControllerId()) && game.getOpponents(source.getControllerId()).contains(sourceControllerId)) {
return super.applies(event, source, game);
}
}
return false;
}
@Override
public GuardianSeraphEffect copy() {
return new GuardianSeraphEffect(this);
}
}

View file

@ -0,0 +1,64 @@
/*
* 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.magic2010;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Rarity;
import mage.abilities.common.CantBlockAbility;
import mage.abilities.effects.common.continious.GainAbilityTargetEffect;
import mage.cards.CardImpl;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author North
*/
public class PanicAttack extends CardImpl<PanicAttack> {
public PanicAttack(UUID ownerId) {
super(ownerId, 150, "Panic Attack", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{2}{R}");
this.expansionSetCode = "M10";
this.color.setRed(true);
// Up to three target creatures can't block this turn.
this.getSpellAbility().addEffect(new GainAbilityTargetEffect(CantBlockAbility.getInstance(), Duration.EndOfTurn));
this.getSpellAbility().addTarget(new TargetCreaturePermanent(1, 3));
}
public PanicAttack(final PanicAttack card) {
super(card);
}
@Override
public PanicAttack copy() {
return new PanicAttack(this);
}
}

View file

@ -0,0 +1,124 @@
/*
* 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.mirrodin;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.condition.Condition;
import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.effects.common.DrawCardControllerEffect;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.game.stack.StackObject;
import mage.players.Player;
/**
*
* @author North
*/
public class FarsightMask extends CardImpl<FarsightMask> {
public FarsightMask(UUID ownerId) {
super(ownerId, 170, "Farsight Mask", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{5}");
this.expansionSetCode = "MRD";
// Whenever a source an opponent controls deals damage to you, if Farsight Mask is untapped, you may draw a card.
this.addAbility(new FarsightMaskTriggeredAbility());
}
public FarsightMask(final FarsightMask card) {
super(card);
}
@Override
public FarsightMask copy() {
return new FarsightMask(this);
}
}
class FarsightMaskTriggeredAbility extends TriggeredAbilityImpl<FarsightMaskTriggeredAbility> {
public FarsightMaskTriggeredAbility() {
super(Zone.BATTLEFIELD, new ConditionalOneShotEffect(new DrawCardControllerEffect(1), new FarsightMaskCondition(), ""), false);
}
public FarsightMaskTriggeredAbility(final FarsightMaskTriggeredAbility ability) {
super(ability);
}
@Override
public FarsightMaskTriggeredAbility copy() {
return new FarsightMaskTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType().equals(GameEvent.EventType.DAMAGED_PLAYER)) {
UUID sourceControllerId = null;
Permanent permanent = game.getPermanent(event.getSourceId());
if (permanent != null) {
sourceControllerId = permanent.getControllerId();
} else {
StackObject sourceStackObject = game.getStack().getStackObject(event.getSourceId());
if (sourceStackObject != null) {
sourceControllerId = sourceStackObject.getControllerId();
}
}
if (event.getTargetId().equals(controllerId) && game.getOpponents(controllerId).contains(sourceControllerId)) {
return true;
}
}
return false;
}
@Override
public String getRule() {
return "Whenever a source an opponent controls deals damage to you, if Farsight Mask is untapped, you may draw a card.";
}
}
class FarsightMaskCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getSourceId());
Player player = game.getPlayer(source.getControllerId());
if (permanent != null && !permanent.isTapped()
&& player != null && player.chooseUse(Outcome.DrawCard, "Do you wish to draw a card?", game)) {
return true;
}
return false;
}
}

View file

@ -0,0 +1,116 @@
/*
* 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.saviorsofkamigawa;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.SacrificeEffect;
import mage.cards.CardImpl;
import mage.filter.FilterPermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.game.stack.StackObject;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author North
*/
public class MichikoKondaTruthSeeker extends CardImpl<MichikoKondaTruthSeeker> {
public MichikoKondaTruthSeeker(UUID ownerId) {
super(ownerId, 19, "Michiko Konda, Truth Seeker", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{W}");
this.expansionSetCode = "SOK";
this.supertype.add("Legendary");
this.subtype.add("Human");
this.subtype.add("Advisor");
this.color.setWhite(true);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Whenever a source an opponent controls deals damage to you, that player sacrifices a permanent.
this.addAbility(new MichikoKondaTruthSeekerAbility());
}
public MichikoKondaTruthSeeker(final MichikoKondaTruthSeeker card) {
super(card);
}
@Override
public MichikoKondaTruthSeeker copy() {
return new MichikoKondaTruthSeeker(this);
}
}
class MichikoKondaTruthSeekerAbility extends TriggeredAbilityImpl<MichikoKondaTruthSeekerAbility> {
public MichikoKondaTruthSeekerAbility() {
super(Zone.BATTLEFIELD, new SacrificeEffect(new FilterPermanent(), 1, "that player"), false);
}
public MichikoKondaTruthSeekerAbility(final MichikoKondaTruthSeekerAbility ability) {
super(ability);
}
@Override
public MichikoKondaTruthSeekerAbility copy() {
return new MichikoKondaTruthSeekerAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType().equals(GameEvent.EventType.DAMAGED_PLAYER)) {
UUID sourceControllerId = null;
Permanent permanent = game.getPermanent(event.getSourceId());
if (permanent != null) {
sourceControllerId = permanent.getControllerId();
} else {
StackObject sourceStackObject = game.getStack().getStackObject(event.getSourceId());
if (sourceStackObject != null) {
sourceControllerId = sourceStackObject.getControllerId();
}
}
if (event.getTargetId().equals(controllerId) && game.getOpponents(controllerId).contains(sourceControllerId)) {
getEffects().get(0).setTargetPointer(new FixedTarget(sourceControllerId));
return true;
}
}
return false;
}
@Override
public String getRule() {
return "Whenever a source an opponent controls deals damage to you, that player sacrifices a permanent.";
}
}

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.tenth;
import java.util.UUID;
/**
*
* @author North
*/
public class CoatOfArms extends mage.sets.magic2010.CoatOfArms {
public CoatOfArms(UUID ownerId) {
super(ownerId);
this.cardNumber = 316;
this.expansionSetCode = "10E";
}
public CoatOfArms(final CoatOfArms card) {
super(card);
}
@Override
public CoatOfArms copy() {
return new CoatOfArms(this);
}
}