mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
* Icefall Regent, Monastery Siege, Elderwood Scion, Accursed Witch, Infectious Curse - Fixed target check not working for multi modal spells (fixed #2114).
This commit is contained in:
parent
e9c994d8e5
commit
94e59e5ee7
5 changed files with 65 additions and 53 deletions
|
@ -30,6 +30,7 @@ package mage.sets.dragonsoftarkir;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.Mode;
|
||||||
import mage.abilities.SpellAbility;
|
import mage.abilities.SpellAbility;
|
||||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
|
@ -63,7 +64,7 @@ import mage.watchers.Watcher;
|
||||||
* @author fireshoes
|
* @author fireshoes
|
||||||
*/
|
*/
|
||||||
public class IcefallRegent extends CardImpl {
|
public class IcefallRegent extends CardImpl {
|
||||||
|
|
||||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature an opponent controls");
|
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature an opponent controls");
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
@ -79,17 +80,17 @@ public class IcefallRegent extends CardImpl {
|
||||||
|
|
||||||
// Flying
|
// Flying
|
||||||
this.addAbility(FlyingAbility.getInstance());
|
this.addAbility(FlyingAbility.getInstance());
|
||||||
|
|
||||||
// When Icefall Regent enters the battlefield, tap target creature an opponent controls. That creature doesn't untap during its controller's untap step for as long as you control Icefall Regent.
|
// When Icefall Regent enters the battlefield, tap target creature an opponent controls. That creature doesn't untap during its controller's untap step for as long as you control Icefall Regent.
|
||||||
Ability ability = new EntersBattlefieldTriggeredAbility(new TapTargetEffect(), false);
|
Ability ability = new EntersBattlefieldTriggeredAbility(new TapTargetEffect(), false);
|
||||||
ability.addEffect(new IcefallRegentEffect());
|
ability.addEffect(new IcefallRegentEffect());
|
||||||
Target target = new TargetCreaturePermanent(filter);
|
Target target = new TargetCreaturePermanent(filter);
|
||||||
ability.addTarget(target);
|
ability.addTarget(target);
|
||||||
this.addAbility(ability, new IcefallRegentWatcher());
|
this.addAbility(ability, new IcefallRegentWatcher());
|
||||||
|
|
||||||
// Spells your opponents cast that target Icefall Regent cost {2} more to cast.
|
// Spells your opponents cast that target Icefall Regent cost {2} more to cast.
|
||||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new IcefallRegentCostIncreaseEffect()));
|
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new IcefallRegentCostIncreaseEffect()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IcefallRegent(final IcefallRegent card) {
|
public IcefallRegent(final IcefallRegent card) {
|
||||||
|
@ -122,14 +123,14 @@ class IcefallRegentEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checksEventType(GameEvent event, Game game) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
return event.getType() == GameEvent.EventType.LOST_CONTROL ||
|
return event.getType() == GameEvent.EventType.LOST_CONTROL
|
||||||
event.getType() == GameEvent.EventType.ZONE_CHANGE ||
|
|| event.getType() == GameEvent.EventType.ZONE_CHANGE
|
||||||
event.getType() == GameEvent.EventType.UNTAP;
|
|| event.getType() == GameEvent.EventType.UNTAP;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
// Source must be on the battlefield (it's neccessary to check here because if as response to the enter
|
// Source must be on the battlefield (it's neccessary to check here because if as response to the enter
|
||||||
|
@ -147,7 +148,7 @@ class IcefallRegentEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && event.getTargetId().equals(source.getSourceId())) {
|
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && event.getTargetId().equals(source.getSourceId())) {
|
||||||
ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
|
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||||
if (zEvent.getFromZone() == Zone.BATTLEFIELD) {
|
if (zEvent.getFromZone() == Zone.BATTLEFIELD) {
|
||||||
discard();
|
discard();
|
||||||
return false;
|
return false;
|
||||||
|
@ -167,7 +168,7 @@ class IcefallRegentEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
|
|
||||||
class IcefallRegentWatcher extends Watcher {
|
class IcefallRegentWatcher extends Watcher {
|
||||||
|
|
||||||
IcefallRegentWatcher () {
|
IcefallRegentWatcher() {
|
||||||
super("ControlLost", WatcherScope.CARD);
|
super("ControlLost", WatcherScope.CARD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,7 +184,7 @@ class IcefallRegentWatcher extends Watcher {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && event.getTargetId().equals(sourceId)) {
|
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && event.getTargetId().equals(sourceId)) {
|
||||||
ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
|
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||||
if (zEvent.getFromZone() == Zone.BATTLEFIELD) {
|
if (zEvent.getFromZone() == Zone.BATTLEFIELD) {
|
||||||
condition = true;
|
condition = true;
|
||||||
game.replaceEvent(event);
|
game.replaceEvent(event);
|
||||||
|
@ -226,10 +227,12 @@ class IcefallRegentCostIncreaseEffect extends CostModificationEffectImpl {
|
||||||
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||||
if (abilityToModify instanceof SpellAbility) {
|
if (abilityToModify instanceof SpellAbility) {
|
||||||
if (game.getOpponents(source.getControllerId()).contains(abilityToModify.getControllerId())) {
|
if (game.getOpponents(source.getControllerId()).contains(abilityToModify.getControllerId())) {
|
||||||
for (Target target :abilityToModify.getTargets()) {
|
for (Mode mode : abilityToModify.getModes().getSelectedModes()) {
|
||||||
for (UUID targetUUID :target.getTargets()) {
|
for (Target target : mode.getTargets()) {
|
||||||
if (targetUUID.equals(source.getSourceId())) {
|
for (UUID targetUUID : target.getTargets()) {
|
||||||
return true;
|
if (targetUUID.equals(source.getSourceId())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -243,4 +246,4 @@ class IcefallRegentCostIncreaseEffect extends CostModificationEffectImpl {
|
||||||
return new IcefallRegentCostIncreaseEffect(this);
|
return new IcefallRegentCostIncreaseEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ package mage.sets.fatereforged;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.Mode;
|
||||||
import mage.abilities.SpellAbility;
|
import mage.abilities.SpellAbility;
|
||||||
import mage.abilities.common.BeginningOfDrawTriggeredAbility;
|
import mage.abilities.common.BeginningOfDrawTriggeredAbility;
|
||||||
import mage.abilities.common.EntersBattlefieldAbility;
|
import mage.abilities.common.EntersBattlefieldAbility;
|
||||||
|
@ -64,13 +65,13 @@ public class MonasterySiege extends CardImpl {
|
||||||
// As Monastery Siege enters the battlefield, choose Khans or Dragons.
|
// As Monastery Siege enters the battlefield, choose Khans or Dragons.
|
||||||
this.addAbility(new EntersBattlefieldAbility(new ChooseModeEffect("Khans or Dragons?", "Khans", "Dragons"), null,
|
this.addAbility(new EntersBattlefieldAbility(new ChooseModeEffect("Khans or Dragons?", "Khans", "Dragons"), null,
|
||||||
"As {this} enters the battlefield, choose Khans or Dragons.", ""));
|
"As {this} enters the battlefield, choose Khans or Dragons.", ""));
|
||||||
|
|
||||||
// * Khans - At the beginning of your draw step, draw an additional card, then discard a card.
|
// * Khans - At the beginning of your draw step, draw an additional card, then discard a card.
|
||||||
this.addAbility(new ConditionalTriggeredAbility(
|
this.addAbility(new ConditionalTriggeredAbility(
|
||||||
new BeginningOfDrawTriggeredAbility(new DrawDiscardControllerEffect(1, 1), TargetController.YOU, false),
|
new BeginningOfDrawTriggeredAbility(new DrawDiscardControllerEffect(1, 1), TargetController.YOU, false),
|
||||||
new ModeChoiceSourceCondition("Khans"),
|
new ModeChoiceSourceCondition("Khans"),
|
||||||
"• Khans — At the beginning of your draw step, draw an additional card, then discard a card."));
|
"• Khans — At the beginning of your draw step, draw an additional card, then discard a card."));
|
||||||
|
|
||||||
// * Dragons - Spells your opponents cast that target you or a permanent you control cost {2} more to cast.
|
// * Dragons - Spells your opponents cast that target you or a permanent you control cost {2} more to cast.
|
||||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new MonasterySiegeCostIncreaseEffect()));
|
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new MonasterySiegeCostIncreaseEffect()));
|
||||||
}
|
}
|
||||||
|
@ -108,14 +109,16 @@ class MonasterySiegeCostIncreaseEffect extends CostModificationEffectImpl {
|
||||||
if (new ModeChoiceSourceCondition("Dragons").apply(game, source)) {
|
if (new ModeChoiceSourceCondition("Dragons").apply(game, source)) {
|
||||||
if (abilityToModify instanceof SpellAbility) {
|
if (abilityToModify instanceof SpellAbility) {
|
||||||
if (game.getOpponents(source.getControllerId()).contains(abilityToModify.getControllerId())) {
|
if (game.getOpponents(source.getControllerId()).contains(abilityToModify.getControllerId())) {
|
||||||
for (Target target : abilityToModify.getTargets()) {
|
for (Mode mode : abilityToModify.getModes().getSelectedModes()) {
|
||||||
for (UUID targetUUID : target.getTargets()) {
|
for (Target target : mode.getTargets()) {
|
||||||
if (targetUUID.equals(source.getControllerId())) {
|
for (UUID targetUUID : target.getTargets()) {
|
||||||
return true;
|
if (targetUUID.equals(source.getControllerId())) {
|
||||||
}
|
return true;
|
||||||
Permanent permanent = game.getPermanent(targetUUID);
|
}
|
||||||
if (permanent != null && permanent.getControllerId().equals(source.getControllerId())) {
|
Permanent permanent = game.getPermanent(targetUUID);
|
||||||
return true;
|
if (permanent != null && permanent.getControllerId().equals(source.getControllerId())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,11 +27,10 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.planechase2012;
|
package mage.sets.planechase2012;
|
||||||
|
|
||||||
import mage.constants.CardType;
|
import java.util.UUID;
|
||||||
import mage.constants.Rarity;
|
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.Mode;
|
||||||
import mage.abilities.SpellAbility;
|
import mage.abilities.SpellAbility;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
|
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
|
||||||
|
@ -39,15 +38,16 @@ import mage.abilities.keyword.FlashbackAbility;
|
||||||
import mage.abilities.keyword.LifelinkAbility;
|
import mage.abilities.keyword.LifelinkAbility;
|
||||||
import mage.abilities.keyword.TrampleAbility;
|
import mage.abilities.keyword.TrampleAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.CostModificationType;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Rarity;
|
||||||
|
import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.target.Target;
|
import mage.target.Target;
|
||||||
import mage.util.CardUtil;
|
import mage.util.CardUtil;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.constants.CostModificationType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
|
@ -106,10 +106,12 @@ class ElderwoodScionCostReductionEffect extends CostModificationEffectImpl {
|
||||||
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||||
if (abilityToModify instanceof SpellAbility || abilityToModify instanceof FlashbackAbility) {
|
if (abilityToModify instanceof SpellAbility || abilityToModify instanceof FlashbackAbility) {
|
||||||
if (abilityToModify.getControllerId().equals(source.getControllerId())) {
|
if (abilityToModify.getControllerId().equals(source.getControllerId())) {
|
||||||
for (Target target :abilityToModify.getTargets()) {
|
for (Mode mode : abilityToModify.getModes().getSelectedModes()) {
|
||||||
for (UUID targetUUID :target.getTargets()) {
|
for (Target target : mode.getTargets()) {
|
||||||
if (targetUUID.equals(source.getSourceId())) {
|
for (UUID targetUUID : target.getTargets()) {
|
||||||
return true;
|
if (targetUUID.equals(source.getSourceId())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -149,8 +151,8 @@ class ElderwoodScionCostReductionEffect2 extends CostModificationEffectImpl {
|
||||||
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||||
if (abilityToModify instanceof SpellAbility) {
|
if (abilityToModify instanceof SpellAbility) {
|
||||||
if (game.getOpponents(source.getControllerId()).contains(abilityToModify.getControllerId())) {
|
if (game.getOpponents(source.getControllerId()).contains(abilityToModify.getControllerId())) {
|
||||||
for (Target target :abilityToModify.getTargets()) {
|
for (Target target : abilityToModify.getTargets()) {
|
||||||
for (UUID targetUUID :target.getTargets()) {
|
for (UUID targetUUID : target.getTargets()) {
|
||||||
if (targetUUID.equals(source.getSourceId())) {
|
if (targetUUID.equals(source.getSourceId())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ package mage.sets.shadowsoverinnistrad;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.Mode;
|
||||||
import mage.abilities.SpellAbility;
|
import mage.abilities.SpellAbility;
|
||||||
import mage.abilities.common.DiesTriggeredAbility;
|
import mage.abilities.common.DiesTriggeredAbility;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
|
@ -138,12 +139,14 @@ class AccursedWitchSpellsCostReductionEffect extends CostModificationEffectImpl
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||||
if (abilityToModify instanceof SpellAbility) {
|
if (abilityToModify instanceof SpellAbility) {
|
||||||
if(game.getOpponents(source.getControllerId()).contains(abilityToModify.getControllerId())) {
|
if (game.getOpponents(source.getControllerId()).contains(abilityToModify.getControllerId())) {
|
||||||
for (Target target : abilityToModify.getTargets()) {
|
for (Mode mode : abilityToModify.getModes().getSelectedModes()) {
|
||||||
for (UUID targetUUID : target.getTargets()) {
|
for (Target target : mode.getTargets()) {
|
||||||
Permanent permanent = game.getPermanent(targetUUID);
|
for (UUID targetUUID : target.getTargets()) {
|
||||||
if(permanent != null && permanent.getId().equals(source.getSourceId())) {
|
Permanent permanent = game.getPermanent(targetUUID);
|
||||||
return true;
|
if (permanent != null && permanent.getId().equals(source.getSourceId())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -157,5 +160,3 @@ class AccursedWitchSpellsCostReductionEffect extends CostModificationEffectImpl
|
||||||
return new AccursedWitchSpellsCostReductionEffect(this);
|
return new AccursedWitchSpellsCostReductionEffect(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ package mage.sets.shadowsoverinnistrad;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.Mode;
|
||||||
import mage.abilities.SpellAbility;
|
import mage.abilities.SpellAbility;
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
|
@ -154,12 +155,14 @@ class InfectiousCurseCostReductionEffect extends CostModificationEffectImpl {
|
||||||
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||||
if (abilityToModify instanceof SpellAbility) {
|
if (abilityToModify instanceof SpellAbility) {
|
||||||
if (source.getControllerId().equals(abilityToModify.getControllerId())) {
|
if (source.getControllerId().equals(abilityToModify.getControllerId())) {
|
||||||
for (Target target : abilityToModify.getTargets()) {
|
for (Mode mode : abilityToModify.getModes().getSelectedModes()) {
|
||||||
for (UUID targetUUID : target.getTargets()) {
|
for (Target target : mode.getTargets()) {
|
||||||
Permanent enchantment = game.getPermanent(source.getSourceId());
|
for (UUID targetUUID : target.getTargets()) {
|
||||||
UUID attachedTo = enchantment.getAttachedTo();
|
Permanent enchantment = game.getPermanent(source.getSourceId());
|
||||||
if (targetUUID.equals(attachedTo)) {
|
UUID attachedTo = enchantment.getAttachedTo();
|
||||||
return true;
|
if (targetUUID.equals(attachedTo)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue