mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
update commander rules to allow vehicles and spacecraft with P/T
This commit is contained in:
parent
c07c2cf1ac
commit
ccaeabaeba
2 changed files with 19 additions and 3 deletions
|
|
@ -5,11 +5,13 @@ import mage.abilities.Ability;
|
||||||
import mage.abilities.common.CanBeYourCommanderAbility;
|
import mage.abilities.common.CanBeYourCommanderAbility;
|
||||||
import mage.abilities.common.CommanderChooseColorAbility;
|
import mage.abilities.common.CommanderChooseColorAbility;
|
||||||
import mage.abilities.keyword.CompanionAbility;
|
import mage.abilities.keyword.CompanionAbility;
|
||||||
|
import mage.abilities.keyword.StationLevelAbility;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.decks.Constructed;
|
import mage.cards.decks.Constructed;
|
||||||
import mage.cards.decks.Deck;
|
import mage.cards.decks.Deck;
|
||||||
import mage.cards.decks.DeckValidatorErrorType;
|
import mage.cards.decks.DeckValidatorErrorType;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.SubType;
|
||||||
import mage.filter.FilterMana;
|
import mage.filter.FilterMana;
|
||||||
import mage.util.CardUtil;
|
import mage.util.CardUtil;
|
||||||
import mage.util.ManaUtil;
|
import mage.util.ManaUtil;
|
||||||
|
|
@ -51,9 +53,19 @@ public abstract class AbstractCommander extends Constructed {
|
||||||
protected abstract boolean checkBanned(Map<String, Integer> counts);
|
protected abstract boolean checkBanned(Map<String, Integer> counts);
|
||||||
|
|
||||||
protected boolean checkCommander(Card commander, Set<Card> commanders) {
|
protected boolean checkCommander(Card commander, Set<Card> commanders) {
|
||||||
return commander.hasCardTypeForDeckbuilding(CardType.CREATURE) && commander.isLegendary()
|
if (commander.getAbilities().contains(CanBeYourCommanderAbility.getInstance())) {
|
||||||
|| commander.getAbilities().contains(CanBeYourCommanderAbility.getInstance())
|
return true;
|
||||||
|| (validators.stream().anyMatch(validator -> validator.specialCheck(commander)) && commanders.size() == 2);
|
}
|
||||||
|
if (commander.isLegendary()
|
||||||
|
&& (commander.hasCardTypeForDeckbuilding(CardType.CREATURE)
|
||||||
|
|| commander.hasSubTypeForDeckbuilding(SubType.VEHICLE)
|
||||||
|
|| commander.hasSubTypeForDeckbuilding(SubType.SPACECRAFT)
|
||||||
|
&& CardUtil
|
||||||
|
.castStream(commander.getAbilities(), StationLevelAbility.class)
|
||||||
|
.anyMatch(StationLevelAbility::hasPT))) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return commanders.size() == 2 && validators.stream().anyMatch(validator -> validator.specialCheck(commander));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean checkPartners(Set<Card> commanders) {
|
protected boolean checkPartners(Set<Card> commanders) {
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,10 @@ public class StationLevelAbility extends StaticAbility {
|
||||||
.map(CardUtil::getTextWithFirstCharUpperCase)
|
.map(CardUtil::getTextWithFirstCharUpperCase)
|
||||||
.collect(Collectors.joining("<br>"));
|
.collect(Collectors.joining("<br>"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasPT() {
|
||||||
|
return this.getEffects().stream().anyMatch(StationLevelCreatureEffect.class::isInstance);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class StationLevelAbilityEffect extends ContinuousEffectImpl {
|
class StationLevelAbilityEffect extends ContinuousEffectImpl {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue