1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-03-30 01:03:57 -09:00

* AI: fixed that computer can't play some cards correctly (Ad Nauseam, Crazed Firecat, Fiery Gambit);

This commit is contained in:
Oleg Agafonov 2020-07-01 13:15:39 +04:00
parent 529153312f
commit 3b19e3db35
3 changed files with 29 additions and 14 deletions

View file

@ -1,7 +1,5 @@
package mage.cards.a;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
@ -14,6 +12,8 @@ import mage.constants.Zone;
import mage.game.Game;
import mage.players.Player;
import java.util.UUID;
/**
* @author North
*/
@ -62,13 +62,19 @@ class AdNauseamEffect extends OneShotEffect {
}
while (controller.chooseUse(outcome, message, source, game) && controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().getFromTop(game);
if (card != null) {
controller.moveCards(card, Zone.HAND, source, game);
int cmc = card.getConvertedManaCost();
if (cmc > 0) {
controller.loseLife(cmc, game, false);
}
controller.revealCards(sourceCard.getIdName() + " put into hand", new CardsImpl(card), game);
if (card == null) {
break;
}
controller.moveCards(card, Zone.HAND, source, game);
int cmc = card.getConvertedManaCost();
if (cmc > 0) {
controller.loseLife(cmc, game, false);
}
controller.revealCards(sourceCard.getIdName() + " put into hand", new CardsImpl(card), game);
// AI workaround to stop infinite choose (only one card allows)
if (!controller.isHuman() && !controller.isTestMode()) {
break;
}
}
return true;

View file

@ -1,4 +1,3 @@
package mage.cards.c;
import mage.MageInt;
@ -68,6 +67,11 @@ class CrazedFirecatEffect extends OneShotEffect {
int flipsWon = 0;
while (controller.flipCoin(source, game, true)) {
flipsWon++;
// AI workaround to stop on good condition
if (!controller.isHuman() && !controller.isTestMode() && flipsWon >= 2) {
break;
}
}
sourceObject.addCounters(CounterType.P1P1.createInstance(flipsWon), source, game);
return true;

View file

@ -1,7 +1,5 @@
package mage.cards.f;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
@ -17,14 +15,15 @@ import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public final class FieryGambit extends CardImpl {
public FieryGambit(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{2}{R}");
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{R}");
// Flip a coin until you lose a flip or choose to stop flipping. If you lose a flip, Fiery Gambit has no effect. If you win one or more flips, Fiery Gambit deals 3 damage to target creature. If you win two or more flips, Fiery Gambit deals 6 damage to each opponent. If you win three or more flips, draw nine cards and untap all lands you control.
this.getSpellAbility().addEffect(new FieryGambitEffect());
@ -71,6 +70,12 @@ class FieryGambitEffect extends OneShotEffect {
controllerStopped = true;
break;
}
// AI workaround to stop flips on good result
if (!controller.isHuman() && !controller.isTestMode() && flipsWon >= 3) {
controllerStopped = true;
break;
}
}
if (controllerStopped) {
Permanent creature = game.getPermanent(getTargetPointer().getFirst(game, source));