Fixed evasion abilities. Splitted canBlock to canBeBlocked and canBlock methods (previous version caused bugs). Refactored some cards.

This commit is contained in:
magenoxx 2011-07-05 17:00:05 +04:00
parent 8bcc228aa4
commit a3a38823d6
9 changed files with 18 additions and 10 deletions

View file

@ -115,7 +115,7 @@ class SignalPestEffect extends RestrictionEffect<SignalPestEffect> {
}
@Override
public boolean canBlock(Permanent attacker, Permanent blocker, Game game) {
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Game game) {
if (blocker.getAbilities().contains(FlyingAbility.getInstance()) || blocker.getAbilities().contains(ReachAbility.getInstance())) {
return true;
}

View file

@ -101,7 +101,7 @@ class JuggernautEffect extends CantBlockSourceEffect {
}
@Override
public boolean canBlock(Permanent attacker, Permanent blocker, Game game) {
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Game game) {
return !blocker.getSubtype().contains("Wall");
}

View file

@ -65,4 +65,8 @@ public abstract class RestrictionEffect<T extends RestrictionEffect<T>> extends
return true;
}
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Game game) {
return true;
}
}

View file

@ -29,6 +29,8 @@
package mage.abilities.keyword;
import java.io.ObjectStreamException;
import mage.Constants;
import mage.Constants.Duration;
import mage.abilities.Ability;
import mage.abilities.EvasionAbility;
@ -87,8 +89,8 @@ class FearEffect extends RestrictionEffect<FearEffect> {
}
@Override
public boolean canBlock(Permanent attacker, Permanent blocker, Game game) {
if (blocker.getAbilities().containsKey(FearAbility.getInstance().getId()) || blocker.getColor().isBlack()) {
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Game game) {
if (blocker.getCardType().contains(Constants.CardType.ARTIFACT) || blocker.getColor().isBlack()) {
return true;
}
return false;

View file

@ -87,7 +87,7 @@ class FlyingEffect extends RestrictionEffect<FlyingEffect> {
}
@Override
public boolean canBlock(Permanent attacker, Permanent blocker, Game game) {
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Game game) {
if (blocker.getAbilities().containsKey(FlyingAbility.getInstance().getId()) || blocker.getAbilities().containsKey(ReachAbility.getInstance().getId()))
return true;
return false;

View file

@ -47,7 +47,7 @@ class IntimidateEffect extends RestrictionEffect<IntimidateEffect> {
}
@Override
public boolean canBlock(Permanent attacker, Permanent blocker, Game game) {
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Game game) {
boolean result = false;
if (blocker.getCardType().contains(Constants.CardType.ARTIFACT) && (blocker.getCardType().contains(Constants.CardType.CREATURE)))
result = true;

View file

@ -72,7 +72,7 @@ class LandwalkEffect extends RestrictionEffect<LandwalkEffect> {
}
@Override
public boolean canBlock(Permanent attacker, Permanent blocker, Game game) {
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Game game) {
return !game.getBattlefield().contains(filter, blocker.getControllerId(), 1);
}

View file

@ -87,7 +87,7 @@ class UnblockableEffect extends RestrictionEffect<UnblockableEffect> {
}
@Override
public boolean canBlock(Permanent attacker, Permanent blocker, Game game) {
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Game game) {
return false;
}

View file

@ -610,7 +610,9 @@ public abstract class PermanentImpl<T extends PermanentImpl<T>> extends CardImpl
}
// check also attacker's restriction effects
for (RestrictionEffect effect : game.getContinuousEffects().getApplicableRestrictionEffects(attacker, game)) {
if (!effect.canBlock(attacker, this, game))
/*if (!effect.canBlock(attacker, this, game))
return false;*/
if (!effect.canBeBlocked(attacker, this, game))
return false;
}
if (attacker.hasProtectionFrom(this))