This commit is contained in:
North 2012-03-22 22:34:57 +02:00
parent 63e47b795a
commit 7484469ccf
7 changed files with 45 additions and 58 deletions

View file

@ -34,14 +34,11 @@ import mage.Constants.CardType;
import mage.Constants.Rarity; import mage.Constants.Rarity;
import mage.MageInt; import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleTriggeredAbility;
import mage.abilities.effects.common.DrawCardControllerEffect; import mage.abilities.effects.common.DrawCardControllerEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.DoubleStrikeAbility; import mage.abilities.keyword.DoubleStrikeAbility;
import mage.abilities.keyword.LifelinkAbility; import mage.abilities.keyword.LifelinkAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;

View file

@ -87,6 +87,7 @@ class ProperBurialTriggeredAbility extends TriggeredAbilityImpl<ProperBurialTrig
&& ((ZoneChangeEvent) event).getFromZone() == Zone.BATTLEFIELD) { && ((ZoneChangeEvent) event).getFromZone() == Zone.BATTLEFIELD) {
Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD);
if (permanent.getControllerId().equals(this.getControllerId()) && permanent.getCardType().contains(CardType.CREATURE)) { if (permanent.getControllerId().equals(this.getControllerId()) && permanent.getCardType().contains(CardType.CREATURE)) {
this.getEffects().clear();
this.addEffect(new GainLifeEffect(permanent.getToughness().getValue())); this.addEffect(new GainLifeEffect(permanent.getToughness().getValue()));
return true; return true;
} }

View file

@ -88,6 +88,7 @@ class HuntersInsightTriggeredAbility extends TriggeredAbilityImpl<HuntersInsight
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
if ((event.getType() == EventType.DAMAGED_PLAYER || event.getType() == EventType.DAMAGED_PLANESWALKER) if ((event.getType() == EventType.DAMAGED_PLAYER || event.getType() == EventType.DAMAGED_PLANESWALKER)
&& event.getSourceId().equals(this.sourceId) && ((DamagedEvent) event).isCombatDamage()) { && event.getSourceId().equals(this.sourceId) && ((DamagedEvent) event).isCombatDamage()) {
this.getEffects().clear();
this.addEffect(new DrawCardControllerEffect(event.getAmount())); this.addEffect(new DrawCardControllerEffect(event.getAmount()));
return true; return true;
} }

View file

@ -93,6 +93,7 @@ class RapaciousOneTriggeredAbility extends TriggeredAbilityImpl<RapaciousOneTrig
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.DAMAGED_PLAYER && event.getSourceId().equals(this.sourceId) if (event.getType() == EventType.DAMAGED_PLAYER && event.getSourceId().equals(this.sourceId)
&& ((DamagedPlayerEvent) event).isCombatDamage()) { && ((DamagedPlayerEvent) event).isCombatDamage()) {
this.getEffects().clear();
this.addEffect(new CreateTokenEffect(new EldraziSpawnToken(), event.getAmount())); this.addEffect(new CreateTokenEffect(new EldraziSpawnToken(), event.getAmount()));
return true; return true;
} }

View file

