mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
Merge origin/master
This commit is contained in:
commit
7b5b4928a4
86 changed files with 844 additions and 1047 deletions
|
@ -83,9 +83,13 @@ class AliFromCairoReplacementEffect extends ReplacementEffectImpl {
|
||||||
return new AliFromCairoReplacementEffect(this);
|
return new AliFromCairoReplacementEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == GameEvent.EventType.DAMAGE_CAUSES_LIFE_LOSS;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType().equals(GameEvent.EventType.DAMAGE_CAUSES_LIFE_LOSS)) {
|
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
@ -93,25 +97,22 @@ class AliFromCairoReplacementEffect extends ReplacementEffectImpl {
|
||||||
&& (controller.getLife() > 0) &&(controller.getLife() - event.getAmount()) < 1
|
&& (controller.getLife() > 0) &&(controller.getLife() - event.getAmount()) < 1
|
||||||
&& event.getPlayerId().equals(controller.getId())
|
&& event.getPlayerId().equals(controller.getId())
|
||||||
) {
|
) {
|
||||||
event.setAmount(controller.getLife() - 1);
|
return true;
|
||||||
//unsure how to make this comply with
|
//unsure how to make this comply with
|
||||||
// 10/1/2008: The ability doesn't change how much damage is dealt;
|
// 10/1/2008: The ability doesn't change how much damage is dealt;
|
||||||
// it just changes how much life that damage makes you lose.
|
// it just changes how much life that damage makes you lose.
|
||||||
// An effect such as Spirit Link will see the full amount of damage being dealt.
|
// An effect such as Spirit Link will see the full amount of damage being dealt.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
if (controller != null) {
|
||||||
|
event.setAmount(controller.getLife() - 1);
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,31 +84,24 @@ class GloomSurgeonEffect extends ReplacementEffectImpl {
|
||||||
GameEvent preventEvent = new GameEvent(GameEvent.EventType.PREVENT_DAMAGE, source.getFirstTarget(), source.getSourceId(), source.getControllerId(), event.getAmount(), false);
|
GameEvent preventEvent = new GameEvent(GameEvent.EventType.PREVENT_DAMAGE, source.getFirstTarget(), source.getSourceId(), source.getControllerId(), event.getAmount(), false);
|
||||||
if (!game.replaceEvent(preventEvent)) {
|
if (!game.replaceEvent(preventEvent)) {
|
||||||
int preventedDamage = event.getAmount();
|
int preventedDamage = event.getAmount();
|
||||||
event.setAmount(0);
|
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, source.getFirstTarget(), source.getSourceId(), source.getControllerId(), preventedDamage));
|
||||||
|
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
int cardsCount = Math.min(preventedDamage, player.getLibrary().size());
|
player.moveCards(player.getLibrary().getTopCards(game, preventedDamage), Zone.LIBRARY, Zone.EXILED, source, game);
|
||||||
for (int i = 0; i < cardsCount; i++) {
|
|
||||||
Card card = player.getLibrary().removeFromTop(game);
|
|
||||||
if (card != null) {
|
|
||||||
player.moveCardToExileWithInfo(card, null, null, source.getSourceId(), game, Zone.LIBRARY, true);
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, source.getFirstTarget(), source.getSourceId(), source.getControllerId(), preventedDamage));
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == GameEvent.EventType.DAMAGE_CREATURE;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.DAMAGE_CREATURE && event.getTargetId().equals(source.getSourceId())) {
|
if (event.getTargetId().equals(source.getSourceId())) {
|
||||||
DamageCreatureEvent damageEvent = (DamageCreatureEvent) event;
|
DamageCreatureEvent damageEvent = (DamageCreatureEvent) event;
|
||||||
if (damageEvent.isCombatDamage()) {
|
if (damageEvent.isCombatDamage()) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -117,11 +110,6 @@ class GloomSurgeonEffect extends ReplacementEffectImpl {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GloomSurgeonEffect copy() {
|
public GloomSurgeonEffect copy() {
|
||||||
return new GloomSurgeonEffect(this);
|
return new GloomSurgeonEffect(this);
|
||||||
|
|
|
@ -132,23 +132,19 @@ class InfiniteReflectionEntersBattlefieldEffect extends ReplacementEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
|
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
|
||||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
|
||||||
if (permanent != null && permanent.getControllerId().equals(source.getControllerId())
|
|
||||||
&& permanent.getCardType().contains(CardType.CREATURE)
|
|
||||||
&& !(permanent instanceof PermanentToken)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
return false;
|
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||||
|
return permanent != null && permanent.getControllerId().equals(source.getControllerId())
|
||||||
|
&& permanent.getCardType().contains(CardType.CREATURE)
|
||||||
|
&& !(permanent instanceof PermanentToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
Permanent toCopyToPermanent = game.getPermanent(event.getTargetId());
|
Permanent toCopyToPermanent = game.getPermanent(event.getTargetId());
|
||||||
|
|
|
@ -27,22 +27,25 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.avacynrestored;
|
package mage.sets.avacynrestored;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.dynamicvalue.DynamicValue;
|
import mage.abilities.dynamicvalue.DynamicValue;
|
||||||
import mage.abilities.dynamicvalue.common.CardsInControllerHandCount;
|
import mage.abilities.dynamicvalue.common.CardsInControllerHandCount;
|
||||||
|
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
|
||||||
import mage.abilities.effects.Effect;
|
import mage.abilities.effects.Effect;
|
||||||
import mage.abilities.effects.ReplacementEffectImpl;
|
|
||||||
import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect;
|
import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.constants.*;
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Duration;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Rarity;
|
||||||
|
import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author noxx
|
* @author noxx
|
||||||
*/
|
*/
|
||||||
|
@ -111,7 +114,7 @@ class HighestLifeTotalAmongOpponentsCount implements DynamicValue {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class MalignusEffect extends ReplacementEffectImpl {
|
class MalignusEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
|
|
||||||
public MalignusEffect() {
|
public MalignusEffect() {
|
||||||
super(Duration.WhileOnBattlefield, Outcome.Benefit);
|
super(Duration.WhileOnBattlefield, Outcome.Benefit);
|
||||||
|
@ -128,21 +131,13 @@ class MalignusEffect extends ReplacementEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
return true;
|
return event.getType() == GameEvent.EventType.PREVENT_DAMAGE;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.PREVENT_DAMAGE && event.getSourceId().equals(source.getSourceId())) {
|
return event.getSourceId().equals(source.getSourceId());
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,11 +37,13 @@ import mage.abilities.effects.ReplacementEffectImpl;
|
||||||
import mage.abilities.effects.common.DamageTargetEffect;
|
import mage.abilities.effects.common.DamageTargetEffect;
|
||||||
import mage.abilities.effects.common.replacement.DealtDamageToCreatureBySourceDies;
|
import mage.abilities.effects.common.replacement.DealtDamageToCreatureBySourceDies;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.events.GameEvent.EventType;
|
import mage.game.events.GameEvent.EventType;
|
||||||
import mage.game.events.ZoneChangeEvent;
|
import mage.game.events.ZoneChangeEvent;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
import mage.players.Player;
|
||||||
import mage.target.common.TargetCreatureOrPlayer;
|
import mage.target.common.TargetCreatureOrPlayer;
|
||||||
import mage.watchers.common.DamagedByWatcher;
|
import mage.watchers.common.DamagedByWatcher;
|
||||||
|
|
||||||
|
@ -55,7 +57,6 @@ public class PillarOfFlame extends CardImpl {
|
||||||
super(ownerId, 149, "Pillar of Flame", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{R}");
|
super(ownerId, 149, "Pillar of Flame", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{R}");
|
||||||
this.expansionSetCode = "AVR";
|
this.expansionSetCode = "AVR";
|
||||||
|
|
||||||
|
|
||||||
// Pillar of Flame deals 2 damage to target creature or player.
|
// Pillar of Flame deals 2 damage to target creature or player.
|
||||||
this.getSpellAbility().addEffect(new DamageTargetEffect(2));
|
this.getSpellAbility().addEffect(new DamageTargetEffect(2));
|
||||||
this.getSpellAbility().addTarget(new TargetCreatureOrPlayer());
|
this.getSpellAbility().addTarget(new TargetCreatureOrPlayer());
|
||||||
|
@ -97,19 +98,25 @@ class PillarOfFlameEffect extends ReplacementEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
Permanent permanent = ((ZoneChangeEvent) event).getTarget();
|
Permanent permanent = ((ZoneChangeEvent) event).getTarget();
|
||||||
if (permanent != null) {
|
if (controller != null && permanent != null) {
|
||||||
return permanent.moveToExile(null, "", source.getSourceId(), game);
|
return controller.moveCards(permanent, Zone.BATTLEFIELD, Zone.EXILED, source, game);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == EventType.ZONE_CHANGE;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).isDiesEvent()) {
|
if (((ZoneChangeEvent) event).isDiesEvent()) {
|
||||||
DamagedByWatcher watcher = (DamagedByWatcher) game.getState().getWatchers().get("DamagedByWatcher", source.getSourceId());
|
DamagedByWatcher watcher = (DamagedByWatcher) game.getState().getWatchers().get("DamagedByWatcher", source.getSourceId());
|
||||||
if (watcher != null) {
|
if (watcher != null) {
|
||||||
return watcher.damagedCreatures.contains(event.getTargetId());
|
return watcher.wasDamaged(event.getTargetId(), game);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -34,6 +34,7 @@ import mage.MageInt;
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
|
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
|
||||||
import mage.abilities.effects.ReplacementEffectImpl;
|
import mage.abilities.effects.ReplacementEffectImpl;
|
||||||
import mage.abilities.keyword.FlyingAbility;
|
import mage.abilities.keyword.FlyingAbility;
|
||||||
import mage.abilities.keyword.HexproofAbility;
|
import mage.abilities.keyword.HexproofAbility;
|
||||||
|
@ -75,7 +76,7 @@ public class SigardaHostOfHerons extends CardImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class SigardaHostOfHeronsEffect extends ReplacementEffectImpl {
|
class SigardaHostOfHeronsEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
|
|
||||||
public SigardaHostOfHeronsEffect() {
|
public SigardaHostOfHeronsEffect() {
|
||||||
super(Duration.WhileOnBattlefield, Outcome.Benefit);
|
super(Duration.WhileOnBattlefield, Outcome.Benefit);
|
||||||
|
@ -92,18 +93,13 @@ class SigardaHostOfHeronsEffect extends ReplacementEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
return true;
|
return event.getType() == GameEvent.EventType.SACRIFICE_PERMANENT;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.SACRIFICE_PERMANENT && event.getPlayerId().equals(source.getControllerId())) {
|
if (event.getPlayerId().equals(source.getControllerId())) {
|
||||||
MageObject object = game.getObject(event.getSourceId());
|
MageObject object = game.getObject(event.getSourceId());
|
||||||
if (object instanceof PermanentCard) {
|
if (object instanceof PermanentCard) {
|
||||||
if (game.getOpponents(source.getControllerId()).contains(((PermanentCard)object).getControllerId())) {
|
if (game.getOpponents(source.getControllerId()).contains(((PermanentCard)object).getControllerId())) {
|
||||||
|
|
|
@ -65,7 +65,6 @@ public class KumanosBlessing extends CardImpl {
|
||||||
this.expansionSetCode = "BOK";
|
this.expansionSetCode = "BOK";
|
||||||
this.subtype.add("Aura");
|
this.subtype.add("Aura");
|
||||||
|
|
||||||
|
|
||||||
// Flash
|
// Flash
|
||||||
this.addAbility(FlashAbility.getInstance());
|
this.addAbility(FlashAbility.getInstance());
|
||||||
// Enchant creature
|
// Enchant creature
|
||||||
|
@ -106,11 +105,6 @@ class KumanosBlessingEffect extends ReplacementEffectImpl {
|
||||||
return new KumanosBlessingEffect(this);
|
return new KumanosBlessingEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
Permanent permanent = ((ZoneChangeEvent)event).getTarget();
|
Permanent permanent = ((ZoneChangeEvent)event).getTarget();
|
||||||
|
@ -121,9 +115,13 @@ class KumanosBlessingEffect extends ReplacementEffectImpl {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == EventType.ZONE_CHANGE;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == EventType.ZONE_CHANGE) {
|
|
||||||
ZoneChangeEvent zce = (ZoneChangeEvent) event;
|
ZoneChangeEvent zce = (ZoneChangeEvent) event;
|
||||||
if (zce.isDiesEvent()) {
|
if (zce.isDiesEvent()) {
|
||||||
DamagedByEnchantedWatcher watcher = (DamagedByEnchantedWatcher) game.getState().getWatchers().get("DamagedByEnchantedWatcher", source.getSourceId());
|
DamagedByEnchantedWatcher watcher = (DamagedByEnchantedWatcher) game.getState().getWatchers().get("DamagedByEnchantedWatcher", source.getSourceId());
|
||||||
|
@ -131,7 +129,6 @@ class KumanosBlessingEffect extends ReplacementEffectImpl {
|
||||||
return watcher.wasDamaged(zce.getTarget(), game);
|
return watcher.wasDamaged(zce.getTarget(), game);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ import mage.abilities.costs.common.TapSourceCost;
|
||||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
import mage.abilities.effects.PreventionEffectImpl;
|
import mage.abilities.effects.PreventionEffectImpl;
|
||||||
import mage.abilities.effects.ReplacementEffectImpl;
|
import mage.abilities.effects.ReplacementEffectImpl;
|
||||||
|
import mage.abilities.effects.common.PreventDamageToSourceEffect;
|
||||||
import mage.abilities.keyword.BushidoAbility;
|
import mage.abilities.keyword.BushidoAbility;
|
||||||
import mage.abilities.keyword.DefenderAbility;
|
import mage.abilities.keyword.DefenderAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
@ -79,7 +80,7 @@ public class OpalEyeKondasYojimbo extends CardImpl {
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
|
|
||||||
// {1}{W}: Prevent the next 1 damage that would be dealt to Opal-Eye this turn.
|
// {1}{W}: Prevent the next 1 damage that would be dealt to Opal-Eye this turn.
|
||||||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new OpalEyeKondasYojimboPreventEffect(), new ManaCostsImpl("{1}{W}")));
|
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new PreventDamageToSourceEffect(Duration.EndOfTurn, 1), new ManaCostsImpl("{1}{W}")));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,22 +96,35 @@ public class OpalEyeKondasYojimbo extends CardImpl {
|
||||||
|
|
||||||
class OpalEyeKondasYojimboRedirectionEffect extends ReplacementEffectImpl {
|
class OpalEyeKondasYojimboRedirectionEffect extends ReplacementEffectImpl {
|
||||||
|
|
||||||
|
private final TargetSource target;
|
||||||
|
|
||||||
OpalEyeKondasYojimboRedirectionEffect() {
|
OpalEyeKondasYojimboRedirectionEffect() {
|
||||||
super(Duration.EndOfTurn, Outcome.RedirectDamage);
|
super(Duration.EndOfTurn, Outcome.RedirectDamage);
|
||||||
staticText = "The next time a source of your choice would deal damage this turn, that damage is dealt to {this} instead";
|
staticText = "The next time a source of your choice would deal damage this turn, that damage is dealt to {this} instead";
|
||||||
|
this.target = new TargetSource();
|
||||||
}
|
}
|
||||||
|
|
||||||
OpalEyeKondasYojimboRedirectionEffect(final OpalEyeKondasYojimboRedirectionEffect effect) {
|
OpalEyeKondasYojimboRedirectionEffect(final OpalEyeKondasYojimboRedirectionEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
|
this.target = effect.target.copy();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(Ability source, Game game) {
|
||||||
|
this.target.choose(Outcome.PreventDamage, source.getControllerId(), source.getSourceId(), game);
|
||||||
|
super.init(source, game);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType().equals(GameEvent.EventType.DAMAGE_CREATURE ) ||
|
||||||
|
event.getType().equals(GameEvent.EventType.DAMAGE_PLANESWALKER ) ||
|
||||||
|
event.getType().equals(GameEvent.EventType.DAMAGE_PLAYER );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (!this.used) {
|
if (event.getSourceId().equals(target.getFirstTarget())) {
|
||||||
if (event.getType().equals(GameEvent.EventType.DAMAGE_CREATURE ) ||
|
|
||||||
event.getType().equals(GameEvent.EventType.DAMAGE_PLANESWALKER ) ||
|
|
||||||
event.getType().equals(GameEvent.EventType.DAMAGE_PLAYER ) ) {
|
|
||||||
if (event.getSourceId().equals(targetPointer.getFirst(game, source))) {
|
|
||||||
// check source
|
// check source
|
||||||
MageObject object = game.getObject(event.getSourceId());
|
MageObject object = game.getObject(event.getSourceId());
|
||||||
if (object == null) {
|
if (object == null) {
|
||||||
|
@ -119,8 +133,6 @@ class OpalEyeKondasYojimboRedirectionEffect extends ReplacementEffectImpl {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,64 +160,15 @@ class OpalEyeKondasYojimboRedirectionEffect extends ReplacementEffectImpl {
|
||||||
}
|
}
|
||||||
game.informPlayers(message.toString());
|
game.informPlayers(message.toString());
|
||||||
// redirect damage
|
// redirect damage
|
||||||
this.used = true;
|
discard();
|
||||||
sourcePermanent.damage(damageEvent.getAmount(), damageEvent.getSourceId(), game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), event.getAppliedEffects());
|
sourcePermanent.damage(damageEvent.getAmount(), damageEvent.getSourceId(), game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), event.getAppliedEffects());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OpalEyeKondasYojimboRedirectionEffect copy() {
|
public OpalEyeKondasYojimboRedirectionEffect copy() {
|
||||||
return new OpalEyeKondasYojimboRedirectionEffect(this);
|
return new OpalEyeKondasYojimboRedirectionEffect(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class OpalEyeKondasYojimboPreventEffect extends PreventionEffectImpl {
|
|
||||||
|
|
||||||
public OpalEyeKondasYojimboPreventEffect() {
|
|
||||||
super(Duration.EndOfTurn);
|
|
||||||
staticText = "Prevent the next 1 damage that would be dealt to {this} this turn";
|
|
||||||
}
|
|
||||||
|
|
||||||
public OpalEyeKondasYojimboPreventEffect(final OpalEyeKondasYojimboPreventEffect effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public OpalEyeKondasYojimboPreventEffect copy() {
|
|
||||||
return new OpalEyeKondasYojimboPreventEffect(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
|
||||||
GameEvent preventEvent = new GameEvent(GameEvent.EventType.PREVENT_DAMAGE, source.getFirstTarget(), source.getSourceId(), source.getControllerId(), event.getAmount(), false);
|
|
||||||
if (!game.replaceEvent(preventEvent)) {
|
|
||||||
if (event.getAmount() >= 1) {
|
|
||||||
int damage = 1;
|
|
||||||
event.setAmount(event.getAmount() - 1);
|
|
||||||
this.used = true;
|
|
||||||
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, source.getFirstTarget(), source.getSourceId(), source.getControllerId(), damage));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
|
||||||
if (!this.used && super.applies(event, source, game) && event.getTargetId().equals(source.getSourceId())) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -87,17 +87,15 @@ public class OrbOfDreams extends CardImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
|
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -130,7 +130,7 @@ class ToshiroUmezawaEffect extends OneShotEffect {
|
||||||
|
|
||||||
class ToshiroUmezawaReplacementEffect extends ReplacementEffectImpl {
|
class ToshiroUmezawaReplacementEffect extends ReplacementEffectImpl {
|
||||||
|
|
||||||
private UUID cardId;
|
private final UUID cardId;
|
||||||
|
|
||||||
public ToshiroUmezawaReplacementEffect(UUID cardId) {
|
public ToshiroUmezawaReplacementEffect(UUID cardId) {
|
||||||
super(Duration.EndOfTurn, Outcome.Exile);
|
super(Duration.EndOfTurn, Outcome.Exile);
|
||||||
|
@ -147,11 +147,6 @@ class ToshiroUmezawaReplacementEffect extends ReplacementEffectImpl {
|
||||||
return new ToshiroUmezawaReplacementEffect(this);
|
return new ToshiroUmezawaReplacementEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
UUID eventObject = ((ZoneChangeEvent) event).getTargetId();
|
UUID eventObject = ((ZoneChangeEvent) event).getTargetId();
|
||||||
|
@ -168,15 +163,15 @@ class ToshiroUmezawaReplacementEffect extends ReplacementEffectImpl {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == EventType.ZONE_CHANGE;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == EventType.ZONE_CHANGE) {
|
|
||||||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||||
if (zEvent.getToZone() == Zone.GRAVEYARD
|
return zEvent.getToZone() == Zone.GRAVEYARD
|
||||||
&& ((ZoneChangeEvent) event).getTargetId().equals(cardId)) {
|
&& ((ZoneChangeEvent) event).getTargetId().equals(cardId);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,25 +118,24 @@ class TokTokVolcanoBornEffect extends ReplacementEffectImpl {
|
||||||
super(effect);
|
super(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == GameEvent.EventType.DAMAGE_PLAYER;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.DAMAGE_PLAYER) {
|
|
||||||
Card card = game.getCard(event.getSourceId());
|
Card card = game.getCard(event.getSourceId());
|
||||||
if (card != null && card.getColor().isRed()) {
|
if (card != null && card.getColor().isRed()) {
|
||||||
event.setAmount(event.getAmount() + 1);
|
return true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
return apply(game, source);
|
event.setAmount(event.getAmount() + 1);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -60,7 +60,6 @@ public class Hinder extends CardImpl {
|
||||||
super(ownerId, 65, "Hinder", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{1}{U}{U}");
|
super(ownerId, 65, "Hinder", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{1}{U}{U}");
|
||||||
this.expansionSetCode = "CHK";
|
this.expansionSetCode = "CHK";
|
||||||
|
|
||||||
|
|
||||||
// Counter target spell. If that spell is countered this way, put that card on the top or bottom of its owner's library instead of into that player's graveyard.
|
// Counter target spell. If that spell is countered this way, put that card on the top or bottom of its owner's library instead of into that player's graveyard.
|
||||||
this.getSpellAbility().addEffect(new HinderEffect());
|
this.getSpellAbility().addEffect(new HinderEffect());
|
||||||
this.getSpellAbility().addTarget(new TargetSpell());
|
this.getSpellAbility().addTarget(new TargetSpell());
|
||||||
|
@ -143,11 +142,6 @@ class HinderReplacementEffect extends ReplacementEffectImpl {
|
||||||
return new HinderReplacementEffect(this);
|
return new HinderReplacementEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isInactive(Ability source, Game game) {
|
public boolean isInactive(Ability source, Game game) {
|
||||||
if (!game.getPhase().getStep().getType().equals(phaseStep)) {
|
if (!game.getPhase().getStep().getType().equals(phaseStep)) {
|
||||||
|
@ -179,9 +173,14 @@ class HinderReplacementEffect extends ReplacementEffectImpl {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == EventType.ZONE_CHANGE;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == EventType.ZONE_CHANGE && ((ZoneChangeEvent)event).getToZone().equals(Zone.GRAVEYARD)) {
|
if (((ZoneChangeEvent)event).getToZone().equals(Zone.GRAVEYARD)) {
|
||||||
MageObject mageObject = game.getLastKnownInformation(getTargetPointer().getFirst(game, source), Zone.STACK);
|
MageObject mageObject = game.getLastKnownInformation(getTargetPointer().getFirst(game, source), Zone.STACK);
|
||||||
if (mageObject instanceof Spell) {
|
if (mageObject instanceof Spell) {
|
||||||
return ((Spell)mageObject).getSourceId().equals(event.getTargetId());
|
return ((Spell)mageObject).getSourceId().equals(event.getTargetId());
|
||||||
|
|
|
@ -96,11 +96,6 @@ class SamuraiOfThePaleCurtainEffect extends ReplacementEffectImpl {
|
||||||
return new SamuraiOfThePaleCurtainEffect(this);
|
return new SamuraiOfThePaleCurtainEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
Permanent permanent = ((ZoneChangeEvent)event).getTarget();
|
Permanent permanent = ((ZoneChangeEvent)event).getTarget();
|
||||||
|
@ -110,15 +105,15 @@ class SamuraiOfThePaleCurtainEffect extends ReplacementEffectImpl {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == EventType.ZONE_CHANGE;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == EventType.ZONE_CHANGE ) {
|
|
||||||
ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
|
ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
|
||||||
if (zEvent.getToZone() == Zone.GRAVEYARD) {
|
return zEvent.getToZone() == Zone.GRAVEYARD;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,28 +39,29 @@ import mage.abilities.effects.ReplacementEffectImpl;
|
||||||
import mage.abilities.effects.common.DamageAllEffect;
|
import mage.abilities.effects.common.DamageAllEffect;
|
||||||
import mage.abilities.effects.common.replacement.DealtDamageToCreatureBySourceDies;
|
import mage.abilities.effects.common.replacement.DealtDamageToCreatureBySourceDies;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.Zone;
|
||||||
import mage.filter.common.FilterCreaturePermanent;
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.events.GameEvent.EventType;
|
import mage.game.events.GameEvent.EventType;
|
||||||
import mage.game.events.ZoneChangeEvent;
|
import mage.game.events.ZoneChangeEvent;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
import mage.players.Player;
|
||||||
import mage.watchers.common.DamagedByWatcher;
|
import mage.watchers.common.DamagedByWatcher;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author LevelX
|
* @author LevelX
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class YamabushisStorm extends CardImpl {
|
public class YamabushisStorm extends CardImpl {
|
||||||
|
|
||||||
public YamabushisStorm(UUID ownerId) {
|
public YamabushisStorm(UUID ownerId) {
|
||||||
super(ownerId, 199, "Yamabushi's Storm", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{1}{R}");
|
super(ownerId, 199, "Yamabushi's Storm", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{1}{R}");
|
||||||
this.expansionSetCode = "CHK";
|
this.expansionSetCode = "CHK";
|
||||||
|
|
||||||
|
|
||||||
// Yamabushi's Storm deals 1 damage to each creature.
|
// Yamabushi's Storm deals 1 damage to each creature.
|
||||||
this.getSpellAbility().addEffect(new DamageAllEffect(1, new FilterCreaturePermanent()));
|
this.getSpellAbility().addEffect(new DamageAllEffect(1, new FilterCreaturePermanent()));
|
||||||
|
|
||||||
// If a creature dealt damage this way would die this turn, exile it instead.
|
// If a creature dealt damage this way would die this turn, exile it instead.
|
||||||
this.getSpellAbility().addEffect(new DealtDamageToCreatureBySourceDies(this, Duration.EndOfTurn));
|
this.getSpellAbility().addEffect(new DealtDamageToCreatureBySourceDies(this, Duration.EndOfTurn));
|
||||||
this.getSpellAbility().addWatcher(new DamagedByWatcher());
|
this.getSpellAbility().addWatcher(new DamagedByWatcher());
|
||||||
|
@ -93,27 +94,26 @@ class YamabushisStormEffect extends ReplacementEffectImpl {
|
||||||
return new YamabushisStormEffect(this);
|
return new YamabushisStormEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
Permanent permanent = ((ZoneChangeEvent)event).getTarget();
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (permanent != null) {
|
Permanent permanent = ((ZoneChangeEvent) event).getTarget();
|
||||||
return permanent.moveToExile(null, "", source.getSourceId(), game);
|
if (controller != null && permanent != null) {
|
||||||
|
return controller.moveCardToExileWithInfo(permanent, null, "", source.getSourceId(), game, Zone.BATTLEFIELD, true);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == EventType.ZONE_CHANGE;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == EventType.ZONE_CHANGE && ((ZoneChangeEvent)event).isDiesEvent()) {
|
if (((ZoneChangeEvent) event).isDiesEvent()) {
|
||||||
DamagedByWatcher watcher =
|
DamagedByWatcher watcher = (DamagedByWatcher) game.getState().getWatchers().get("DamagedByWatcher", source.getSourceId());
|
||||||
(DamagedByWatcher) game.getState().getWatchers().get("DamagedByWatcher", source.getSourceId());
|
return watcher != null && watcher.wasDamaged(event.getTargetId(), game);
|
||||||
if (watcher != null)
|
|
||||||
return watcher.damagedCreatures.contains(event.getTargetId());
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,6 @@ public class SpellCrumple extends CardImpl {
|
||||||
super(ownerId, 63, "Spell Crumple", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{1}{U}{U}");
|
super(ownerId, 63, "Spell Crumple", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{1}{U}{U}");
|
||||||
this.expansionSetCode = "CMD";
|
this.expansionSetCode = "CMD";
|
||||||
|
|
||||||
|
|
||||||
// Counter target spell. If that spell is countered this way, put it on the bottom of its owner's library instead of into that player's graveyard. Put Spell Crumple on the bottom of its owner's library.
|
// Counter target spell. If that spell is countered this way, put it on the bottom of its owner's library instead of into that player's graveyard. Put Spell Crumple on the bottom of its owner's library.
|
||||||
this.getSpellAbility().addTarget(new TargetSpell());
|
this.getSpellAbility().addTarget(new TargetSpell());
|
||||||
this.getSpellAbility().addEffect(new SpellCrumpleCounterEffect());
|
this.getSpellAbility().addEffect(new SpellCrumpleCounterEffect());
|
||||||
|
@ -145,11 +144,6 @@ class SpellCrumpleReplacementEffect extends ReplacementEffectImpl {
|
||||||
return new SpellCrumpleReplacementEffect(this);
|
return new SpellCrumpleReplacementEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isInactive(Ability source, Game game) {
|
public boolean isInactive(Ability source, Game game) {
|
||||||
if (!game.getPhase().getStep().getType().equals(phaseStep)) {
|
if (!game.getPhase().getStep().getType().equals(phaseStep)) {
|
||||||
|
@ -180,9 +174,14 @@ class SpellCrumpleReplacementEffect extends ReplacementEffectImpl {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == EventType.ZONE_CHANGE;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == EventType.ZONE_CHANGE && ((ZoneChangeEvent)event).getToZone().equals(Zone.GRAVEYARD)) {
|
if (((ZoneChangeEvent)event).getToZone().equals(Zone.GRAVEYARD)) {
|
||||||
MageObject mageObject = game.getLastKnownInformation(getTargetPointer().getFirst(game, source), Zone.STACK);
|
MageObject mageObject = game.getLastKnownInformation(getTargetPointer().getFirst(game, source), Zone.STACK);
|
||||||
if (mageObject instanceof Spell) {
|
if (mageObject instanceof Spell) {
|
||||||
return ((Spell)mageObject).getSourceId().equals(event.getTargetId());
|
return ((Spell)mageObject).getSourceId().equals(event.getTargetId());
|
||||||
|
|
|
@ -139,25 +139,20 @@ class NayaSoulbeastReplacementEffect extends ReplacementEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD) {
|
return event.getType() == EventType.ENTERS_THE_BATTLEFIELD;
|
||||||
if (event.getTargetId().equals(source.getSourceId())) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
return false;
|
return event.getTargetId().equals(source.getSourceId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
Object object = this.getValue("NayaSoulbeastCounters");
|
Object object = this.getValue("NayaSoulbeastCounters");
|
||||||
if (object instanceof Integer) {
|
if (object instanceof Integer) {
|
||||||
int amount = ((Integer)object).intValue();
|
int amount = ((Integer)object);
|
||||||
new AddCountersSourceEffect(CounterType.P1P1.createInstance(amount)).apply(game, source);
|
new AddCountersSourceEffect(CounterType.P1P1.createInstance(amount)).apply(game, source);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -146,19 +146,15 @@ class OpalPalaceEntersBattlefieldEffect extends ReplacementEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD) {
|
return event.getType() == EventType.ENTERS_THE_BATTLEFIELD;
|
||||||
OpalPalaceWatcher watcher = (OpalPalaceWatcher) game.getState().getWatchers().get("ManaPaidFromOpalPalaceWatcher", source.getSourceId());
|
|
||||||
if (watcher != null) {
|
|
||||||
return watcher.commanderId.contains(event.getTargetId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
return false;
|
OpalPalaceWatcher watcher = (OpalPalaceWatcher) game.getState().getWatchers().get("ManaPaidFromOpalPalaceWatcher", source.getSourceId());
|
||||||
|
return watcher != null &&
|
||||||
|
watcher.commanderId.contains(event.getTargetId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -83,11 +83,6 @@ class WarCadenceReplacementEffect extends ReplacementEffectImpl {
|
||||||
super(effect);
|
super(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
Player player = game.getPlayer(event.getPlayerId());
|
Player player = game.getPlayer(event.getPlayerId());
|
||||||
|
@ -108,9 +103,14 @@ class WarCadenceReplacementEffect extends ReplacementEffectImpl {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == GameEvent.EventType.DECLARE_BLOCKER;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
return event.getType().equals(GameEvent.EventType.DECLARE_BLOCKER);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -27,23 +27,27 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.darkascension;
|
package mage.sets.darkascension;
|
||||||
|
|
||||||
import mage.constants.*;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.effects.ReplacementEffectImpl;
|
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
|
||||||
import mage.abilities.effects.common.continuous.BoostControlledEffect;
|
import mage.abilities.effects.common.continuous.BoostControlledEffect;
|
||||||
import mage.abilities.keyword.IntimidateAbility;
|
import mage.abilities.keyword.IntimidateAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Duration;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Rarity;
|
||||||
|
import mage.constants.Zone;
|
||||||
import mage.filter.common.FilterCreaturePermanent;
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
import mage.filter.predicate.Predicates;
|
import mage.filter.predicate.Predicates;
|
||||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.game.events.GameEvent.EventType;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author BetaSteward
|
* @author BetaSteward
|
||||||
|
@ -84,14 +88,13 @@ public class Immerwolf extends CardImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ImmerwolfEffect extends ReplacementEffectImpl {
|
class ImmerwolfEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
|
|
||||||
private static final FilterCreaturePermanent filterWerewolf = new FilterCreaturePermanent("Werewolf creature");
|
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
||||||
private static final FilterCreaturePermanent filterNonhuman = new FilterCreaturePermanent("Non-human creature");
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
filterWerewolf.add(new SubtypePredicate("Werewolf"));
|
filter.add(new SubtypePredicate("Werewolf"));
|
||||||
filterNonhuman.add(Predicates.not(new SubtypePredicate("Human")));
|
filter.add(Predicates.not(new SubtypePredicate("Human")));
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImmerwolfEffect() {
|
public ImmerwolfEffect() {
|
||||||
|
@ -109,23 +112,15 @@ class ImmerwolfEffect extends ReplacementEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
return true;
|
return event.getType() == EventType.TRANSFORM;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.TRANSFORM) {
|
|
||||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||||
if (permanent != null && permanent.getControllerId().equals(source.getControllerId()) && filterWerewolf.match(permanent, game) && filterNonhuman.match(permanent, game)) {
|
return permanent != null &&
|
||||||
return true;
|
permanent.getControllerId().equals(source.getControllerId()) &&
|
||||||
}
|
filter.match(permanent, game) ;
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,6 +87,9 @@ class SerumPowderReplaceEffect extends ReplacementEffectImpl {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
Card sourceCard = game.getCard(source.getSourceId());
|
Card sourceCard = game.getCard(source.getSourceId());
|
||||||
if (controller != null && sourceCard != null) {
|
if (controller != null && sourceCard != null) {
|
||||||
|
if (!controller.chooseUse(outcome, "Exile all cards from hand and draw that many cards?", game)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
int cardsHand = controller.getHand().size();
|
int cardsHand = controller.getHand().size();
|
||||||
if (cardsHand > 0){
|
if (cardsHand > 0){
|
||||||
Cards cards = new CardsImpl();
|
Cards cards = new CardsImpl();
|
||||||
|
@ -98,26 +101,20 @@ class SerumPowderReplaceEffect extends ReplacementEffectImpl {
|
||||||
}
|
}
|
||||||
controller.drawCards(cardsHand, game);
|
controller.drawCards(cardsHand, game);
|
||||||
}
|
}
|
||||||
game.informPlayers(new StringBuilder(sourceCard.getName()).append(": ").append(controller.getLogName()).append(" exiles hand and draws ").append(cardsHand).append(" card(s)").toString());
|
game.informPlayers(sourceCard.getLogName() +": " + controller.getLogName() + " exiles hand and draws " + cardsHand + " card(s)");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.CAN_TAKE_MULLIGAN && source.getControllerId().equals(event.getPlayerId())) {
|
return event.getType() == GameEvent.EventType.CAN_TAKE_MULLIGAN;
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
|
||||||
if (controller != null) {
|
|
||||||
return controller.chooseUse(outcome, "Exile all cards from hand and draw that many cards?", game);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
return false;
|
return source.getControllerId().equals(event.getPlayerId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -86,11 +86,6 @@ class RainOfGoreEffect extends ReplacementEffectImpl {
|
||||||
return new RainOfGoreEffect(this);
|
return new RainOfGoreEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
Player player = game.getPlayer(event.getPlayerId());
|
Player player = game.getPlayer(event.getPlayerId());
|
||||||
|
@ -100,17 +95,19 @@ class RainOfGoreEffect extends ReplacementEffectImpl {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == GameEvent.EventType.GAIN_LIFE;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
switch (event.getType()) {
|
|
||||||
case GAIN_LIFE:
|
|
||||||
if (!game.getStack().isEmpty()) {
|
if (!game.getStack().isEmpty()) {
|
||||||
StackObject stackObject = game.getStack().getFirst();
|
StackObject stackObject = game.getStack().getFirst();
|
||||||
if (stackObject != null) {
|
if (stackObject != null) {
|
||||||
return stackObject.getControllerId().equals(event.getPlayerId());
|
return stackObject.getControllerId().equals(event.getPlayerId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -36,6 +36,7 @@ import mage.constants.Zone;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
|
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.ReplacementEffectImpl;
|
import mage.abilities.effects.ReplacementEffectImpl;
|
||||||
import mage.abilities.keyword.CanAttackOnlyAloneAbility;
|
import mage.abilities.keyword.CanAttackOnlyAloneAbility;
|
||||||
|
@ -153,7 +154,7 @@ class MasterOfCrueltiesEffect extends OneShotEffect {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class MasterOfCrueltiesNoDamageEffect extends ReplacementEffectImpl {
|
class MasterOfCrueltiesNoDamageEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
|
|
||||||
public MasterOfCrueltiesNoDamageEffect() {
|
public MasterOfCrueltiesNoDamageEffect() {
|
||||||
super(Duration.EndOfCombat, Outcome.PreventDamage);
|
super(Duration.EndOfCombat, Outcome.PreventDamage);
|
||||||
|
@ -170,25 +171,21 @@ class MasterOfCrueltiesNoDamageEffect extends ReplacementEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
|
||||||
switch (event.getType()) {
|
switch (event.getType()) {
|
||||||
case DAMAGE_CREATURE:
|
case DAMAGE_CREATURE:
|
||||||
case DAMAGE_PLAYER:
|
case DAMAGE_PLAYER:
|
||||||
case DAMAGE_PLANESWALKER:
|
case DAMAGE_PLANESWALKER:
|
||||||
DamageEvent damageEvent = (DamageEvent) event;
|
return true;
|
||||||
return event.getSourceId().equals(source.getSourceId()) && damageEvent.isCombatDamage();
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
|
DamageEvent damageEvent = (DamageEvent) event;
|
||||||
|
return event.getSourceId().equals(source.getSourceId()) && damageEvent.isCombatDamage();
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,10 +117,14 @@ class KorChantEffect extends RedirectionEffect {
|
||||||
this.target.choose(Outcome.PreventDamage, source.getControllerId(), source.getSourceId(), game);
|
this.target.choose(Outcome.PreventDamage, source.getControllerId(), source.getSourceId(), game);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == GameEvent.EventType.DAMAGE_CREATURE;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.DAMAGE_CREATURE
|
if (event.getTargetId().equals(this.getTargetPointer().getFirst(game, source))
|
||||||
&& event.getTargetId().equals(this.getTargetPointer().getFirst(game, source))
|
|
||||||
&& event.getSourceId().equals(this.target.getFirstTarget())) {
|
&& event.getSourceId().equals(this.target.getFirstTarget())) {
|
||||||
this.redirectTarget = source.getTargets().get(1);
|
this.redirectTarget = source.getTargets().get(1);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -32,6 +32,7 @@ import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.effects.ContinuousEffect;
|
import mage.abilities.effects.ContinuousEffect;
|
||||||
|
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
|
||||||
import mage.abilities.effects.ReplacementEffectImpl;
|
import mage.abilities.effects.ReplacementEffectImpl;
|
||||||
import mage.abilities.keyword.FirstStrikeAbility;
|
import mage.abilities.keyword.FirstStrikeAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
@ -75,7 +76,7 @@ public class GoblinBrawler extends CardImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class CantBeEquippedSourceEffect extends ReplacementEffectImpl {
|
class CantBeEquippedSourceEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
|
|
||||||
public CantBeEquippedSourceEffect(CantBeEquippedSourceEffect effect) {
|
public CantBeEquippedSourceEffect(CantBeEquippedSourceEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
|
@ -92,18 +93,13 @@ class CantBeEquippedSourceEffect extends ReplacementEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
return true;
|
return event.getType() == GameEvent.EventType.ATTACH;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.ATTACH && event.getTargetId().equals(source.getSourceId())) {
|
if (event.getTargetId().equals(source.getSourceId())) {
|
||||||
Permanent permanent = game.getPermanent(event.getSourceId());
|
Permanent permanent = game.getPermanent(event.getSourceId());
|
||||||
if(permanent != null && permanent.getSubtype().contains("Equipment")){
|
if(permanent != null && permanent.getSubtype().contains("Equipment")){
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -39,6 +39,7 @@ import mage.constants.Rarity;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.game.events.GameEvent.EventType;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -51,7 +52,6 @@ public class Kismet extends CardImpl {
|
||||||
super(ownerId, 319, "Kismet", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{3}{W}");
|
super(ownerId, 319, "Kismet", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{3}{W}");
|
||||||
this.expansionSetCode = "5ED";
|
this.expansionSetCode = "5ED";
|
||||||
|
|
||||||
|
|
||||||
// Artifacts, creatures, and lands played by your opponents enter the battlefield tapped.
|
// Artifacts, creatures, and lands played by your opponents enter the battlefield tapped.
|
||||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new KismetEffect()));
|
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new KismetEffect()));
|
||||||
}
|
}
|
||||||
|
@ -86,9 +86,15 @@ class KismetEffect extends ReplacementEffectImpl {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == EventType.ENTERS_THE_BATTLEFIELD;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
|
if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
|
||||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||||
if (permanent != null && (permanent.getCardType().contains(CardType.ARTIFACT) ||
|
if (permanent != null && (permanent.getCardType().contains(CardType.ARTIFACT) ||
|
||||||
permanent.getCardType().contains(CardType.CREATURE) ||
|
permanent.getCardType().contains(CardType.CREATURE) ||
|
||||||
|
@ -99,11 +105,6 @@ class KismetEffect extends ReplacementEffectImpl {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public KismetEffect copy() {
|
public KismetEffect copy() {
|
||||||
return new KismetEffect(this);
|
return new KismetEffect(this);
|
||||||
|
|
|
@ -95,19 +95,14 @@ class AvenMindcensorEffect extends ReplacementEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.SEARCH_LIBRARY) {
|
return event.getType() == GameEvent.EventType.SEARCH_LIBRARY;
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
|
||||||
if (controller != null && game.isOpponent(controller, event.getPlayerId())) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
return false;
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
return controller != null && game.isOpponent(controller, event.getPlayerId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -90,9 +90,14 @@ class BlindObedienceTapEffect extends ReplacementEffectImpl {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
|
if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
|
||||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||||
if (permanent != null && (permanent.getCardType().contains(CardType.CREATURE) || permanent.getCardType().contains(CardType.ARTIFACT))) {
|
if (permanent != null && (permanent.getCardType().contains(CardType.CREATURE) || permanent.getCardType().contains(CardType.ARTIFACT))) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -101,11 +106,6 @@ class BlindObedienceTapEffect extends ReplacementEffectImpl {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlindObedienceTapEffect copy() {
|
public BlindObedienceTapEffect copy() {
|
||||||
return new BlindObedienceTapEffect(this);
|
return new BlindObedienceTapEffect(this);
|
||||||
|
|
|
@ -88,21 +88,16 @@ class MasterBiomancerEntersBattlefieldEffect extends ReplacementEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD) {
|
return event.getType() == EventType.ENTERS_THE_BATTLEFIELD;
|
||||||
Permanent creature = game.getPermanent(event.getTargetId());
|
|
||||||
if (creature != null && creature.getControllerId().equals(source.getControllerId())
|
|
||||||
&& creature.getCardType().contains(CardType.CREATURE)
|
|
||||||
&& !event.getTargetId().equals(source.getSourceId())) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
return false;
|
Permanent creature = game.getPermanent(event.getTargetId());
|
||||||
|
return creature != null && creature.getControllerId().equals(source.getControllerId())
|
||||||
|
&& creature.getCardType().contains(CardType.CREATURE)
|
||||||
|
&& !event.getTargetId().equals(source.getSourceId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -33,6 +33,7 @@ import mage.constants.CardType;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
|
||||||
import mage.abilities.effects.ReplacementEffectImpl;
|
import mage.abilities.effects.ReplacementEffectImpl;
|
||||||
import mage.abilities.effects.common.DamageTargetEffect;
|
import mage.abilities.effects.common.DamageTargetEffect;
|
||||||
import mage.abilities.effects.common.continuous.CantGainLifeAllEffect;
|
import mage.abilities.effects.common.continuous.CantGainLifeAllEffect;
|
||||||
|
@ -71,7 +72,7 @@ public class Skullcrack extends CardImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class DamageCantBePreventedEffect extends ReplacementEffectImpl {
|
class DamageCantBePreventedEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
|
|
||||||
public DamageCantBePreventedEffect() {
|
public DamageCantBePreventedEffect() {
|
||||||
super(Duration.EndOfTurn, Outcome.Benefit);
|
super(Duration.EndOfTurn, Outcome.Benefit);
|
||||||
|
@ -93,15 +94,12 @@ class DamageCantBePreventedEffect extends ReplacementEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
return true;
|
return event.getType() == GameEvent.EventType.PREVENT_DAMAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType().equals(GameEvent.EventType.PREVENT_DAMAGE)) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,10 +104,14 @@ class KjeldoranRoyalGuardEffect extends ReplacementEffectImpl {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == GameEvent.EventType.DAMAGE_PLAYER;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.DAMAGE_PLAYER
|
if (event.getPlayerId().equals(source.getControllerId())
|
||||||
&& event.getPlayerId().equals(source.getControllerId())
|
|
||||||
&& ((DamageEvent)event).isCombatDamage()) {
|
&& ((DamageEvent)event).isCombatDamage()) {
|
||||||
Permanent p = game.getPermanent(source.getSourceId());
|
Permanent p = game.getPermanent(source.getSourceId());
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
|
@ -121,11 +125,6 @@ class KjeldoranRoyalGuardEffect extends ReplacementEffectImpl {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public KjeldoranRoyalGuardEffect copy() {
|
public KjeldoranRoyalGuardEffect copy() {
|
||||||
return new KjeldoranRoyalGuardEffect(this);
|
return new KjeldoranRoyalGuardEffect(this);
|
||||||
|
|
|
@ -51,13 +51,14 @@ import mage.game.stack.Spell;
|
||||||
import mage.target.targetpointer.FixedTarget;
|
import mage.target.targetpointer.FixedTarget;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.game.events.GameEvent.EventType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author nantuko
|
* @author nantuko
|
||||||
*/
|
*/
|
||||||
public class DearlyDeparted extends CardImpl {
|
public class DearlyDeparted extends CardImpl {
|
||||||
|
|
||||||
private static final String ruleText = "As long as Dearly Departed is in your graveyard, each Human creature you control enters the battlefield with an additional +1/+1 counter on it";
|
private static final String ruleText = "As long as {this} is in your graveyard, each Human creature you control enters the battlefield with an additional +1/+1 counter on it";
|
||||||
|
|
||||||
public DearlyDeparted(UUID ownerId) {
|
public DearlyDeparted(UUID ownerId) {
|
||||||
super(ownerId, 9, "Dearly Departed", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{4}{W}{W}");
|
super(ownerId, 9, "Dearly Departed", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{4}{W}{W}");
|
||||||
|
@ -111,20 +112,18 @@ class EntersBattlefieldEffect extends ReplacementEffectImpl {
|
||||||
baseEffects.add(effect);
|
baseEffects.add(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == EventType.ENTERS_THE_BATTLEFIELD;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
|
|
||||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||||
if (permanent != null && permanent.getControllerId().equals(source.getControllerId()) && permanent.hasSubtype("Human")) {
|
if (permanent != null && permanent.getControllerId().equals(source.getControllerId()) && permanent.hasSubtype("Human")) {
|
||||||
setValue("target", permanent);
|
setValue("target", permanent);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,19 +86,14 @@ class EssenceOfTheWildEffect extends ReplacementEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD) {
|
return event.getType() == EventType.ENTERS_THE_BATTLEFIELD;
|
||||||
Permanent perm = game.getPermanent(event.getTargetId());
|
|
||||||
if (perm != null && perm.getCardType().contains(CardType.CREATURE) && perm.getControllerId().equals(source.getControllerId())) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
return false;
|
Permanent perm = game.getPermanent(event.getTargetId());
|
||||||
|
return perm != null && perm.getCardType().contains(CardType.CREATURE) && perm.getControllerId().equals(source.getControllerId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -122,8 +117,8 @@ class EssenceOfTheWildEffect extends ReplacementEffectImpl {
|
||||||
|
|
||||||
class EssenceOfTheWildCopyEffect extends ContinuousEffectImpl {
|
class EssenceOfTheWildCopyEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
private Permanent essence;
|
private final Permanent essence;
|
||||||
private UUID targetId;
|
private final UUID targetId;
|
||||||
|
|
||||||
public EssenceOfTheWildCopyEffect(Permanent essence, UUID targetId) {
|
public EssenceOfTheWildCopyEffect(Permanent essence, UUID targetId) {
|
||||||
super(Duration.EndOfGame, Layer.CopyEffects_1, SubLayer.NA, Outcome.BecomeCreature);
|
super(Duration.EndOfGame, Layer.CopyEffects_1, SubLayer.NA, Outcome.BecomeCreature);
|
||||||
|
|
|
@ -33,6 +33,7 @@ import mage.abilities.ActivatedAbility;
|
||||||
import mage.abilities.PlayLandAbility;
|
import mage.abilities.PlayLandAbility;
|
||||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
|
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
|
||||||
import mage.abilities.effects.ReplacementEffectImpl;
|
import mage.abilities.effects.ReplacementEffectImpl;
|
||||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||||
import mage.abilities.mana.ManaAbility;
|
import mage.abilities.mana.ManaAbility;
|
||||||
|
@ -61,7 +62,6 @@ public class TsabosWeb extends CardImpl {
|
||||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new DrawCardSourceControllerEffect(1), false));
|
this.addAbility(new EntersBattlefieldTriggeredAbility(new DrawCardSourceControllerEffect(1), false));
|
||||||
// Each land with an activated ability that isn't a mana ability doesn't untap during its controller's untap step.
|
// Each land with an activated ability that isn't a mana ability doesn't untap during its controller's untap step.
|
||||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new TsabosWebPreventUntapEffect()));
|
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new TsabosWebPreventUntapEffect()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public TsabosWeb(final TsabosWeb card) {
|
public TsabosWeb(final TsabosWeb card) {
|
||||||
|
@ -74,7 +74,7 @@ public class TsabosWeb extends CardImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class TsabosWebPreventUntapEffect extends ReplacementEffectImpl {
|
class TsabosWebPreventUntapEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
|
|
||||||
public TsabosWebPreventUntapEffect() {
|
public TsabosWebPreventUntapEffect() {
|
||||||
super(Duration.WhileOnBattlefield, Outcome.Detriment);
|
super(Duration.WhileOnBattlefield, Outcome.Detriment);
|
||||||
|
@ -85,24 +85,19 @@ class TsabosWebPreventUntapEffect extends ReplacementEffectImpl {
|
||||||
super(effect);
|
super(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TsabosWebPreventUntapEffect copy() {
|
public TsabosWebPreventUntapEffect copy() {
|
||||||
return new TsabosWebPreventUntapEffect(this);
|
return new TsabosWebPreventUntapEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
return true;
|
return event.getType() == GameEvent.EventType.UNTAP;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (game.getTurn().getStepType() == PhaseStep.UNTAP && event.getType() == GameEvent.EventType.UNTAP) {
|
if (game.getTurn().getStepType() == PhaseStep.UNTAP) {
|
||||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||||
if (permanent != null && permanent.getCardType().contains(CardType.LAND)) {
|
if (permanent != null && permanent.getCardType().contains(CardType.LAND)) {
|
||||||
for (Ability ability :permanent.getAbilities()) {
|
for (Ability ability :permanent.getAbilities()) {
|
||||||
|
|
|
@ -61,7 +61,6 @@ public class YawgmothsAgenda extends CardImpl {
|
||||||
super(ownerId, 135, "Yawgmoth's Agenda", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{B}{B}");
|
super(ownerId, 135, "Yawgmoth's Agenda", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{B}{B}");
|
||||||
this.expansionSetCode = "INV";
|
this.expansionSetCode = "INV";
|
||||||
|
|
||||||
|
|
||||||
// You can't cast more than one spell each turn.
|
// You can't cast more than one spell each turn.
|
||||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantCastMoreThanOneSpellEffect(TargetController.YOU)));
|
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantCastMoreThanOneSpellEffect(TargetController.YOU)));
|
||||||
// You may play cards from your graveyard.
|
// You may play cards from your graveyard.
|
||||||
|
@ -134,11 +133,6 @@ class YawgmothsAgendaReplacementEffect extends ReplacementEffectImpl {
|
||||||
return new YawgmothsAgendaReplacementEffect(this);
|
return new YawgmothsAgendaReplacementEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
@ -159,9 +153,14 @@ class YawgmothsAgendaReplacementEffect extends ReplacementEffectImpl {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == EventType.ZONE_CHANGE;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD) {
|
if (((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD) {
|
||||||
Card card = game.getCard(event.getTargetId());
|
Card card = game.getCard(event.getTargetId());
|
||||||
if (card != null && card.getOwnerId().equals(source.getControllerId())) {
|
if (card != null && card.getOwnerId().equals(source.getControllerId())) {
|
||||||
Permanent permanent = ((ZoneChangeEvent) event).getTarget();
|
Permanent permanent = ((ZoneChangeEvent) event).getTarget();
|
||||||
|
|
|
@ -54,7 +54,6 @@ public class DeflectingPalm extends CardImpl {
|
||||||
super(ownerId, 173, "Deflecting Palm", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{R}{W}");
|
super(ownerId, 173, "Deflecting Palm", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{R}{W}");
|
||||||
this.expansionSetCode = "KTK";
|
this.expansionSetCode = "KTK";
|
||||||
|
|
||||||
|
|
||||||
// The next time a source of your choice would deal damage to you this turn, prevent that damage. If damage is prevented this way, Deflecting Palm deals that much damage to that source's controller.
|
// The next time a source of your choice would deal damage to you this turn, prevent that damage. If damage is prevented this way, Deflecting Palm deals that much damage to that source's controller.
|
||||||
this.getSpellAbility().addEffect(new DeflectingPalmEffect());
|
this.getSpellAbility().addEffect(new DeflectingPalmEffect());
|
||||||
}
|
}
|
||||||
|
@ -89,14 +88,10 @@ class DeflectingPalmEffect extends PreventionEffectImpl {
|
||||||
return new DeflectingPalmEffect(this);
|
return new DeflectingPalmEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(Ability source, Game game) {
|
public void init(Ability source, Game game) {
|
||||||
this.target.choose(Outcome.PreventDamage, source.getControllerId(), source.getSourceId(), game);
|
this.target.choose(Outcome.PreventDamage, source.getControllerId(), source.getSourceId(), game);
|
||||||
|
super.init(source, game);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -90,11 +90,6 @@ class UginsNexusSkipExtraTurnsEffect extends ReplacementEffectImpl {
|
||||||
return new UginsNexusSkipExtraTurnsEffect(this);
|
return new UginsNexusSkipExtraTurnsEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
Player player = game.getPlayer(event.getPlayerId());
|
Player player = game.getPlayer(event.getPlayerId());
|
||||||
|
@ -106,10 +101,15 @@ class UginsNexusSkipExtraTurnsEffect extends ReplacementEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
return event.getType() == EventType.EXTRA_TURN;
|
return event.getType() == EventType.EXTRA_TURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class UginsNexusExileEffect extends ReplacementEffectImpl {
|
class UginsNexusExileEffect extends ReplacementEffectImpl {
|
||||||
|
|
|
@ -39,6 +39,7 @@ import mage.constants.Duration;
|
||||||
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.filter.FilterObject;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.DamageEvent;
|
import mage.game.events.DamageEvent;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
|
@ -79,9 +80,9 @@ class JadeMonolithRedirectionEffect extends ReplacementEffectImpl {
|
||||||
private final TargetSource targetSource;
|
private final TargetSource targetSource;
|
||||||
|
|
||||||
public JadeMonolithRedirectionEffect() {
|
public JadeMonolithRedirectionEffect() {
|
||||||
super(Duration.EndOfTurn, Outcome.RedirectDamage);
|
super(Duration.OneUse, Outcome.RedirectDamage);
|
||||||
this.staticText = "The next time a source of your choice would deal damage to target creature this turn, that source deals that damage to you instead";
|
this.staticText = "The next time a source of your choice would deal damage to target creature this turn, that source deals that damage to you instead";
|
||||||
this.targetSource = new TargetSource();
|
this.targetSource = new TargetSource(new FilterObject("source of your choice"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public JadeMonolithRedirectionEffect(final JadeMonolithRedirectionEffect effect) {
|
public JadeMonolithRedirectionEffect(final JadeMonolithRedirectionEffect effect) {
|
||||||
|
@ -99,11 +100,6 @@ class JadeMonolithRedirectionEffect extends ReplacementEffectImpl {
|
||||||
this.targetSource.choose(Outcome.PreventDamage, source.getControllerId(), source.getSourceId(), game);
|
this.targetSource.choose(Outcome.PreventDamage, source.getControllerId(), source.getSourceId(), game);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
@ -111,28 +107,27 @@ class JadeMonolithRedirectionEffect extends ReplacementEffectImpl {
|
||||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||||
DamageEvent damageEvent = (DamageEvent) event;
|
DamageEvent damageEvent = (DamageEvent) event;
|
||||||
if (controller != null && targetCreature != null) {
|
if (controller != null && targetCreature != null) {
|
||||||
this.used = true;
|
|
||||||
controller.damage(damageEvent.getAmount(), damageEvent.getSourceId(), game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), damageEvent.getAppliedEffects());
|
controller.damage(damageEvent.getAmount(), damageEvent.getSourceId(), game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), damageEvent.getAppliedEffects());
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder(sourceObject != null ? sourceObject.getLogName() : "");
|
StringBuilder sb = new StringBuilder(sourceObject != null ? sourceObject.getLogName() : "");
|
||||||
sb.append(": ").append(damageEvent.getAmount()).append(" damage redirected from ").append(targetCreature.getLogName());
|
sb.append(": ").append(damageEvent.getAmount()).append(" damage redirected from ").append(targetCreature.getLogName());
|
||||||
sb.append(" to ").append(controller.getLogName());
|
sb.append(" to ").append(controller.getLogName());
|
||||||
game.informPlayers(sb.toString());
|
game.informPlayers(sb.toString());
|
||||||
|
discard(); // only one use
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == EventType.DAMAGE_CREATURE;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (!this.used) {
|
|
||||||
if (event.getType().equals(EventType.DAMAGE_CREATURE)) {
|
|
||||||
if (event.getSourceId().equals(targetSource.getFirstTarget()) && event.getTargetId().equals(source.getFirstTarget())) {
|
if (event.getSourceId().equals(targetSource.getFirstTarget()) && event.getTargetId().equals(source.getFirstTarget())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -109,15 +109,14 @@ class VigorReplacementEffect extends ReplacementEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
return event.getType() == GameEvent.EventType.DAMAGE_CREATURE
|
return event.getType() == GameEvent.EventType.DAMAGE_CREATURE;
|
||||||
&& event.getPlayerId().equals(source.getControllerId())
|
|
||||||
&& !event.getTargetId().equals(source.getSourceId());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
return true;
|
return event.getPlayerId().equals(source.getControllerId())
|
||||||
|
&& !event.getTargetId().equals(source.getSourceId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -35,6 +35,7 @@ import mage.abilities.effects.PreventionEffectImpl;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
|
import mage.constants.Outcome;
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
|
@ -53,10 +54,8 @@ public class HarmsWay extends CardImpl {
|
||||||
super(ownerId, 14, "Harm's Way", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{W}");
|
super(ownerId, 14, "Harm's Way", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{W}");
|
||||||
this.expansionSetCode = "M10";
|
this.expansionSetCode = "M10";
|
||||||
|
|
||||||
|
|
||||||
// The next 2 damage that a source of your choice would deal to you and/or permanents you control this turn is dealt to target creature or player instead.
|
// The next 2 damage that a source of your choice would deal to you and/or permanents you control this turn is dealt to target creature or player instead.
|
||||||
this.getSpellAbility().addEffect(new HarmsWayPreventDamageTargetEffect());
|
this.getSpellAbility().addEffect(new HarmsWayPreventDamageTargetEffect());
|
||||||
this.getSpellAbility().addTarget(new TargetSource());
|
|
||||||
this.getSpellAbility().addTarget(new TargetCreatureOrPlayer());
|
this.getSpellAbility().addTarget(new TargetCreatureOrPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,13 +71,17 @@ public class HarmsWay extends CardImpl {
|
||||||
|
|
||||||
class HarmsWayPreventDamageTargetEffect extends PreventionEffectImpl {
|
class HarmsWayPreventDamageTargetEffect extends PreventionEffectImpl {
|
||||||
|
|
||||||
|
private final TargetSource target;
|
||||||
|
|
||||||
public HarmsWayPreventDamageTargetEffect() {
|
public HarmsWayPreventDamageTargetEffect() {
|
||||||
super(Duration.EndOfTurn, 2, false, true);
|
super(Duration.EndOfTurn, 2, false, true);
|
||||||
staticText = "The next 2 damage that a source of your choice would deal to you and/or permanents you control this turn is dealt to target creature or player instead";
|
staticText = "The next 2 damage that a source of your choice would deal to you and/or permanents you control this turn is dealt to target creature or player instead";
|
||||||
|
this.target = new TargetSource();
|
||||||
}
|
}
|
||||||
|
|
||||||
public HarmsWayPreventDamageTargetEffect(final HarmsWayPreventDamageTargetEffect effect) {
|
public HarmsWayPreventDamageTargetEffect(final HarmsWayPreventDamageTargetEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
|
this.target = effect.target.copy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -87,8 +90,9 @@ class HarmsWayPreventDamageTargetEffect extends PreventionEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public void init(Ability source, Game game) {
|
||||||
return true;
|
this.target.choose(Outcome.PreventDamage, source.getControllerId(), source.getSourceId(), game);
|
||||||
|
super.init(source, game);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -96,18 +100,20 @@ class HarmsWayPreventDamageTargetEffect extends PreventionEffectImpl {
|
||||||
PreventionEffectData preventionData = preventDamageAction(event, source, game);
|
PreventionEffectData preventionData = preventDamageAction(event, source, game);
|
||||||
// deal damage now
|
// deal damage now
|
||||||
if (preventionData.getPreventedDamage() > 0) {
|
if (preventionData.getPreventedDamage() > 0) {
|
||||||
UUID redirectTo = source.getTargets().get(1).getFirstTarget();
|
UUID redirectTo = source.getFirstTarget();
|
||||||
Permanent permanent = game.getPermanent(redirectTo);
|
Permanent permanent = game.getPermanent(redirectTo);
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
game.informPlayers("Dealing " + preventionData.getPreventedDamage() + " to " + permanent.getLogName() + " instead");
|
game.informPlayers("Dealing " + preventionData.getPreventedDamage() + " to " + permanent.getLogName() + " instead");
|
||||||
// keep the original source id as it is redirecting
|
// keep the original source id as it is redirecting
|
||||||
permanent.damage(preventionData.getPreventedDamage(), event.getSourceId(), game, false, true);
|
permanent.damage(preventionData.getPreventedDamage(), event.getSourceId(), game, false, true);
|
||||||
|
discard();
|
||||||
}
|
}
|
||||||
Player player = game.getPlayer(redirectTo);
|
Player player = game.getPlayer(redirectTo);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
game.informPlayers("Dealing " + preventionData.getPreventedDamage() + " to " + player.getLogName() + " instead");
|
game.informPlayers("Dealing " + preventionData.getPreventedDamage() + " to " + player.getLogName() + " instead");
|
||||||
// keep the original source id as it is redirecting
|
// keep the original source id as it is redirecting
|
||||||
player.damage(preventionData.getPreventedDamage(), event.getSourceId(), game, false, true);
|
player.damage(preventionData.getPreventedDamage(), event.getSourceId(), game, false, true);
|
||||||
|
discard();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -115,7 +121,7 @@ class HarmsWayPreventDamageTargetEffect extends PreventionEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (!this.used && super.applies(event, source, game)) {
|
if (super.applies(event, source, game)) {
|
||||||
// check source
|
// check source
|
||||||
MageObject object = game.getObject(event.getSourceId());
|
MageObject object = game.getObject(event.getSourceId());
|
||||||
if (object == null) {
|
if (object == null) {
|
||||||
|
@ -123,8 +129,8 @@ class HarmsWayPreventDamageTargetEffect extends PreventionEffectImpl {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!object.getId().equals(source.getFirstTarget())
|
if (!object.getId().equals(target.getFirstTarget())
|
||||||
&& (!(object instanceof Spell) || !((Spell) object).getSourceId().equals(source.getFirstTarget()))) {
|
&& (!(object instanceof Spell) || !((Spell) object).getSourceId().equals(target.getFirstTarget()))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@ import mage.constants.Zone;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
|
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
|
||||||
import mage.abilities.effects.ReplacementEffectImpl;
|
import mage.abilities.effects.ReplacementEffectImpl;
|
||||||
import mage.abilities.effects.common.continuous.CantGainLifeAllEffect;
|
import mage.abilities.effects.common.continuous.CantGainLifeAllEffect;
|
||||||
import mage.abilities.keyword.LeylineAbility;
|
import mage.abilities.keyword.LeylineAbility;
|
||||||
|
@ -58,7 +59,6 @@ public class LeylineOfPunishment extends CardImpl {
|
||||||
super(ownerId, 148, "Leyline of Punishment", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{2}{R}{R}");
|
super(ownerId, 148, "Leyline of Punishment", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{2}{R}{R}");
|
||||||
this.expansionSetCode = "M11";
|
this.expansionSetCode = "M11";
|
||||||
|
|
||||||
|
|
||||||
// If Leyline of Punishment is in your opening hand, you may begin the game with it on the battlefield.
|
// If Leyline of Punishment is in your opening hand, you may begin the game with it on the battlefield.
|
||||||
this.addAbility(LeylineAbility.getInstance());
|
this.addAbility(LeylineAbility.getInstance());
|
||||||
// Players can't gain life.
|
// Players can't gain life.
|
||||||
|
@ -78,7 +78,7 @@ public class LeylineOfPunishment extends CardImpl {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class LeylineOfPunishmentEffect2 extends ReplacementEffectImpl {
|
class LeylineOfPunishmentEffect2 extends ContinuousRuleModifyingEffectImpl {
|
||||||
|
|
||||||
public LeylineOfPunishmentEffect2() {
|
public LeylineOfPunishmentEffect2() {
|
||||||
super(Duration.WhileOnBattlefield, Outcome.Benefit);
|
super(Duration.WhileOnBattlefield, Outcome.Benefit);
|
||||||
|
@ -95,21 +95,13 @@ class LeylineOfPunishmentEffect2 extends ReplacementEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
return true;
|
return event.getType() == EventType.PREVENT_DAMAGE;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == EventType.PREVENT_DAMAGE) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,11 +90,6 @@ class LeylineOfTheVoidEffect extends ReplacementEffectImpl {
|
||||||
return new LeylineOfTheVoidEffect(this);
|
return new LeylineOfTheVoidEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
@ -115,9 +110,14 @@ class LeylineOfTheVoidEffect extends ReplacementEffectImpl {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == EventType.ZONE_CHANGE;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == EventType.ZONE_CHANGE && ((ZoneChangeEvent)event).getToZone() == Zone.GRAVEYARD) {
|
if (((ZoneChangeEvent)event).getToZone() == Zone.GRAVEYARD) {
|
||||||
Card card = game.getCard(event.getTargetId());
|
Card card = game.getCard(event.getTargetId());
|
||||||
if (card != null && game.getOpponents(source.getControllerId()).contains(card.getOwnerId())) {
|
if (card != null && game.getOpponents(source.getControllerId()).contains(card.getOwnerId())) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -97,9 +97,14 @@ class ObstinateBalothEffect extends ReplacementEffectImpl {
|
||||||
return new ObstinateBalothEffect(this);
|
return new ObstinateBalothEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == EventType.ZONE_CHANGE;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == EventType.ZONE_CHANGE && event.getTargetId().equals(source.getSourceId())) {
|
if (event.getTargetId().equals(source.getSourceId())) {
|
||||||
ZoneChangeEvent zcEvent = (ZoneChangeEvent) event;
|
ZoneChangeEvent zcEvent = (ZoneChangeEvent) event;
|
||||||
if (zcEvent.getFromZone() == Zone.HAND && zcEvent.getToZone() == Zone.GRAVEYARD) {
|
if (zcEvent.getFromZone() == Zone.HAND && zcEvent.getToZone() == Zone.GRAVEYARD) {
|
||||||
StackObject spell = game.getStack().getStackObject(event.getSourceId());
|
StackObject spell = game.getStack().getStackObject(event.getSourceId());
|
||||||
|
@ -112,7 +117,7 @@ class ObstinateBalothEffect extends ReplacementEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
Card card = game.getCard(source.getSourceId());
|
Card card = game.getCard(source.getSourceId());
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
Player owner = game.getPlayer(card.getOwnerId());
|
Player owner = game.getPlayer(card.getOwnerId());
|
||||||
|
@ -125,9 +130,4 @@ class ObstinateBalothEffect extends ReplacementEffectImpl {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
|
||||||
return apply(game, source);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -38,7 +38,6 @@ import mage.abilities.keyword.TrampleAbility;
|
||||||
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.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -122,32 +121,28 @@ class ElderscaleWurmReplacementEffect extends ReplacementEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
if (event.getType().equals(GameEvent.EventType.DAMAGE_CAUSES_LIFE_LOSS)) {
|
return event.getType() == GameEvent.EventType.DAMAGE_CAUSES_LIFE_LOSS;
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
|
||||||
if (permanent == null) {
|
|
||||||
permanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
|
|
||||||
}
|
|
||||||
if (permanent != null) {
|
|
||||||
Player controller = game.getPlayer(permanent.getControllerId());
|
|
||||||
if (controller != null && controller.getLife() >= 7
|
|
||||||
&& (controller.getLife() - event.getAmount()) < 7
|
|
||||||
&& event.getPlayerId().equals(controller.getId())) {
|
|
||||||
event.setAmount(controller.getLife() - 7);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
|
if (event.getPlayerId().equals(source.getControllerId())) {
|
||||||
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
if (controller != null && controller.getLife() >= 7
|
||||||
|
&& (controller.getLife() - event.getAmount()) < 7) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
if (controller != null) {
|
||||||
|
event.setAmount(controller.getLife() - 7);
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,9 +91,14 @@ class ImposingSovereignEffect extends ReplacementEffectImpl {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
|
if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
|
||||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||||
if (permanent != null && permanent.getCardType().contains(CardType.CREATURE)) {
|
if (permanent != null && permanent.getCardType().contains(CardType.CREATURE)) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -102,11 +107,6 @@ class ImposingSovereignEffect extends ReplacementEffectImpl {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ImposingSovereignEffect copy() {
|
public ImposingSovereignEffect copy() {
|
||||||
return new ImposingSovereignEffect(this);
|
return new ImposingSovereignEffect(this);
|
||||||
|
|
|
@ -79,10 +79,14 @@ class PyromancersGauntletReplacementEffect extends ReplacementEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
if (event.getType().equals(GameEvent.EventType.DAMAGE_PLAYER)
|
return event.getType().equals(GameEvent.EventType.DAMAGE_PLAYER)
|
||||||
|| event.getType().equals(GameEvent.EventType.DAMAGE_CREATURE)
|
|| event.getType().equals(GameEvent.EventType.DAMAGE_CREATURE)
|
||||||
|| event.getType().equals(GameEvent.EventType.DAMAGE_PLANESWALKER)) {
|
|| event.getType().equals(GameEvent.EventType.DAMAGE_PLANESWALKER);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
MageObject object = game.getObject(event.getSourceId());
|
MageObject object = game.getObject(event.getSourceId());
|
||||||
if (object != null && object instanceof Spell) {
|
if (object != null && object instanceof Spell) {
|
||||||
if (((Spell) object).getControllerId().equals(source.getControllerId())
|
if (((Spell) object).getControllerId().equals(source.getControllerId())
|
||||||
|
@ -95,15 +99,9 @@ class PyromancersGauntletReplacementEffect extends ReplacementEffectImpl {
|
||||||
if(permanent != null && permanent.getCardType().contains(CardType.PLANESWALKER)){
|
if(permanent != null && permanent.getCardType().contains(CardType.PLANESWALKER)){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
event.setAmount(event.getAmount() + 2);
|
event.setAmount(event.getAmount() + 2);
|
||||||
|
|
|
@ -50,6 +50,7 @@ import mage.constants.WatcherScope;
|
||||||
import mage.counters.CounterType;
|
import mage.counters.CounterType;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.game.events.GameEvent.EventType;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.game.stack.Spell;
|
import mage.game.stack.Spell;
|
||||||
import mage.watchers.Watcher;
|
import mage.watchers.Watcher;
|
||||||
|
@ -193,10 +194,7 @@ class SavageSummoningWatcher extends Watcher {
|
||||||
public boolean isSpellCastWithThisSavageSummoning(UUID spellId, UUID cardId, int zoneChangeCounter) {
|
public boolean isSpellCastWithThisSavageSummoning(UUID spellId, UUID cardId, int zoneChangeCounter) {
|
||||||
String cardKey = new StringBuilder(cardId.toString()).append("_").append(zoneChangeCounter).toString();
|
String cardKey = new StringBuilder(cardId.toString()).append("_").append(zoneChangeCounter).toString();
|
||||||
HashSet<String> savageSpells = (HashSet<String>) spellsCastWithSavageSummoning.get(spellId);
|
HashSet<String> savageSpells = (HashSet<String>) spellsCastWithSavageSummoning.get(spellId);
|
||||||
if (savageSpells != null && savageSpells.contains(cardKey)) {
|
return savageSpells != null && savageSpells.contains(cardKey);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCardCastWithThisSavageSummoning(Card card, UUID cardId, int zoneChangeCounter, Game game) {
|
public boolean isCardCastWithThisSavageSummoning(Card card, UUID cardId, int zoneChangeCounter, Game game) {
|
||||||
|
@ -204,10 +202,7 @@ class SavageSummoningWatcher extends Watcher {
|
||||||
// add one because card is now gone to battlefield as creature
|
// add one because card is now gone to battlefield as creature
|
||||||
String cardKey = new StringBuilder(cardId.toString()).append("_").append(zoneChangeCounter).toString();
|
String cardKey = new StringBuilder(cardId.toString()).append("_").append(zoneChangeCounter).toString();
|
||||||
HashSet<String> savageSpells = (HashSet<String>) cardsCastWithSavageSummoning.get(creatureCardKey);
|
HashSet<String> savageSpells = (HashSet<String>) cardsCastWithSavageSummoning.get(creatureCardKey);
|
||||||
if (savageSpells != null && savageSpells.contains(cardKey)) {
|
return savageSpells != null && savageSpells.contains(cardKey);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -307,11 +302,6 @@ class SavageSummoningEntersBattlefieldEffect extends ReplacementEffectImpl {
|
||||||
return new SavageSummoningEntersBattlefieldEffect(this);
|
return new SavageSummoningEntersBattlefieldEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
Permanent creature = game.getPermanent(event.getTargetId());
|
Permanent creature = game.getPermanent(event.getTargetId());
|
||||||
|
@ -322,15 +312,15 @@ class SavageSummoningEntersBattlefieldEffect extends ReplacementEffectImpl {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == EventType.ENTERS_THE_BATTLEFIELD;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if ((event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD)) {
|
|
||||||
Card card = game.getCard(event.getTargetId());
|
Card card = game.getCard(event.getTargetId());
|
||||||
if (card != null && watcher.isCardCastWithThisSavageSummoning(card, source.getSourceId(), zoneChangeCounter, game)) {
|
return card != null && watcher.isCardCastWithThisSavageSummoning(card, source.getSourceId(), zoneChangeCounter, game);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,11 +90,6 @@ class ForbiddenCryptDrawCardReplacementEffect extends ReplacementEffectImpl {
|
||||||
return new ForbiddenCryptDrawCardReplacementEffect(this);
|
return new ForbiddenCryptDrawCardReplacementEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
|
@ -119,9 +114,14 @@ class ForbiddenCryptDrawCardReplacementEffect extends ReplacementEffectImpl {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == EventType.DRAW_CARD;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
return event.getType() == EventType.DRAW_CARD && event.getPlayerId().equals(source.getControllerId());
|
return event.getPlayerId().equals(source.getControllerId());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,16 +96,13 @@ class GravebaneZombieEffect extends ReplacementEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
if (event.getType() == EventType.ZONE_CHANGE && event.getTargetId().equals(source.getSourceId())) {
|
return event.getType() == EventType.ZONE_CHANGE;
|
||||||
return ((ZoneChangeEvent) event).isDiesEvent();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
return true;
|
return event.getTargetId().equals(source.getSourceId()) && ((ZoneChangeEvent) event).isDiesEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -89,11 +89,6 @@ class DampingMatrixEffect extends ReplacementEffectImpl {
|
||||||
super(effect);
|
super(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DampingMatrixEffect copy() {
|
public DampingMatrixEffect copy() {
|
||||||
return new DampingMatrixEffect(this);
|
return new DampingMatrixEffect(this);
|
||||||
|
@ -104,9 +99,13 @@ class DampingMatrixEffect extends ReplacementEffectImpl {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == EventType.ACTIVATE_ABILITY;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == EventType.ACTIVATE_ABILITY) {
|
|
||||||
MageObject object = game.getObject(event.getSourceId());
|
MageObject object = game.getObject(event.getSourceId());
|
||||||
if (object instanceof Permanent && filter.match((Permanent)object, game)) {
|
if (object instanceof Permanent && filter.match((Permanent)object, game)) {
|
||||||
Ability ability = object.getAbilities().get(event.getTargetId());
|
Ability ability = object.getAbilities().get(event.getTargetId());
|
||||||
|
@ -114,7 +113,6 @@ class DampingMatrixEffect extends ReplacementEffectImpl {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ import mage.constants.Zone;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.effects.ReplacementEffectImpl;
|
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
|
||||||
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;
|
||||||
|
@ -57,6 +57,7 @@ public class MelirasKeepers extends CardImpl {
|
||||||
this.power = new MageInt(4);
|
this.power = new MageInt(4);
|
||||||
this.toughness = new MageInt(4);
|
this.toughness = new MageInt(4);
|
||||||
|
|
||||||
|
// Melira's Keepers can't have counters placed on it
|
||||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new MelirasKeepersEffect()));
|
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new MelirasKeepersEffect()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,7 +72,7 @@ public class MelirasKeepers extends CardImpl {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class MelirasKeepersEffect extends ReplacementEffectImpl {
|
class MelirasKeepersEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
|
|
||||||
public MelirasKeepersEffect() {
|
public MelirasKeepersEffect() {
|
||||||
super(Duration.WhileOnBattlefield, Outcome.PreventDamage);
|
super(Duration.WhileOnBattlefield, Outcome.PreventDamage);
|
||||||
|
@ -82,27 +83,19 @@ class MelirasKeepersEffect extends ReplacementEffectImpl {
|
||||||
super(effect);
|
super(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MelirasKeepersEffect copy() {
|
public MelirasKeepersEffect copy() {
|
||||||
return new MelirasKeepersEffect(this);
|
return new MelirasKeepersEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
return true;
|
return event.getType() == EventType.ADD_COUNTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == EventType.ADD_COUNTER && event.getTargetId().equals(source.getSourceId())) {
|
return event.getTargetId().equals(source.getSourceId());
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,22 +101,17 @@ class BramblewoodParagonReplacementEffect extends ReplacementEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
|
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
|
||||||
Permanent creature = game.getPermanent(event.getTargetId());
|
|
||||||
if (creature != null && creature.getControllerId().equals(source.getControllerId())
|
|
||||||
&& creature.getCardType().contains(CardType.CREATURE)
|
|
||||||
&& creature.hasSubtype("Warrior")
|
|
||||||
&& !event.getTargetId().equals(source.getSourceId())) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
return false;
|
Permanent creature = game.getPermanent(event.getTargetId());
|
||||||
|
return creature != null && creature.getControllerId().equals(source.getControllerId())
|
||||||
|
&& creature.getCardType().contains(CardType.CREATURE)
|
||||||
|
&& creature.hasSubtype("Warrior")
|
||||||
|
&& !event.getTargetId().equals(source.getSourceId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -31,7 +31,6 @@ import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
|
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.effects.Effect;
|
import mage.abilities.effects.Effect;
|
||||||
import mage.abilities.effects.ReplacementEffectImpl;
|
import mage.abilities.effects.ReplacementEffectImpl;
|
||||||
|
@ -47,6 +46,7 @@ import mage.counters.CounterType;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.DamagedPlayerEvent;
|
import mage.game.events.DamagedPlayerEvent;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.game.events.GameEvent.EventType;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.target.targetpointer.FixedTarget;
|
import mage.target.targetpointer.FixedTarget;
|
||||||
|
|
||||||
|
@ -95,9 +95,13 @@ class OonasBlackguardReplacementEffect extends ReplacementEffectImpl {
|
||||||
super(effect);
|
super(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == EventType.ENTERS_THE_BATTLEFIELD;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
|
|
||||||
Permanent creature = game.getPermanent(event.getTargetId());
|
Permanent creature = game.getPermanent(event.getTargetId());
|
||||||
if (creature != null && creature.getControllerId().equals(source.getControllerId())
|
if (creature != null && creature.getControllerId().equals(source.getControllerId())
|
||||||
&& creature.getCardType().contains(CardType.CREATURE)
|
&& creature.getCardType().contains(CardType.CREATURE)
|
||||||
|
@ -105,7 +109,6 @@ class OonasBlackguardReplacementEffect extends ReplacementEffectImpl {
|
||||||
&& !event.getTargetId().equals(source.getSourceId())) {
|
&& !event.getTargetId().equals(source.getSourceId())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,18 +92,18 @@ class SageOfFablesReplacementEffect extends ReplacementEffectImpl {
|
||||||
super(effect);
|
super(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
|
|
||||||
Permanent creature = game.getPermanent(event.getTargetId());
|
Permanent creature = game.getPermanent(event.getTargetId());
|
||||||
if (creature != null && creature.getControllerId().equals(source.getControllerId())
|
return creature != null && creature.getControllerId().equals(source.getControllerId())
|
||||||
&& creature.getCardType().contains(CardType.CREATURE)
|
&& creature.getCardType().contains(CardType.CREATURE)
|
||||||
&& creature.getSubtype().contains("Wizard")
|
&& creature.getSubtype().contains("Wizard")
|
||||||
&& !event.getTargetId().equals(source.getSourceId())) {
|
&& !event.getTargetId().equals(source.getSourceId());
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -42,6 +42,7 @@ import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.DamageCreatureEvent;
|
import mage.game.events.DamageCreatureEvent;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.game.events.GameEvent.EventType;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.target.TargetSource;
|
import mage.target.TargetSource;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
|
@ -102,11 +103,6 @@ class OraclesAttendantsReplacementEffect extends ReplacementEffectImpl {
|
||||||
this.targetSource.choose(Outcome.PreventDamage, source.getControllerId(), source.getSourceId(), game);
|
this.targetSource.choose(Outcome.PreventDamage, source.getControllerId(), source.getSourceId(), game);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
|
@ -119,13 +115,14 @@ class OraclesAttendantsReplacementEffect extends ReplacementEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.DAMAGE_CREATURE
|
return event.getType() == EventType.DAMAGE_CREATURE;
|
||||||
&& event.getTargetId().equals(source.getFirstTarget())
|
|
||||||
&& event.getSourceId().equals(targetSource.getFirstTarget())) {
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
|
@Override
|
||||||
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
|
return event.getTargetId().equals(source.getFirstTarget())
|
||||||
|
&& event.getSourceId().equals(targetSource.getFirstTarget());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,15 +93,13 @@ class DueRespectEffect extends ReplacementEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
|
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,11 +99,6 @@ class MeliraSylvokOutcastEffect extends ReplacementEffectImpl {
|
||||||
super(effect);
|
super(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MeliraSylvokOutcastEffect copy() {
|
public MeliraSylvokOutcastEffect copy() {
|
||||||
return new MeliraSylvokOutcastEffect(this);
|
return new MeliraSylvokOutcastEffect(this);
|
||||||
|
@ -115,11 +110,13 @@ class MeliraSylvokOutcastEffect extends ReplacementEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
if (event.getType() == EventType.ADD_COUNTER && event.getData().equals(CounterType.POISON.getName()) && event.getTargetId().equals(source.getControllerId())) {
|
return event.getType() == EventType.ADD_COUNTER;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
|
@Override
|
||||||
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
|
return event.getData().equals(CounterType.POISON.getName()) && event.getTargetId().equals(source.getControllerId());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -135,11 +132,6 @@ class MeliraSylvokOutcastEffect2 extends ReplacementEffectImpl {
|
||||||
super(effect);
|
super(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MeliraSylvokOutcastEffect2 copy() {
|
public MeliraSylvokOutcastEffect2 copy() {
|
||||||
return new MeliraSylvokOutcastEffect2(this);
|
return new MeliraSylvokOutcastEffect2(this);
|
||||||
|
@ -150,13 +142,19 @@ class MeliraSylvokOutcastEffect2 extends ReplacementEffectImpl {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == EventType.ADD_COUNTER;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == EventType.ADD_COUNTER && event.getData().equals(CounterType.M1M1.getName())) {
|
if (event.getData().equals(CounterType.M1M1.getName())) {
|
||||||
Permanent perm = game.getPermanent(event.getTargetId());
|
Permanent perm = game.getPermanent(event.getTargetId());
|
||||||
if (perm != null && perm.getCardType().contains(CardType.CREATURE) && perm.getControllerId().equals(source.getControllerId()))
|
if (perm != null && perm.getCardType().contains(CardType.CREATURE) && perm.getControllerId().equals(source.getControllerId())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,11 +98,6 @@ class PhyrexianUnlifeEffect2 extends ReplacementEffectImpl {
|
||||||
return new PhyrexianUnlifeEffect2(this);
|
return new PhyrexianUnlifeEffect2(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
DamagePlayerEvent damageEvent = (DamagePlayerEvent) event;
|
DamagePlayerEvent damageEvent = (DamagePlayerEvent) event;
|
||||||
|
@ -120,9 +115,14 @@ class PhyrexianUnlifeEffect2 extends ReplacementEffectImpl {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == EventType.DAMAGE_PLAYER;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == EventType.DAMAGE_PLAYER && event.getPlayerId().equals(source.getControllerId())) {
|
if (event.getPlayerId().equals(source.getControllerId())) {
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
// The decision if the player has more than 0 life has to be checked only at start of a combat damage step
|
// The decision if the player has more than 0 life has to be checked only at start of a combat damage step
|
||||||
|
|
|
@ -41,6 +41,7 @@ import mage.cards.CardImpl;
|
||||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.game.events.GameEvent.EventType;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -91,20 +92,22 @@ class UrabraskTheHiddenEffect extends ReplacementEffectImpl {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == EventType.ENTERS_THE_BATTLEFIELD;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
|
if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
|
||||||
Card c = game.getCard(event.getTargetId());
|
Card card = game.getCard(event.getTargetId());
|
||||||
if (c != null && c.getCardType().contains(CardType.CREATURE))
|
if (card != null && card.getCardType().contains(CardType.CREATURE)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UrabraskTheHiddenEffect copy() {
|
public UrabraskTheHiddenEffect copy() {
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
package mage.sets.odyssey;
|
package mage.sets.odyssey;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageObject;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
|
@ -46,25 +45,23 @@ import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.stack.Spell;
|
import mage.game.stack.Spell;
|
||||||
import mage.game.stack.StackObject;
|
import mage.game.stack.StackObject;
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.TargetPlayer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author cbt33 / LevelX2
|
* @author cbt33 / LevelX2
|
||||||
*/
|
*/
|
||||||
|
public class AegisOfHonor extends CardImpl {
|
||||||
|
|
||||||
public class AegisOfHonor extends CardImpl{
|
public AegisOfHonor(UUID ownerId) {
|
||||||
|
|
||||||
public AegisOfHonor(UUID ownerId){
|
|
||||||
super(ownerId, 1, "Aegis of Honor", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{W}");
|
super(ownerId, 1, "Aegis of Honor", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{W}");
|
||||||
this.expansionSetCode = "ODY";
|
this.expansionSetCode = "ODY";
|
||||||
|
|
||||||
|
|
||||||
// {1}: The next time an instant or sorcery spell would deal damage to you this
|
// {1}: The next time an instant or sorcery spell would deal damage to you this
|
||||||
//turn, that spell deals that damage to its controller instead.
|
//turn, that spell deals that damage to its controller instead.
|
||||||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new AegisOfHonorEffect(), new ManaCostsImpl("{1}")));
|
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new AegisOfHonorEffect(), new ManaCostsImpl("{1}")));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public AegisOfHonor(final AegisOfHonor card) {
|
public AegisOfHonor(final AegisOfHonor card) {
|
||||||
super(card);
|
super(card);
|
||||||
}
|
}
|
||||||
|
@ -97,11 +94,14 @@ class AegisOfHonorEffect extends RedirectionEffect {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == GameEvent.EventType.DAMAGE_PLAYER;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType().equals(GameEvent.EventType.DAMAGE_PLAYER) //Checks for player damage
|
if (event.getTargetId().equals(source.getControllerId())) { //Checks to see the damage is to Aegis of Honor's controller
|
||||||
&& event.getTargetId().equals(source.getControllerId())) //Checks to see the damage is to Aegis of Honor's controller
|
|
||||||
{
|
|
||||||
Spell spell = null;
|
Spell spell = null;
|
||||||
StackObject stackObject = game.getStack().getStackObject(event.getSourceId());
|
StackObject stackObject = game.getStack().getStackObject(event.getSourceId());
|
||||||
if (stackObject == null) {
|
if (stackObject == null) {
|
||||||
|
@ -112,7 +112,7 @@ class AegisOfHonorEffect extends RedirectionEffect {
|
||||||
}
|
}
|
||||||
//Checks if damage is from a sorcery or instants
|
//Checks if damage is from a sorcery or instants
|
||||||
if (spell != null && instantOrSorceryfilter.match(spell.getCard(), game)) {
|
if (spell != null && instantOrSorceryfilter.match(spell.getCard(), game)) {
|
||||||
TargetPermanent target = new TargetPermanent();
|
TargetPlayer target = new TargetPlayer();
|
||||||
target.add(spell.getControllerId(), game);
|
target.add(spell.getControllerId(), game);
|
||||||
redirectTarget = target;
|
redirectTarget = target;
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -99,13 +99,13 @@ class DelayingShieldReplacementEffect extends ReplacementEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
return event.getType() == EventType.DAMAGE_PLAYER && event.getTargetId().equals(source.getControllerId());
|
return event.getType() == EventType.DAMAGE_PLAYER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
return true;
|
return event.getTargetId().equals(source.getControllerId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -39,6 +39,7 @@ import mage.constants.Rarity;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.game.events.GameEvent.EventType;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -84,9 +85,14 @@ class FrozenAEtherTapEffect extends ReplacementEffectImpl {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == EventType.ENTERS_THE_BATTLEFIELD;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
|
if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
|
||||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||||
if (permanent != null &&
|
if (permanent != null &&
|
||||||
(permanent.getCardType().contains(CardType.CREATURE) ||
|
(permanent.getCardType().contains(CardType.CREATURE) ||
|
||||||
|
@ -98,11 +104,6 @@ class FrozenAEtherTapEffect extends ReplacementEffectImpl {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FrozenAEtherTapEffect copy() {
|
public FrozenAEtherTapEffect copy() {
|
||||||
return new FrozenAEtherTapEffect(this);
|
return new FrozenAEtherTapEffect(this);
|
||||||
|
|
|
@ -92,10 +92,14 @@ class ShieldDancerRedirectionEffect extends RedirectionEffect {
|
||||||
return new ShieldDancerRedirectionEffect(this);
|
return new ShieldDancerRedirectionEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == EventType.DAMAGE_CREATURE;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == EventType.DAMAGE_CREATURE
|
if (event.getTargetId().equals(source.getSourceId())
|
||||||
&& event.getTargetId().equals(source.getSourceId())
|
|
||||||
&& event.getSourceId().equals(source.getTargets().get(0).getFirstTarget())) {
|
&& event.getSourceId().equals(source.getTargets().get(0).getFirstTarget())) {
|
||||||
DamageEvent damageEvent = (DamageEvent) event;
|
DamageEvent damageEvent = (DamageEvent) event;
|
||||||
if (damageEvent.isCombatDamage()) {
|
if (damageEvent.isCombatDamage()) {
|
||||||
|
|
|
@ -40,6 +40,7 @@ import mage.constants.Outcome;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.game.events.GameEvent.EventType;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
|
|
||||||
|
@ -92,9 +93,14 @@ class LoxodonGatekeeperTapEffect extends ReplacementEffectImpl {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == EventType.ENTERS_THE_BATTLEFIELD;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
|
if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
|
||||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||||
if (permanent != null &&
|
if (permanent != null &&
|
||||||
(permanent.getCardType().contains(CardType.CREATURE) ||
|
(permanent.getCardType().contains(CardType.CREATURE) ||
|
||||||
|
@ -106,11 +112,6 @@ class LoxodonGatekeeperTapEffect extends ReplacementEffectImpl {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LoxodonGatekeeperTapEffect copy() {
|
public LoxodonGatekeeperTapEffect copy() {
|
||||||
return new LoxodonGatekeeperTapEffect(this);
|
return new LoxodonGatekeeperTapEffect(this);
|
||||||
|
|
|
@ -39,6 +39,7 @@ import mage.counters.CounterType;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.DamageCreatureEvent;
|
import mage.game.events.DamageCreatureEvent;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.game.events.GameEvent.EventType;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -91,11 +92,13 @@ class PhytohydraEffect extends ReplacementEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.DAMAGE_CREATURE && event.getTargetId().equals(source.getSourceId())) {
|
return event.getType() == EventType.DAMAGE_CREATURE;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
|
@Override
|
||||||
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
|
return event.getTargetId().equals(source.getSourceId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -42,6 +42,7 @@ import mage.constants.Rarity;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.game.events.GameEvent.EventType;
|
||||||
import mage.game.events.ZoneChangeEvent;
|
import mage.game.events.ZoneChangeEvent;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
@ -142,11 +143,6 @@ class RestInPeaceReplacementEffect extends ReplacementEffectImpl {
|
||||||
return new RestInPeaceReplacementEffect(this);
|
return new RestInPeaceReplacementEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
@ -168,9 +164,14 @@ class RestInPeaceReplacementEffect extends ReplacementEffectImpl {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == EventType.ZONE_CHANGE;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
return event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent)event).getToZone() == Zone.GRAVEYARD;
|
return ((ZoneChangeEvent)event).getToZone() == Zone.GRAVEYARD;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,19 +85,18 @@ class TajuruPreserverEffect extends ReplacementEffectImpl {
|
||||||
return new TajuruPreserverEffect(this);
|
return new TajuruPreserverEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == GameEvent.EventType.SACRIFICE_PERMANENT;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.SACRIFICE_PERMANENT) {
|
|
||||||
MageObject object = game.getObject(event.getSourceId());
|
MageObject object = game.getObject(event.getSourceId());
|
||||||
if (object instanceof PermanentCard) {
|
if (object instanceof PermanentCard) {
|
||||||
if (game.getOpponents(source.getControllerId()).contains(((PermanentCard)object).getControllerId())) {
|
if (game.getOpponents(source.getControllerId()).contains(((PermanentCard)object).getControllerId())) {
|
||||||
|
@ -109,7 +108,6 @@ class TajuruPreserverEffect extends ReplacementEffectImpl {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,20 +100,19 @@ class HeavyArbalestEffect extends ReplacementEffectImpl {
|
||||||
return new HeavyArbalestEffect(this);
|
return new HeavyArbalestEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == EventType.UNTAP;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (game.getTurn().getStepType() == PhaseStep.UNTAP
|
if (game.getTurn().getStepType() == PhaseStep.UNTAP) {
|
||||||
&& event.getType() == EventType.UNTAP ) {
|
|
||||||
Permanent equipment = game.getPermanent(source.getSourceId());
|
Permanent equipment = game.getPermanent(source.getSourceId());
|
||||||
if (equipment != null && equipment.getAttachedTo() != null) {
|
if (equipment != null && equipment.getAttachedTo() != null) {
|
||||||
Permanent equipped = game.getPermanent(equipment.getAttachedTo());
|
Permanent equipped = game.getPermanent(equipment.getAttachedTo());
|
||||||
|
|
|
@ -79,7 +79,6 @@ public class MossbridgeTroll extends CardImpl {
|
||||||
ability.setAdditionalCostsRuleVisible(false);
|
ability.setAdditionalCostsRuleVisible(false);
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public MossbridgeTroll(final MossbridgeTroll card) {
|
public MossbridgeTroll(final MossbridgeTroll card) {
|
||||||
|
@ -103,11 +102,6 @@ class MossbridgeTrollReplacementEffect extends ReplacementEffectImpl {
|
||||||
super(effect);
|
super(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
Permanent mossbridgeTroll = game.getPermanent(event.getTargetId());
|
Permanent mossbridgeTroll = game.getPermanent(event.getTargetId());
|
||||||
|
@ -118,12 +112,13 @@ class MossbridgeTrollReplacementEffect extends ReplacementEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.DESTROY_PERMANENT
|
return event.getType() == GameEvent.EventType.DESTROY_PERMANENT;
|
||||||
&& event.getTargetId() == source.getSourceId()) {
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
|
@Override
|
||||||
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
|
return event.getTargetId() == source.getSourceId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -62,7 +62,6 @@ public class WheelOfSunAndMoon extends CardImpl {
|
||||||
this.expansionSetCode = "SHM";
|
this.expansionSetCode = "SHM";
|
||||||
this.subtype.add("Aura");
|
this.subtype.add("Aura");
|
||||||
|
|
||||||
|
|
||||||
// Enchant player
|
// Enchant player
|
||||||
TargetPlayer auraTarget = new TargetPlayer();
|
TargetPlayer auraTarget = new TargetPlayer();
|
||||||
this.getSpellAbility().addTarget(auraTarget);
|
this.getSpellAbility().addTarget(auraTarget);
|
||||||
|
@ -99,9 +98,13 @@ class WheelOfSunAndMoonEffect extends ReplacementEffectImpl {
|
||||||
return new WheelOfSunAndMoonEffect(this);
|
return new WheelOfSunAndMoonEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == EventType.ZONE_CHANGE;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (EventType.ZONE_CHANGE.equals(event.getType())) {
|
|
||||||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||||
if (zEvent.getToZone().equals(Zone.GRAVEYARD)) {
|
if (zEvent.getToZone().equals(Zone.GRAVEYARD)) {
|
||||||
Card card = game.getCard(event.getTargetId());
|
Card card = game.getCard(event.getTargetId());
|
||||||
|
@ -113,15 +116,9 @@ class WheelOfSunAndMoonEffect extends ReplacementEffectImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
|
|
@ -94,15 +94,13 @@ class EmpyrialArchangelEffect extends ReplacementEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.DAMAGE_PLAYER && event.getPlayerId().equals(source.getControllerId()))
|
return event.getType() == GameEvent.EventType.DAMAGE_PLAYER;
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
return true;
|
return event.getPlayerId().equals(source.getControllerId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -46,6 +46,7 @@ import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.DamageEvent;
|
import mage.game.events.DamageEvent;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.game.events.GameEvent.EventType;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.TargetSource;
|
import mage.target.TargetSource;
|
||||||
|
@ -155,10 +156,15 @@ class ShamanEnKorReplacementEffect extends ReplacementEffectImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == EventType.DAMAGE_CREATURE;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (!this.used) {
|
if (!this.used) {
|
||||||
if (event.getType().equals(GameEvent.EventType.DAMAGE_CREATURE) && targetSource != null) {
|
if (targetSource != null) {
|
||||||
if (event.getSourceId().equals(targetSource.getFirstTarget())) {
|
if (event.getSourceId().equals(targetSource.getFirstTarget())) {
|
||||||
// check source
|
// check source
|
||||||
MageObject object = game.getObject(event.getSourceId());
|
MageObject object = game.getObject(event.getSourceId());
|
||||||
|
|
|
@ -84,7 +84,7 @@ class FurnaceOfRathEffect extends ReplacementEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
switch (event.getType()) {
|
switch (event.getType()) {
|
||||||
case DAMAGE_PLAYER:
|
case DAMAGE_PLAYER:
|
||||||
return true;
|
return true;
|
||||||
|
@ -95,26 +95,13 @@ class FurnaceOfRathEffect extends ReplacementEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
DamageEvent damageEvent = (DamageEvent)event;
|
event.setAmount(2 * event.getAmount());
|
||||||
if (damageEvent.getType() == EventType.DAMAGE_PLAYER) {
|
|
||||||
Player targetPlayer = game.getPlayer(event.getTargetId());
|
|
||||||
if (targetPlayer != null) {
|
|
||||||
targetPlayer.damage(damageEvent.getAmount()*2, damageEvent.getSourceId(), game, damageEvent.isPreventable(), damageEvent.isCombatDamage(), event.getAppliedEffects());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Permanent targetPermanent = game.getPermanent(event.getTargetId());
|
|
||||||
if (targetPermanent != null) {
|
|
||||||
targetPermanent.damage(damageEvent.getAmount()*2, damageEvent.getSourceId(), game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), event.getAppliedEffects());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,6 @@ public class RootMaze extends CardImpl {
|
||||||
super(ownerId, 144, "Root Maze", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{G}");
|
super(ownerId, 144, "Root Maze", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{G}");
|
||||||
this.expansionSetCode = "TMP";
|
this.expansionSetCode = "TMP";
|
||||||
|
|
||||||
|
|
||||||
// Artifacts and lands enter the battlefield tapped.
|
// Artifacts and lands enter the battlefield tapped.
|
||||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new RootMazeEffect()));
|
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new RootMazeEffect()));
|
||||||
}
|
}
|
||||||
|
@ -87,19 +86,14 @@ class RootMazeEffect extends ReplacementEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD) {
|
return event.getType() == EventType.ENTERS_THE_BATTLEFIELD;
|
||||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
|
||||||
if (permanent != null && (permanent.getCardType().contains(CardType.LAND) || permanent.getCardType().contains(CardType.ARTIFACT))) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
return false;
|
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||||
|
return permanent != null && (permanent.getCardType().contains(CardType.LAND) || permanent.getCardType().contains(CardType.ARTIFACT));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -116,13 +116,13 @@ class DralnuLichLordReplacementEffect extends ReplacementEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
return event.getType() == GameEvent.EventType.DAMAGE_CREATURE && event.getTargetId().equals(source.getSourceId());
|
return event.getType() == GameEvent.EventType.DAMAGE_CREATURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
return true;
|
return event.getTargetId().equals(source.getSourceId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -92,9 +92,13 @@ class FortuneThiefReplacementEffect extends ReplacementEffectImpl {
|
||||||
return new FortuneThiefReplacementEffect(this);
|
return new FortuneThiefReplacementEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == GameEvent.EventType.DAMAGE_CAUSES_LIFE_LOSS;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType().equals(GameEvent.EventType.DAMAGE_CAUSES_LIFE_LOSS)) {
|
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
@ -109,13 +113,6 @@ class FortuneThiefReplacementEffect extends ReplacementEffectImpl {
|
||||||
// An effect such as Spirit Link will see the full amount of damage being dealt.
|
// An effect such as Spirit Link will see the full amount of damage being dealt.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,9 +98,14 @@ class TimeVaultReplacementEffect extends ReplacementEffectImpl {
|
||||||
return new TimeVaultReplacementEffect(this);
|
return new TimeVaultReplacementEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == EventType.PLAY_TURN;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == EventType.PLAY_TURN && source.getControllerId().equals(event.getPlayerId())) {
|
if (source.getControllerId().equals(event.getPlayerId())) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
if (permanent != null && permanent.isTapped()) {
|
if (permanent != null && permanent.isTapped()) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -109,11 +114,6 @@ class TimeVaultReplacementEffect extends ReplacementEffectImpl {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
|
|
|
@ -57,12 +57,12 @@ public class Pariah extends CardImpl {
|
||||||
this.expansionSetCode = "USG";
|
this.expansionSetCode = "USG";
|
||||||
this.subtype.add("Aura");
|
this.subtype.add("Aura");
|
||||||
|
|
||||||
|
|
||||||
// Enchant creature
|
// Enchant creature
|
||||||
TargetPermanent auraTarget = new TargetCreaturePermanent();
|
TargetPermanent auraTarget = new TargetCreaturePermanent();
|
||||||
this.getSpellAbility().addTarget(auraTarget);
|
this.getSpellAbility().addTarget(auraTarget);
|
||||||
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
|
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
|
||||||
this.addAbility(new EnchantAbility(auraTarget.getTargetName()));
|
this.addAbility(new EnchantAbility(auraTarget.getTargetName()));
|
||||||
|
|
||||||
// All damage that would be dealt to you is dealt to enchanted creature instead.
|
// All damage that would be dealt to you is dealt to enchanted creature instead.
|
||||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PariahEffect()));
|
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PariahEffect()));
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ class PariahEffect extends ReplacementEffectImpl {
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
DamagePlayerEvent damageEvent = (DamagePlayerEvent) event;
|
DamagePlayerEvent damageEvent = (DamagePlayerEvent) event;
|
||||||
Permanent equipment = game.getPermanent(source.getSourceId());
|
Permanent equipment = game.getPermanent(source.getSourceId());
|
||||||
if(equipment != null){
|
if (equipment != null) {
|
||||||
Permanent p = game.getPermanent(equipment.getAttachedTo());
|
Permanent p = game.getPermanent(equipment.getAttachedTo());
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
p.damage(damageEvent.getAmount(), event.getSourceId(), game, damageEvent.isCombatDamage(), damageEvent.isPreventable());
|
p.damage(damageEvent.getAmount(), event.getSourceId(), game, damageEvent.isCombatDamage(), damageEvent.isPreventable());
|
||||||
|
@ -101,11 +101,14 @@ class PariahEffect extends ReplacementEffectImpl {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == GameEvent.EventType.DAMAGE_PLAYER;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.DAMAGE_PLAYER && event.getPlayerId().equals(source.getControllerId()))
|
return event.getPlayerId().equals(source.getControllerId());
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -35,7 +35,6 @@ import mage.cards.CardImpl;
|
||||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||||
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.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -49,7 +48,6 @@ public class Worship extends CardImpl {
|
||||||
super(ownerId, 57, "Worship", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{W}");
|
super(ownerId, 57, "Worship", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{W}");
|
||||||
this.expansionSetCode = "USG";
|
this.expansionSetCode = "USG";
|
||||||
|
|
||||||
|
|
||||||
// If you control a creature, damage that would reduce your life total to less than 1 reduces it to 1 instead.
|
// If you control a creature, damage that would reduce your life total to less than 1 reduces it to 1 instead.
|
||||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new WorshipReplacementEffect()));
|
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new WorshipReplacementEffect()));
|
||||||
}
|
}
|
||||||
|
@ -81,24 +79,21 @@ class WorshipReplacementEffect extends ReplacementEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
if (event.getType().equals(GameEvent.EventType.DAMAGE_CAUSES_LIFE_LOSS)) {
|
return event.getType() == GameEvent.EventType.DAMAGE_CAUSES_LIFE_LOSS;
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
|
||||||
if (permanent == null) {
|
|
||||||
permanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
|
|
||||||
}
|
}
|
||||||
if (permanent != null) {
|
|
||||||
Player controller = game.getPlayer(permanent.getControllerId());
|
@Override
|
||||||
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
|
if (source.getControllerId().equals(event.getPlayerId())) {
|
||||||
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (controller != null
|
if (controller != null
|
||||||
&& (controller.getLife() - event.getAmount()) < 1
|
&& (controller.getLife() - event.getAmount()) < 1
|
||||||
&& event.getPlayerId().equals(controller.getId())
|
|
||||||
&& game.getBattlefield().count(new FilterControlledCreaturePermanent(), source.getSourceId(), event.getPlayerId(), game) > 0
|
&& game.getBattlefield().count(new FilterControlledCreaturePermanent(), source.getSourceId(), event.getPlayerId(), game) > 0
|
||||||
) {
|
) {
|
||||||
event.setAmount(controller.getLife() - 1);
|
event.setAmount(controller.getLife() - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,5 +106,4 @@ class WorshipReplacementEffect extends ReplacementEffectImpl {
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,6 @@ public class YawgmothsWill extends CardImpl {
|
||||||
super(ownerId, 171, "Yawgmoth's Will", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{2}{B}");
|
super(ownerId, 171, "Yawgmoth's Will", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{2}{B}");
|
||||||
this.expansionSetCode = "USG";
|
this.expansionSetCode = "USG";
|
||||||
|
|
||||||
|
|
||||||
// Until end of turn, you may play cards from your graveyard.
|
// Until end of turn, you may play cards from your graveyard.
|
||||||
this.getSpellAbility().addEffect(new CanPlayCardsFromGraveyardEffect());
|
this.getSpellAbility().addEffect(new CanPlayCardsFromGraveyardEffect());
|
||||||
|
|
||||||
|
@ -130,11 +129,6 @@ class YawgmothsWillReplacementEffect extends ReplacementEffectImpl {
|
||||||
return new YawgmothsWillReplacementEffect(this);
|
return new YawgmothsWillReplacementEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
@ -155,9 +149,14 @@ class YawgmothsWillReplacementEffect extends ReplacementEffectImpl {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == EventType.ZONE_CHANGE;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD) {
|
if (((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD) {
|
||||||
Card card = game.getCard(event.getTargetId());
|
Card card = game.getCard(event.getTargetId());
|
||||||
if (card != null && card.getOwnerId().equals(source.getControllerId())) {
|
if (card != null && card.getOwnerId().equals(source.getControllerId())) {
|
||||||
Permanent permanent = ((ZoneChangeEvent) event).getTarget();
|
Permanent permanent = ((ZoneChangeEvent) event).getTarget();
|
||||||
|
|
|
@ -72,7 +72,6 @@ public class ElephantGrass extends CardImpl {
|
||||||
|
|
||||||
class ElephantGrassReplacementEffect extends ReplacementEffectImpl {
|
class ElephantGrassReplacementEffect extends ReplacementEffectImpl {
|
||||||
|
|
||||||
|
|
||||||
ElephantGrassReplacementEffect ( ) {
|
ElephantGrassReplacementEffect ( ) {
|
||||||
super(Duration.WhileOnBattlefield, Outcome.Neutral);
|
super(Duration.WhileOnBattlefield, Outcome.Neutral);
|
||||||
staticText = "Black creatures can't attack you";
|
staticText = "Black creatures can't attack you";
|
||||||
|
@ -103,7 +102,6 @@ class ElephantGrassReplacementEffect extends ReplacementEffectImpl {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ElephantGrassReplacementEffect copy() {
|
public ElephantGrassReplacementEffect copy() {
|
||||||
return new ElephantGrassReplacementEffect(this);
|
return new ElephantGrassReplacementEffect(this);
|
||||||
|
@ -122,14 +120,8 @@ class ElephantGrassReplacementEffect2 extends ReplacementEffectImpl {
|
||||||
super(effect);
|
super(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
if ( event.getType() == GameEvent.EventType.DECLARE_ATTACKER) {
|
|
||||||
Player player = game.getPlayer(event.getPlayerId());
|
Player player = game.getPlayer(event.getPlayerId());
|
||||||
if ( player != null && event.getTargetId().equals(source.getControllerId())) {
|
if ( player != null && event.getTargetId().equals(source.getControllerId())) {
|
||||||
ManaCostsImpl attackCost = new ManaCostsImpl("{2}");
|
ManaCostsImpl attackCost = new ManaCostsImpl("{2}");
|
||||||
|
@ -141,13 +133,17 @@ class ElephantGrassReplacementEffect2 extends ReplacementEffectImpl {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == GameEvent.EventType.DECLARE_ATTACKER;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if ( event.getType() == GameEvent.EventType.DECLARE_ATTACKER && event.getTargetId().equals(source.getControllerId()) ) {
|
if (event.getTargetId().equals(source.getControllerId()) ) {
|
||||||
Permanent creature = game.getPermanent(event.getSourceId());
|
Permanent creature = game.getPermanent(event.getSourceId());
|
||||||
if (creature != null && !creature.getColor().isBlack()) {
|
if (creature != null && !creature.getColor().isBlack()) {
|
||||||
Player attackedPlayer = game.getPlayer(event.getTargetId());
|
Player attackedPlayer = game.getPlayer(event.getTargetId());
|
||||||
|
|
|
@ -153,35 +153,35 @@ class WrexialReplacementEffect extends ReplacementEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == EventType.ZONE_CHANGE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
|
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||||
|
if (zEvent.getToZone() == Zone.GRAVEYARD
|
||||||
|
&& ((ZoneChangeEvent) event).getTargetId() == cardid) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
UUID eventObject = ((ZoneChangeEvent) event).getTargetId();
|
UUID eventObject = ((ZoneChangeEvent) event).getTargetId();
|
||||||
StackObject card = game.getStack().getStackObject(eventObject);
|
StackObject card = game.getStack().getStackObject(eventObject);
|
||||||
if (card != null) {
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
if (card != null && controller != null) {
|
||||||
if (card instanceof Spell) {
|
if (card instanceof Spell) {
|
||||||
game.rememberLKI(card.getId(), Zone.STACK, (Spell) card);
|
game.rememberLKI(card.getId(), Zone.STACK, (Spell) card);
|
||||||
}
|
}
|
||||||
if (card instanceof Card && eventObject == cardid) {
|
if (card instanceof Card) {
|
||||||
((Card) card).moveToExile(source.getSourceId(), "Wrexial, The Risen Deep", source.getSourceId(), game);
|
controller.moveCardToExileWithInfo((Card)card, null, "", source.getSourceId(), game, game.getState().getZone(event.getTargetId()), true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
|
||||||
if (event.getType() == EventType.ZONE_CHANGE) {
|
|
||||||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
|
||||||
if (zEvent.getToZone() == Zone.GRAVEYARD
|
|
||||||
&& ((ZoneChangeEvent) event).getTargetId() == cardid) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,7 @@ import mage.game.events.GameEvent;
|
||||||
import mage.game.events.GameEvent.EventType;
|
import mage.game.events.GameEvent.EventType;
|
||||||
import mage.game.events.ZoneChangeEvent;
|
import mage.game.events.ZoneChangeEvent;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
import mage.players.Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -59,6 +60,7 @@ public class NissasChosen extends CardImpl {
|
||||||
this.power = new MageInt(2);
|
this.power = new MageInt(2);
|
||||||
this.toughness = new MageInt(3);
|
this.toughness = new MageInt(3);
|
||||||
|
|
||||||
|
// If Nissa's Chosen would be put into a graveyard from the battlefield, put it on the bottom of its owner's library instead
|
||||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new NissasChosenEffect()));
|
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new NissasChosenEffect()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,27 +91,13 @@ class NissasChosenEffect extends ReplacementEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
return false;
|
return event.getType() == EventType.ZONE_CHANGE;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
|
||||||
Permanent permanent = ((ZoneChangeEvent) event).getTarget();
|
|
||||||
if (permanent != null) {
|
|
||||||
if(permanent.moveToZone(Zone.LIBRARY, source.getSourceId(), game, false)) {
|
|
||||||
game.informPlayers(new StringBuilder(permanent.getName()).append(" was put on the bottom of its owner's library").toString());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if ( event.getType() == EventType.ZONE_CHANGE && event.getTargetId().equals(source.getSourceId()) )
|
if (event.getTargetId().equals(source.getSourceId())) {
|
||||||
{
|
|
||||||
ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
|
ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
|
||||||
if ( zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD ) {
|
if ( zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD ) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -118,4 +106,14 @@ class NissasChosenEffect extends ReplacementEffectImpl {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
|
Permanent permanent = ((ZoneChangeEvent) event).getTarget();
|
||||||
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
if (permanent != null && controller != null) {
|
||||||
|
controller.moveCardToLibraryWithInfo(permanent, source.getSourceId(), game, Zone.BATTLEFIELD, false, true);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,7 @@ import mage.cards.CardImpl;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.game.events.GameEvent.EventType;
|
||||||
import mage.target.TargetPlayer;
|
import mage.target.TargetPlayer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -55,7 +56,6 @@ public class UnstableFooting extends CardImpl {
|
||||||
super(ownerId, 153, "Unstable Footing", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{R}");
|
super(ownerId, 153, "Unstable Footing", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{R}");
|
||||||
this.expansionSetCode = "ZEN";
|
this.expansionSetCode = "ZEN";
|
||||||
|
|
||||||
|
|
||||||
// Kicker {3}{R} (You may pay an additional {3}{R} as you cast this spell.)
|
// Kicker {3}{R} (You may pay an additional {3}{R} as you cast this spell.)
|
||||||
this.addAbility(new KickerAbility("{3}{R}"));
|
this.addAbility(new KickerAbility("{3}{R}"));
|
||||||
|
|
||||||
|
@ -64,9 +64,7 @@ public class UnstableFooting extends CardImpl {
|
||||||
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(
|
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(
|
||||||
new DamageTargetEffect(5),
|
new DamageTargetEffect(5),
|
||||||
KickedCondition.getInstance(),
|
KickedCondition.getInstance(),
|
||||||
"If Unstable Footing was kicked, it deals 5 damage to target player"));
|
"If {this} was kicked, it deals 5 damage to target player"));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,22 +104,19 @@ class UnstableFootingEffect extends ReplacementEffectImpl {
|
||||||
return new UnstableFootingEffect(this);
|
return new UnstableFootingEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.PREVENT_DAMAGE) {
|
return event.getType() == EventType.PREVENT_DAMAGE;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
|
@Override
|
||||||
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -64,9 +64,13 @@ public class PlaneswalkerRedirectionEffect extends RedirectionEffect {
|
||||||
return new PlaneswalkerRedirectionEffect(this);
|
return new PlaneswalkerRedirectionEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == EventType.DAMAGE_PLAYER;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == EventType.DAMAGE_PLAYER) {
|
|
||||||
DamageEvent damageEvent = (DamageEvent)event;
|
DamageEvent damageEvent = (DamageEvent)event;
|
||||||
UUID playerId = getSourceControllerId(event.getSourceId(), game);
|
UUID playerId = getSourceControllerId(event.getSourceId(), game);
|
||||||
if (!damageEvent.isCombatDamage() && game.getOpponents(event.getTargetId()).contains(playerId)) {
|
if (!damageEvent.isCombatDamage() && game.getOpponents(event.getTargetId()).contains(playerId)) {
|
||||||
|
@ -82,13 +86,13 @@ public class PlaneswalkerRedirectionEffect extends RedirectionEffect {
|
||||||
else {
|
else {
|
||||||
player.choose(Outcome.Damage, redirectTarget, null, game);
|
player.choose(Outcome.Damage, redirectTarget, null, game);
|
||||||
}
|
}
|
||||||
if (!game.isSimulation())
|
if (!game.isSimulation()) {
|
||||||
game.informPlayers(new StringBuilder(player.getLogName()).append(" redirects ")
|
game.informPlayers(new StringBuilder(player.getLogName()).append(" redirects ")
|
||||||
.append(event.getAmount())
|
.append(event.getAmount())
|
||||||
.append(" damage to ")
|
.append(" damage to ")
|
||||||
.append(game.getPermanent(redirectTarget.getFirstTarget()).getLogName()).toString());
|
.append(game.getPermanent(redirectTarget.getFirstTarget()).getLogName()).toString());
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,9 +79,4 @@ public abstract class ReplacementEffectImpl extends ContinuousEffectImpl impleme
|
||||||
throw new UnsupportedOperationException("Not used for replacemnt effect.");
|
throw new UnsupportedOperationException("Not used for replacemnt effect.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean checksEventType(GameEvent event, Game game) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,8 +59,7 @@ public class AddContinuousEffectToGame extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
ContinuousEffect effectToAdd = effect.copy();
|
game.addEffect(effect, source);
|
||||||
game.addEffect(effectToAdd, source);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue