This commit is contained in:
magenoxx 2011-05-16 22:04:23 +04:00
commit 6517a6da09
4 changed files with 81 additions and 73 deletions

View file

@ -31,14 +31,11 @@ package mage.sets.alarareborn;
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.common.DrawCardTriggeredAbility;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.events.GameEvent;
/**
*
@ -50,11 +47,13 @@ public class LorescaleCoatl extends CardImpl<LorescaleCoatl> {
super(ownerId, 101, "Lorescale Coatl", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{G}{U}");
this.expansionSetCode = "ARB";
this.subtype.add("Snake");
this.color.setGreen(true);
this.color.setBlue(true);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
this.addAbility(new LorescaleCoatlAbility());
this.addAbility(new DrawCardTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), true));
}
public LorescaleCoatl (final LorescaleCoatl card) {
@ -65,32 +64,4 @@ public class LorescaleCoatl extends CardImpl<LorescaleCoatl> {
public LorescaleCoatl copy() {
return new LorescaleCoatl(this);
}
}
class LorescaleCoatlAbility extends TriggeredAbilityImpl<LorescaleCoatlAbility> {
public LorescaleCoatlAbility() {
super(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance()), true);
}
public LorescaleCoatlAbility(final LorescaleCoatlAbility ability) {
super(ability);
}
@Override
public LorescaleCoatlAbility copy() {
return new LorescaleCoatlAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.DREW_CARD && event.getPlayerId().equals(controllerId)) {
return true;
}
return false;
}
@Override
public String getRule() {
return "Whenever you draw a card, you may put a +1/+1 counter on Lorescale Coatl.";
}
}

View file

@ -31,14 +31,9 @@ package mage.sets.magic2011;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.DrawCardTriggeredAbility;
import mage.abilities.effects.common.PutLibraryIntoGraveTargetEffect;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.target.TargetPlayer;
/**
@ -51,7 +46,10 @@ public class JacesErasure extends CardImpl<JacesErasure> {
super(ownerId, 59, "Jace's Erasure", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}");
this.expansionSetCode = "M11";
this.color.setBlue(true);
this.addAbility(new JacesErasureAbility());
DrawCardTriggeredAbility ability = new DrawCardTriggeredAbility(new PutLibraryIntoGraveTargetEffect(1), true);
ability.addTarget(new TargetPlayer());
this.addAbility(ability);
}
public JacesErasure(final JacesErasure card) {
@ -67,36 +65,4 @@ public class JacesErasure extends CardImpl<JacesErasure> {
public String getArt() {
return "125788_typ_reg_sty_010.jpg";
}
}
class JacesErasureAbility extends TriggeredAbilityImpl<JacesErasureAbility> {
public JacesErasureAbility() {
super(Zone.BATTLEFIELD, new PutLibraryIntoGraveTargetEffect(1), true);
this.addTarget(new TargetPlayer());
}
public JacesErasureAbility(final JacesErasureAbility ability) {
super(ability);
}
@Override
public JacesErasureAbility copy() {
return new JacesErasureAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.DREW_CARD && event.getPlayerId().equals(controllerId)) {
return true;
}
return false;
}
@Override
public String getRule() {
return "Whenever you draw a card, you may have target player put the top card of his or her library into his or her graveyard.";
}
}
}

View file

@ -98,4 +98,8 @@ public abstract class TriggeredAbilityImpl<T extends TriggeredAbilityImpl<T>> ex
return false;
}
@Override
public String getRule() {
return (optional ? "you may " : "") + super.getRule();
}
}

View file

@ -0,0 +1,67 @@
/*
* 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.Constants.Zone;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.game.Game;
import mage.game.events.GameEvent;
/**
*
* @author North
*/
public class DrawCardTriggeredAbility extends TriggeredAbilityImpl<DrawCardTriggeredAbility> {
public DrawCardTriggeredAbility(Effect effect, boolean optional) {
super(Zone.BATTLEFIELD, effect, optional);
}
public DrawCardTriggeredAbility(final DrawCardTriggeredAbility ability) {
super(ability);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.DREW_CARD && event.getPlayerId().equals(controllerId)) {
return true;
}
return false;
}
@Override
public String getRule() {
return "Whenever you draw a card, " + super.getRule();
}
@Override
public DrawCardTriggeredAbility copy() {
return new DrawCardTriggeredAbility(this);
}
}