mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
* Momir format - Fixed that AI turn calculation caused H2 DB errors (fixes #7014).
This commit is contained in:
parent
482712200a
commit
dbea1e35eb
1 changed files with 8 additions and 1 deletions
|
@ -22,6 +22,8 @@ import mage.util.CardUtil;
|
|||
import mage.util.RandomUtil;
|
||||
|
||||
import java.util.List;
|
||||
import mage.game.permanent.token.Token;
|
||||
import mage.game.permanent.token.custom.CreatureToken;
|
||||
|
||||
/**
|
||||
* @author spjspj
|
||||
|
@ -61,7 +63,12 @@ class MomirEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
int value = source.getManaCostsToPay().getX();
|
||||
|
||||
if (game.isSimulation()) {
|
||||
// Create dummy token to prevent multiple DB find cards what causes H2 java.lang.IllegalStateException if AI cancels calculation because of time out
|
||||
Token token = new CreatureToken(value, value +1);
|
||||
token.putOntoBattlefield(1, game, source, source.getControllerId(), false, false);
|
||||
return true;
|
||||
}
|
||||
// should this be random across card names
|
||||
CardCriteria criteria = new CardCriteria().types(CardType.CREATURE).convertedManaCost(value);
|
||||
List<CardInfo> options = CardRepository.instance.findCards(criteria);
|
||||
|
|
Loading…
Reference in a new issue