commiting to work on home, so far when enchantment goes into battlefiled other creatures are not allowed to attack regardless of color choice

This commit is contained in:
mkalender 2015-06-19 13:00:36 -04:00
parent 15800987c3
commit bfc4d2592a

View file

@ -77,9 +77,11 @@ class TeferisMoatRestrictionEffect extends RestrictionEffect {
super(Duration.WhileOnBattlefield, Outcome.Benefit);
staticText = "Creatures of the chosen color without flying can't attack you";
}
TeferisMoatRestrictionEffect(final TeferisMoatRestrictionEffect effect) {
super(effect);
}
@Override
public boolean applies(Permanent permanent, Ability source, Game game) {
ObjectColor chosenColor = (ObjectColor) game.getState().getValue(source.getSourceId() + "_color");
@ -87,6 +89,12 @@ class TeferisMoatRestrictionEffect extends RestrictionEffect {
return false;
return permanent.getCardType().contains(CardType.CREATURE) && !permanent.getAbilities().contains(FlyingAbility.getInstance()) && !permanent.getColor(game).shares(chosenColor);
}
@Override
public boolean canAttack(UUID defenderId, Ability source, Game game) {
return !defenderId.equals(source.getControllerId());
}
@Override
public TeferisMoatRestrictionEffect copy() {
return new TeferisMoatRestrictionEffect(this);