mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
simplified various cards to use isInstantOrSorcery method
This commit is contained in:
parent
df866f858e
commit
2a42bec1f2
38 changed files with 46 additions and 43 deletions
|
@ -87,7 +87,7 @@ class AbeyanceEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (event.getType() == GameEvent.EventType.CAST_SPELL
|
if (event.getType() == GameEvent.EventType.CAST_SPELL
|
||||||
&& (object.isInstant() || object.isSorcery())) {
|
&& object.isInstantOrSorcery()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (event.getType() == GameEvent.EventType.ACTIVATE_ABILITY) {
|
if (event.getType() == GameEvent.EventType.ACTIVATE_ABILITY) {
|
||||||
|
|
|
@ -131,7 +131,7 @@ class AzorTheLawbringerCantCastEffect extends ContinuousRuleModifyingEffectImpl
|
||||||
if (opponentId.equals(event.getPlayerId())) {
|
if (opponentId.equals(event.getPlayerId())) {
|
||||||
MageObject object = game.getObject(event.getSourceId());
|
MageObject object = game.getObject(event.getSourceId());
|
||||||
if (event.getType() == GameEvent.EventType.CAST_SPELL) {
|
if (event.getType() == GameEvent.EventType.CAST_SPELL) {
|
||||||
if (object.isInstant() || object.isSorcery()) {
|
if (object.isInstantOrSorcery()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package mage.cards.b;
|
package mage.cards.b;
|
||||||
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
|
import mage.MageObject;
|
||||||
import mage.MageObjectReference;
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.AttacksTriggeredAbility;
|
import mage.abilities.common.AttacksTriggeredAbility;
|
||||||
|
@ -75,7 +76,7 @@ class BackdraftHellkiteEffect extends ContinuousEffectImpl {
|
||||||
player.getGraveyard()
|
player.getGraveyard()
|
||||||
.stream()
|
.stream()
|
||||||
.map((cardId) -> game.getCard(cardId))
|
.map((cardId) -> game.getCard(cardId))
|
||||||
.filter(card -> card.isInstant() || card.isSorcery())
|
.filter(MageObject::isInstantOrSorcery)
|
||||||
.forEachOrdered(card -> affectedObjectList.add(new MageObjectReference(card, game)));
|
.forEachOrdered(card -> affectedObjectList.add(new MageObjectReference(card, game)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ class BlazeCommandoTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
if (isControlledBy(game.getControllerId(event.getSourceId()))) {
|
if (isControlledBy(game.getControllerId(event.getSourceId()))) {
|
||||||
MageObject damageSource = game.getObject(event.getSourceId());
|
MageObject damageSource = game.getObject(event.getSourceId());
|
||||||
if (damageSource != null) {
|
if (damageSource != null) {
|
||||||
if (damageSource.isInstant()|| damageSource.isSorcery()) {
|
if (damageSource.isInstantOrSorcery()) {
|
||||||
if (!handledStackObjects.contains(damageSource.getId())) {
|
if (!handledStackObjects.contains(damageSource.getId())) {
|
||||||
handledStackObjects.add(damageSource.getId());
|
handledStackObjects.add(damageSource.getId());
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -60,7 +60,7 @@ class BonusRoundDelayedTriggeredAbility extends DelayedTriggeredAbility {
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||||
if (spell != null && (spell.isInstant() || spell.isSorcery())) {
|
if (spell != null && spell.isInstantOrSorcery()) {
|
||||||
this.getEffects().setTargetPointer(new FixedTarget(event.getTargetId()));
|
this.getEffects().setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ class BoseijuWhoSheltersAllWatcher extends Watcher {
|
||||||
if (event.getType() == GameEvent.EventType.MANA_PAID) {
|
if (event.getType() == GameEvent.EventType.MANA_PAID) {
|
||||||
if (event.getData() != null && event.getData().equals(originalId.toString()) && event.getTargetId() != null) {
|
if (event.getData() != null && event.getData().equals(originalId.toString()) && event.getTargetId() != null) {
|
||||||
Card spell = game.getSpell(event.getTargetId());
|
Card spell = game.getSpell(event.getTargetId());
|
||||||
if (spell != null && (spell.isInstant() || spell.isSorcery())) {
|
if (spell != null && spell.isInstantOrSorcery()) {
|
||||||
spells.add(new MageObjectReference(game.getObject(event.getTargetId()), game));
|
spells.add(new MageObjectReference(game.getObject(event.getTargetId()), game));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ class ChandraTheFirebrandAbility extends DelayedTriggeredAbility {
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
if (event.getPlayerId().equals(this.getControllerId())) {
|
if (event.getPlayerId().equals(this.getControllerId())) {
|
||||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||||
if (spell != null && (spell.isInstant() || spell.isSorcery())) {
|
if (spell != null && spell.isInstantOrSorcery()) {
|
||||||
for (Effect effect : this.getEffects()) {
|
for (Effect effect : this.getEffects()) {
|
||||||
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ class ChaosWandEffect extends OneShotEffect {
|
||||||
}
|
}
|
||||||
opponent.moveCards(card, Zone.EXILED, source, game);
|
opponent.moveCards(card, Zone.EXILED, source, game);
|
||||||
controller.revealCards(source, new CardsImpl(card), game);
|
controller.revealCards(source, new CardsImpl(card), game);
|
||||||
if (card.isInstant() || card.isSorcery()) {
|
if (card.isInstantOrSorcery()) {
|
||||||
boolean cardWasCast = false;
|
boolean cardWasCast = false;
|
||||||
if (controller.chooseUse(Outcome.PlayForFree, "Cast " + card.getName()
|
if (controller.chooseUse(Outcome.PlayForFree, "Cast " + card.getName()
|
||||||
+ " without paying its mana cost?", source, game)) {
|
+ " without paying its mana cost?", source, game)) {
|
||||||
|
|
|
@ -85,7 +85,7 @@ class CurseOfEchoesCopyTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||||
if (spell != null && (spell.isInstant() || spell.isSorcery())) {
|
if (spell != null && spell.isInstantOrSorcery()) {
|
||||||
Permanent enchantment = game.getPermanent(sourceId);
|
Permanent enchantment = game.getPermanent(sourceId);
|
||||||
if (enchantment != null && enchantment.getAttachedTo() != null) {
|
if (enchantment != null && enchantment.getAttachedTo() != null) {
|
||||||
Player player = game.getPlayer(enchantment.getAttachedTo());
|
Player player = game.getPlayer(enchantment.getAttachedTo());
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package mage.cards.d;
|
package mage.cards.d;
|
||||||
|
|
||||||
|
import mage.MageObject;
|
||||||
import mage.abilities.common.SpellCastControllerTriggeredAbility;
|
import mage.abilities.common.SpellCastControllerTriggeredAbility;
|
||||||
import mage.abilities.effects.common.CopyTargetSpellEffect;
|
import mage.abilities.effects.common.CopyTargetSpellEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
@ -71,7 +72,7 @@ class DoubleVisionCopyTriggeredAbility extends SpellCastControllerTriggeredAbili
|
||||||
if (watcher != null) {
|
if (watcher != null) {
|
||||||
List<Spell> eligibleSpells = watcher.getSpellsCastThisTurn(this.getControllerId())
|
List<Spell> eligibleSpells = watcher.getSpellsCastThisTurn(this.getControllerId())
|
||||||
.stream()
|
.stream()
|
||||||
.filter(s -> s.isInstant() || s.isSorcery())
|
.filter(MageObject::isInstantOrSorcery)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
return eligibleSpells.size() == 1 && eligibleSpells.get(0).getId().equals(spell.getId());
|
return eligibleSpells.size() == 1 && eligibleSpells.get(0).getId().equals(spell.getId());
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ class DoublecastAbility extends DelayedTriggeredAbility {
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
if (event.getPlayerId().equals(this.getControllerId())) {
|
if (event.getPlayerId().equals(this.getControllerId())) {
|
||||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||||
if (spell != null && (spell.isInstant() || spell.isSorcery())) {
|
if (spell != null && spell.isInstantOrSorcery()) {
|
||||||
for (Effect effect : this.getEffects()) {
|
for (Effect effect : this.getEffects()) {
|
||||||
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ class EyeOfTheStormAbility extends TriggeredAbilityImpl {
|
||||||
&& !spell.isCopy()
|
&& !spell.isCopy()
|
||||||
&& spell.getCard() != null
|
&& spell.getCard() != null
|
||||||
&& !spell.getCard().isCopy()
|
&& !spell.getCard().isCopy()
|
||||||
&& (spell.isInstant() || spell.isSorcery())) {
|
&& spell.isInstantOrSorcery()) {
|
||||||
for (Effect effect : this.getEffects()) {
|
for (Effect effect : this.getEffects()) {
|
||||||
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ class FireServantEffect extends ReplacementEffectImpl {
|
||||||
return spell != null &&
|
return spell != null &&
|
||||||
spell.isControlledBy(source.getControllerId()) &&
|
spell.isControlledBy(source.getControllerId()) &&
|
||||||
spell.getColor(game).isRed() &&
|
spell.getColor(game).isRed() &&
|
||||||
(spell.isInstant() || spell.isSorcery());
|
spell.isInstantOrSorcery();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -75,7 +75,7 @@ class ForethoughtAmuletEffect extends ReplacementEffectImpl {
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getAmount() >= 3) {
|
if (event.getAmount() >= 3) {
|
||||||
MageObject object = game.getObject(event.getSourceId());
|
MageObject object = game.getObject(event.getSourceId());
|
||||||
return object != null && (object.isInstant() || object.isSorcery());
|
return object != null && object.isInstantOrSorcery();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ class GalvanothEffect extends OneShotEffect {
|
||||||
Card card = controller.getLibrary().getFromTop(game);
|
Card card = controller.getLibrary().getFromTop(game);
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
controller.lookAtCards(source, null, new CardsImpl(card), game);
|
controller.lookAtCards(source, null, new CardsImpl(card), game);
|
||||||
if (card.isInstant() || card.isSorcery()) {
|
if (card.isInstantOrSorcery()) {
|
||||||
if (controller.chooseUse(Outcome.PlayForFree, "Cast " + card.getName() + " without paying its mana cost?", source, game)) {
|
if (controller.chooseUse(Outcome.PlayForFree, "Cast " + card.getName() + " without paying its mana cost?", source, game)) {
|
||||||
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), Boolean.TRUE);
|
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), Boolean.TRUE);
|
||||||
controller.cast(controller.chooseAbilityForCast(card, game, true),
|
controller.cast(controller.chooseAbilityForCast(card, game, true),
|
||||||
|
|
|
@ -79,7 +79,7 @@ class HowlOfTheHordeDelayedTriggeredAbility extends DelayedTriggeredAbility {
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
if (event.getPlayerId().equals(this.getControllerId())) {
|
if (event.getPlayerId().equals(this.getControllerId())) {
|
||||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||||
if (spell != null && (spell.isInstant() || spell.isSorcery())) {
|
if (spell != null && spell.isInstantOrSorcery()) {
|
||||||
for (Effect effect : this.getEffects()) {
|
for (Effect effect : this.getEffects()) {
|
||||||
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,8 +87,8 @@ class MirariTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
private boolean isControlledInstantOrSorcery(Spell spell) {
|
private boolean isControlledInstantOrSorcery(Spell spell) {
|
||||||
return spell != null
|
return spell != null
|
||||||
&& (spell.isControlledBy(this.getControllerId()))
|
&& spell.isControlledBy(this.getControllerId())
|
||||||
&& (spell.isInstant() || spell.isSorcery());
|
&& spell.isInstantOrSorcery();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -129,7 +129,7 @@ class NarsetTranscendentTriggeredAbility extends DelayedTriggeredAbility {
|
||||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||||
if (spell != null && spell.getFromZone() == Zone.HAND) {
|
if (spell != null && spell.getFromZone() == Zone.HAND) {
|
||||||
if (spell.getCard() != null
|
if (spell.getCard() != null
|
||||||
&& spell.getCard().isInstant() || spell.getCard().isSorcery()) {
|
&& spell.getCard().isInstantOrSorcery()) {
|
||||||
for (Effect effect : getEffects()) {
|
for (Effect effect : getEffects()) {
|
||||||
effect.setTargetPointer(new FixedTarget(spell.getId()));
|
effect.setTargetPointer(new FixedTarget(spell.getId()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ class NivixAerieOfTheFiremindEffect extends OneShotEffect {
|
||||||
Card card = library.getFromTop(game);
|
Card card = library.getFromTop(game);
|
||||||
if (card != null
|
if (card != null
|
||||||
&& controller.moveCardsToExile(card, source, game, true, source.getSourceId(), CardUtil.createObjectRealtedWindowTitle(source, game, null))
|
&& controller.moveCardsToExile(card, source, game, true, source.getSourceId(), CardUtil.createObjectRealtedWindowTitle(source, game, null))
|
||||||
&& (card.isInstant() || card.isSorcery())) {
|
&& card.isInstantOrSorcery()) {
|
||||||
ContinuousEffect effect = new NivixAerieOfTheFiremindCanCastEffect();
|
ContinuousEffect effect = new NivixAerieOfTheFiremindCanCastEffect();
|
||||||
effect.setTargetPointer(new FixedTarget(card.getId()));
|
effect.setTargetPointer(new FixedTarget(card.getId()));
|
||||||
game.addEffect(effect, source);
|
game.addEffect(effect, source);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package mage.cards.p;
|
package mage.cards.p;
|
||||||
|
|
||||||
|
import mage.MageObject;
|
||||||
import mage.MageObjectReference;
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
|
@ -63,7 +64,7 @@ class PastInFlamesEffect extends ContinuousEffectImpl {
|
||||||
if (this.affectedObjectsSet) {
|
if (this.affectedObjectsSet) {
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
player.getGraveyard().stream().map((cardId) -> game.getCard(cardId)).filter((card) -> (card.isInstant() || card.isSorcery())).forEachOrdered((card) -> {
|
player.getGraveyard().stream().map((cardId) -> game.getCard(cardId)).filter(MageObject::isInstantOrSorcery).forEachOrdered((card) -> {
|
||||||
affectedObjectList.add(new MageObjectReference(card, game));
|
affectedObjectList.add(new MageObjectReference(card, game));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,8 +87,8 @@ class PyromancerAscensionQuestTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
private boolean isControlledInstantOrSorcery(Spell spell) {
|
private boolean isControlledInstantOrSorcery(Spell spell) {
|
||||||
return spell != null &&
|
return spell != null &&
|
||||||
(spell.isControlledBy(this.getControllerId())) &&
|
spell.isControlledBy(this.getControllerId()) &&
|
||||||
(spell.isInstant() || spell.isSorcery());
|
spell.isInstantOrSorcery();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -134,8 +134,8 @@ class PyromancerAscensionCopyTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
private boolean isControlledInstantOrSorcery(Spell spell) {
|
private boolean isControlledInstantOrSorcery(Spell spell) {
|
||||||
return spell != null &&
|
return spell != null &&
|
||||||
(spell.isControlledBy(this.getControllerId())) &&
|
spell.isControlledBy(this.getControllerId()) &&
|
||||||
(spell.isInstant() || spell.isSorcery());
|
spell.isInstantOrSorcery();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -68,7 +68,7 @@ class PyromancersSwathReplacementEffect extends ReplacementEffectImpl {
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (source.isControlledBy(game.getControllerId(event.getSourceId()))) {
|
if (source.isControlledBy(game.getControllerId(event.getSourceId()))) {
|
||||||
MageObject object = game.getObject(event.getSourceId());
|
MageObject object = game.getObject(event.getSourceId());
|
||||||
return object != null && (object.isInstant() || object.isSorcery());
|
return object != null && object.isInstantOrSorcery();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,7 +120,7 @@ class RalStormConduitDelayedTriggeredAbility extends DelayedTriggeredAbility {
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
if (event.getPlayerId().equals(this.getControllerId())) {
|
if (event.getPlayerId().equals(this.getControllerId())) {
|
||||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||||
if (spell != null && (spell.isInstant() || spell.isSorcery())) {
|
if (spell != null && spell.isInstantOrSorcery()) {
|
||||||
for (Effect effect : this.getEffects()) {
|
for (Effect effect : this.getEffects()) {
|
||||||
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@ class SatyrFiredancerTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
MageObject sourceObject = game.getObject(event.getSourceId());
|
MageObject sourceObject = game.getObject(event.getSourceId());
|
||||||
if (sourceObject == null || !(sourceObject.isInstant() || sourceObject.isSorcery())) {
|
if (sourceObject == null || !sourceObject.isInstantOrSorcery()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (Effect effect : this.getEffects()) {
|
for (Effect effect : this.getEffects()) {
|
||||||
|
|
|
@ -119,7 +119,7 @@ class SentinelTowerWatcher extends Watcher {
|
||||||
public void watch(GameEvent event, Game game) {
|
public void watch(GameEvent event, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.SPELL_CAST) {
|
if (event.getType() == GameEvent.EventType.SPELL_CAST) {
|
||||||
MageObject object = game.getObject(event.getTargetId());
|
MageObject object = game.getObject(event.getTargetId());
|
||||||
if (object != null && (object.isInstant() || object.isSorcery())) {
|
if (object != null && object.isInstantOrSorcery()) {
|
||||||
spellsThisTurn.add(new MageObjectReference(object, game));
|
spellsThisTurn.add(new MageObjectReference(object, game));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,7 +111,7 @@ class SphinxsDecreeCantCastEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
if (opponentId.equals(event.getPlayerId())) {
|
if (opponentId.equals(event.getPlayerId())) {
|
||||||
MageObject object = game.getObject(event.getSourceId());
|
MageObject object = game.getObject(event.getSourceId());
|
||||||
if (event.getType() == GameEvent.EventType.CAST_SPELL) {
|
if (event.getType() == GameEvent.EventType.CAST_SPELL) {
|
||||||
if (object != null && (object.isInstant() || object.isSorcery())) {
|
if (object != null && object.isInstantOrSorcery()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,7 @@ class TaigamOjutaiMasterTriggeredAbility extends DelayedTriggeredAbility {
|
||||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||||
if (spell != null && spell.getFromZone() == Zone.HAND) {
|
if (spell != null && spell.getFromZone() == Zone.HAND) {
|
||||||
if (spell.getCard() != null
|
if (spell.getCard() != null
|
||||||
&& spell.getCard().isInstant() || spell.getCard().isSorcery()) {
|
&& spell.getCard().isInstantOrSorcery()) {
|
||||||
for (Effect effect : getEffects()) {
|
for (Effect effect : getEffects()) {
|
||||||
effect.setTargetPointer(new FixedTarget(spell.getId()));
|
effect.setTargetPointer(new FixedTarget(spell.getId()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,7 +120,7 @@ class TergridGodOfFrightTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
if (event.getType() == GameEvent.EventType.DISCARDED_CARD) {
|
if (event.getType() == GameEvent.EventType.DISCARDED_CARD) {
|
||||||
Card discardedCard = game.getCard(event.getTargetId());
|
Card discardedCard = game.getCard(event.getTargetId());
|
||||||
if (discardedCard != null
|
if (discardedCard != null
|
||||||
&& !(discardedCard.isInstantOrSorcery())) {
|
&& !discardedCard.isInstantOrSorcery()) {
|
||||||
for (Effect effect : this.getEffects()) {
|
for (Effect effect : this.getEffects()) {
|
||||||
effect.setTargetPointer(new FixedTarget(discardedCard.getId(), game));
|
effect.setTargetPointer(new FixedTarget(discardedCard.getId(), game));
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,7 @@ class TheMirariConjectureDelayedTriggeredAbility extends DelayedTriggeredAbility
|
||||||
if (event.getPlayerId().equals(this.getControllerId())) {
|
if (event.getPlayerId().equals(this.getControllerId())) {
|
||||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||||
if (spell != null
|
if (spell != null
|
||||||
&& (spell.isInstant() || spell.isSorcery())) {
|
&& spell.isInstantOrSorcery()) {
|
||||||
this.getEffects().setTargetPointer(new FixedTarget(event.getTargetId()));
|
this.getEffects().setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -158,7 +158,7 @@ class ThousandYearStormWatcher extends Watcher {
|
||||||
public void watch(GameEvent event, Game game) {
|
public void watch(GameEvent event, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.SPELL_CAST) {
|
if (event.getType() == GameEvent.EventType.SPELL_CAST) {
|
||||||
MageObject object = game.getObject(event.getTargetId());
|
MageObject object = game.getObject(event.getTargetId());
|
||||||
if (object != null && (object.isInstant() || object.isSorcery())) {
|
if (object != null && object.isInstantOrSorcery()) {
|
||||||
UUID playerId = event.getPlayerId();
|
UUID playerId = event.getPlayerId();
|
||||||
List<MageObjectReference> spellsCast = spellsThisTurn.getOrDefault(playerId, new ArrayList<MageObjectReference>());
|
List<MageObjectReference> spellsCast = spellsThisTurn.getOrDefault(playerId, new ArrayList<MageObjectReference>());
|
||||||
spellsCast.add(new MageObjectReference(object, game));
|
spellsCast.add(new MageObjectReference(object, game));
|
||||||
|
|
|
@ -67,7 +67,7 @@ class CreaturesYouControlBecomesTargetTriggeredAbility extends TriggeredAbilityI
|
||||||
MageObject object = game.getObject(event.getSourceId());
|
MageObject object = game.getObject(event.getSourceId());
|
||||||
if (object instanceof Spell) {
|
if (object instanceof Spell) {
|
||||||
Card c = (Spell) object;
|
Card c = (Spell) object;
|
||||||
if (c.isInstant() || c.isSorcery()) {
|
if (c.isInstantOrSorcery()) {
|
||||||
if (getTargets().isEmpty()) {
|
if (getTargets().isEmpty()) {
|
||||||
for (Effect effect : getEffects()) {
|
for (Effect effect : getEffects()) {
|
||||||
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class PreventDamageByTargetEffect extends PreventionEffectImpl {
|
||||||
if (!this.used && super.applies(event, source, game)) {
|
if (!this.used && super.applies(event, source, game)) {
|
||||||
MageObject mageObject = game.getObject(event.getSourceId());
|
MageObject mageObject = game.getObject(event.getSourceId());
|
||||||
if (mageObject != null
|
if (mageObject != null
|
||||||
&& (mageObject.isInstant() || mageObject.isSorcery())) {
|
&& mageObject.isInstantOrSorcery()) {
|
||||||
for (Target target : source.getTargets()) {
|
for (Target target : source.getTargets()) {
|
||||||
if (target instanceof TargetSpell) {
|
if (target instanceof TargetSpell) {
|
||||||
if (((TargetSpell) target).getSourceIds().contains(event.getSourceId())) {
|
if (((TargetSpell) target).getSourceIds().contains(event.getSourceId())) {
|
||||||
|
|
|
@ -23,7 +23,7 @@ public class SupportEffect extends AddCountersTargetEffect {
|
||||||
super(CounterType.P1P1.createInstance(0), StaticValue.get(1));
|
super(CounterType.P1P1.createInstance(0), StaticValue.get(1));
|
||||||
this.amountSupportTargets = StaticValue.get(amount);
|
this.amountSupportTargets = StaticValue.get(amount);
|
||||||
this.otherPermanent = otherPermanent;
|
this.otherPermanent = otherPermanent;
|
||||||
if (card.isInstant() || card.isSorcery()) {
|
if (card.isInstantOrSorcery()) {
|
||||||
card.getSpellAbility().addTarget(new TargetCreaturePermanent(0, amount, new FilterCreaturePermanent("target creatures"), false));
|
card.getSpellAbility().addTarget(new TargetCreaturePermanent(0, amount, new FilterCreaturePermanent("target creatures"), false));
|
||||||
}
|
}
|
||||||
staticText = setText();
|
staticText = setText();
|
||||||
|
|
|
@ -99,7 +99,7 @@ public class ProtectionAbility extends StaticAbility {
|
||||||
// object is still a card and not a spell yet. So return only if the source object can't be a spell
|
// object is still a card and not a spell yet. So return only if the source object can't be a spell
|
||||||
// otherwise the following FilterObject check will be applied
|
// otherwise the following FilterObject check will be applied
|
||||||
if (source instanceof StackObject
|
if (source instanceof StackObject
|
||||||
|| (!source.isInstant() && !source.isSorcery())) {
|
|| !source.isInstantOrSorcery()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ public class ProtectionAbility extends StaticAbility {
|
||||||
// Emrakul, the Aeons Torn
|
// Emrakul, the Aeons Torn
|
||||||
if (filter instanceof FilterStackObject) {
|
if (filter instanceof FilterStackObject) {
|
||||||
if (filter.match(source, game)) {
|
if (filter.match(source, game)) {
|
||||||
return (!source.isInstantOrSorcery());
|
return !source.isInstantOrSorcery();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class SupportAbility extends EntersBattlefieldTriggeredAbility {
|
||||||
*/
|
*/
|
||||||
public SupportAbility(Card card, int amount, boolean otherPermanent) {
|
public SupportAbility(Card card, int amount, boolean otherPermanent) {
|
||||||
super(new SupportEffect(card, amount, otherPermanent));
|
super(new SupportEffect(card, amount, otherPermanent));
|
||||||
if (!card.isInstant() && !card.isSorcery()) {
|
if (!card.isInstantOrSorcery()) {
|
||||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures");
|
FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures");
|
||||||
if (card.isCreature()) {
|
if (card.isCreature()) {
|
||||||
filter.add(AnotherPredicate.instance);
|
filter.add(AnotherPredicate.instance);
|
||||||
|
|
|
@ -44,7 +44,7 @@ class InstantOrSorceryCastManaCondition extends ManaCondition implements Conditi
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
if (source instanceof SpellAbility) {
|
if (source instanceof SpellAbility) {
|
||||||
MageObject object = game.getObject(source.getSourceId());
|
MageObject object = game.getObject(source.getSourceId());
|
||||||
return object != null && (object.isInstant() || object.isSorcery());
|
return object != null && object.isInstantOrSorcery();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,7 +110,7 @@ public final class RateCard {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int isRemoval(Card card) {
|
private static int isRemoval(Card card) {
|
||||||
if (card.isEnchantment() || card.isInstant() || card.isSorcery()) {
|
if (card.isEnchantment() || card.isInstantOrSorcery()) {
|
||||||
|
|
||||||
for (Ability ability : card.getAbilities()) {
|
for (Ability ability : card.getAbilities()) {
|
||||||
for (Effect effect : ability.getEffects()) {
|
for (Effect effect : ability.getEffects()) {
|
||||||
|
|
|
@ -207,7 +207,7 @@ public class Spell extends StackObjImpl implements Card {
|
||||||
turnController.controlPlayersTurn(game, controller.getId());
|
turnController.controlPlayersTurn(game, controller.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.isInstant() || this.isSorcery()) {
|
if (this.isInstantOrSorcery()) {
|
||||||
int index = 0;
|
int index = 0;
|
||||||
result = false;
|
result = false;
|
||||||
boolean legalParts = false;
|
boolean legalParts = false;
|
||||||
|
|
Loading…
Reference in a new issue