mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
* Fixed some prroblems with can't cast effects and morph ability (related to Reflector Mage, Exclusion Ritual and Alhammarret High Arbiter).
This commit is contained in:
parent
3f57012c85
commit
4674b18a51
4 changed files with 30 additions and 13 deletions
|
@ -173,7 +173,7 @@ class AlhammarretHighArbiterCantCastEffect extends ContinuousRuleModifyingEffect
|
|||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == EventType.CAST_SPELL;
|
||||
return event.getType() == EventType.CAST_SPELL_LATE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -28,8 +28,6 @@
|
|||
package mage.sets.newphyrexia;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.constants.*;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
|
@ -37,6 +35,7 @@ import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
|
|||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.*;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
|
@ -50,6 +49,7 @@ import mage.target.TargetPermanent;
|
|||
* @author Loki
|
||||
*/
|
||||
public class ExclusionRitual extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter = new FilterPermanent("nonland permanent");
|
||||
|
||||
static {
|
||||
|
@ -60,7 +60,6 @@ public class ExclusionRitual extends CardImpl {
|
|||
super(ownerId, 10, "Exclusion Ritual", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{4}{W}{W}");
|
||||
this.expansionSetCode = "NPH";
|
||||
|
||||
|
||||
// Imprint - When Exclusion Ritual enters the battlefield, exile target nonland permanent.
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new ExclusionRitualImprintEffect(), false);
|
||||
ability.addTarget(new TargetPermanent(filter));
|
||||
|
@ -80,6 +79,7 @@ public class ExclusionRitual extends CardImpl {
|
|||
}
|
||||
|
||||
class ExclusionRitualImprintEffect extends OneShotEffect {
|
||||
|
||||
ExclusionRitualImprintEffect() {
|
||||
super(Outcome.Exile);
|
||||
staticText = "exile target nonland permanent";
|
||||
|
@ -108,6 +108,7 @@ class ExclusionRitualImprintEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
class ExclusionRitualReplacementEffect extends ContinuousRuleModifyingEffectImpl {
|
||||
|
||||
ExclusionRitualReplacementEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Detriment);
|
||||
staticText = "Players can't cast spells with the same name as the exiled card";
|
||||
|
@ -116,12 +117,12 @@ class ExclusionRitualReplacementEffect extends ContinuousRuleModifyingEffectImpl
|
|||
ExclusionRitualReplacementEffect(final ExclusionRitualReplacementEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.CAST_SPELL;
|
||||
return event.getType() == GameEvent.EventType.CAST_SPELL_LATE;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
|
|
|
@ -47,6 +47,7 @@ import mage.filter.predicate.permanent.ControllerPredicate;
|
|||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.game.turn.Step;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
@ -110,7 +111,9 @@ class ReflectorMageEffect extends OneShotEffect {
|
|||
Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (targetCreature != null) {
|
||||
controller.moveCards(targetCreature, Zone.HAND, source, game);
|
||||
game.addEffect(new ExclusionRitualReplacementEffect(targetCreature.getName(), targetCreature.getOwnerId()), source);
|
||||
if (!targetCreature.getName().isEmpty()) { // if the creature had no name, no restrict effect will be created
|
||||
game.addEffect(new ExclusionRitualReplacementEffect(targetCreature.getName(), targetCreature.getOwnerId()), source);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -138,13 +141,17 @@ class ExclusionRitualReplacementEffect extends ContinuousRuleModifyingEffectImpl
|
|||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.CAST_SPELL;
|
||||
return event.getType() == GameEvent.EventType.CAST_SPELL_LATE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
Card card = game.getCard(event.getSourceId());
|
||||
if (card != null) {
|
||||
Spell spell = game.getState().getStack().getSpell(event.getSourceId());
|
||||
if (spell != null && spell.isFaceDown(game)) {
|
||||
return false; // Face Down cast spell (Morph creature) has no name
|
||||
}
|
||||
return card.getName().equals(creatureName);
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -2580,9 +2580,17 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
playable.add(ability);
|
||||
}
|
||||
}
|
||||
} else if (card.getCardType().contains(CardType.LAND) && ability instanceof AlternativeSourceCosts) {
|
||||
if (canLandPlayAlternateSourceCostsAbility(card, availableMana, ability, game)) { // e.g. Land with Morph
|
||||
playable.add(ability);
|
||||
} else if (ability instanceof AlternativeSourceCosts) {
|
||||
if (card.getCardType().contains(CardType.LAND)) {
|
||||
if (canLandPlayAlternateSourceCostsAbility(card, availableMana, ability, game)) { // e.g. Land with Morph
|
||||
playable.add(ability);
|
||||
}
|
||||
} else if (card.getCardType().contains(CardType.CREATURE)) { // e.g. makes a card available for play by Morph if the card may not be cast normally
|
||||
if (!playable.contains(card.getSpellAbility())) {
|
||||
if (((AlternativeSourceCosts) ability).isAvailable(card.getSpellAbility(), game)) {
|
||||
playable.add(card.getSpellAbility());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2701,7 +2709,8 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
*
|
||||
*/
|
||||
@Override
|
||||
public Set<UUID> getPlayableInHand(Game game) {
|
||||
public Set<UUID> getPlayableInHand(Game game
|
||||
) {
|
||||
Set<UUID> playable = new HashSet<>();
|
||||
if (!shouldSkipGettingPlayable(game)) {
|
||||
ManaOptions available = getManaAvailable(game);
|
||||
|
|
Loading…
Reference in a new issue