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