forked from External/mage
* Fixed cards with skip untap optional ability that cause game freezes (#5606)
This commit is contained in:
parent
4a14940414
commit
6846db75f4
169 changed files with 754 additions and 1172 deletions
|
|
@ -520,7 +520,7 @@ public class Combat implements Serializable, Copyable<Combat> {
|
|||
for (Map.Entry<RestrictionEffect, Set<Ability>> entry : game.getContinuousEffects().getApplicableRestrictionEffects(attackingCreature, game).entrySet()) {
|
||||
RestrictionEffect effect = entry.getKey();
|
||||
for (Ability ability : entry.getValue()) {
|
||||
if (!effect.canAttackCheckAfter(numberAttackers, ability, game)) {
|
||||
if (!effect.canAttackCheckAfter(numberAttackers, ability, game, true)) {
|
||||
MageObject sourceObject = ability.getSourceObject(game);
|
||||
if (attackingPlayer.isHuman()) {
|
||||
game.informPlayer(attackingPlayer, attackingCreature.getIdName() + " can't attack this way (" + (sourceObject == null ? "null" : sourceObject.getIdName()) + ')');
|
||||
|
|
@ -1178,7 +1178,7 @@ public class Combat implements Serializable, Copyable<Combat> {
|
|||
for (Map.Entry<RestrictionEffect, Set<Ability>> entry : game.getContinuousEffects().getApplicableRestrictionEffects(blockingCreature, game).entrySet()) {
|
||||
RestrictionEffect effect = entry.getKey();
|
||||
for (Ability ability : entry.getValue()) {
|
||||
if (!effect.canBlockCheckAfter(ability, game)) {
|
||||
if (!effect.canBlockCheckAfter(ability, game, true)) {
|
||||
if (controller.isHuman()) {
|
||||
game.informPlayer(controller, blockingCreature.getLogName() + " can't block this way.");
|
||||
return false;
|
||||
|
|
@ -1198,7 +1198,7 @@ public class Combat implements Serializable, Copyable<Combat> {
|
|||
for (Map.Entry<RestrictionEffect, Set<Ability>> entry : game.getContinuousEffects().getApplicableRestrictionEffects(attackingCreature, game).entrySet()) {
|
||||
RestrictionEffect effect = entry.getKey();
|
||||
for (Ability ability : entry.getValue()) {
|
||||
if (!effect.canBeBlockedCheckAfter(attackingCreature, ability, game)) {
|
||||
if (!effect.canBeBlockedCheckAfter(attackingCreature, ability, game, true)) {
|
||||
if (controller.isHuman()) {
|
||||
game.informPlayer(controller, attackingCreature.getLogName() + " can't be blocked this way.");
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ class AgyremRestrictionEffect extends RestrictionEffect {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canAttack(Permanent attacker, UUID defenderId, Ability source, Game game) {
|
||||
public boolean canAttack(Permanent attacker, UUID defenderId, Ability source, Game game, boolean canUseChooseDialogs) {
|
||||
if (defenderId == null) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
|
||||
package mage.game.command.planes;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.ActivateIfConditionActivatedAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
|
|
@ -24,8 +20,11 @@ import mage.target.Target;
|
|||
import mage.watchers.common.AttackedThisTurnWatcher;
|
||||
import mage.watchers.common.PlanarRollWatcher;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author spjspj
|
||||
*/
|
||||
public class AstralArenaPlane extends Plane {
|
||||
|
|
@ -81,15 +80,11 @@ class AstralArenaAttackRestrictionEffect extends RestrictionEffect {
|
|||
if (cPlane == null) {
|
||||
return false;
|
||||
}
|
||||
if (!cPlane.getName().equalsIgnoreCase("Plane - Astral Arena")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return cPlane.getName().equalsIgnoreCase("Plane - Astral Arena");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAttack(Permanent attacker, UUID defenderId, Ability source, Game game) {
|
||||
public boolean canAttack(Permanent attacker, UUID defenderId, Ability source, Game game, boolean canUseChooseDialogs) {
|
||||
return game.getCombat().getAttackers().isEmpty();
|
||||
}
|
||||
}
|
||||
|
|
@ -116,14 +111,11 @@ class AstralArenaBlockRestrictionEffect extends RestrictionEffect {
|
|||
if (cPlane == null) {
|
||||
return false;
|
||||
}
|
||||
if (!cPlane.getName().equalsIgnoreCase("Plane - Astral Arena")) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return cPlane.getName().equalsIgnoreCase("Plane - Astral Arena");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
||||
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game, boolean canUseChooseDialogs) {
|
||||
return game.getCombat().getBlockers().isEmpty();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
|
||||
package mage.game.command.planes;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.ActivateIfConditionActivatedAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
|
|
@ -21,12 +18,14 @@ import mage.filter.predicate.mageobject.PowerPredicate;
|
|||
import mage.game.Game;
|
||||
import mage.game.command.Plane;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.token.EldraziAnnihilatorToken;
|
||||
import mage.target.Target;
|
||||
import mage.watchers.common.PlanarRollWatcher;
|
||||
import mage.game.permanent.token.EldraziAnnihilatorToken;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author spjspj
|
||||
*/
|
||||
public class HedronFieldsOfAgadeemPlane extends Plane {
|
||||
|
|
@ -80,12 +79,12 @@ class HedronFieldsOfAgadeemRestrictionEffect extends RestrictionEffect {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canAttack(Game game) {
|
||||
public boolean canAttack(Game game, boolean canUseChooseDialogs) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
||||
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game, boolean canUseChooseDialogs) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
|
||||
package mage.game.command.planes;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.common.ActivateIfConditionActivatedAbility;
|
||||
|
|
@ -25,8 +22,10 @@ import mage.game.permanent.Permanent;
|
|||
import mage.target.Target;
|
||||
import mage.watchers.common.PlanarRollWatcher;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author spjspj
|
||||
*/
|
||||
public class TazeemPlane extends Plane {
|
||||
|
|
@ -83,7 +82,7 @@ class TazeemCantBlockAllEffect extends RestrictionEffect {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
||||
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game, boolean canUseChooseDialogs) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -268,23 +268,23 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!entry.getKey().canAttack(game) || !entry.getKey().canAttack(this, null, ability, game)) {
|
||||
if (!entry.getKey().canAttack(game, false) || !entry.getKey().canAttack(this, null, ability, game, false)) {
|
||||
restrictHints.add(HintUtils.prepareText("Can't attack" + addSourceObjectName(game, ability), null, HintUtils.HINT_ICON_RESTRICT));
|
||||
}
|
||||
|
||||
if (!entry.getKey().canBlock(null, this, ability, game)) {
|
||||
if (!entry.getKey().canBlock(null, this, ability, game, false)) {
|
||||
restrictHints.add(HintUtils.prepareText("Can't block" + addSourceObjectName(game, ability), null, HintUtils.HINT_ICON_RESTRICT));
|
||||
}
|
||||
|
||||
if (!entry.getKey().canBeUntapped(this, ability, game)) {
|
||||
if (!entry.getKey().canBeUntapped(this, ability, game, false)) {
|
||||
restrictHints.add(HintUtils.prepareText("Can't untapped" + addSourceObjectName(game, ability), null, HintUtils.HINT_ICON_RESTRICT));
|
||||
}
|
||||
|
||||
if (!entry.getKey().canUseActivatedAbilities(this, ability, game)) {
|
||||
if (!entry.getKey().canUseActivatedAbilities(this, ability, game, false)) {
|
||||
restrictHints.add(HintUtils.prepareText("Can't use activated abilities" + addSourceObjectName(game, ability), null, HintUtils.HINT_ICON_RESTRICT));
|
||||
}
|
||||
|
||||
if (!entry.getKey().canTransform(this, ability, game)) {
|
||||
if (!entry.getKey().canTransform(this, ability, game, false)) {
|
||||
restrictHints.add(HintUtils.prepareText("Can't transform" + addSourceObjectName(game, ability), null, HintUtils.HINT_ICON_RESTRICT));
|
||||
}
|
||||
}
|
||||
|
|
@ -1190,11 +1190,11 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
|||
private boolean canAttackCheckRestrictionEffects(UUID defenderId, Game game) {
|
||||
//20101001 - 508.1c
|
||||
for (Map.Entry<RestrictionEffect, Set<Ability>> effectEntry : game.getContinuousEffects().getApplicableRestrictionEffects(this, game).entrySet()) {
|
||||
if (!effectEntry.getKey().canAttack(game)) {
|
||||
if (!effectEntry.getKey().canAttack(game, true)) {
|
||||
return false;
|
||||
}
|
||||
for (Ability ability : effectEntry.getValue()) {
|
||||
if (!effectEntry.getKey().canAttack(this, defenderId, ability, game)) {
|
||||
if (!effectEntry.getKey().canAttack(this, defenderId, ability, game, true)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -1219,7 +1219,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
|||
// check blocker restrictions
|
||||
for (Map.Entry<RestrictionEffect, Set<Ability>> entry : game.getContinuousEffects().getApplicableRestrictionEffects(this, game).entrySet()) {
|
||||
for (Ability ability : entry.getValue()) {
|
||||
if (!entry.getKey().canBlock(attacker, this, ability, game)) {
|
||||
if (!entry.getKey().canBlock(attacker, this, ability, game, true)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -1227,7 +1227,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
|||
// check also attacker's restriction effects
|
||||
for (Map.Entry<RestrictionEffect, Set<Ability>> restrictionEntry : game.getContinuousEffects().getApplicableRestrictionEffects(attacker, game).entrySet()) {
|
||||
for (Ability ability : restrictionEntry.getValue()) {
|
||||
if (!restrictionEntry.getKey().canBeBlocked(attacker, this, ability, game)) {
|
||||
if (!restrictionEntry.getKey().canBeBlocked(attacker, this, ability, game, true)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -1245,7 +1245,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
|||
for (Map.Entry<RestrictionEffect, Set<Ability>> entry : game.getContinuousEffects().getApplicableRestrictionEffects(this, game).entrySet()) {
|
||||
RestrictionEffect effect = entry.getKey();
|
||||
for (Ability ability : entry.getValue()) {
|
||||
if (!effect.canBlock(null, this, ability, game)) {
|
||||
if (!effect.canBlock(null, this, ability, game, true)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -1266,7 +1266,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
|||
for (Map.Entry<RestrictionEffect, Set<Ability>> entry : game.getContinuousEffects().getApplicableRestrictionEffects(this, game).entrySet()) {
|
||||
RestrictionEffect effect = entry.getKey();
|
||||
for (Ability ability : entry.getValue()) {
|
||||
if (!effect.canUseActivatedAbilities(this, ability, game)) {
|
||||
if (!effect.canUseActivatedAbilities(this, ability, game, true)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -1280,7 +1280,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
|||
for (Map.Entry<RestrictionEffect, Set<Ability>> entry : game.getContinuousEffects().getApplicableRestrictionEffects(this, game).entrySet()) {
|
||||
RestrictionEffect effect = entry.getKey();
|
||||
for (Ability ability : entry.getValue()) {
|
||||
if (!effect.canTransform(this, ability, game)) {
|
||||
if (!effect.canTransform(this, ability, game, true)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue