mirror of
https://github.com/correl/mage.git
synced 2025-03-30 01:03:57 -09:00
Fixed some effects that did target doesn't untap next untap step not handle quite correctly.
This commit is contained in:
parent
7c0f93afcd
commit
dcdbc10187
8 changed files with 30 additions and 159 deletions
Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck
Mage.Sets/src/mage/sets
commander
darkascension
elspethvstezzeret
magic2010
portalthreekingdoms
worldwake
Mage/src/mage/abilities/effects/common
|
@ -48,8 +48,8 @@ import mage.filter.FilterMana;
|
|||
|
||||
public class Commander extends DeckValidator {
|
||||
|
||||
protected List<String> banned = new ArrayList<String>();
|
||||
protected List<String> bannedCommander = new ArrayList<String>();
|
||||
protected List<String> banned = new ArrayList<>();
|
||||
protected List<String> bannedCommander = new ArrayList<>();
|
||||
|
||||
private static final String regexBlack = ".*\\x7b.{0,2}B.{0,2}\\x7d.*";
|
||||
private static final String regexBlue = ".*\\x7b.{0,2}U.{0,2}\\x7d.*";
|
||||
|
|
|
@ -28,10 +28,8 @@
|
|||
package mage.sets.commander;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.DoIfClashWonEffect;
|
||||
import mage.abilities.effects.common.PreventAllDamageByAllEffect;
|
||||
|
@ -40,12 +38,9 @@ import mage.cards.CardImpl;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Rarity;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
|
|
@ -45,6 +45,9 @@ import mage.game.events.GameEvent;
|
|||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.common.SkipNextUntapTargetEffect;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -94,7 +97,9 @@ class ClingingMistsEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
for (Permanent creature: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||
creature.tap(game);
|
||||
game.addEffect(new ClingingMistsEffect2(creature.getId()), source);
|
||||
ContinuousEffect effect = new SkipNextUntapTargetEffect();
|
||||
effect.setTargetPointer(new FixedTarget(creature.getId()));
|
||||
game.addEffect(effect, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -105,45 +110,3 @@ class ClingingMistsEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
class ClingingMistsEffect2 extends ReplacementEffectImpl {
|
||||
|
||||
protected UUID creatureId;
|
||||
|
||||
public ClingingMistsEffect2(UUID creatureId) {
|
||||
super(Duration.OneUse, Outcome.Detriment);
|
||||
this.creatureId = creatureId;
|
||||
}
|
||||
|
||||
public ClingingMistsEffect2(final ClingingMistsEffect2 effect) {
|
||||
super(effect);
|
||||
creatureId = effect.creatureId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClingingMistsEffect2 copy() {
|
||||
return new ClingingMistsEffect2(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
used = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (game.getTurn().getStepType() == PhaseStep.UNTAP &&
|
||||
event.getType() == GameEvent.EventType.UNTAP &&
|
||||
event.getTargetId().equals(creatureId)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -30,8 +30,8 @@ package mage.sets.elspethvstezzeret;
|
|||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.common.TapTargetEffect;
|
||||
import mage.abilities.keyword.EntwineAbility;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -102,7 +102,7 @@ class BlindingBeamEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||
if (player != null) {
|
||||
if (player != null) {
|
||||
game.addEffect(new BlindingBeamEffect2(player.getId()), source);
|
||||
return true;
|
||||
}
|
||||
|
@ -116,11 +116,11 @@ class BlindingBeamEffect extends OneShotEffect {
|
|||
|
||||
}
|
||||
|
||||
class BlindingBeamEffect2 extends ReplacementEffectImpl {
|
||||
class BlindingBeamEffect2 extends ContinuousRuleModifiyingEffectImpl {
|
||||
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
||||
|
||||
private UUID targetPlayerId;
|
||||
private final UUID targetPlayerId;
|
||||
|
||||
public BlindingBeamEffect2(UUID targetPlayerId) {
|
||||
super(Duration.Custom, Outcome.Detriment);
|
||||
|
@ -142,15 +142,10 @@ class BlindingBeamEffect2 extends ReplacementEffectImpl {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInactive(Ability source, Game game) {
|
||||
if (game.getPhase().getStep().getType() == PhaseStep.UNTAP && game.getStep().getStepPart() == Step.StepPart.PRE)
|
||||
{
|
||||
// the PRE step part is directly after the UNTAP events for permanents
|
||||
if (game.getPhase().getStep().getType() == PhaseStep.UNTAP && game.getStep().getStepPart() == Step.StepPart.PRE) {
|
||||
if (game.getActivePlayerId().equals(targetPlayerId) || game.getPlayer(source.getControllerId()).hasReachedNextTurnAfterLeaving()) {
|
||||
return true;
|
||||
}
|
||||
|
@ -160,8 +155,8 @@ class BlindingBeamEffect2 extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
// replace untap event of creatures of target player
|
||||
if (game.getTurn().getStepType() == PhaseStep.UNTAP && event.getType() == EventType.UNTAP) {
|
||||
// prevent untap event of creatures of target player
|
||||
if (game.getTurn().getStepType().equals(PhaseStep.UNTAP) && event.getType().equals(EventType.UNTAP)) {
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
if (permanent != null && permanent.getControllerId().equals(targetPlayerId) && filter.match(permanent, game)) {
|
||||
return true;
|
||||
|
|
|
@ -30,21 +30,19 @@ package mage.sets.magic2010;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Rarity;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.common.SkipNextUntapTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPlayer;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -87,7 +85,9 @@ class SleepEffect extends OneShotEffect {
|
|||
if (player != null) {
|
||||
for (Permanent creature: game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), player.getId(), game)) {
|
||||
creature.tap(game);
|
||||
game.addEffect(new SleepEffect2(creature.getId()), source);
|
||||
ContinuousEffect effect = new SkipNextUntapTargetEffect();
|
||||
effect.setTargetPointer(new FixedTarget(creature.getId()));
|
||||
game.addEffect(effect, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -100,45 +100,3 @@ class SleepEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
class SleepEffect2 extends ReplacementEffectImpl {
|
||||
|
||||
protected UUID creatureId;
|
||||
|
||||
public SleepEffect2(UUID creatureId) {
|
||||
super(Duration.OneUse, Outcome.Detriment);
|
||||
this.creatureId = creatureId;
|
||||
}
|
||||
|
||||
public SleepEffect2(final SleepEffect2 effect) {
|
||||
super(effect);
|
||||
creatureId = effect.creatureId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SleepEffect2 copy() {
|
||||
return new SleepEffect2(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
used = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (game.getTurn().getStepType() == PhaseStep.UNTAP &&
|
||||
event.getType() == EventType.UNTAP &&
|
||||
event.getTargetId().equals(creatureId)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,22 +29,21 @@ package mage.sets.portalthreekingdoms;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.common.SkipNextUntapTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Rarity;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetOpponent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -100,49 +99,12 @@ class ExhaustionEffect extends OneShotEffect {
|
|||
Player player = game.getPlayer(source.getFirstTarget());
|
||||
if (player != null) {
|
||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, player.getId(), game)) {
|
||||
game.addEffect(new ExhaustionReplacementEffect(permanent.getId()), source);
|
||||
ContinuousEffect effect = new SkipNextUntapTargetEffect();
|
||||
effect.setTargetPointer(new FixedTarget(permanent.getId()));
|
||||
game.addEffect(effect, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class ExhaustionReplacementEffect extends ReplacementEffectImpl {
|
||||
|
||||
protected UUID permanentId;
|
||||
|
||||
ExhaustionReplacementEffect(UUID permanentId) {
|
||||
super(Duration.OneUse, Outcome.Detriment);
|
||||
this.permanentId = permanentId;
|
||||
}
|
||||
|
||||
ExhaustionReplacementEffect(final ExhaustionReplacementEffect effect) {
|
||||
super(effect);
|
||||
permanentId = effect.permanentId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExhaustionReplacementEffect copy() {
|
||||
return new ExhaustionReplacementEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
used = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
return game.getTurn().getStepType() == PhaseStep.UNTAP &&
|
||||
event.getType() == GameEvent.EventType.UNTAP &&
|
||||
event.getTargetId().equals(permanentId);
|
||||
}
|
||||
|
||||
}
|
|
@ -35,9 +35,7 @@ import mage.ObjectColor;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.AlternativeCostImpl;
|
||||
import mage.abilities.costs.mana.ColoredManaCost;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.common.SkipNextUntapTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.*;
|
||||
|
|
|
@ -89,8 +89,8 @@ public class SkipNextUntapTargetEffect extends ContinuousRuleModifiyingEffectImp
|
|||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
// the check for turn number is needed if multiple effects are added to prevent untap in next untap step
|
||||
// if we don't check for turn number, every turn only one effect would be used instead of correctly only one time
|
||||
// the check for turn number is needed if multiple effects are added to prevent untap in next untap step of controller
|
||||
// if we don't check for turn number, every untap step of a turn only one effect would be used instead of correctly only one time
|
||||
// to skip the untap effect.
|
||||
|
||||
// Discard effect if related to previous turn
|
||||
|
|
Loading…
Add table
Reference in a new issue