forked from External/mage
(refactor) break out assignment into its own package
This commit is contained in:
parent
675639013a
commit
bac4e7b507
26 changed files with 30 additions and 34 deletions
|
|
@ -1,24 +0,0 @@
|
|||
package mage.abilities.dynamicvalue.common;
|
||||
|
||||
import mage.abilities.dynamicvalue.RoleAssignment;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.CardType;
|
||||
import mage.game.Game;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class CardTypeAssignment extends RoleAssignment<CardType> {
|
||||
|
||||
public CardTypeAssignment(CardType... subTypes) {
|
||||
super(subTypes);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<CardType> makeSet(Card card, Game game) {
|
||||
return attributes
|
||||
.stream()
|
||||
.filter(subType -> card.getCardType(game).contains(subType))
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
}
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
package mage.abilities.dynamicvalue.common;
|
||||
|
||||
import mage.abilities.dynamicvalue.RoleAssignment;
|
||||
import mage.cards.Card;
|
||||
import mage.game.Game;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ColorAssignment extends RoleAssignment<String> {
|
||||
|
||||
public ColorAssignment(String... colors) {
|
||||
super(colors);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<String> makeSet(Card card, Game game) {
|
||||
return Arrays.stream(card.getColor(game).toString().split(""))
|
||||
.filter(attributes::contains)
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package mage.abilities.dynamicvalue.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.assignment.common.SubTypeAssignment;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.cards.Cards;
|
||||
|
|
|
|||
|
|
@ -1,24 +0,0 @@
|
|||
package mage.abilities.dynamicvalue.common;
|
||||
|
||||
import mage.abilities.dynamicvalue.RoleAssignment;
|
||||
import mage.cards.Card;
|
||||
import mage.filter.predicate.Predicate;
|
||||
import mage.game.Game;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class PredicateCardAssignment extends RoleAssignment<Predicate<? super Card>> {
|
||||
|
||||
public PredicateCardAssignment(Predicate<? super Card>... predicates) {
|
||||
super(predicates);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<Predicate<? super Card>> makeSet(Card card, Game game) {
|
||||
return attributes
|
||||
.stream()
|
||||
.filter(predicate -> predicate.apply(card, game))
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
package mage.abilities.dynamicvalue.common;
|
||||
|
||||
import mage.abilities.dynamicvalue.RoleAssignment;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.SubType;
|
||||
import mage.game.Game;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class SubTypeAssignment extends RoleAssignment<SubType> {
|
||||
|
||||
public SubTypeAssignment(SubType... subTypes) {
|
||||
super(subTypes);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<SubType> makeSet(Card card, Game game) {
|
||||
return attributes
|
||||
.stream()
|
||||
.filter(subType -> card.hasSubtype(subType, game))
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue