* 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

@ -23,6 +23,7 @@ import mage.filter.Filter;
import mage.filter.predicate.mageobject.NamePredicate;
import mage.game.CardState;
import mage.game.Game;
import mage.game.command.Commander;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.game.permanent.PermanentCard;
@ -815,6 +816,15 @@ public final class CardUtil {
public static Abilities<Ability> getAbilities(MageObject object, Game game) {
if (object instanceof Card) {
return ((Card) object).getAbilities(game);
} else if (object instanceof Commander && Zone.COMMAND.equals(game.getState().getZone(object.getId()))) {
// Commanders in command zone must gain cost related abilities for playable
// calculation (affinity, convoke; example: Chief Engineer). So you must use card object here
Card card = game.getCard(object.getId());
if (card != null) {
return card.getAbilities(game);
} else {
return object.getAbilities();
}
} else {
return object.getAbilities();
}