forked from External/mage
Reworking card types in preparation for implementing Grist, the Hunger Tide (#7899)
Co-authored-by: Oleg Agafonov <jaydi85@gmail.com>
This commit is contained in:
parent
07e1dff10c
commit
572104b8fc
1159 changed files with 2704 additions and 2203 deletions
|
|
@ -3,8 +3,10 @@ package mage.cards;
|
|||
import mage.MageObject;
|
||||
import mage.MageObjectImpl;
|
||||
import mage.Mana;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.*;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.common.continuous.HasSubtypesSourceEffect;
|
||||
import mage.abilities.keyword.ChangelingAbility;
|
||||
import mage.abilities.keyword.FlashbackAbility;
|
||||
import mage.abilities.mana.ActivatedManaAbilityImpl;
|
||||
import mage.cards.repository.PluginClassloaderRegistery;
|
||||
|
|
@ -269,7 +271,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
|
|||
&& mainCardState != null
|
||||
&& !mainCardState.hasLostAllAbilities()
|
||||
&& mainCardState.getAbilities().containsClass(FlashbackAbility.class)) {
|
||||
FlashbackAbility flash = new FlashbackAbility(this.getManaCost(), this.isInstant() ? TimingRule.INSTANT : TimingRule.SORCERY);
|
||||
FlashbackAbility flash = new FlashbackAbility(this.getManaCost(), this.isInstant(game) ? TimingRule.INSTANT : TimingRule.SORCERY);
|
||||
flash.setSourceId(this.getId());
|
||||
flash.setControllerId(this.getOwnerId());
|
||||
flash.setSpellAbilityType(this.getSpellAbility().getSpellAbilityType());
|
||||
|
|
@ -830,4 +832,38 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CardType> getCardTypeForDeckbuilding() {
|
||||
return getCardType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCardTypeForDeckbuilding(CardType cardType) {
|
||||
return getCardTypeForDeckbuilding().contains(cardType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasSubTypeForDeckbuilding(SubType subType) {
|
||||
// own subtype
|
||||
if (this.hasSubtype(subType, null)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// gained subtypes from source ability
|
||||
if (this.getAbilities()
|
||||
.stream()
|
||||
.filter(SimpleStaticAbility.class::isInstance)
|
||||
.map(Ability::getAllEffects)
|
||||
.flatMap(Collection::stream)
|
||||
.filter(HasSubtypesSourceEffect.class::isInstance)
|
||||
.map(HasSubtypesSourceEffect.class::cast)
|
||||
.anyMatch(effect -> effect.hasSubtype(subType))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// changeling (any subtype)
|
||||
return subType.getSubTypeSet() == SubTypeSet.CreatureType
|
||||
&& this.getAbilities().containsClass(ChangelingAbility.class);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue