mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
Fixed evasion abilities. Splitted canBlock to canBeBlocked and canBlock methods (previous version caused bugs). Refactored some cards.
This commit is contained in:
parent
8bcc228aa4
commit
a3a38823d6
9 changed files with 18 additions and 10 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
||||
|
|
|
@ -64,5 +64,9 @@ public abstract class RestrictionEffect<T extends RestrictionEffect<T>> extends
|
|||
public boolean canBlock(Permanent attacker, Permanent blocker, Game game) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Game game) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -610,8 +610,10 @@ 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))
|
||||
return false;
|
||||
/*if (!effect.canBlock(attacker, this, game))
|
||||
return false;*/
|
||||
if (!effect.canBeBlocked(attacker, this, game))
|
||||
return false;
|
||||
}
|
||||
if (attacker.hasProtectionFrom(this))
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue