* Gain cost modification abilities - fixed that commanders can't be played without full mana (example: gained Affinity by Mycosynth Golem, gained Convoke by Chief Engineer, see #7249 #7171, #6698);

This commit is contained in:
Oleg Agafonov 2020-12-18 18:33:44 +04:00
parent 53c5abea14
commit 384ff2e7ac
8 changed files with 145 additions and 28 deletions

View file

@ -60,6 +60,14 @@ public class GainAbilitySpellsEffect extends ContinuousEffectImpl {
game.getState().addOtherAbility(card, ability);
}
}
// workaround to gain cost reduction abilities to commanders before cast (make it playable)
game.getCommanderCardsFromCommandZone(player).stream()
.filter(card -> filter.match(card, game))
.forEach(card -> {
game.getState().addOtherAbility(card, ability);
});
for (StackObject stackObject : game.getStack()) {
if (stackObject.isControlledBy(source.getControllerId())) {
Card card = game.getCard(stackObject.getSourceId());

View file

@ -44,8 +44,7 @@ public class GainAbilityControlledSpellsEffect extends ContinuousEffectImpl {
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Permanent permanent = game.getPermanent(source.getSourceId());
if (player != null
&& permanent != null) {
if (player != null && permanent != null) {
for (Card card : game.getExile().getAllCards(game)) {
if (card.isOwnedBy(source.getControllerId())
&& filter.match(card, game)) {
@ -67,6 +66,14 @@ public class GainAbilityControlledSpellsEffect extends ContinuousEffectImpl {
game.getState().addOtherAbility(card, ability);
}
}
// workaround to gain cost reduction abilities to commanders before cast (make it playable)
game.getCommanderCardsFromCommandZone(player).stream()
.filter(card -> filter.match(card, game))
.forEach(card -> {
game.getState().addOtherAbility(card, ability);
});
for (StackObject stackObject : game.getStack()) {
// only spells cast, so no copies of spells
if ((stackObject instanceof Spell)