Fixed Killian, Ink Duelist's cost reduction not applying for getPlayable (#7786)

* Fixed Killian, Ink Duelist's cost reduction not applying for getPlayable
This commit is contained in:
Daniel Bomar 2021-05-23 21:14:13 -05:00 committed by GitHub
parent de55367af4
commit 8826a8a543
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -69,19 +69,30 @@ class KillianInkDuelistEffect extends CostModificationEffectImpl {
@Override
public boolean apply(Game game, Ability source, Ability abilityToModify) {
CardUtil.reduceCost(abilityToModify, 2);
// Bug #7762: https://github.com/magefree/mage/issues/7762
// Check possible targets for getPlayable
if (game.inCheckPlayableState()) {
if (CardUtil.getAllPossibleTargets(abilityToModify, game)
.stream()
.map(game::getPermanent)
.filter(Objects::nonNull)
.anyMatch(MageObject::isCreature)) {
CardUtil.reduceCost(abilityToModify, 2);
}
// Check selected targets on actual cast
} else if (CardUtil.getAllSelectedTargets(abilityToModify, game)
.stream()
.map(game::getPermanent)
.filter(Objects::nonNull)
.anyMatch(MageObject::isCreature)) {
CardUtil.reduceCost(abilityToModify, 2);
}
return true;
}
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
return abilityToModify instanceof SpellAbility
&& abilityToModify.isControlledBy(source.getControllerId())
&& CardUtil
.getAllSelectedTargets(abilityToModify, game)
.stream()
.map(game::getPermanent)
.filter(Objects::nonNull)
.anyMatch(MageObject::isCreature);
&& abilityToModify.isControlledBy(source.getControllerId());
}
}