mirror of
https://github.com/correl/mage.git
synced 2025-04-09 01:01:06 -09:00
replaced various instances of instanceof lambda functions with
This commit is contained in:
parent
26ef55c1bc
commit
26ae7b7281
21 changed files with 37 additions and 46 deletions
Mage.Client/src/main/java/mage/client/deckeditor
Mage.Common/src/main/java/mage/view
Mage.Server.Plugins
Mage.Deck.Constructed/src/mage/deck
Mage.Player.Human/src/mage/player/human
Mage.Sets/src/mage/cards
Mage.Tests/src/test/java/org/mage/test
cards/abilities
sets
Mage/src/main/java/mage
abilities
condition/common
costs
effects
keyword
filter
players
|
@ -110,7 +110,7 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
||||||
|
|
||||||
// deck legality cards selection
|
// deck legality cards selection
|
||||||
Arrays.stream(deckLegalityDisplay.getComponents())
|
Arrays.stream(deckLegalityDisplay.getComponents())
|
||||||
.filter(c -> c instanceof LegalityLabel)
|
.filter(LegalityLabel.class::isInstance)
|
||||||
.forEach(c -> {
|
.forEach(c -> {
|
||||||
c.addMouseListener(new MouseAdapter() {
|
c.addMouseListener(new MouseAdapter() {
|
||||||
public void mouseClicked(MouseEvent e) {
|
public void mouseClicked(MouseEvent e) {
|
||||||
|
|
|
@ -542,7 +542,7 @@ public class CardView extends SimpleCardView {
|
||||||
} else if (spell.getCard() != null) {
|
} else if (spell.getCard() != null) {
|
||||||
SplitCard wholeCard = ((SplitCardHalf) spell.getCard()).getParentCard();
|
SplitCard wholeCard = ((SplitCardHalf) spell.getCard()).getParentCard();
|
||||||
Abilities<Ability> aftermathHalfAbilities = wholeCard.getRightHalfCard().getAbilities(game);
|
Abilities<Ability> aftermathHalfAbilities = wholeCard.getRightHalfCard().getAbilities(game);
|
||||||
if (aftermathHalfAbilities.stream().anyMatch(halfAbility -> halfAbility instanceof AftermathAbility)) {
|
if (aftermathHalfAbilities.stream().anyMatch(AftermathAbility.class::isInstance)) {
|
||||||
if (ty == SpellAbilityType.SPLIT_RIGHT) {
|
if (ty == SpellAbilityType.SPLIT_RIGHT) {
|
||||||
artRect = ArtRect.AFTERMATH_BOTTOM;
|
artRect = ArtRect.AFTERMATH_BOTTOM;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -57,10 +57,10 @@ public class Brawl extends Constructed {
|
||||||
Iterator<Card> iter = deck.getSideboard().iterator();
|
Iterator<Card> iter = deck.getSideboard().iterator();
|
||||||
Card card1 = iter.next();
|
Card card1 = iter.next();
|
||||||
Card card2 = iter.next();
|
Card card2 = iter.next();
|
||||||
if (card1.getAbilities().stream().anyMatch(ability -> ability instanceof CompanionAbility)) {
|
if (card1.getAbilities().stream().anyMatch(CompanionAbility.class::isInstance)) {
|
||||||
companion = card1;
|
companion = card1;
|
||||||
brawler = card2;
|
brawler = card2;
|
||||||
} else if (card2.getAbilities().stream().anyMatch(ability -> ability instanceof CompanionAbility)) {
|
} else if (card2.getAbilities().stream().anyMatch(CompanionAbility.class::isInstance)) {
|
||||||
companion = card2;
|
companion = card2;
|
||||||
brawler = card1;
|
brawler = card1;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1482,7 +1482,7 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
// can't see lands as playable and must know the reason (if they click on land then they get that message)
|
// can't see lands as playable and must know the reason (if they click on land then they get that message)
|
||||||
if (abilityToCast.getAbilityType() == AbilityType.SPELL) {
|
if (abilityToCast.getAbilityType() == AbilityType.SPELL) {
|
||||||
Spell spell = game.getStack().getSpell(abilityToCast.getSourceId());
|
Spell spell = game.getStack().getSpell(abilityToCast.getSourceId());
|
||||||
boolean haveManaAbilities = object.getAbilities().stream().anyMatch(a -> a instanceof ManaAbility);
|
boolean haveManaAbilities = object.getAbilities().stream().anyMatch(ManaAbility.class::isInstance);
|
||||||
if (spell != null && !spell.isResolving() && haveManaAbilities) {
|
if (spell != null && !spell.isResolving() && haveManaAbilities) {
|
||||||
switch (spell.getCurrentActivatingManaAbilitiesStep()) {
|
switch (spell.getCurrentActivatingManaAbilitiesStep()) {
|
||||||
// if you used special mana ability like convoke then normal mana abilities will be restricted to use, see Convoke for details
|
// if you used special mana ability like convoke then normal mana abilities will be restricted to use, see Convoke for details
|
||||||
|
|
|
@ -67,7 +67,7 @@ class KadenasSilencerEffect extends OneShotEffect {
|
||||||
Set<UUID> opps = game.getOpponents(source.getControllerId());
|
Set<UUID> opps = game.getOpponents(source.getControllerId());
|
||||||
game.getStack()
|
game.getStack()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(stackObject -> stackObject instanceof Ability)
|
.filter(Ability.class::isInstance)
|
||||||
.filter(stackObject -> opps.contains(stackObject.getControllerId()))
|
.filter(stackObject -> opps.contains(stackObject.getControllerId()))
|
||||||
.forEach(stackObject -> game.getStack().counter(stackObject.getId(), source, game));
|
.forEach(stackObject -> game.getStack().counter(stackObject.getId(), source, game));
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -117,11 +117,11 @@ class MandateOfPeaceEndCombatEffect extends OneShotEffect {
|
||||||
combat.endCombat(game);
|
combat.endCombat(game);
|
||||||
if (!game.getStack().isEmpty()) {
|
if (!game.getStack().isEmpty()) {
|
||||||
game.getStack().stream()
|
game.getStack().stream()
|
||||||
.filter(stackObject -> stackObject instanceof Spell)
|
.filter(Spell.class::isInstance)
|
||||||
.forEach(stackObject -> ((Spell) stackObject).moveToExile(null, "", null, game));
|
.forEach(stackObject -> ((Spell) stackObject).moveToExile(null, "", null, game));
|
||||||
|
|
||||||
game.getStack().stream()
|
game.getStack().stream()
|
||||||
.filter(stackObject -> stackObject instanceof Ability)
|
.filter(Ability.class::isInstance)
|
||||||
.forEach(stackObject -> game.getStack().remove(stackObject, game));
|
.forEach(stackObject -> game.getStack().remove(stackObject, game));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
|
|
||||||
package mage.cards.w;
|
package mage.cards.w;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.SpellAbility;
|
import mage.abilities.SpellAbility;
|
||||||
|
@ -12,30 +10,26 @@ import mage.abilities.keyword.DashAbility;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.*;
|
||||||
import mage.constants.SubType;
|
|
||||||
import mage.constants.CostModificationType;
|
|
||||||
import mage.constants.Duration;
|
|
||||||
import mage.constants.Outcome;
|
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.util.CardUtil;
|
import mage.util.CardUtil;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
*/
|
*/
|
||||||
public final class Warbringer extends CardImpl {
|
public final class Warbringer extends CardImpl {
|
||||||
|
|
||||||
public Warbringer(UUID ownerId, CardSetInfo setInfo) {
|
public Warbringer(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{R}");
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}");
|
||||||
this.subtype.add(SubType.ORC);
|
this.subtype.add(SubType.ORC);
|
||||||
this.subtype.add(SubType.BERSERKER);
|
this.subtype.add(SubType.BERSERKER);
|
||||||
this.power = new MageInt(3);
|
this.power = new MageInt(3);
|
||||||
this.toughness = new MageInt(3);
|
this.toughness = new MageInt(3);
|
||||||
|
|
||||||
// Dash costs you pay cost {2} less (as long as this creature is on the battlefield).
|
// Dash costs you pay cost {2} less (as long as this creature is on the battlefield).
|
||||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new WarbringerSpellsCostReductionEffect()));
|
this.addAbility(new SimpleStaticAbility(new WarbringerSpellsCostReductionEffect()));
|
||||||
|
|
||||||
// Dash {2}{R}
|
// Dash {2}{R}
|
||||||
this.addAbility(new DashAbility(this, "{2}{R}"));
|
this.addAbility(new DashAbility(this, "{2}{R}"));
|
||||||
|
@ -70,18 +64,15 @@ class WarbringerSpellsCostReductionEffect extends CostModificationEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||||
if (abilityToModify instanceof SpellAbility
|
if (!(abilityToModify instanceof SpellAbility)
|
||||||
&& abilityToModify.isControlledBy(source.getControllerId())) {
|
|| !abilityToModify.isControlledBy(source.getControllerId())) {
|
||||||
if (game != null && game.inCheckPlayableState()) {
|
return false;
|
||||||
Card card = game.getCard(source.getSourceId());
|
|
||||||
if (card != null) {
|
|
||||||
return card.getAbilities(game).stream().anyMatch(a -> a instanceof DashAbility);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return DashedCondition.instance.apply(game, abilityToModify);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
if (game == null || !game.inCheckPlayableState()) {
|
||||||
|
return DashedCondition.instance.apply(game, abilityToModify);
|
||||||
|
}
|
||||||
|
Card card = game.getCard(source.getSourceId());
|
||||||
|
return card != null && card.getAbilities(game).stream().anyMatch(DashAbility.class::isInstance);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -617,7 +617,7 @@ public class FlashbackTest extends CardTestPlayerBase {
|
||||||
checkPlayableAbility("after", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Flashback {1}{U}", true);
|
checkPlayableAbility("after", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Flashback {1}{U}", true);
|
||||||
runCode("test", 1, PhaseStep.PRECOMBAT_MAIN, playerA, (info, player, game) -> {
|
runCode("test", 1, PhaseStep.PRECOMBAT_MAIN, playerA, (info, player, game) -> {
|
||||||
long flashbackCount = player.getPlayable(game, true).stream()
|
long flashbackCount = player.getPlayable(game, true).stream()
|
||||||
.filter(ability -> ability instanceof FlashbackAbility)
|
.filter(FlashbackAbility.class::isInstance)
|
||||||
.count();
|
.count();
|
||||||
Assert.assertEquals("must have only two playable abilities without duplicates", 2, flashbackCount);
|
Assert.assertEquals("must have only two playable abilities without duplicates", 2, flashbackCount);
|
||||||
});
|
});
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class GainAbilitiesTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
Permanent permanent = getPermanent("Balduvian Bears");
|
Permanent permanent = getPermanent("Balduvian Bears");
|
||||||
Assert.assertEquals("must have only 1 singleton ability instance from two attachments",
|
Assert.assertEquals("must have only 1 singleton ability instance from two attachments",
|
||||||
1, permanent.getAbilities(currentGame).stream().filter(a -> a instanceof VigilanceAbility).count());
|
1, permanent.getAbilities(currentGame).stream().filter(VigilanceAbility.class::isInstance).count());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -63,7 +63,7 @@ public class GainAbilitiesTest extends CardTestPlayerBase {
|
||||||
Permanent permanent = getPermanent("Balduvian Bears");
|
Permanent permanent = getPermanent("Balduvian Bears");
|
||||||
Assert.assertEquals("must have 2 dynamic ability instances from two attachments",
|
Assert.assertEquals("must have 2 dynamic ability instances from two attachments",
|
||||||
2, permanent.getAbilities(currentGame).stream().filter(
|
2, permanent.getAbilities(currentGame).stream().filter(
|
||||||
a -> a.getEffects().stream().anyMatch(e -> e instanceof DrawCardSourceControllerEffect)
|
a -> a.getEffects().stream().anyMatch(DrawCardSourceControllerEffect.class::isInstance)
|
||||||
).count());
|
).count());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class GainMenaceAbilityAsSingletonTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
Permanent permanent = getPermanent("Minotaur", playerA);
|
Permanent permanent = getPermanent("Minotaur", playerA);
|
||||||
Assert.assertEquals("must have only 1 Menace instance", 1, permanent.getAbilities(currentGame).stream()
|
Assert.assertEquals("must have only 1 Menace instance", 1, permanent.getAbilities(currentGame).stream()
|
||||||
.filter(a -> a instanceof MenaceAbility).count());
|
.filter(MenaceAbility.class::isInstance).count());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -353,7 +353,7 @@ public class BoosterGenerationTest extends MageTestBase {
|
||||||
fail("Booster can't have more than three snow lands");
|
fail("Booster can't have more than three snow lands");
|
||||||
}
|
}
|
||||||
|
|
||||||
long mdfcCount = booster.stream().filter(card -> card instanceof ModalDoubleFacesCard).count();
|
long mdfcCount = booster.stream().filter(ModalDoubleFacesCard.class::isInstance).count();
|
||||||
assertTrue("Booster can't have more than one MDFC", mdfcCount < 2);
|
assertTrue("Booster can't have more than one MDFC", mdfcCount < 2);
|
||||||
|
|
||||||
foundMDFC |= mdfcCount > 0;
|
foundMDFC |= mdfcCount > 0;
|
||||||
|
|
|
@ -18,7 +18,7 @@ public enum BuybackCondition implements Condition {
|
||||||
Card card = game.getCard(source.getSourceId());
|
Card card = game.getCard(source.getSourceId());
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
return card.getAbilities(game).stream()
|
return card.getAbilities(game).stream()
|
||||||
.filter(a -> a instanceof BuybackAbility)
|
.filter(BuybackAbility.class::isInstance)
|
||||||
.anyMatch(a -> ((BuybackAbility) a).isBuybackActivated(game));
|
.anyMatch(a -> ((BuybackAbility) a).isBuybackActivated(game));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -20,7 +20,7 @@ public enum DashedCondition implements Condition {
|
||||||
Card card = game.getCard(source.getSourceId());
|
Card card = game.getCard(source.getSourceId());
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
return card.getAbilities(game).stream()
|
return card.getAbilities(game).stream()
|
||||||
.filter(a -> a instanceof DashAbility)
|
.filter(DashAbility.class::isInstance)
|
||||||
.anyMatch(d -> ((DashAbility) d).isActivated(source, game));
|
.anyMatch(d -> ((DashAbility) d).isActivated(source, game));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ public enum EvokedCondition implements Condition {
|
||||||
Card card = game.getCard(source.getSourceId());
|
Card card = game.getCard(source.getSourceId());
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
return card.getAbilities(game).stream()
|
return card.getAbilities(game).stream()
|
||||||
.filter(ab -> ab instanceof EvokeAbility)
|
.filter(EvokeAbility.class::isInstance)
|
||||||
.anyMatch(evoke -> ((EvokeAbility) evoke).isActivated(source, game));
|
.anyMatch(evoke -> ((EvokeAbility) evoke).isActivated(source, game));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -140,7 +140,7 @@ public class AlternativeCostSourceAbility extends StaticAbility implements Alter
|
||||||
if (alternativeCostsToCheck.canPay(ability, ability, ability.getControllerId(), game)
|
if (alternativeCostsToCheck.canPay(ability, ability, ability.getControllerId(), game)
|
||||||
&& player.chooseUse(Outcome.Benefit, costChoiceText, this, game)) {
|
&& player.chooseUse(Outcome.Benefit, costChoiceText, this, game)) {
|
||||||
if (ability instanceof SpellAbility) {
|
if (ability instanceof SpellAbility) {
|
||||||
ability.getManaCostsToPay().removeIf(manaCost -> manaCost instanceof VariableCost);
|
ability.getManaCostsToPay().removeIf(VariableCost.class::isInstance);
|
||||||
CardUtil.reduceCost((SpellAbility) ability, ability.getManaCosts());
|
CardUtil.reduceCost((SpellAbility) ability, ability.getManaCosts());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -418,7 +418,7 @@ public abstract class ContinuousEffectImpl extends EffectImpl implements Continu
|
||||||
// extraPredicates from some filters is player related, you don't need it here
|
// extraPredicates from some filters is player related, you don't need it here
|
||||||
List<Predicate> list = new ArrayList<>();
|
List<Predicate> list = new ArrayList<>();
|
||||||
Predicates.collectAllComponents(filter.getPredicates(), list);
|
Predicates.collectAllComponents(filter.getPredicates(), list);
|
||||||
if (list.stream().anyMatch(p -> p instanceof SubType.SubTypePredicate)) {
|
if (list.stream().anyMatch(SubType.SubTypePredicate.class::isInstance)) {
|
||||||
this.addDependedToType(DependencyType.AddingCreatureType);
|
this.addDependedToType(DependencyType.AddingCreatureType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,7 +118,7 @@ class CipherStoreEffect extends OneShotEffect {
|
||||||
Card copyCard = game.copyCard(cipherCard, source, controller.getId());
|
Card copyCard = game.copyCard(cipherCard, source, controller.getId());
|
||||||
SpellAbility ability = copyCard.getSpellAbility();
|
SpellAbility ability = copyCard.getSpellAbility();
|
||||||
// remove the cipher effect from the copy
|
// remove the cipher effect from the copy
|
||||||
ability.getEffects().removeIf(effect -> effect instanceof CipherEffect);
|
ability.getEffects().removeIf(CipherEffect.class::isInstance);
|
||||||
controller.cast(ability, game, true, new ApprovingObject(source, game));
|
controller.cast(ability, game, true, new ApprovingObject(source, game));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class CastAsThoughItHadFlashAllEffect extends AsThoughEffectImpl {
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
//Allow lands with morph to be played at instant speed
|
//Allow lands with morph to be played at instant speed
|
||||||
if (card.isLand(game)) {
|
if (card.isLand(game)) {
|
||||||
boolean morphAbility = card.getAbilities().stream().anyMatch(ability -> ability instanceof MorphAbility);
|
boolean morphAbility = card.getAbilities().stream().anyMatch(MorphAbility.class::isInstance);
|
||||||
if (morphAbility) {
|
if (morphAbility) {
|
||||||
Card cardCopy = card.copy();
|
Card cardCopy = card.copy();
|
||||||
cardCopy.removeAllCardTypes(game);
|
cardCopy.removeAllCardTypes(game);
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class FlankingAbility extends TriggeredAbilityImpl {
|
||||||
Permanent permanent = game.getPermanent(event.getSourceId());
|
Permanent permanent = game.getPermanent(event.getSourceId());
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
boolean hasFlankingAbility
|
boolean hasFlankingAbility
|
||||||
= permanent.getAbilities().stream().anyMatch(ability -> ability instanceof FlankingAbility);
|
= permanent.getAbilities().stream().anyMatch(FlankingAbility.class::isInstance);
|
||||||
|
|
||||||
if (!hasFlankingAbility) {
|
if (!hasFlankingAbility) {
|
||||||
for (Effect effect : this.getEffects()) {
|
for (Effect effect : this.getEffects()) {
|
||||||
|
|
|
@ -95,7 +95,7 @@ public class FilterCard extends FilterObject<Card> {
|
||||||
// card filter can't contain controller predicate (only permanents on battlefield have controller)
|
// card filter can't contain controller predicate (only permanents on battlefield have controller)
|
||||||
List<Predicate> list = new ArrayList<>();
|
List<Predicate> list = new ArrayList<>();
|
||||||
Predicates.collectAllComponents(predicate, list);
|
Predicates.collectAllComponents(predicate, list);
|
||||||
if (list.stream().anyMatch(p -> p instanceof TargetController.ControllerPredicate)) {
|
if (list.stream().anyMatch(TargetController.ControllerPredicate.class::isInstance)) {
|
||||||
throw new IllegalArgumentException("Card filter doesn't support controller predicate");
|
throw new IllegalArgumentException("Card filter doesn't support controller predicate");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3706,7 +3706,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
ManaOptions manaFull = availableMana.copy();
|
ManaOptions manaFull = availableMana.copy();
|
||||||
if (ability instanceof SpellAbility) {
|
if (ability instanceof SpellAbility) {
|
||||||
for (AlternateManaPaymentAbility altAbility : CardUtil.getAbilities(object, game).stream()
|
for (AlternateManaPaymentAbility altAbility : CardUtil.getAbilities(object, game).stream()
|
||||||
.filter(a -> a instanceof AlternateManaPaymentAbility)
|
.filter(AlternateManaPaymentAbility.class::isInstance)
|
||||||
.map(a -> (AlternateManaPaymentAbility) a)
|
.map(a -> (AlternateManaPaymentAbility) a)
|
||||||
.collect(Collectors.toList())) {
|
.collect(Collectors.toList())) {
|
||||||
ManaOptions manaSpecial = altAbility.getManaOptions(ability, game, ability.getManaCostsToPay());
|
ManaOptions manaSpecial = altAbility.getManaOptions(ability, game, ability.getManaCostsToPay());
|
||||||
|
@ -3739,7 +3739,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
if (ability instanceof AlternativeSourceCosts && object != null && !(object instanceof Permanent)) {
|
if (ability instanceof AlternativeSourceCosts && object != null && !(object instanceof Permanent)) {
|
||||||
ActivatedAbility playAbility = null;
|
ActivatedAbility playAbility = null;
|
||||||
if (object.isLand(game)) {
|
if (object.isLand(game)) {
|
||||||
playAbility = (PlayLandAbility) CardUtil.getAbilities(object, game).stream().filter(a -> a instanceof PlayLandAbility).findFirst().orElse(null);
|
playAbility = (PlayLandAbility) CardUtil.getAbilities(object, game).stream().filter(PlayLandAbility.class::isInstance).findFirst().orElse(null);
|
||||||
} else if (object instanceof Card) {
|
} else if (object instanceof Card) {
|
||||||
playAbility = ((Card) object).getSpellAbility();
|
playAbility = ((Card) object).getSpellAbility();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue