mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Added DrawCardOpponentTriggeredAbility.
This commit is contained in:
parent
b97049d0a7
commit
fac51c9e75
11 changed files with 107 additions and 90 deletions
|
@ -32,7 +32,7 @@ import java.util.UUID;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.DrawCardTriggeredAbility;
|
||||
import mage.abilities.common.DrawCardControllerTriggeredAbility;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.counters.CounterType;
|
||||
|
@ -53,7 +53,7 @@ public class LorescaleCoatl extends CardImpl<LorescaleCoatl> {
|
|||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(2);
|
||||
|
||||
this.addAbility(new DrawCardTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), true));
|
||||
this.addAbility(new DrawCardControllerTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), true));
|
||||
}
|
||||
|
||||
public LorescaleCoatl (final LorescaleCoatl card) {
|
||||
|
|
|
@ -33,7 +33,7 @@ import mage.constants.CardType;
|
|||
import mage.constants.Rarity;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.DrawCardTriggeredAbility;
|
||||
import mage.abilities.common.DrawCardControllerTriggeredAbility;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
|
@ -60,7 +60,7 @@ public class NivMizzetTheFiremind extends CardImpl<NivMizzetTheFiremind> {
|
|||
this.power = new MageInt(4);
|
||||
this.toughness = new MageInt(4);
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
Ability ability = new DrawCardTriggeredAbility(new DamageTargetEffect(1), false);
|
||||
Ability ability = new DrawCardControllerTriggeredAbility(new DamageTargetEffect(1), false);
|
||||
ability.addTarget(new TargetCreatureOrPlayer());
|
||||
this.addAbility(ability);
|
||||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawCardControllerEffect(1), new TapSourceCost()));
|
||||
|
|
|
@ -31,7 +31,7 @@ import mage.constants.CardType;
|
|||
import mage.constants.Rarity;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.DrawCardTriggeredAbility;
|
||||
import mage.abilities.common.DrawCardControllerTriggeredAbility;
|
||||
import mage.abilities.costs.common.RemoveCountersSourceCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
|
@ -58,7 +58,7 @@ public class HoofprintsOfTheStag extends CardImpl<HoofprintsOfTheStag> {
|
|||
this.supertype.add("Tribal");
|
||||
this.subtype.add("Elemental");
|
||||
this.color.setWhite(true);
|
||||
this.addAbility(new DrawCardTriggeredAbility(new AddCountersSourceEffect(CounterType.HOOFPRINT.createInstance(1)), true));
|
||||
this.addAbility(new DrawCardControllerTriggeredAbility(new AddCountersSourceEffect(CounterType.HOOFPRINT.createInstance(1)), true));
|
||||
Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, new CreateTokenEffect(new WhiteElementalToken(), 1), new ManaCostsImpl("{2}{W}"), MyTurnCondition.getInstance());
|
||||
ability.addCost(new RemoveCountersSourceCost(CounterType.HOOFPRINT.createInstance(4)));
|
||||
this.addAbility(ability);
|
||||
|
|
|
@ -28,12 +28,13 @@
|
|||
package mage.sets.magic2010;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.DrawCardOpponentTriggeredAbility;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
@ -51,7 +52,7 @@ public class UnderworldDreams extends CardImpl<UnderworldDreams> {
|
|||
this.color.setBlack(true);
|
||||
|
||||
// Whenever an opponent draws a card, Underworld Dreams deals 1 damage to him or her.
|
||||
this.addAbility(new UnderworldDreamsTriggeredAbility());
|
||||
this.addAbility(new DrawCardOpponentTriggeredAbility(new DamageTargetEffect(1, true, "him or her"), false, true));
|
||||
}
|
||||
|
||||
public UnderworldDreams(final UnderworldDreams card) {
|
||||
|
@ -63,33 +64,3 @@ public class UnderworldDreams extends CardImpl<UnderworldDreams> {
|
|||
return new UnderworldDreams(this);
|
||||
}
|
||||
}
|
||||
|
||||
class UnderworldDreamsTriggeredAbility extends TriggeredAbilityImpl<UnderworldDreamsTriggeredAbility> {
|
||||
|
||||
UnderworldDreamsTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new DamageTargetEffect(1), false);
|
||||
}
|
||||
|
||||
UnderworldDreamsTriggeredAbility(final UnderworldDreamsTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UnderworldDreamsTriggeredAbility copy() {
|
||||
return new UnderworldDreamsTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.DREW_CARD && game.getOpponents(this.getControllerId()).contains(event.getPlayerId())) {
|
||||
getEffects().get(0).setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever an opponent draws a card, {this} deals 1 damage to him or her";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ package mage.sets.magic2011;
|
|||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.abilities.common.DrawCardTriggeredAbility;
|
||||
import mage.abilities.common.DrawCardControllerTriggeredAbility;
|
||||
import mage.abilities.effects.common.PutLibraryIntoGraveTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.target.TargetPlayer;
|
||||
|
@ -47,7 +47,7 @@ public class JacesErasure extends CardImpl<JacesErasure> {
|
|||
this.expansionSetCode = "M11";
|
||||
this.color.setBlue(true);
|
||||
|
||||
DrawCardTriggeredAbility ability = new DrawCardTriggeredAbility(new PutLibraryIntoGraveTargetEffect(1), true);
|
||||
DrawCardControllerTriggeredAbility ability = new DrawCardControllerTriggeredAbility(new PutLibraryIntoGraveTargetEffect(1), true);
|
||||
ability.addTarget(new TargetPlayer());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
|
|
@ -28,17 +28,13 @@
|
|||
package mage.sets.mirrodin;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.DrawCardOpponentTriggeredAbility;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.effects.common.DoIfCostPaid;
|
||||
import mage.abilities.effects.common.DrawCardControllerEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -51,7 +47,7 @@ public class MindsEye extends CardImpl<MindsEye> {
|
|||
this.expansionSetCode = "MRD";
|
||||
|
||||
// Whenever an opponent draws a card, you may pay {1}. If you do, draw a card.
|
||||
this.addAbility(new MindsEyeTriggeredAbility());
|
||||
this.addAbility(new DrawCardOpponentTriggeredAbility(new DoIfCostPaid(new DrawCardControllerEffect(1), new GenericManaCost(1)), false, false));
|
||||
}
|
||||
|
||||
public MindsEye(final MindsEye card) {
|
||||
|
@ -63,32 +59,3 @@ public class MindsEye extends CardImpl<MindsEye> {
|
|||
return new MindsEye(this);
|
||||
}
|
||||
}
|
||||
|
||||
class MindsEyeTriggeredAbility extends TriggeredAbilityImpl<MindsEyeTriggeredAbility> {
|
||||
|
||||
MindsEyeTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new DoIfCostPaid(new DrawCardControllerEffect(1), new GenericManaCost(1)), false);
|
||||
}
|
||||
|
||||
MindsEyeTriggeredAbility(final MindsEyeTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MindsEyeTriggeredAbility copy() {
|
||||
return new MindsEyeTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.DREW_CARD && game.getOpponents(this.getControllerId()).contains(event.getPlayerId())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever an opponent draws a card, you may pay {1}. If you do, draw a card.";
|
||||
}
|
||||
}
|
|
@ -36,7 +36,7 @@ import mage.constants.Rarity;
|
|||
import mage.constants.Zone;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.DrawCardTriggeredAbility;
|
||||
import mage.abilities.common.DrawCardControllerTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.dynamicvalue.common.CardsInControllerHandCount;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
@ -61,7 +61,7 @@ public class PsychosisCrawler extends CardImpl<PsychosisCrawler> {
|
|||
this.toughness = new MageInt(0);
|
||||
|
||||
this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetPowerToughnessSourceEffect(new CardsInControllerHandCount(), Duration.EndOfGame)));
|
||||
this.addAbility(new DrawCardTriggeredAbility(new LoseLifeOpponentsEffect(), false));
|
||||
this.addAbility(new DrawCardControllerTriggeredAbility(new LoseLifeOpponentsEffect(), false));
|
||||
}
|
||||
|
||||
public PsychosisCrawler(final PsychosisCrawler card) {
|
||||
|
|
|
@ -35,7 +35,7 @@ import mage.constants.Outcome;
|
|||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.DrawCardTriggeredAbility;
|
||||
import mage.abilities.common.DrawCardControllerTriggeredAbility;
|
||||
import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
|
@ -72,7 +72,7 @@ public class DivinersWand extends CardImpl<DivinersWand> {
|
|||
this.subtype.add("Equipment");
|
||||
|
||||
// Equipped creature has "Whenever you draw a card, this creature gets +1/+1 and gains flying until end of turn" and "{4}: Draw a card."
|
||||
Ability gainedAbility = new DrawCardTriggeredAbility(new BoostSourceEffect(1,1, Duration.EndOfTurn), false);
|
||||
Ability gainedAbility = new DrawCardControllerTriggeredAbility(new BoostSourceEffect(1,1, Duration.EndOfTurn), false);
|
||||
gainedAbility.addEffect(new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.EndOfTurn));
|
||||
Effect effect = new GainAbilityAttachedEffect(gainedAbility, AttachmentType.EQUIPMENT);
|
||||
effect.setText("Equipped creature has \"Whenever you draw a card, this creature gets +1/+1 and gains flying until end of turn\"");
|
||||
|
|
|
@ -29,7 +29,7 @@ package mage.sets.theros;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.DrawCardTriggeredAbility;
|
||||
import mage.abilities.common.DrawCardControllerTriggeredAbility;
|
||||
import mage.abilities.effects.common.GainLifeEffect;
|
||||
import mage.abilities.keyword.FlashAbility;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
|
@ -61,7 +61,7 @@ public class HorizonChimera extends CardImpl<HorizonChimera> {
|
|||
// Trample
|
||||
this.addAbility(TrampleAbility.getInstance());
|
||||
// Whenever you draw a card, you gain 1 life.
|
||||
this.addAbility(new DrawCardTriggeredAbility(new GainLifeEffect(1), false));
|
||||
this.addAbility(new DrawCardControllerTriggeredAbility(new GainLifeEffect(1), false));
|
||||
}
|
||||
|
||||
public HorizonChimera(final HorizonChimera card) {
|
||||
|
|
|
@ -37,13 +37,13 @@ import mage.game.events.GameEvent;
|
|||
*
|
||||
* @author North
|
||||
*/
|
||||
public class DrawCardTriggeredAbility extends TriggeredAbilityImpl<DrawCardTriggeredAbility> {
|
||||
public class DrawCardControllerTriggeredAbility extends TriggeredAbilityImpl<DrawCardControllerTriggeredAbility> {
|
||||
|
||||
public DrawCardTriggeredAbility(Effect effect, boolean optional) {
|
||||
public DrawCardControllerTriggeredAbility(Effect effect, boolean optional) {
|
||||
super(Zone.BATTLEFIELD, effect, optional);
|
||||
}
|
||||
|
||||
public DrawCardTriggeredAbility(final DrawCardTriggeredAbility ability) {
|
||||
public DrawCardControllerTriggeredAbility(final DrawCardControllerTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ public class DrawCardTriggeredAbility extends TriggeredAbilityImpl<DrawCardTrig
|
|||
}
|
||||
|
||||
@Override
|
||||
public DrawCardTriggeredAbility copy() {
|
||||
return new DrawCardTriggeredAbility(this);
|
||||
public DrawCardControllerTriggeredAbility copy() {
|
||||
return new DrawCardControllerTriggeredAbility(this);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* 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.abilities.common;
|
||||
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
||||
public class DrawCardOpponentTriggeredAbility extends TriggeredAbilityImpl<DrawCardOpponentTriggeredAbility> {
|
||||
|
||||
boolean setTargetPointer;
|
||||
|
||||
public DrawCardOpponentTriggeredAbility(Effect effect, boolean optional, boolean setTargetPointer) {
|
||||
super(Zone.BATTLEFIELD, effect, optional);
|
||||
this.setTargetPointer = setTargetPointer;
|
||||
}
|
||||
|
||||
public DrawCardOpponentTriggeredAbility(final DrawCardOpponentTriggeredAbility ability) {
|
||||
super(ability);
|
||||
this.setTargetPointer = ability.setTargetPointer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DrawCardOpponentTriggeredAbility copy() {
|
||||
return new DrawCardOpponentTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.DREW_CARD && game.getOpponents(this.getControllerId()).contains(event.getPlayerId())) {
|
||||
if (setTargetPointer) {
|
||||
for (Effect effect:this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return new StringBuilder("Whenever an opponent draws a card, ").append(super.getRule()).toString();
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue