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.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleTriggeredAbility;
import mage.abilities.effects.common.DrawCardControllerEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.DoubleStrikeAbility;
import mage.abilities.keyword.LifelinkAbility;
import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.events.GameEvent;

View file

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

View file

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

View file

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

View file

@ -25,26 +25,19 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.scarsofmirrodin;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.StateTriggeredAbility;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.PreventionEffectImpl;
import mage.abilities.effects.common.ReturnToHandTargetEffect;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.target.TargetStackObject;
import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.FixedTarget;
/**
*
@ -52,14 +45,16 @@ import mage.target.common.TargetCreaturePermanent;
*/
public class DissipationField extends CardImpl<DissipationField> {
public DissipationField (UUID ownerId) {
public DissipationField(UUID ownerId) {
super(ownerId, 32, "Dissipation Field", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}{U}");
this.expansionSetCode = "SOM";
this.color.setBlue(true);
this.addAbility(new DissipationFieldEffect());
}
this.color.setBlue(true);
public DissipationField (final DissipationField card) {
// Whenever a permanent deals damage to you, return it to its owner's hand.
this.addAbility(new DissipationFieldAbility());
}
public DissipationField(final DissipationField card) {
super(card);
}
@ -67,41 +62,37 @@ public class DissipationField extends CardImpl<DissipationField> {
public DissipationField copy() {
return new DissipationField(this);
}
public class DissipationFieldEffect extends TriggeredAbilityImpl<DissipationFieldEffect> {
public DissipationFieldEffect() {
super(Constants.Zone.BATTLEFIELD, new ReturnToHandTargetEffect());
}
public DissipationFieldEffect(DissipationFieldEffect effect) {
super(effect);
}
@Override
public DissipationFieldEffect copy() {
return new DissipationFieldEffect(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER && event.getTargetId().equals(this.controllerId)) {
Permanent permanent = game.getPermanent(event.getSourceId());
if (permanent != null) {
this.getTargets().clear();
TargetCreaturePermanent target = new TargetCreaturePermanent();
target.add(permanent.getId(), game);
this.addTarget(target);
return true;
}
}
return false;
}
@Override
public String getRule() {
return "Whenever a permanent deals damage to you, return it to its owner's hand.";
}
}
}
class DissipationFieldAbility extends TriggeredAbilityImpl<DissipationFieldAbility> {
public DissipationFieldAbility() {
super(Constants.Zone.BATTLEFIELD, new ReturnToHandTargetEffect());
}
public DissipationFieldAbility(DissipationFieldAbility effect) {
super(effect);
}
@Override
public DissipationFieldAbility copy() {
return new DissipationFieldAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER && event.getTargetId().equals(this.controllerId)) {
Permanent permanent = game.getPermanent(event.getSourceId());
if (permanent != null) {
this.getEffects().get(0).setTargetPointer(new FixedTarget(permanent.getId()));
return true;
}
}
return false;
}
@Override
public String getRule() {
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;
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.costs.mana.ManaCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.game.Game;
@ -46,7 +43,6 @@ import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.FixedTarget;
/**
*
@ -95,7 +91,6 @@ class CradleOfVitalityGainLifeTriggeredAbility extends TriggeredAbilityImpl<Crad
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (event.getType() == EventType.GAINED_LIFE && event.getPlayerId().equals(this.controllerId)) {
this.getEffects().get(0).setValue("amount", event.getAmount());
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())) {
Player player = game.getPlayer(event.getPlayerId());
if (player != null && player.getHand().size() < 3) {
this.getEffects().clear();
DamageTargetEffect effect = new DamageTargetEffect(2);
effect.setTargetPointer(new FixedTarget(player.getId()));
this.addEffect(effect);