mirror of
https://github.com/correl/mage.git
synced 2024-11-25 03:00:11 +00:00
Fix that Warbringer's cost reduction doesn't apply when checking playable (for real this time)
This commit is contained in:
parent
081b2f2f39
commit
c58eeef77d
3 changed files with 26 additions and 3 deletions
|
@ -9,6 +9,7 @@ import mage.abilities.common.SimpleStaticAbility;
|
|||
import mage.abilities.condition.common.DashedCondition;
|
||||
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
|
||||
import mage.abilities.keyword.DashAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
|
@ -69,8 +70,14 @@ class WarbringerSpellsCostReductionEffect extends CostModificationEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||
if (abilityToModify instanceof SpellAbility) {
|
||||
if (abilityToModify.isControlledBy(source.getControllerId())) {
|
||||
if (abilityToModify instanceof SpellAbility
|
||||
&& abilityToModify.isControlledBy(source.getControllerId())) {
|
||||
if (game != null && game.inCheckPlayableState()) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,4 +117,20 @@ public class DashTest extends CardTestPlayerBase {
|
|||
assertHandCount(playerA, "Screamreach Brawler", 0);
|
||||
assertAbility(playerA, "Screamreach Brawler", HasteAbility.getInstance(), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWarbringerCostReduction() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Warbringer");
|
||||
addCard(Zone.HAND, playerA, "Warbringer");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Warbringer");
|
||||
setChoice(playerA, true);
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "Warbringer", 2);
|
||||
assertHandCount(playerA, "Warbringer", 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,4 +26,4 @@ public enum DashedCondition implements Condition {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue