mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +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
|
@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())) {
|
if (blocker.getAbilities().contains(FlyingAbility.getInstance()) || blocker.getAbilities().contains(ReachAbility.getInstance())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,7 +101,7 @@ class JuggernautEffect extends CantBlockSourceEffect {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canBlock(Permanent attacker, Permanent blocker, Game game) {
|
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Game game) {
|
||||||
return !blocker.getSubtype().contains("Wall");
|
return !blocker.getSubtype().contains("Wall");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,4 +65,8 @@ public abstract class RestrictionEffect<T extends RestrictionEffect<T>> extends
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Game game) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,8 @@
|
||||||
package mage.abilities.keyword;
|
package mage.abilities.keyword;
|
||||||
|
|
||||||
import java.io.ObjectStreamException;
|
import java.io.ObjectStreamException;
|
||||||
|
|
||||||
|
import mage.Constants;
|
||||||
import mage.Constants.Duration;
|
import mage.Constants.Duration;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.EvasionAbility;
|
import mage.abilities.EvasionAbility;
|
||||||
|
@ -87,8 +89,8 @@ class FearEffect extends RestrictionEffect<FearEffect> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canBlock(Permanent attacker, Permanent blocker, Game game) {
|
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Game game) {
|
||||||
if (blocker.getAbilities().containsKey(FearAbility.getInstance().getId()) || blocker.getColor().isBlack()) {
|
if (blocker.getCardType().contains(Constants.CardType.ARTIFACT) || blocker.getColor().isBlack()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -87,7 +87,7 @@ class FlyingEffect extends RestrictionEffect<FlyingEffect> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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()))
|
if (blocker.getAbilities().containsKey(FlyingAbility.getInstance().getId()) || blocker.getAbilities().containsKey(ReachAbility.getInstance().getId()))
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -47,7 +47,7 @@ class IntimidateEffect extends RestrictionEffect<IntimidateEffect> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canBlock(Permanent attacker, Permanent blocker, Game game) {
|
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Game game) {
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
if (blocker.getCardType().contains(Constants.CardType.ARTIFACT) && (blocker.getCardType().contains(Constants.CardType.CREATURE)))
|
if (blocker.getCardType().contains(Constants.CardType.ARTIFACT) && (blocker.getCardType().contains(Constants.CardType.CREATURE)))
|
||||||
result = true;
|
result = true;
|
||||||
|
|
|
@ -72,7 +72,7 @@ class LandwalkEffect extends RestrictionEffect<LandwalkEffect> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
return !game.getBattlefield().contains(filter, blocker.getControllerId(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ class UnblockableEffect extends RestrictionEffect<UnblockableEffect> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canBlock(Permanent attacker, Permanent blocker, Game game) {
|
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Game game) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -610,7 +610,9 @@ public abstract class PermanentImpl<T extends PermanentImpl<T>> extends CardImpl
|
||||||
}
|
}
|
||||||
// check also attacker's restriction effects
|
// check also attacker's restriction effects
|
||||||
for (RestrictionEffect effect : game.getContinuousEffects().getApplicableRestrictionEffects(attacker, game)) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
if (attacker.hasProtectionFrom(this))
|
if (attacker.hasProtectionFrom(this))
|
||||||
|
|
Loading…
Reference in a new issue