added support for Battalion in engine

master
melvin 2013-02-17 10:05:54 +08:00
parent 8f86795b39
commit f3a51a5224
2 changed files with 16 additions and 0 deletions

View File

@ -249,6 +249,12 @@ public interface MagicCondition {
}
};
MagicCondition THREE_ATTACKERS_CONDITION=new MagicCondition() {
public boolean accept(final MagicSource source) {
return source.getController().getNrOfAttackers() >= 3;
}
};
MagicCondition TWO_CREATURES_CONDITION=new MagicCondition() {
public boolean accept(final MagicSource source) {
return source.getController().getNrOfPermanentsWithType(MagicType.Creature)>=2;

View File

@ -0,0 +1,10 @@
package magic.model.trigger;
import magic.model.MagicPermanent;
import magic.model.condition.MagicCondition;
public abstract class MagicBattalionTrigger extends MagicWhenAttacksTrigger {
public boolean accept(final MagicPermanent permanent, final MagicPermanent attacker) {
return permanent == attacker && MagicCondition.THREE_ATTACKERS_CONDITION.accept(permanent);
}
}