@ -25,26 +25,19 @@
* authors and should not be interpreted as representing official policies, either expressed * authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com. * or implied, of BetaSteward_at_googlemail.com.
*/ */
package mage.sets.scarsofmirrodin; package mage.sets.scarsofmirrodin;
import java.util.UUID; import java.util.UUID;
import mage.Constants; import mage.Constants;
import mage.Constants.CardType; import mage.Constants.CardType;
import mage.Constants.Rarity; import mage.Constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.StateTriggeredAbility;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.PreventionEffectImpl;
import mage.abilities.effects.common.ReturnToHandTargetEffect; import mage.abilities.effects.common.ReturnToHandTargetEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.TargetStackObject; import mage.target.targetpointer.FixedTarget;
import mage.target.common.TargetCreaturePermanent;
/** /**
* *
@ -56,7 +49,9 @@ public class DissipationField extends CardImpl<DissipationField> {
super(ownerId, 32, "Dissipation Field", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}{U}"); super(ownerId, 32, "Dissipation Field", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}{U}");
this.expansionSetCode = "SOM"; this.expansionSetCode = "SOM";
this.color.setBlue(true); this.color.setBlue(true);
this.addAbility(new DissipationFieldEffect());
// Whenever a permanent deals damage to you, return it to its owner's hand.
this.addAbility(new DissipationFieldAbility());
} }
public DissipationField(final DissipationField card) { public DissipationField(final DissipationField card) {
@ -67,20 +62,21 @@ public class DissipationField extends CardImpl<DissipationField> {
public DissipationField copy() { public DissipationField copy() {
return new DissipationField(this); return new DissipationField(this);
} }
}
public class DissipationFieldEffect extends TriggeredAbilityImpl<DissipationFieldEffect> { class DissipationFieldAbility extends TriggeredAbilityImpl<DissipationFieldAbility> {
public DissipationFieldEffect() { public DissipationFieldAbility() {
super(Constants.Zone.BATTLEFIELD, new ReturnToHandTargetEffect()); super(Constants.Zone.BATTLEFIELD, new ReturnToHandTargetEffect());
} }
public DissipationFieldEffect(DissipationFieldEffect effect) { public DissipationFieldAbility(DissipationFieldAbility effect) {
super(effect); super(effect);
} }
@Override @Override
public DissipationFieldEffect copy() { public DissipationFieldAbility copy() {
return new DissipationFieldEffect(this); return new DissipationFieldAbility(this);
} }
@Override @Override
@ -88,10 +84,7 @@ public class DissipationField extends CardImpl<DissipationField> {
if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER && event.getTargetId().equals(this.controllerId)) { if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER && event.getTargetId().equals(this.controllerId)) {
Permanent permanent = game.getPermanent(event.getSourceId()); Permanent permanent = game.getPermanent(event.getSourceId());
if (permanent != null) { if (permanent != null) {
this.getTargets().clear(); this.getEffects().get(0).setTargetPointer(new FixedTarget(permanent.getId()));
TargetCreaturePermanent target = new TargetCreaturePermanent();
target.add(permanent.getId(), game);
this.addTarget(target);
return true; return true;
} }
} }
@ -103,5 +96,3 @@ public class DissipationField extends CardImpl<DissipationField> {
return "Whenever a permanent deals damage to you, return it to its owner's hand."; return "Whenever a permanent deals damage to you, return it to its owner's hand.";
} }
} }
}

View file

@ -28,17 +28,14 @@
package mage.sets.shardsofalara; package mage.sets.shardsofalara;
import java.util.UUID; import java.util.UUID;
import mage.Constants.CardType; import mage.Constants.CardType;
import mage.Constants.Outcome; import mage.Constants.Outcome;
import mage.Constants.Rarity; import mage.Constants.Rarity;
import mage.Constants.Zone; import mage.Constants.Zone;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.costs.mana.ManaCost;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.game.Game; import mage.game.Game;
@ -46,7 +43,6 @@ import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType; import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.FixedTarget;
/** /**
* *
@ -95,7 +91,6 @@ class CradleOfVitalityGainLifeTriggeredAbility extends TriggeredAbilityImpl<Crad
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (event.getType() == EventType.GAINED_LIFE && event.getPlayerId().equals(this.controllerId)) { if (event.getType() == EventType.GAINED_LIFE && event.getPlayerId().equals(this.controllerId)) {
this.getEffects().get(0).setValue("amount", event.getAmount()); this.getEffects().get(0).setValue("amount", event.getAmount());
return true; return true;

View file

@ -90,6 +90,7 @@ class HellfireMongrelTriggeredAbility extends TriggeredAbilityImpl<HellfireMongr
if (event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE && game.getOpponents(controllerId).contains(event.getPlayerId())) { if (event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE && game.getOpponents(controllerId).contains(event.getPlayerId())) {
Player player = game.getPlayer(event.getPlayerId()); Player player = game.getPlayer(event.getPlayerId());
if (player != null && player.getHand().size() < 3) { if (player != null && player.getHand().size() < 3) {
this.getEffects().clear();
DamageTargetEffect effect = new DamageTargetEffect(2); DamageTargetEffect effect = new DamageTargetEffect(2);
effect.setTargetPointer(new FixedTarget(player.getId())); effect.setTargetPointer(new FixedTarget(player.getId()));
this.addEffect(effect); this.addEffect(effect);