* Jeweled Lotus - fixed that mana can't be used to cast commanders without normal mana (#7272);

This commit is contained in:
Oleg Agafonov 2020-12-22 23:22:41 +04:00
parent 736901efcf
commit 347a3b1e1a
5 changed files with 104 additions and 9 deletions

View file

@ -19,6 +19,7 @@ import mage.choices.Choice;
import mage.constants.*;
import mage.counters.Counters;
import mage.game.combat.Combat;
import mage.game.command.CommandObject;
import mage.game.command.Commander;
import mage.game.command.Emblem;
import mage.game.command.Plane;
@ -519,6 +520,27 @@ public interface Game extends MageItem, Serializable {
.collect(Collectors.toSet());
}
/**
* Finds is it a commander card/object (use it in conditional and other things)
*
* @param player
* @param object
* @return
*/
default boolean isCommanderObject(Player player, MageObject object) {
UUID idToCheck = null;
if (object instanceof Spell) {
idToCheck = ((Spell) object).getCard().getId();
}
if (object instanceof CommandObject) {
idToCheck = object.getId();
}
if (object instanceof Card) {
idToCheck = ((Card) object).getMainCard().getId();
}
return idToCheck != null && this.getCommandersIds(player).contains(idToCheck);
}
void setGameStopped(boolean gameStopped);
boolean isGameStopped();