mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
Fixed NPE errors in canBlock restrict checks;
This commit is contained in:
parent
454d76e30b
commit
60a0ec03c0
18 changed files with 86 additions and 69 deletions
|
@ -1,7 +1,5 @@
|
||||||
|
|
||||||
package mage.cards.c;
|
package mage.cards.c;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
|
||||||
|
@ -10,11 +8,7 @@ import mage.abilities.effects.RestrictionEffect;
|
||||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.*;
|
||||||
import mage.constants.SubType;
|
|
||||||
import mage.constants.Duration;
|
|
||||||
import mage.constants.TargetController;
|
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.counters.CounterType;
|
import mage.counters.CounterType;
|
||||||
import mage.filter.common.FilterCreaturePermanent;
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
import mage.filter.predicate.permanent.AnotherPredicate;
|
import mage.filter.predicate.permanent.AnotherPredicate;
|
||||||
|
@ -22,6 +16,8 @@ import mage.filter.predicate.permanent.ControllerPredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author noxx
|
* @author noxx
|
||||||
*/
|
*/
|
||||||
|
@ -79,7 +75,7 @@ class ChampionOfLambholtEffect extends RestrictionEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
||||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||||
if (sourcePermanent != null && attacker.isControlledBy(sourcePermanent.getControllerId())) {
|
if (sourcePermanent != null && attacker != null && attacker.isControlledBy(sourcePermanent.getControllerId())) {
|
||||||
return blocker.getPower().getValue() >= sourcePermanent.getPower().getValue();
|
return blocker.getPower().getValue() >= sourcePermanent.getPower().getValue();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
|
|
||||||
package mage.cards.c;
|
package mage.cards.c;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.effects.RestrictionEffect;
|
import mage.abilities.effects.RestrictionEffect;
|
||||||
|
@ -20,8 +18,9 @@ import mage.filter.predicate.mageobject.AbilityPredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author jeffwadsworth
|
* @author jeffwadsworth
|
||||||
*/
|
*/
|
||||||
public final class Chaosphere extends CardImpl {
|
public final class Chaosphere extends CardImpl {
|
||||||
|
@ -80,6 +79,9 @@ class ChaosphereEffect extends RestrictionEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
||||||
|
if (attacker == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return attacker.hasAbility(FlyingAbility.getInstance().getId(), game);
|
return attacker.hasAbility(FlyingAbility.getInstance().getId(), game);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
|
|
||||||
package mage.cards.d;
|
package mage.cards.d;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.effects.RestrictionEffect;
|
import mage.abilities.effects.RestrictionEffect;
|
||||||
|
@ -16,14 +14,15 @@ import mage.filter.predicate.mageobject.AbilityPredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
*/
|
*/
|
||||||
public final class DenseCanopy extends CardImpl {
|
public final class DenseCanopy extends CardImpl {
|
||||||
|
|
||||||
public DenseCanopy(UUID ownerId, CardSetInfo setInfo) {
|
public DenseCanopy(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{G}");
|
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}");
|
||||||
|
|
||||||
|
|
||||||
// Creatures with flying can block only creatures with flying.
|
// Creatures with flying can block only creatures with flying.
|
||||||
|
@ -64,6 +63,9 @@ class DenseCanopyCantBlockEffect extends RestrictionEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
||||||
|
if (attacker == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return attacker.hasAbility(FlyingAbility.getInstance().getId(), game);
|
return attacker.hasAbility(FlyingAbility.getInstance().getId(), game);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
|
|
||||||
package mage.cards.e;
|
package mage.cards.e;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
|
@ -12,14 +10,15 @@ import mage.abilities.keyword.TrampleAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.SubType;
|
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
|
import mage.constants.SubType;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author Styxo
|
* @author Styxo
|
||||||
*/
|
*/
|
||||||
public final class Exogorth extends CardImpl {
|
public final class Exogorth extends CardImpl {
|
||||||
|
@ -84,6 +83,9 @@ class CanBlockOnlySpaceflightEffect extends RestrictionEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
||||||
|
if (attacker == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return attacker.getAbilities().contains(SpaceflightAbility.getInstance());
|
return attacker.getAbilities().contains(SpaceflightAbility.getInstance());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -111,6 +111,9 @@ class GoblinGoonCantBlockEffect extends RestrictionEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
||||||
|
if (attacker == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
UUID attackingPlayerId = attacker.getControllerId();
|
UUID attackingPlayerId = attacker.getControllerId();
|
||||||
if (attackingPlayerId != null) {
|
if (attackingPlayerId != null) {
|
||||||
return game.getBattlefield().countAll(new FilterControlledCreaturePermanent(), source.getControllerId(), game) > game.getBattlefield().countAll(new FilterControlledCreaturePermanent(), attackingPlayerId, game);
|
return game.getBattlefield().countAll(new FilterControlledCreaturePermanent(), source.getControllerId(), game) > game.getBattlefield().countAll(new FilterControlledCreaturePermanent(), attackingPlayerId, game);
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
|
|
||||||
package mage.cards.i;
|
package mage.cards.i;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.effects.common.AttachEffect;
|
import mage.abilities.effects.common.AttachEffect;
|
||||||
|
@ -10,19 +8,15 @@ import mage.abilities.effects.common.continuous.BoostEnchantedEffect;
|
||||||
import mage.abilities.keyword.EnchantAbility;
|
import mage.abilities.keyword.EnchantAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.AttachmentType;
|
import mage.constants.*;
|
||||||
import mage.constants.CardType;
|
|
||||||
import mage.constants.SubType;
|
|
||||||
import mage.constants.Duration;
|
|
||||||
import mage.constants.Outcome;
|
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.TargetPermanent;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author L_J
|
* @author L_J
|
||||||
*/
|
*/
|
||||||
public final class IronclawCurse extends CardImpl {
|
public final class IronclawCurse extends CardImpl {
|
||||||
|
@ -73,6 +67,9 @@ class IronclawCurseEffect extends CantBlockAttachedEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
||||||
|
if (attacker == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
Permanent enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
Permanent enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||||
if (enchantment == null) {
|
if (enchantment == null) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
|
|
||||||
package mage.cards.m;
|
package mage.cards.m;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.AttacksTriggeredAbility;
|
import mage.abilities.common.AttacksTriggeredAbility;
|
||||||
|
@ -14,20 +12,14 @@ import mage.abilities.effects.common.AddContinuousEffectToGame;
|
||||||
import mage.abilities.keyword.FirstStrikeAbility;
|
import mage.abilities.keyword.FirstStrikeAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.*;
|
||||||
import mage.constants.SubType;
|
|
||||||
import mage.constants.Duration;
|
|
||||||
import mage.constants.Layer;
|
|
||||||
import mage.constants.Outcome;
|
|
||||||
import mage.constants.SubLayer;
|
|
||||||
import mage.constants.SuperType;
|
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author TheElk801
|
* @author TheElk801
|
||||||
*/
|
*/
|
||||||
public final class MirriWeatherlightDuelist extends CardImpl {
|
public final class MirriWeatherlightDuelist extends CardImpl {
|
||||||
|
@ -87,6 +79,9 @@ class MirriWeatherlightDuelistBlockRestrictionEffect extends RestrictionEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
||||||
|
if (attacker == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
for (UUID creature : game.getCombat().getBlockers()) {
|
for (UUID creature : game.getCombat().getBlockers()) {
|
||||||
if (game.getPlayer(game.getPermanent(creature).getOwnerId()).hasOpponent(attacker.getControllerId(), game)) {
|
if (game.getPlayer(game.getPermanent(creature).getOwnerId()).hasOpponent(attacker.getControllerId(), game)) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -110,6 +110,9 @@ class MoggToadyCantBlockEffect extends RestrictionEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
||||||
|
if (attacker == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
UUID attackingPlayerId = attacker.getControllerId();
|
UUID attackingPlayerId = attacker.getControllerId();
|
||||||
if (attackingPlayerId != null) {
|
if (attackingPlayerId != null) {
|
||||||
return game.getBattlefield().countAll(new FilterControlledCreaturePermanent(), source.getControllerId(), game) > game.getBattlefield().countAll(new FilterControlledCreaturePermanent(), attackingPlayerId, game);
|
return game.getBattlefield().countAll(new FilterControlledCreaturePermanent(), source.getControllerId(), game) > game.getBattlefield().countAll(new FilterControlledCreaturePermanent(), attackingPlayerId, game);
|
||||||
|
|
|
@ -119,6 +119,9 @@ class CantBlockUnlessControllerControlsMoreLandsEffect extends RestrictionEffect
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
||||||
|
if (attacker == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
UUID attackingPlayerId = attacker.getControllerId();
|
UUID attackingPlayerId = attacker.getControllerId();
|
||||||
if (attackingPlayerId != null) {
|
if (attackingPlayerId != null) {
|
||||||
return game.getBattlefield().countAll(new FilterControlledLandPermanent(),
|
return game.getBattlefield().countAll(new FilterControlledLandPermanent(),
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
|
|
||||||
package mage.cards.s;
|
package mage.cards.s;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
|
@ -13,19 +11,15 @@ import mage.abilities.keyword.PartnerAbility;
|
||||||
import mage.abilities.keyword.ReachAbility;
|
import mage.abilities.keyword.ReachAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.*;
|
||||||
import mage.constants.SubType;
|
|
||||||
import mage.constants.ComparisonType;
|
|
||||||
import mage.constants.Duration;
|
|
||||||
import mage.constants.SuperType;
|
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.filter.common.FilterCreaturePermanent;
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
import mage.filter.predicate.mageobject.PowerPredicate;
|
import mage.filter.predicate.mageobject.PowerPredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
*/
|
*/
|
||||||
public final class SidarKondoOfJamuraa extends CardImpl {
|
public final class SidarKondoOfJamuraa extends CardImpl {
|
||||||
|
@ -95,6 +89,9 @@ class SidarKondoOfJamuraaCantBlockCreaturesSourceEffect extends RestrictionEffec
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
||||||
|
if (attacker == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return !filter.match(attacker, source.getSourceId(), source.getControllerId(), game);
|
return !filter.match(attacker, source.getSourceId(), source.getControllerId(), game);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
|
|
||||||
package mage.cards.s;
|
package mage.cards.s;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
|
@ -9,18 +7,15 @@ import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.costs.mana.ColoredManaCost;
|
import mage.abilities.costs.mana.ColoredManaCost;
|
||||||
import mage.abilities.effects.RestrictionEffect;
|
import mage.abilities.effects.RestrictionEffect;
|
||||||
import mage.abilities.effects.common.continuous.BoostSourceEffect;
|
import mage.abilities.effects.common.continuous.BoostSourceEffect;
|
||||||
import mage.constants.SubType;
|
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.*;
|
||||||
import mage.constants.ColoredManaSymbol;
|
|
||||||
import mage.constants.Duration;
|
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author TheElk801
|
* @author TheElk801
|
||||||
*/
|
*/
|
||||||
public final class SpitfireHandler extends CardImpl {
|
public final class SpitfireHandler extends CardImpl {
|
||||||
|
@ -67,6 +62,9 @@ class SpitfireHandlerCantBlockEffect extends RestrictionEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
||||||
|
if (attacker == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return (blocker.getPower().getValue() >= attacker.getPower().getValue());
|
return (blocker.getPower().getValue() >= attacker.getPower().getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,13 @@ public abstract class RestrictionEffect extends ContinuousEffectImpl {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param attacker can be empty for general checks
|
||||||
|
* @param blocker
|
||||||
|
* @param source
|
||||||
|
* @param game
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
|
|
||||||
|
|
||||||
package mage.abilities.effects.common.combat;
|
package mage.abilities.effects.common.combat;
|
||||||
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
@ -32,6 +30,9 @@ public class CanBlockOnlyFlyingAttachedEffect extends RestrictionEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
||||||
|
if (attacker == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return attacker.getAbilities().contains(FlyingAbility.getInstance());
|
return attacker.getAbilities().contains(FlyingAbility.getInstance());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
|
|
||||||
|
|
||||||
package mage.abilities.effects.common.combat;
|
package mage.abilities.effects.common.combat;
|
||||||
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
@ -10,7 +8,6 @@ import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -33,6 +30,9 @@ public class CanBlockOnlyFlyingEffect extends RestrictionEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
||||||
|
if (attacker == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return attacker.getAbilities().contains(FlyingAbility.getInstance());
|
return attacker.getAbilities().contains(FlyingAbility.getInstance());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,17 @@
|
||||||
|
|
||||||
package mage.abilities.effects.common.combat;
|
package mage.abilities.effects.common.combat;
|
||||||
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.effects.RestrictionEffect;
|
import mage.abilities.effects.RestrictionEffect;
|
||||||
import mage.constants.AttachmentType;
|
import mage.constants.AttachmentType;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
import static mage.constants.Duration.EndOfTurn;
|
|
||||||
import mage.filter.common.FilterCreaturePermanent;
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.target.targetpointer.FixedTarget;
|
import mage.target.targetpointer.FixedTarget;
|
||||||
|
|
||||||
|
import static mage.constants.Duration.EndOfTurn;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author North
|
* @author North
|
||||||
*/
|
*/
|
||||||
public class CantBlockAttachedEffect extends RestrictionEffect {
|
public class CantBlockAttachedEffect extends RestrictionEffect {
|
||||||
|
@ -70,6 +69,9 @@ public class CantBlockAttachedEffect extends RestrictionEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
||||||
|
if (attacker == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return !filter.match(attacker, source.getSourceId(), source.getControllerId(), game);
|
return !filter.match(attacker, source.getSourceId(), source.getControllerId(), game);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,9 @@ public class CantBlockCreaturesSourceEffect extends RestrictionEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
||||||
|
if (attacker == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return !filter.match(attacker, source.getSourceId(), source.getControllerId(), game);
|
return !filter.match(attacker, source.getSourceId(), source.getControllerId(), game);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package mage.abilities.keyword;
|
package mage.abilities.keyword;
|
||||||
|
|
||||||
import java.io.ObjectStreamException;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.EvasionAbility;
|
import mage.abilities.EvasionAbility;
|
||||||
import mage.abilities.MageSingleton;
|
import mage.abilities.MageSingleton;
|
||||||
|
@ -10,6 +9,8 @@ import mage.constants.Duration;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
|
import java.io.ObjectStreamException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* "Shadow" keyword
|
* "Shadow" keyword
|
||||||
*
|
*
|
||||||
|
@ -60,6 +61,9 @@ class ShadowEffect extends RestrictionEffect implements MageSingleton {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
||||||
|
if (attacker == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return attacker.getAbilities().containsKey(ShadowAbility.getInstance().getId());
|
return attacker.getAbilities().containsKey(ShadowAbility.getInstance().getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
|
|
||||||
package mage.abilities.keyword;
|
package mage.abilities.keyword;
|
||||||
|
|
||||||
import java.io.ObjectStreamException;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.EvasionAbility;
|
import mage.abilities.EvasionAbility;
|
||||||
import mage.abilities.MageSingleton;
|
import mage.abilities.MageSingleton;
|
||||||
|
@ -10,8 +8,9 @@ import mage.constants.Duration;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
|
import java.io.ObjectStreamException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author Styxo
|
* @author Styxo
|
||||||
*/
|
*/
|
||||||
public class SpaceflightAbility extends EvasionAbility implements MageSingleton {
|
public class SpaceflightAbility extends EvasionAbility implements MageSingleton {
|
||||||
|
@ -59,6 +58,9 @@ class SpaceFlightEffect extends RestrictionEffect implements MageSingleton {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
||||||
|
if (attacker == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return attacker.getAbilities().containsKey(SpaceflightAbility.getInstance().getId());
|
return attacker.getAbilities().containsKey(SpaceflightAbility.getInstance().getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue