replaced explicit checking with call to HELLBENT.accept

master
melvin 2012-08-28 22:37:27 +08:00
parent 2bcc7e1924
commit e427390489
2 changed files with 10 additions and 2 deletions

View File

@ -5,13 +5,15 @@ import magic.model.MagicGame;
import magic.model.MagicPermanent;
import magic.model.mstatic.MagicLayer;
import magic.model.mstatic.MagicStatic;
import magic.model.condition.MagicCondition;
public class Cutthroat_il_Dal {
public static final MagicStatic S = new MagicStatic(MagicLayer.Ability) {
@Override
public long getAbilityFlags(final MagicPermanent source,final MagicPermanent permanent,final long flags) {
return permanent.getController().getHandSize() == 0 ?
flags|MagicAbility.Shadow.getMask() : flags;
return MagicCondition.HELLBENT.accept(permanent) ?
flags | MagicAbility.Shadow.getMask() :
flags;
}
};
}

View File

@ -265,6 +265,12 @@ public interface MagicCondition {
}
};
MagicCondition HELLBENT = new MagicCondition() {
public boolean accept(final MagicSource source) {
return source.getController().getHandSize() == 0;
}
};
MagicCondition POWER_4_OR_GREATER_CONDITION = new MagicCondition() {
public boolean accept(final MagicSource source) {
final MagicPermanent permanent = (MagicPermanent)source;