mirror of
https://github.com/correl/mage.git
synced 2024-11-29 03:00:12 +00:00
* Nicol Bolas, Dragon-God - +1 ability: fixed that opponent can skip exile step, fixed that AI selects wrong cards/permanents;
This commit is contained in:
parent
144e62e4f5
commit
4f1fb63dda
1 changed files with 43 additions and 21 deletions
|
@ -1,5 +1,6 @@
|
||||||
package mage.cards.n;
|
package mage.cards.n;
|
||||||
|
|
||||||
|
import mage.MageObject;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.LoyaltyAbility;
|
import mage.abilities.LoyaltyAbility;
|
||||||
import mage.abilities.common.PlaneswalkerEntersWithLoyaltyCountersAbility;
|
import mage.abilities.common.PlaneswalkerEntersWithLoyaltyCountersAbility;
|
||||||
|
@ -7,6 +8,7 @@ import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.DestroyTargetEffect;
|
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||||
|
import mage.cards.Card;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.*;
|
import mage.constants.*;
|
||||||
|
@ -17,16 +19,13 @@ import mage.filter.predicate.permanent.AnotherPredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
import mage.target.Target;
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.TargetPermanent;
|
||||||
import mage.target.common.TargetCardInHand;
|
import mage.target.common.TargetCardInHand;
|
||||||
import mage.target.common.TargetControlledPermanent;
|
import mage.target.common.TargetControlledPermanent;
|
||||||
import mage.target.common.TargetCreatureOrPlaneswalker;
|
import mage.target.common.TargetCreatureOrPlaneswalker;
|
||||||
|
|
||||||
import java.util.LinkedHashSet;
|
import java.util.*;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageObject;
|
|
||||||
import mage.cards.Card;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author TheElk801
|
* @author TheElk801
|
||||||
|
@ -141,24 +140,47 @@ class NicolBolasDragonGodPlusOneEffect extends OneShotEffect {
|
||||||
if (opponent == null) {
|
if (opponent == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (opponent.getHand().isEmpty()
|
|
||||||
|| !opponent.chooseUse(outcome, "Exile a card in your hand or a permanent you control?",
|
List<Target> possibleTargetTypes = new ArrayList<>();
|
||||||
|
// hand
|
||||||
|
TargetCardInHand targetHand = new TargetCardInHand();
|
||||||
|
if (!opponent.getHand().isEmpty()) {
|
||||||
|
possibleTargetTypes.add(targetHand);
|
||||||
|
}
|
||||||
|
// permanent
|
||||||
|
TargetPermanent targetPermanent = new TargetControlledPermanent();
|
||||||
|
targetPermanent.setNotTarget(true);
|
||||||
|
targetPermanent.setTargetController(opponentId);
|
||||||
|
if (!targetPermanent.possibleTargets(opponentId, game).isEmpty()) {
|
||||||
|
possibleTargetTypes.add(targetPermanent);
|
||||||
|
}
|
||||||
|
|
||||||
|
// choose target type first, AI must use hand first (benefit)
|
||||||
|
if (possibleTargetTypes.size() > 1
|
||||||
|
&& !opponent.chooseUse(Outcome.Benefit, "Exile a card in your hand or a permanent you control?",
|
||||||
null, "Card in hand", "Permanent", source, game)) {
|
null, "Card in hand", "Permanent", source, game)) {
|
||||||
TargetPermanent target = new TargetControlledPermanent();
|
Collections.reverse(possibleTargetTypes); // change order (permanent goes first)
|
||||||
target.setNotTarget(true);
|
}
|
||||||
target.setTargetController(opponentId);
|
|
||||||
if (opponent.choose(outcome, target, source.getSourceId(), game)) {
|
// choose target
|
||||||
MageObject mageObject = game.getObject(target.getFirstTarget());
|
for (Target target : possibleTargetTypes) {
|
||||||
if (mageObject != null
|
// hand
|
||||||
&& mageObject instanceof Permanent) {
|
if (target.equals(targetHand)) {
|
||||||
|
if (opponent.choose(Outcome.Exile, opponent.getHand(), targetHand, game)
|
||||||
|
&& game.getCard(targetHand.getFirstTarget()) != null) {
|
||||||
|
cards.add(game.getCard(targetHand.getFirstTarget()));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// permanent
|
||||||
|
if (target.equals(targetPermanent)) {
|
||||||
|
if (opponent.choose(Outcome.Exile, targetPermanent, source.getSourceId(), game)) {
|
||||||
|
MageObject mageObject = game.getObject(targetPermanent.getFirstTarget());
|
||||||
|
if (mageObject instanceof Permanent) {
|
||||||
cardsOnBattlefield.add((Card) mageObject);
|
cardsOnBattlefield.add((Card) mageObject);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
TargetCardInHand target = new TargetCardInHand();
|
|
||||||
if (opponent.choose(outcome, opponent.getHand(), target, game)
|
|
||||||
&& game.getCard(target.getFirstTarget()) != null) {
|
|
||||||
cards.add(game.getCard(target.getFirstTarget()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue